UNPKG

@open-condo/apollo

Version:

A wrapper over @apollo/client that allows you to use persistent cache from local storage, configure TTL, invalidate cache, and use a single configuration for getServerSideProps, SSR, and CSR

1 lines 328 kB
import*as react from"react";import{createContext,useContext,useEffect,useRef,useState,useMemo}from"react";import*as core from"@apollo/client/core";import{from,ApolloClient}from"@apollo/client/core";import*as client$1 from"@apollo/client";import crypto from"crypto";import*as utilities from"@apollo/client/utilities";import*as http from"@apollo/client/link/http";var __spreadArray=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},Log=function(){function n(e){e=e.debug;this.debug=void 0!==e&&e,this.lines=[]}return n.prototype.emit=function(e,t){e in console&&console[e].apply(console,__spreadArray([n.prefix],t,!1))},n.prototype.tailLogs=function(){var n=this;this.lines.forEach(function(e){var t=e[0],e=e[1];return n.emit(t,e)})},n.prototype.getLogs=function(){return this.lines},n.prototype.write=function(e,t){this.lines=__spreadArray(__spreadArray([],this.lines.slice(1-n.buffer),!0),[[e,t]],!1),!this.debug&&"log"===e||this.emit(e,t)},n.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("log",e)},n.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("warn",e)},n.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.write("error",e)},n.buffer=30,n.prefix="[apollo-cache-persist]",n}(),Cache=function(){function e(e){var t=e.cache,e=e.serialize,e=void 0===e||e;this.cache=t,this.serialize=e}return e.prototype.extract=function(){var e=this.cache.extract();return e=this.serialize?JSON.stringify(e):e},e.prototype.restore=function(e){null!=(e=this.serialize&&"string"==typeof e?JSON.parse(e):e)&&this.cache.restore(e)},e}(),__awaiter$2=function(e,o,s,c){return new(s=s||Promise)(function(n,t){function r(e){try{a(c.next(e))}catch(e){t(e)}}function i(e){try{a(c.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,i)}a((c=c.apply(e,o||[])).next())})},__generator$1=function(r,i){var a,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},l={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function e(n){return function(e){var t=[n,e];if(a)throw new TypeError("Generator is already executing.");for(;c=l&&t[l=0]?0:c;)try{if(a=1,o&&(s=2&t[0]?o.return:t[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,t[1])).done)return s;switch(o=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=i.call(r,c)}catch(e){t=[6,e],o=0}finally{a=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},Storage=function(){function e(e){var t=e.storage,e=e.key,e=void 0===e?"apollo-cache-persist":e;this.storage=t,this.key=e}return e.prototype.read=function(){return __awaiter$2(this,void 0,void 0,function(){return __generator$1(this,function(e){return[2,this.storage.getItem(this.key)]})})},e.prototype.write=function(t){return __awaiter$2(this,void 0,void 0,function(){return __generator$1(this,function(e){switch(e.label){case 0:return[4,this.storage.setItem(this.key,t)];case 1:return e.sent(),[2]}})})},e.prototype.purge=function(){return __awaiter$2(this,void 0,void 0,function(){return __generator$1(this,function(e){switch(e.label){case 0:return[4,this.storage.removeItem(this.key)];case 1:return e.sent(),[2]}})})},e.prototype.getSize=function(){return __awaiter$2(this,void 0,void 0,function(){var t;return __generator$1(this,function(e){switch(e.label){case 0:return[4,this.storage.getItem(this.key)];case 1:return null==(t=e.sent())?[2,0]:[2,"string"==typeof t?t.length:null]}})})},e}(),__awaiter$1=function(e,o,s,c){return new(s=s||Promise)(function(n,t){function r(e){try{a(c.next(e))}catch(e){t(e)}}function i(e){try{a(c.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,i)}a((c=c.apply(e,o||[])).next())})},__generator=function(r,i){var a,o,s,c={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},l={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function e(n){return function(e){var t=[n,e];if(a)throw new TypeError("Generator is already executing.");for(;c=l&&t[l=0]?0:c;)try{if(a=1,o&&(s=2&t[0]?o.return:t[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,t[1])).done)return s;switch(o=0,(t=s?[2&t[0],s.value]:t)[0]){case 0:case 1:s=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,o=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(s=0<(s=c.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3]))c.label=t[1];else if(6===t[0]&&c.label<s[1])c.label=s[1],s=t;else{if(!(s&&c.label<s[2])){s[2]&&c.ops.pop(),c.trys.pop();continue}c.label=s[2],c.ops.push(t)}}t=i.call(r,c)}catch(e){t=[6,e],o=0}finally{a=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}},Persistor=function(){function e(e,t){var n=e.log,r=e.cache,e=e.storage,i=t.maxSize,i=void 0===i?1048576:i,t=t.persistenceMapper;this.log=n,this.cache=r,this.storage=e,this.paused=!1,t&&(this.persistenceMapper=t),i&&(this.maxSize=i)}return e.prototype.persist=function(){return __awaiter$1(this,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,6,,7]),t=this.cache.extract(),this.paused||!this.persistenceMapper?[3,2]:[4,this.persistenceMapper(t)];case 1:t=e.sent(),e.label=2;case 2:return null!=this.maxSize&&"string"==typeof t&&t.length>this.maxSize&&!this.paused?[4,this.purge()]:[3,4];case 3:return e.sent(),this.paused=!0,[2];case 4:return this.paused?[2]:[4,this.storage.write(t)];case 5:return e.sent(),this.log.info("string"==typeof t?"Persisted cache of size ".concat(t.length," characters"):"Persisted cache"),[3,7];case 6:throw n=e.sent(),this.log.error("Error persisting cache",n),n;case 7:return[2]}})})},e.prototype.restore=function(){return __awaiter$1(this,void 0,void 0,function(){var t,n;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,5,,6]),[4,this.storage.read()];case 1:return null==(t=e.sent())?[3,3]:[4,this.cache.restore(t)];case 2:return e.sent(),this.log.info("string"==typeof t?"Restored cache of size ".concat(t.length," characters"):"Restored cache"),[3,4];case 3:this.log.info("No stored cache to restore"),e.label=4;case 4:return[3,6];case 5:throw n=e.sent(),this.log.error("Error restoring cache",n),n;case 6:return[2]}})})},e.prototype.purge=function(){return __awaiter$1(this,void 0,void 0,function(){var t;return __generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.storage.purge()];case 1:return e.sent(),this.log.info("Purged cache storage"),[3,3];case 2:throw t=e.sent(),this.log.error("Error purging cache storage",t),t;case 3:return[2]}})})},e}(),onCacheWrite=function(e){var c=e.cache;return function(r){var i=c.write,a=c.evict,o=c.modify,s=c.gc;return c.write=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=i.apply(c,e);return r(),n},c.evict=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=a.apply(c,e);return r(),n},c.modify=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o.apply(c,e);return r(),n},c.gc=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=s.apply(c,e);return r(),n},function(){c.write=i,c.evict=a,c.modify=o,c.gc=s}}},onAppBackground=function(e){var t=e.log,n=e.cache;return function(e){return t.warn("Trigger option `background` not available on web; using `write` trigger"),onCacheWrite({cache:n})(e)}},Trigger=function(){function c(e,t){var n=e.log,e=e.persistor,r=this,i=(this.fire=function(){r.debounce?(null!=r.timeout&&clearTimeout(r.timeout),r.timeout=setTimeout(r.persist,r.debounce)):r.persist()},this.persist=function(){r.paused||r.persistor.persist()},c.defaultDebounce),a=t.cache,o=t.debounce,t=t.trigger,s=void 0===t?"write":t;if(s)switch(this.debounce=null!=o?o:i,this.persistor=e,this.paused=!1,s){case"write":this.uninstall=onCacheWrite({cache:a})(this.fire);break;case"background":o&&n.warn("Debounce is not recommended with `background` trigger"),this.debounce=o,this.uninstall=onAppBackground({cache:a,log:n})(this.fire);break;default:if("function"!=typeof s)throw Error("Unrecognized trigger option: ".concat(s));this.uninstall=s(this.fire)}}return c.prototype.pause=function(){this.paused=!0},c.prototype.resume=function(){this.paused=!1},c.prototype.remove=function(){this.uninstall&&(this.uninstall(),this.uninstall=null,this.paused=!0)},c.defaultDebounce=1e3,c}(),CachePersistor=function(){function e(e){if(!e.cache)throw new Error("In order to persist your Apollo Cache, you need to pass in a cache. Please see https://www.apollographql.com/docs/react/basics/caching.html for our default InMemoryCache.");if(!e.storage)throw new Error("In order to persist your Apollo Cache, you need to pass in an underlying storage provider. Please see https://github.com/apollographql/apollo-cache-persist#storage-providers");var t=new Log(e),n=new Cache(e),r=new Storage(e),i=new Persistor({log:t,cache:n,storage:r},e),e=new Trigger({log:t,persistor:i},e);this.log=t,this.cache=n,this.storage=r,this.persistor=i,this.trigger=e}return e.prototype.persist=function(){return this.persistor.persist()},e.prototype.restore=function(){return this.persistor.restore()},e.prototype.purge=function(){return this.persistor.purge()},e.prototype.pause=function(){this.trigger.pause()},e.prototype.resume=function(){this.trigger.resume()},e.prototype.remove=function(){this.trigger.remove()},e.prototype.getLogs=function(e){if(!(e=void 0===e?!1:e))return this.log.getLogs();this.log.tailLogs()},e.prototype.getSize=function(){return this.storage.getSize()},e}(),__extends=function(){var r=function(e,t){return(r=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])}))(e,t)};return function(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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}(),SynchronousPersistor=(!function(n){function e(e){var t=n.call(this,e)||this;return t.storage=new SynchronousStorage(e),t.persistor=new SynchronousPersistor({log:t.log,cache:t.cache,storage:t.storage},e),t}__extends(e,n),e.prototype.restoreSync=function(){this.persistor.restoreSync()}}(CachePersistor),function(i){function e(e,t){var n=e.log,r=e.cache,e=e.storage;return i.call(this,{log:n,cache:r,storage:e},t)||this}return __extends(e,i),e.prototype.restoreSync=function(){this.cache.restore(this.storage.readSync())},e}(Persistor)),SynchronousStorage=function(t){function e(e){return t.call(this,e)||this}return __extends(e,t),e.prototype.readSync=function(){return this.storage.getItem(this.key)},e}(Storage),LocalStorageWrapper=function(){function e(e){this.storage=e}return e.prototype.getItem=function(e){return this.storage.getItem(e)},e.prototype.removeItem=function(e){return this.storage.removeItem(e)},e.prototype.setItem=function(e,t){return null!==t?this.storage.setItem(e,t):this.removeItem(e)},e}();function isSSR(){return"undefined"==typeof window}function isDebug(){return"development"===process.env.NODE_ENV}const APOLLO_STATE_PROP_NAME="__APOLLO_STATE__",APOLLO_PERSISTED_CACHE_KEY="__APOLLO_PERSISTED_CACHE__";function createPersistor(e){return new CachePersistor({cache:e,storage:new LocalStorageWrapper(window.localStorage),debug:isDebug(),key:APOLLO_PERSISTED_CACHE_KEY})}const CachePersistorContext=createContext({});function useCachePersistor(){return useContext(CachePersistorContext)}function __rest$2(e,t){var n={};for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n}function __awaiter(e,t,o,s){return new(o=o||Promise)(function(n,t){function r(e){try{a(s.next(e))}catch(e){t(e)}}function i(e){try{a(s.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?n(e.value):((t=e.value)instanceof o?t:new o(function(e){e(t)})).then(r,i)}a((s=s.apply(e,[])).next())})}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(n){var t,r;return n.__esModule?n:("function"==typeof(t=n.default)?(r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)}).prototype=t.prototype:r={},Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(n).forEach(function(e){var t=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:function(){return n[e]}})}),r)}var require$$0$2=getAugmentedNamespace(core),require$$1$1=getAugmentedNamespace(http),ReactNativeFile_1=class{constructor({uri:e,name:t,type:n}){this.uri=e,this.name=t,this.type=n}};const ReactNativeFile=ReactNativeFile_1;var isExtractableFile$2=function(e){return"undefined"!=typeof File&&e instanceof File||"undefined"!=typeof Blob&&e instanceof Blob||e instanceof ReactNativeFile};const defaultIsExtractableFile=isExtractableFile$2;var extractFiles$1=function(e,t="",f=defaultIsExtractableFile){const h=new Map,m=new Map;return{clone:function t(n,e,r){let i=n;if(f(n))i=null,(a=h.get(n))?a.push(e):h.set(n,[e]);else{var a=Array.isArray(n)||"undefined"!=typeof FileList&&n instanceof FileList,o=n&&n.constructor===Object;if(a||o){var s=m.has(n);if(s?i=m.get(n):(i=a?[]:{},m.set(n,i)),!r.has(n)){var c=e?e+".":"",l=new Set(r).add(n);if(a){let e=0;for(const d of n){var u=t(d,c+e++,l);s||i.push(u)}}else for(const y in n){var p=t(n[y],c+y,l);s||(i[y]=p)}}}}return i}(e,t,new Set),files:h}},formDataAppendFile$1=function(e,t,n){e.append(t,n,n.name)},isExtractableFile$1=isExtractableFile$2;const{ApolloLink,Observable}=require$$0$2,{createSignalIfSupported,fallbackHttpConfig,parseAndCheckHttpResponse,rewriteURIForGET,selectHttpOptionsAndBody,selectURI,serializeFetchParameter}=require$$1$1,extractFiles=extractFiles$1,formDataAppendFile=formDataAppendFile$1,isExtractableFile=isExtractableFile$2;var createUploadLink=function({uri:f="/graphql",useGETForQueries:h,isExtractableFile:m=isExtractableFile,FormData:g,formDataAppendFile:v=formDataAppendFile,fetch:T,fetchOptions:e,credentials:t,headers:n,includeExtensions:r}={}){const _={http:{includeExtensions:r},options:e,credentials:t,headers:n};return new ApolloLink(r=>{var e=r.getContext(),{clientAwareness:{name:t,version:i}={},headers:n}=e,e={http:e.http,options:e.fetchOptions,credentials:e.credentials,headers:{...t&&{"apollographql-client-name":t},...i&&{"apollographql-client-version":i},...n}};const{options:a,body:o}=selectHttpOptionsAndBody(r,fallbackHttpConfig,_,e);var{clone:t,files:i}=extractFiles(o,"",m);let s=selectURI(r,f);if(i.size){delete a.headers["content-type"];const u=new(g||FormData),p=(u.append("operations",serializeFetchParameter(t,"Payload")),{});let n=0;i.forEach(e=>{p[++n]=e}),u.append("map",JSON.stringify(p)),n=0,i.forEach((e,t)=>{v(u,++n,t)}),a.body=u}else if(h&&!r.query.definitions.some(e=>"OperationDefinition"===e.kind&&"mutation"===e.operation)&&(a.method="GET"),"GET"===a.method){const{newURI:d,parseError:y}=rewriteURIForGET(s,o);if(y)return new Observable(e=>{e.error(y)});s=d}else a.body=serializeFetchParameter(t,"Payload");const c=createSignalIfSupported()["controller"],l=(c&&(a.signal&&(a.signal.aborted?c.abort():a.signal.addEventListener("abort",()=>{c.abort()},{once:!0})),a.signal=c.signal),T||fetch);return new Observable(t=>{let n;return l(s,a).then(e=>(r.setContext({response:e}),e)).then(parseAndCheckHttpResponse(r)).then(e=>{t.next(e),t.complete()}).catch(e=>{n||(e.result&&e.result.errors&&e.result.data&&t.next(e.result),t.error(e))}),()=>{n=!0,c&&c.abort()}})})},createUploadLink$1=getDefaultExportFromCjs(createUploadLink);function arrayEach$3(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}var _arrayEach=arrayEach$3,freeGlobal$1="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root$c=freeGlobal||freeSelf||Function("return this")(),_root=root$c,root$b=_root,Symbol$7=_root.Symbol,_Symbol=Symbol$7,Symbol$6=_Symbol,objectProto$h=Object.prototype,hasOwnProperty$g=objectProto$h.hasOwnProperty,nativeObjectToString$1=objectProto$h.toString,symToStringTag$1=Symbol$6?Symbol$6.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$g.call(e,symToStringTag$1),n=e[symToStringTag$1];try{var r=!(e[symToStringTag$1]=void 0)}catch(e){}var i=nativeObjectToString$1.call(e);return r&&(t?e[symToStringTag$1]=n:delete e[symToStringTag$1]),i}var _getRawTag=getRawTag$1,objectProto$g=Object.prototype,nativeObjectToString=objectProto$g.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,Symbol$5=_Symbol,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag$7(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$7;function isObject$a(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$a,baseGetTag$6=_baseGetTag,isObject$9=isObject_1,asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$2(e){return!!isObject$9(e)&&((e=baseGetTag$6(e))==funcTag$2||e==genTag$1||e==asyncTag||e==proxyTag)}var isFunction_1$2=isFunction$2,root$a=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(e){if(null!=e){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$2,isFunction$1=isFunction_1$2,isMasked=_isMasked,isObject$8=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$f=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$f=objectProto$f.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$f).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject$8(e)||isMasked(e))&&(isFunction$1(e)?reIsNative:reIsHostCtor).test(toSource$1(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$7(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$7,getNative$6=_getNative,defineProperty$2=function(){try{var e=getNative$6(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),_defineProperty=defineProperty$2,defineProperty$1=_defineProperty;function baseAssignValue$3(e,t,n){"__proto__"==t&&defineProperty$1?defineProperty$1(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var _baseAssignValue=baseAssignValue$3;function identity$5(e){return e}var identity_1=identity$5;function apply$3(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)}var _apply=apply$3,apply$2=_apply,nativeMax$3=Math.max;function overRest$2(a,o,s){return o=nativeMax$3(void 0===o?a.length-1:o,0),function(){for(var e=arguments,t=-1,n=nativeMax$3(e.length-o,0),r=Array(n);++t<n;)r[t]=e[o+t];for(var t=-1,i=Array(o+1);++t<o;)i[t]=e[t];return i[o]=s(r),apply$2(a,this,i)}}var _overRest=overRest$2;function constant$1(e){return function(){return e}}var constant_1=constant$1,constant=constant$1,defineProperty=_defineProperty,identity$4=identity_1,baseSetToString$1=defineProperty?function(e,t){return defineProperty(e,"toString",{configurable:!0,enumerable:!1,value:constant(t),writable:!0})}:identity_1,_baseSetToString=baseSetToString$1,HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut$2(n){var r=0,i=0;return function(){var e=nativeNow(),t=HOT_SPAN-(e-i);if(i=e,0<t){if(++r>=HOT_COUNT)return arguments[0]}else r=0;return n.apply(void 0,arguments)}}var _shortOut=shortOut$2,baseSetToString=_baseSetToString,shortOut$1=_shortOut,setToString$3=_shortOut(_baseSetToString),_setToString=setToString$3,identity$3=identity_1,overRest$1=_overRest,setToString$2=_setToString;function baseRest$1(e,t){return setToString$2(overRest$1(e,t,identity$3),e+"")}var _baseRest=baseRest$1,getNative$5=_getNative,root$9=_root,WeakMap$3=_getNative(_root,"WeakMap"),_WeakMap=WeakMap$3,WeakMap$2=_WeakMap,metaMap$2=_WeakMap&&new _WeakMap,_metaMap=metaMap$2,identity$2=identity_1,metaMap$1=_metaMap,baseSetData$2=metaMap$1?function(e,t){return metaMap$1.set(e,t),e}:identity_1,_baseSetData=baseSetData$2,isObject$7=isObject_1,objectCreate=Object.create,baseCreate$4=function(){function t(){}return function(e){if(!isObject$7(e))return{};if(objectCreate)return objectCreate(e);t.prototype=e;e=new t;return t.prototype=void 0,e}}(),_baseCreate=baseCreate$4,baseCreate$3=_baseCreate,isObject$6=isObject_1;function createCtor$4(r){return function(){var e=arguments;switch(e.length){case 0:return new r;case 1:return new r(e[0]);case 2:return new r(e[0],e[1]);case 3:return new r(e[0],e[1],e[2]);case 4:return new r(e[0],e[1],e[2],e[3]);case 5:return new r(e[0],e[1],e[2],e[3],e[4]);case 6:return new r(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new r(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var t=baseCreate$3(r.prototype),n=r.apply(t,e);return isObject$6(n)?n:t}}var _createCtor=createCtor$4,createCtor$3=_createCtor,root$8=_root,WRAP_BIND_FLAG$7=1;function createBind$1(t,e,n){var r=e&WRAP_BIND_FLAG$7,i=createCtor$3(t);return function e(){return(this&&this!==root$8&&this instanceof e?i:t).apply(r?n:this,arguments)}}var _createBind=createBind$1,nativeMax$2=Math.max;function composeArgs$2(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=nativeMax$2(a-o,0),u=Array(c+l),p=!r;++s<c;)u[s]=t[s];for(;++i<o;)(p||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}var _composeArgs=composeArgs$2,nativeMax$1=Math.max;function composeArgsRight$2(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=nativeMax$1(a-s,0),p=Array(u+l),d=!r;++i<u;)p[i]=e[i];for(var y=i;++c<l;)p[y+c]=t[c];for(;++o<s;)(d||i<a)&&(p[y+n[o]]=e[i++]);return p}var _composeArgsRight=composeArgsRight$2;function countHolders$1(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var _countHolders=countHolders$1;function baseLodash$3(){}var _baseLodash=baseLodash$3,baseCreate$2=_baseCreate,baseLodash$2=_baseLodash,MAX_ARRAY_LENGTH$1=4294967295;function LazyWrapper$3(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=MAX_ARRAY_LENGTH$1,this.__views__=[]}LazyWrapper$3.prototype=baseCreate$2(baseLodash$2.prototype);var _LazyWrapper=LazyWrapper$3.prototype.constructor=LazyWrapper$3;function noop$1(){}var noop_1=noop$1,metaMap=_metaMap,noop=noop$1,getData$2=metaMap?function(e){return metaMap.get(e)}:noop$1,_getData=getData$2,realNames$1={},_realNames=realNames$1,realNames=realNames$1,objectProto$e=Object.prototype,hasOwnProperty$e=objectProto$e.hasOwnProperty;function getFuncName$1(e){for(var t=e.name+"",n=realNames[t],r=hasOwnProperty$e.call(realNames,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}var _getFuncName=getFuncName$1,baseCreate$1=_baseCreate,baseLodash$1=_baseLodash;function LodashWrapper$2(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}LodashWrapper$2.prototype=baseCreate$1(baseLodash$1.prototype);var _LodashWrapper=LodashWrapper$2.prototype.constructor=LodashWrapper$2,isArray$f=Array.isArray,isArray_1$1=isArray$f;function isObjectLike$b(e){return null!=e&&"object"==typeof e}var isObjectLike_1=isObjectLike$b;function copyArray$3(e,t){var n=-1,r=e.length;for(t=t||Array(r);++n<r;)t[n]=e[n];return t}var _copyArray=copyArray$3,LazyWrapper$2=_LazyWrapper,LodashWrapper$1=_LodashWrapper,copyArray$2=_copyArray;function wrapperClone$1(e){var t;return e instanceof LazyWrapper$2?e.clone():((t=new LodashWrapper$1(e.__wrapped__,e.__chain__)).__actions__=copyArray$2(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t)}var _wrapperClone=wrapperClone$1,LazyWrapper$1=_LazyWrapper,LodashWrapper=_LodashWrapper,baseLodash=_baseLodash,isArray$e=isArray_1$1,isObjectLike$a=isObjectLike_1,wrapperClone=wrapperClone$1,objectProto$d=Object.prototype,hasOwnProperty$d=objectProto$d.hasOwnProperty;function lodash$1(e){if(isObjectLike$a(e)&&!isArray$e(e)&&!(e instanceof LazyWrapper$1)){if(e instanceof LodashWrapper)return e;if(hasOwnProperty$d.call(e,"__wrapped__"))return wrapperClone(e)}return new LodashWrapper(e)}lodash$1.prototype=baseLodash.prototype;var wrapperLodash=lodash$1.prototype.constructor=lodash$1,LazyWrapper=_LazyWrapper,getData$1=_getData,getFuncName=_getFuncName,lodash=lodash$1;function isLaziable$1(e){var t=getFuncName(e),n=lodash[t];return"function"==typeof n&&t in LazyWrapper.prototype&&(e===n||!!(t=getData$1(n))&&e===t[0])}var _isLaziable=isLaziable$1,baseSetData$1=_baseSetData,shortOut=_shortOut,setData$2=_shortOut(_baseSetData),_setData=setData$2,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;function getWrapDetails$1(e){e=e.match(reWrapDetails);return e?e[1].split(reSplitDetails):[]}var _getWrapDetails=getWrapDetails$1,reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function insertWrapDetails$1(e,t){var n,r=t.length;return r?(t[n=r-1]=(1<r?"& ":"")+t[n],t=t.join(2<r?", ":" "),e.replace(reWrapComment,"{\n/* [wrapped with "+t+"] */\n")):e}var _insertWrapDetails=insertWrapDetails$1;function baseFindIndex$1(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}var _baseFindIndex=baseFindIndex$1;function baseIsNaN$1(e){return e!=e}var _baseIsNaN=baseIsNaN$1;function strictIndexOf$1(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var _strictIndexOf=strictIndexOf$1,baseFindIndex=baseFindIndex$1,baseIsNaN=baseIsNaN$1,strictIndexOf=strictIndexOf$1;function baseIndexOf$1(e,t,n){return t==t?strictIndexOf(e,t,n):baseFindIndex(e,baseIsNaN,n)}var _baseIndexOf=baseIndexOf$1,baseIndexOf=baseIndexOf$1;function arrayIncludes$1(e,t){return!!(null==e?0:e.length)&&-1<baseIndexOf(e,t,0)}var _arrayIncludes=arrayIncludes$1,arrayEach$2=_arrayEach,arrayIncludes=arrayIncludes$1,WRAP_BIND_FLAG$6=1,WRAP_BIND_KEY_FLAG$4=2,WRAP_CURRY_FLAG$4=8,WRAP_CURRY_RIGHT_FLAG$2=16,WRAP_PARTIAL_FLAG$3=32,WRAP_PARTIAL_RIGHT_FLAG$2=64,WRAP_ARY_FLAG$2=128,WRAP_REARG_FLAG$1=256,WRAP_FLIP_FLAG$1=512,wrapFlags=[["ary",WRAP_ARY_FLAG$2],["bind",WRAP_BIND_FLAG$6],["bindKey",WRAP_BIND_KEY_FLAG$4],["curry",WRAP_CURRY_FLAG$4],["curryRight",WRAP_CURRY_RIGHT_FLAG$2],["flip",WRAP_FLIP_FLAG$1],["partial",WRAP_PARTIAL_FLAG$3],["partialRight",WRAP_PARTIAL_RIGHT_FLAG$2],["rearg",WRAP_REARG_FLAG$1]];function updateWrapDetails$1(n,r){return arrayEach$2(wrapFlags,function(e){var t="_."+e[0];r&e[1]&&!arrayIncludes(n,t)&&n.push(t)}),n.sort()}var _updateWrapDetails=updateWrapDetails$1,getWrapDetails=getWrapDetails$1,insertWrapDetails=insertWrapDetails$1,setToString$1=_setToString,updateWrapDetails=updateWrapDetails$1;function setWrapToString$2(e,t,n){t+="";return setToString$1(e,insertWrapDetails(t,updateWrapDetails(getWrapDetails(t),n)))}var _setWrapToString=setWrapToString$2,isLaziable=_isLaziable,setData$1=_setData,setWrapToString$1=_setWrapToString,WRAP_BIND_FLAG$5=1,WRAP_BIND_KEY_FLAG$3=2,WRAP_CURRY_BOUND_FLAG$1=4,WRAP_CURRY_FLAG$3=8,WRAP_PARTIAL_FLAG$2=32,WRAP_PARTIAL_RIGHT_FLAG$1=64;function createRecurry$2(e,t,n,r,i,a,o,s,c,l){var u=t&WRAP_CURRY_FLAG$3,i=((t=(t|(u?WRAP_PARTIAL_FLAG$2:WRAP_PARTIAL_RIGHT_FLAG$1))&~(u?WRAP_PARTIAL_RIGHT_FLAG$1:WRAP_PARTIAL_FLAG$2))&WRAP_CURRY_BOUND_FLAG$1||(t&=~(WRAP_BIND_FLAG$5|WRAP_BIND_KEY_FLAG$3)),[e,t,i,u?a:void 0,u?o:void 0,u?void 0:a,u?void 0:o,s,c,l]),a=n.apply(void 0,i);return isLaziable(e)&&setData$1(a,i),a.placeholder=r,setWrapToString$1(a,e,t)}var _createRecurry=createRecurry$2;function getHolder$3(e){return e.placeholder}var _getHolder=getHolder$3,MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex$5(e,t){var n=typeof e;return!!(t=null==t?MAX_SAFE_INTEGER$1:t)&&("number"==n||"symbol"!=n&&reIsUint.test(e))&&-1<e&&e%1==0&&e<t}var _isIndex=isIndex$5,copyArray$1=_copyArray,isIndex$4=_isIndex,nativeMin$1=Math.min;function reorder$1(e,t){for(var n=e.length,r=nativeMin$1(t.length,n),i=copyArray$1(e);r--;){var a=t[r];e[r]=isIndex$4(a,n)?i[a]:void 0}return e}var _reorder=reorder$1,PLACEHOLDER$1="__lodash_placeholder__";function replaceHolders$4(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n];o!==t&&o!==PLACEHOLDER$1||(e[n]=PLACEHOLDER$1,a[i++]=n)}return a}var _replaceHolders=replaceHolders$4,composeArgs$1=_composeArgs,composeArgsRight$1=_composeArgsRight,countHolders=_countHolders,createCtor$2=_createCtor,createRecurry$1=_createRecurry,getHolder$2=_getHolder,reorder=reorder$1,replaceHolders$3=_replaceHolders,root$7=_root,WRAP_BIND_FLAG$4=1,WRAP_BIND_KEY_FLAG$2=2,WRAP_CURRY_FLAG$2=8,WRAP_CURRY_RIGHT_FLAG$1=16,WRAP_ARY_FLAG$1=128,WRAP_FLIP_FLAG=512;function createHybrid$2(o,s,c,l,u,p,d,y,f,h){var m=s&WRAP_ARY_FLAG$1,g=s&WRAP_BIND_FLAG$4,v=s&WRAP_BIND_KEY_FLAG$2,T=s&(WRAP_CURRY_FLAG$2|WRAP_CURRY_RIGHT_FLAG$1),_=s&WRAP_FLIP_FLAG,b=v?void 0:createCtor$2(o);return function e(){for(var t,n,r=arguments.length,i=Array(r),a=r;a--;)i[a]=arguments[a];return T&&(t=getHolder$2(e),n=countHolders(i,t)),l&&(i=composeArgs$1(i,l,u,T)),p&&(i=composeArgsRight$1(i,p,d,T)),r-=n,T&&r<h?(n=replaceHolders$3(i,t),createRecurry$1(o,s,createHybrid$2,e.placeholder,c,i,n,y,f,h-r)):(t=g?c:this,n=v?t[o]:o,r=i.length,y?i=reorder(i,y):_&&1<r&&i.reverse(),m&&f<r&&(i.length=f),(n=this&&this!==root$7&&this instanceof e?b||createCtor$2(n):n).apply(t,i))}}var _createHybrid=createHybrid$2,apply$1=_apply,createCtor$1=_createCtor,createHybrid$1=_createHybrid,createRecurry=_createRecurry,getHolder$1=_getHolder,replaceHolders$2=_replaceHolders,root$6=_root;function createCurry$1(a,o,s){var c=createCtor$1(a);return function e(){for(var t=arguments.length,n=Array(t),r=t,i=getHolder$1(e);r--;)n[r]=arguments[r];i=t<3&&n[0]!==i&&n[t-1]!==i?[]:replaceHolders$2(n,i);return(t-=i.length)<s?createRecurry(a,o,createHybrid$1,e.placeholder,void 0,n,i,void 0,void 0,s-t):apply$1(this&&this!==root$6&&this instanceof e?c:a,this,n)}}var _createCurry=createCurry$1,apply=_apply,createCtor=_createCtor,root$5=_root,WRAP_BIND_FLAG$3=1;function createPartial$1(s,e,c,l){var u=e&WRAP_BIND_FLAG$3,p=createCtor(s);return function e(){for(var t=-1,n=arguments.length,r=-1,i=l.length,a=Array(i+n),o=this&&this!==root$5&&this instanceof e?p:s;++r<i;)a[r]=l[r];for(;n--;)a[r++]=arguments[++t];return apply(o,u?c:this,a)}}var _createPartial=createPartial$1,composeArgs=_composeArgs,composeArgsRight=_composeArgsRight,replaceHolders$1=_replaceHolders,PLACEHOLDER="__lodash_placeholder__",WRAP_BIND_FLAG$2=1,WRAP_BIND_KEY_FLAG$1=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG$1=8,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,nativeMin=Math.min;function mergeData$1(e,t){var n,r=e[1],i=t[1],a=r|i,o=i==WRAP_ARY_FLAG&&r==WRAP_CURRY_FLAG$1||i==WRAP_ARY_FLAG&&r==WRAP_REARG_FLAG&&e[7].length<=t[8]||i==(WRAP_ARY_FLAG|WRAP_REARG_FLAG)&&t[7].length<=t[8]&&r==WRAP_CURRY_FLAG$1;return(a<(WRAP_BIND_FLAG$2|WRAP_BIND_KEY_FLAG$1|WRAP_ARY_FLAG)||o)&&(i&WRAP_BIND_FLAG$2&&(e[2]=t[2],a|=r&WRAP_BIND_FLAG$2?0:WRAP_CURRY_BOUND_FLAG),(o=t[3])&&(n=e[3],e[3]=n?composeArgs(n,o,t[4]):o,e[4]=n?replaceHolders$1(e[3],PLACEHOLDER):t[4]),(o=t[5])&&(n=e[5],e[5]=n?composeArgsRight(n,o,t[6]):o,e[6]=n?replaceHolders$1(e[5],PLACEHOLDER):t[6]),(o=t[7])&&(e[7]=o),i&WRAP_ARY_FLAG&&(e[8]=null==e[8]?t[8]:nativeMin(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=a),e}var _mergeData=mergeData$1,reWhitespace=/\s/;function trimmedEndIndex$1(e){for(var t=e.length;t--&&reWhitespace.test(e.charAt(t)););return t}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=trimmedEndIndex$1,reTrimStart=/^\s+/;function baseTrim$1(e){return e&&e.slice(0,trimmedEndIndex(e)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,baseGetTag$5=_baseGetTag,isObjectLike$9=isObjectLike_1,symbolTag$3="[object Symbol]";function isSymbol$5(e){return"symbol"==typeof e||isObjectLike$9(e)&&baseGetTag$5(e)==symbolTag$3}var isSymbol_1=isSymbol$5,baseTrim=baseTrim$1,isObject$5=isObject_1,isSymbol$4=isSymbol_1,NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(e){if("number"==typeof e)return e;if(isSymbol$4(e))return NAN;if(isObject$5(e)&&(t="function"==typeof e.valueOf?e.valueOf():e,e=isObject$5(t)?t+"":t),"string"!=typeof e)return 0===e?e:+e;e=baseTrim(e);var t=reIsBinary.test(e);return t||reIsOctal.test(e)?freeParseInt(e.slice(2),t?2:8):reIsBadHex.test(e)?NAN:+e}var toNumber_1=toNumber$1,toNumber=toNumber$1,INFINITY$2=1/0,MAX_INTEGER=17976931348623157e292;function toFinite$1(e){return e?(e=toNumber(e))===INFINITY$2||e===-INFINITY$2?(e<0?-1:1)*MAX_INTEGER:e==e?e:0:0===e?e:0}var toFinite_1=toFinite$1,toFinite=toFinite$1;function toInteger$2(e){var e=toFinite(e),t=e%1;return e==e?t?e-t:e:0}var toInteger_1=toInteger$2,baseSetData=_baseSetData,createBind=_createBind,createCurry=_createCurry,createHybrid=_createHybrid,createPartial=_createPartial,getData=_getData,mergeData=mergeData$1,setData=_setData,setWrapToString=_setWrapToString,toInteger$1=toInteger_1,FUNC_ERROR_TEXT$1="Expected a function",WRAP_BIND_FLAG$1=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_FLAG=8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG$1=32,WRAP_PARTIAL_RIGHT_FLAG=64,nativeMax=Math.max;function createWrap$1(e,t,n,r,i,a,o,s){var c,l,u,p=t&WRAP_BIND_KEY_FLAG;if(p||"function"==typeof e)return(c=r?r.length:0)||(t&=~(WRAP_PARTIAL_FLAG$1|WRAP_PARTIAL_RIGHT_FLAG),r=i=void 0),o=void 0===o?o:nativeMax(toInteger$1(o),0),s=void 0===s?s:toInteger$1(s),c-=i?i.length:0,t&WRAP_PARTIAL_RIGHT_FLAG&&(u=r,l=i,r=i=void 0),u=[e,t,n,r,i,u,l,a,o,s],(l=p?void 0:getData(e))&&mergeData(u,l),e=u[0],t=u[1],n=u[2],r=u[3],i=u[4],!(s=u[9]=void 0===u[9]?p?0:e.length:nativeMax(u[9]-c,0))&&t&(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG)&&(t&=~(WRAP_CURRY_FLAG|WRAP_CURRY_RIGHT_FLAG)),a=t&&t!=WRAP_BIND_FLAG$1?t==WRAP_CURRY_FLAG||t==WRAP_CURRY_RIGHT_FLAG?createCurry(e,t,s):t!=WRAP_PARTIAL_FLAG$1&&t!=(WRAP_BIND_FLAG$1|WRAP_PARTIAL_FLAG$1)||i.length?createHybrid.apply(void 0,u):createPartial(e,t,n,r):createBind(e,t,n),setWrapToString((l?baseSetData:setData)(a,u),e,t);throw new TypeError(FUNC_ERROR_TEXT$1)}var _createWrap=createWrap$1,baseRest=_baseRest,createWrap=createWrap$1,getHolder=_getHolder,replaceHolders=_replaceHolders,WRAP_BIND_FLAG=1,WRAP_PARTIAL_FLAG=32,bind$1=_baseRest(function(e,t,n){var r,i=WRAP_BIND_FLAG;return n.length&&(r=replaceHolders(n,getHolder(bind$1)),i|=WRAP_PARTIAL_FLAG),createWrap(e,i,t,n,r)}),bind_1=(bind$1.placeholder={},bind$1);function arrayPush$3(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var _arrayPush=arrayPush$3,baseGetTag$4=_baseGetTag,isObjectLike$8=isObjectLike_1,argsTag$3="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$8(e)&&baseGetTag$4(e)==argsTag$3}var _baseIsArguments=baseIsArguments$1,baseIsArguments=baseIsArguments$1,isObjectLike$7=isObjectLike_1,objectProto$c=Object.prototype,hasOwnProperty$c=objectProto$c.hasOwnProperty,propertyIsEnumerable$1=objectProto$c.propertyIsEnumerable,isArguments$3=baseIsArguments(function(){return arguments}())?baseIsArguments:function(e){return isObjectLike$7(e)&&hasOwnProperty$c.call(e,"callee")&&!propertyIsEnumerable$1.call(e,"callee")},isArguments_1=isArguments$3,Symbol$4=_Symbol,isArguments$2=isArguments_1,isArray$d=isArray_1$1,spreadableSymbol=_Symbol?_Symbol.isConcatSpreadable:void 0;function isFlattenable$1(e){return isArray$d(e)||isArguments$2(e)||!!(spreadableSymbol&&e&&e[spreadableSymbol])}var _isFlattenable=isFlattenable$1,arrayPush$2=_arrayPush,isFlattenable=isFlattenable$1;function baseFlatten$1(e,t,n,r,i){var a=-1,o=e.length;for(n=n||isFlattenable,i=i||[];++a<o;){var s=e[a];0<t&&n(s)?1<t?baseFlatten$1(s,t-1,n,r,i):arrayPush$2(i,s):r||(i[i.length]=s)}return i}var _baseFlatten=baseFlatten$1,baseFlatten=baseFlatten$1;function flatten$1(e){return(null==e?0:e.length)?baseFlatten(e,1):[]}var flatten_1=flatten$1,flatten=flatten$1,overRest=_overRest,setToString=_setToString;function flatRest$2(e){return setToString(overRest(e,void 0,flatten),e+"")}var _flatRest=flatRest$2,isSymbol$3=isSymbol_1,INFINITY$1=1/0;function toKey$6(e){var t;return"string"==typeof e||isSymbol$3(e)?e:"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _toKey=toKey$6,arrayEach$1=_arrayEach,baseAssignValue$2=_baseAssignValue,bind=bind_1,flatRest$1=_flatRest,toKey$5=_toKey,bindAll=_flatRest(function(t,e){return arrayEach$1(e,function(e){e=toKey$5(e),baseAssignValue$2(t,e,bind(t[e],t))}),t}),bindAll_1=bindAll,bindAll$1=getDefaultExportFromCjs(bindAll),isArray$c=isArray_1$1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$3(e,t){var n;return!isArray$c(e)&&(!("number"!=(n=typeof e)&&"symbol"!=n&&"boolean"!=n&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$3,getNative$4=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$b=Object.prototype,hasOwnProperty$b=objectProto$b.hasOwnProperty;function hashGet$1(e){var t,n=this.__data__;return nativeCreate$2?(t=n[e])===HASH_UNDEFINED$2?void 0:t:hasOwnProperty$b.call(n,e)?n[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$a=Object.prototype,hasOwnProperty$a=objectProto$a.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty$a.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet$1(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=nativeCreate&&void 0===t?HASH_UNDEFINED$1:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$4(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$4,eq$3=eq_1;function assocIndexOf$4(e,t){for(var n=e.length;n--;)if(eq$3(e[n][0],t))return n;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var n=this.__data__,r=assocIndexOf(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$4(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ListCache$4.prototype.clear=listCacheClear,ListCache$4.prototype.delete=listCacheDelete,ListCache$4.prototype.get=listCacheGet,ListCache$4.prototype.has=listCacheHas,ListCache$4.prototype.set=listCacheSet;var _ListCache=ListCache$4,getNative$3=_getNative,root$4=_root,Map$4=_getNative(_root,"Map"),_Map=Map$4,Hash=_Hash,ListCache$3=_ListCache,Map$3=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$3||ListCache$3),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var n=getMapData(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$3(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}MapCache$3.prototype.clear=mapCacheClear,MapCache$3.prototype.delete=mapCacheDelete,MapCache$3.prototype.get=mapCacheGet,MapCache$3.prototype.has=mapCacheHas,MapCache$3.prototype.set=mapCacheSet;var _MapCache=MapCache$3,MapCache$2=_MapCache,FUNC_ERROR_TEXT="Expected a function";function memoize$1(r,i){if("function"!=typeof r||null!=i&&"function"!=typeof i)throw new TypeError(FUNC_ERROR_TEXT);function a(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;return n.has(t)?n.get(t):(e=r.apply(this,e),a.cache=n.set(t,e)||n,e)}return a.cache=new(memoize$1.Cache||MapCache$2),a}memoize$1.Cache=MapCache$2;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(rePropName,function(e,t,n,r){i.push(n?r.replace(reEscapeChar,"$1"):t||e)}),i}),_stringToPath=stringToPath$1;function arrayMap$2(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var _arrayMap=arrayMap$2,Symbol$3=_Symbol,arrayMap$1=_arrayMap,isArray$b=isArray_1$1,isSymbol$1=isSymbol_1,INFINITY=1/0,symbolProto$2=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$b(e)?arrayMap$1(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$2(e){return null==e?"":baseToString(e)}var toString_1=toString$2,isArray$a=isArray_1$1,isKey$2=_isKey,stringToPath=_stringToPath,toString$1=toString$2;function castPath$4(e,t){return isArray$a(e)?e:isKey$2(e,t)?[e]:stringToPath(toString$1(e))}var _castPath=castPath$4,castPath$3=_castPath,toKey$4=_toKey;function baseGet$4(e,t){for(var n=0,r=(t=castPath$3(t,e)).length;null!=e&&n<r;)e=e[toKey$4(t[n++])];return n&&n==r?e:void 0}var _baseGet=baseGet$4,baseGet$3=_baseGet;function get$1(e,t,n){e=null==e?void 0:baseGet$3(e,t);return void 0===e?n:e}var get_1=get$1,get$2=getDefaultExportFromCjs(get_1),ListCache$2=_ListCache;function stackClear$1(){this.__data__=new ListCache$2,this.size=0}var _stackClear=stackClear$1;function stackDelete$1(e){var t=this.__data__,e=t.delete(e);return this.size=t.size,e}var _stackDelete=stackDelete$1;function stackGet$1(e){return this.__data__.get(e)}var _stackGet=stackGet$1;function stackHas$1(e){return this.__data__.has(e)}var _stackHas=stackHas$1,ListCache$1=_ListCache,Map$2=_Map,MapCache$1=_MapCache,LARGE_ARRAY_SIZE=200;function stackSet$1(e,t){var n=this.__data__;if(n instanceof ListCache$1){var r=n.__data__;if(!Map$2||r.length<LARGE_ARRAY_SIZE-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new MapCache$1(r)}return n.set(e,t),this.size=n.size,this}var _stackSet=stackSet$1,ListCache=_ListCache,stackClear=stackClear$1,stackDelete=stackDelete$1,stackGet=stackGet$1,stackHas=stackHas$1,stackSet=stackSet$1;function Stack$3(e){e=this.__data__=new ListCache(e);this.size=e.size}Stack$3.prototype.clear=stackClear,Stack$3.prototype.delete=stackDelete,Stack$3.prototype.get=stackGet,Stack$3.prototype.has=stackHas,Stack$3.prototype.set=stackSet;var _Stack=Stack$3,HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd$1(e){return this.__data__.set(e,HASH_UNDEFINED),this}var _setCacheAdd=setCacheAdd$1;function setCacheHas$1(e){return this.__data__.has(e)}var _setCacheHas=setCacheHas$1,MapCache=_MapCache,setCacheAdd=setCacheAdd$1,setCacheHas=setCacheHas$1;function SetCache$1(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new MapCache;++t<n;)this.add(e[t])}SetCache$1.prototype.add=SetCache$1.prototype.push=setCacheAdd,SetCache$1.prototype.has=setCacheHas;var _SetCache=SetCache$1;function arraySome$1(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var _arraySome=arraySome$1;function cacheHas$1(e,t){return e.has(t)}var _cacheHas=cacheHas$1,SetCache=SetCache$1,arraySome=arraySome$1,cacheHas=cacheHas$1,COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays$2(e,t,n,r,i,a){var o=n&COMPARE_PARTIAL_FLAG$5,s=e.length,c=t.length;if(s!=c&&!(o&&s<c))return!1;var c=a.get(e),l=a.get(t);if(c&&l)return c==t&&l==e;var u=-1,p=!0,d=n&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(a.set(e,t),a.set(t,e);++u<s;){var y,f=e[u],h=t[u];if(void 0!==(y=r?o?r(h,f,u,t,e,a):r(f,h,u,e,t,a):y)){if(y)continue;p=!1;break}if(d){if(!arraySome(t,function(e,t){if(!cacheHas(d,t)&&(f===e||i(f,e,n,r,a)))return d.push(t)})){p=!1;break}}else if(f!==h&&!i(f,h,n,r,a)){p=!1;break}}return a.delete(e),a.delete(t),p}var _equalArrays=equalArrays$2,root$3=_root,Uint8Array$3=_root.Uint8Array,_Uint8Array=Uint8Array$3;function mapToArray$1(e){var n=-1,r=Array(e.size);return e.forEach(function(e,t){r[++n]=[t,e]}),r}var _mapToArray=mapToArray$1;function setToArray$1(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var _setToArray=setToArray$1,Symbol$2=_Symbol,Uint8Array$2=_Uint8Array,eq$2=eq_1,equalArrays$1=_equalArrays,mapToArray=mapToArray$1,setToArray=setToArray$1,COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",mapTag$5="[object Map]",numberTag$4="[object Number]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",symbolProto$1=_Symbol?_Symbol.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function equalByTag$1(e,t,n,r,i,a,o){switch(n){case dataViewTag$4:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case arrayBufferTag$3:return e.byteLength==t.byteLength&&a(new Uint8Array$2(e),new Uint8Array$2(t))?!0:!1;case boolTag$3:case dateTag$3:case numberTag$4:return eq$2(+e,+t);case errorTag$2:return e.name==t.name&&e.message==t.message;case regexpTag$3:case stringTag$3:return e==t+"";case mapTag$5:var s=mapToArray;case setTag$5:s=s||setToArray;if(e.size!=t.size&&!(r&COMPARE_PARTIAL_FLAG$4))return!1;var c=o.get(e);if(c)return c==t;r|=COMPARE_UNORDERED_FLAG$2,o.set(e,t);c=equalArrays$1(s(e),s(t),r,i,a,o);return o.delete(e),c;case symbolTag$2:if(symbolValueOf$1)return symbolValueOf$1.call(e)==symbolValueOf$1.call(t)}return!1}var _equalByTag=equalByTag$1,arrayPush$1=_arrayPush,isArray$9=isArray_1$1;function baseGetAll