New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rest-hooks/normalizr

Package Overview
Dependencies
Maintainers
2
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rest-hooks/normalizr - npm Package Compare versions

Comparing version 7.5.1 to 7.5.2

lib/entities/FlatEntity.d.ts

14

CHANGELOG.md

@@ -6,2 +6,16 @@ # Change Log

### [7.5.2](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@7.5.1...@rest-hooks/normalizr@7.5.2) (2022-04-16)
### 💅 Enhancement
* Improve robustness when using distinct schemas to normalize/denormalize ([#1908](https://github.com/coinbase/rest-hooks/issues/1908)) ([6527cd9](https://github.com/coinbase/rest-hooks/commit/6527cd993694510833b47b579a355f797c20b9cb)), closes [#1912](https://github.com/coinbase/rest-hooks/issues/1912)
### 🐛 Bug Fix
* Union schemas with null args[0] hooks ([#1779](https://github.com/coinbase/rest-hooks/issues/1779)) ([ab8557c](https://github.com/coinbase/rest-hooks/commit/ab8557cffa9b55b084b03f0936da0494ce18bf8e))
### [7.5.1](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@7.5.0...@rest-hooks/normalizr@7.5.1) (2021-09-08)

@@ -8,0 +22,0 @@

49

dist/normalizr.amd.js

@@ -16,3 +16,4 @@ define(['exports'], function (exports) { 'use strict';

function isImmutable(object) {
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || // Immutable.Map
object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
}

@@ -148,2 +149,7 @@ /**

if (!this.isSingleSchema && !schemaKey) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
console.warn("TypeError: Unable to infer schema for " + this.constructor.name + "\nValue: " + JSON.stringify(value, undefined, 2) + ".");
}
return [value, true, false];

@@ -991,4 +997,4 @@ }

var unvisitEntity = function unvisitEntity(id, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(id, schema);
var unvisitEntity = function unvisitEntity(entityOrId, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(entityOrId, schema);

@@ -1003,4 +1009,10 @@ if (entity === DELETED) {

var pk = typeof entityOrId === 'string' ? entityOrId : schema.pk(isImmutable(entity) ? entity.toJS() : entity);
if (pk === undefined || pk === '') {
return [entity, false, false];
}
if (localCache[schema.key] === undefined) {
localCache[schema.key] = {};
localCache[schema.key] = Object.create(null);
}

@@ -1011,3 +1023,3 @@

if (!localCache[schema.key][id]) {
if (!localCache[schema.key][pk]) {
var trackingIndex = dependencies.length;

@@ -1020,10 +1032,10 @@ dependencies.push(entity);

return localCache[schema.key][id] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
return localCache[schema.key][pk] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
};
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, id);
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, pk);
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];
localCache[schema.key][pk] = _schema$denormalize[0];
found = _schema$denormalize[1];

@@ -1036,5 +1048,5 @@ deleted = _schema$denormalize[2];

if (!globalCacheEntry.has(localKey)) {
globalCacheEntry.set(localKey, localCache[schema.key][id]);
globalCacheEntry.set(localKey, localCache[schema.key][pk]);
} else {
localCache[schema.key][id] = globalCacheEntry.get(localKey);
localCache[schema.key][pk] = globalCacheEntry.get(localKey);
} // start of cycle - reset cycle detection

@@ -1048,5 +1060,5 @@

// cycle detected
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][id], DRAFT)) {
cycleIndex.i = localCache[schema.key][id].i;
return [localCache[schema.key][id][DRAFT], found, deleted];
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][pk], DRAFT)) {
cycleIndex.i = localCache[schema.key][pk].i;
return [localCache[schema.key][pk][DRAFT], found, deleted];
} else {

@@ -1058,3 +1070,3 @@ // with no cycle, globalCacheEntry will have already been set

return [localCache[schema.key][id], found, deleted];
return [localCache[schema.key][pk], found, deleted];
};

@@ -1088,3 +1100,3 @@

if (isEntity(schema)) {
// unvisitEntity just can't handle undefined
// unvisitEntity only works with valid input of string
if (input === undefined) {

@@ -1281,5 +1293,5 @@ return [input, false, false];

else if ( // eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
}

@@ -1386,2 +1398,3 @@ } // set this after index updates so we know what indexes to remove from

_proto.infer = function infer(args, indexes, recurse) {
if (!args[0]) return undefined;
var attr = this.getSchemaAttribute(args[0], undefined, '');

@@ -1388,0 +1401,0 @@ var discriminatedSchema = this.schema[attr]; // Was unable to infer the entity's schema from params

@@ -1,1 +0,1 @@

define(["exports"],(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]};function p(e,t,n,r){}var d=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var S=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},r.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=O(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=O(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",b="substantially different than expected keys";v&&(g+="\n Missing: "+a,b="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,b="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+b+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(S.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=A()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(x(Error)),J=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),P=Symbol("draft"),M=function(e,t,n,r,i,o,s,a){var u=r(e,t);if(u===_)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===i[t.key]&&(i[t.key]={});var c=!0,f=!1;if(i[t.key][e]){if(Object.prototype.hasOwnProperty.call(i[t.key][e],P))return a.i=i[t.key][e].i,[i[t.key][e][P],c,f];s.push(u)}else{var l=s.length;s.push(u);var h=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(n);h.setLocal=function(n){var r;return i[t.key][e]=((r={})[P]=n,r.i=l,r)};var p=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new J);return e[t.key][n]}(o,t,e),d=t.denormalize(u,h);i[t.key][e]=d[0],c=d[1],f=d[2];var y=s.slice(-1===a.i?l:a.i);p.has(y)?i[t.key][e]=p.get(y):p.set(y,i[t.key][e]),a.i===l&&(a.i=-1)}return[i[t.key][e],c,f]},T=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};var I=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(S);e.DELETED=_,e.Entity=S,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=T(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:M(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=E,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=O(s.indexes);!(v=g()).done;){var b=v.value;b in t[c]||(r[c][b]=t[c][b]={});var k=t[c][b];f&&delete k[f[b]],n[c]&&n[c][u]&&n[c][u][b]!==m[b]&&(k[n[c][u][b]]=_),b in m?k[m[b]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0})}));
define(["exports"],(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):("production"!==process.env.NODE_ENV&&console.warn("TypeError: Unable to infer schema for "+this.constructor.name+"\nValue: "+JSON.stringify(e,void 0,2)+"."),[e,!0,!1])},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]};function p(e,t,n,r){}var d=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var S=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},r.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=O(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=O(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",b="substantially different than expected keys";v&&(g+="\n Missing: "+a,b="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,b="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+b+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(S.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=A()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(x(Error)),J=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),P=Symbol("draft"),M=function(e,n,r,i,o,s,a,u){var c=i(e,n);if(c===_)return[void 0,!0,!0];if("object"!=typeof c||null===c)return[c,!1,!1];var f="string"==typeof e?e:n.pk(t(c)?c.toJS():c);if(void 0===f||""===f)return[c,!1,!1];void 0===o[n.key]&&(o[n.key]=Object.create(null));var l=!0,h=!1;if(o[n.key][f]){if(Object.prototype.hasOwnProperty.call(o[n.key][f],P))return u.i=o[n.key][f].i,[o[n.key][f][P],l,h];a.push(c)}else{var p=a.length;a.push(c);var d=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(r);d.setLocal=function(e){var t;return o[n.key][f]=((t={})[P]=e,t.i=p,t)};var y=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new J);return e[t.key][n]}(s,n,f),m=n.denormalize(c,d);o[n.key][f]=m[0],l=m[1],h=m[2];var v=a.slice(-1===u.i?p:u.i);y.has(v)?o[n.key][f]=y.get(v):y.set(v,o[n.key][f]),u.i===p&&(u.i=-1)}return[o[n.key][f],l,h]},T=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};var I=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){if(e[0]){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}}},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(S);e.DELETED=_,e.Entity=S,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=T(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:M(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=E,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=O(s.indexes);!(v=g()).done;){var b=v.value;b in t[c]||(r[c][b]=t[c][b]={});var k=t[c][b];f&&delete k[f[b]],n[c]&&n[c][u]&&n[c][u][b]!==m[b]&&(k[n[c][u][b]]=_),b in m?k[m[b]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -17,3 +17,4 @@ var rest_hooks_normalizr = (function (exports) {

function isImmutable(object) {
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || // Immutable.Map
object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
}

@@ -149,2 +150,7 @@ /**

if (!this.isSingleSchema && !schemaKey) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
console.warn("TypeError: Unable to infer schema for " + this.constructor.name + "\nValue: " + JSON.stringify(value, undefined, 2) + ".");
}
return [value, true, false];

@@ -992,4 +998,4 @@ }

var unvisitEntity = function unvisitEntity(id, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(id, schema);
var unvisitEntity = function unvisitEntity(entityOrId, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(entityOrId, schema);

@@ -1004,4 +1010,10 @@ if (entity === DELETED) {

var pk = typeof entityOrId === 'string' ? entityOrId : schema.pk(isImmutable(entity) ? entity.toJS() : entity);
if (pk === undefined || pk === '') {
return [entity, false, false];
}
if (localCache[schema.key] === undefined) {
localCache[schema.key] = {};
localCache[schema.key] = Object.create(null);
}

@@ -1012,3 +1024,3 @@

if (!localCache[schema.key][id]) {
if (!localCache[schema.key][pk]) {
var trackingIndex = dependencies.length;

@@ -1021,10 +1033,10 @@ dependencies.push(entity);

return localCache[schema.key][id] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
return localCache[schema.key][pk] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
};
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, id);
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, pk);
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];
localCache[schema.key][pk] = _schema$denormalize[0];
found = _schema$denormalize[1];

@@ -1037,5 +1049,5 @@ deleted = _schema$denormalize[2];

if (!globalCacheEntry.has(localKey)) {
globalCacheEntry.set(localKey, localCache[schema.key][id]);
globalCacheEntry.set(localKey, localCache[schema.key][pk]);
} else {
localCache[schema.key][id] = globalCacheEntry.get(localKey);
localCache[schema.key][pk] = globalCacheEntry.get(localKey);
} // start of cycle - reset cycle detection

@@ -1049,5 +1061,5 @@

// cycle detected
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][id], DRAFT)) {
cycleIndex.i = localCache[schema.key][id].i;
return [localCache[schema.key][id][DRAFT], found, deleted];
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][pk], DRAFT)) {
cycleIndex.i = localCache[schema.key][pk].i;
return [localCache[schema.key][pk][DRAFT], found, deleted];
} else {

@@ -1059,3 +1071,3 @@ // with no cycle, globalCacheEntry will have already been set

return [localCache[schema.key][id], found, deleted];
return [localCache[schema.key][pk], found, deleted];
};

@@ -1089,3 +1101,3 @@

if (isEntity(schema)) {
// unvisitEntity just can't handle undefined
// unvisitEntity only works with valid input of string
if (input === undefined) {

@@ -1282,5 +1294,5 @@ return [input, false, false];

else if ( // eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
}

@@ -1387,2 +1399,3 @@ } // set this after index updates so we know what indexes to remove from

_proto.infer = function infer(args, indexes, recurse) {
if (!args[0]) return undefined;
var attr = this.getSchemaAttribute(args[0], undefined, '');

@@ -1389,0 +1402,0 @@ var discriminatedSchema = this.schema[attr]; // Was unable to infer the entity's schema from params

@@ -1,1 +0,1 @@

var rest_hooks_normalizr=function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]};function p(e,t,n,r){}var d=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var S=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},r.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=O(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=O(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",b="substantially different than expected keys";v&&(g+="\n Missing: "+a,b="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,b="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+b+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(S.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=A()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(x(Error)),J=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),P=Symbol("draft"),M=function(e,t,n,r,i,o,s,a){var u=r(e,t);if(u===_)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===i[t.key]&&(i[t.key]={});var c=!0,f=!1;if(i[t.key][e]){if(Object.prototype.hasOwnProperty.call(i[t.key][e],P))return a.i=i[t.key][e].i,[i[t.key][e][P],c,f];s.push(u)}else{var l=s.length;s.push(u);var h=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(n);h.setLocal=function(n){var r;return i[t.key][e]=((r={})[P]=n,r.i=l,r)};var p=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new J);return e[t.key][n]}(o,t,e),d=t.denormalize(u,h);i[t.key][e]=d[0],c=d[1],f=d[2];var y=s.slice(-1===a.i?l:a.i);p.has(y)?i[t.key][e]=p.get(y):p.set(y,i[t.key][e]),a.i===l&&(a.i=-1)}return[i[t.key][e],c,f]},T=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};var I=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(S);return e.DELETED=_,e.Entity=S,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=T(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:M(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=E,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=O(s.indexes);!(v=g()).done;){var b=v.value;b in t[c]||(r[c][b]=t[c][b]={});var k=t[c][b];f&&delete k[f[b]],n[c]&&n[c][u]&&n[c][u][b]!==m[b]&&(k[n[c][u][b]]=_),b in m?k[m[b]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var rest_hooks_normalizr=function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):("production"!==process.env.NODE_ENV&&console.warn("TypeError: Unable to infer schema for "+this.constructor.name+"\nValue: "+JSON.stringify(e,void 0,2)+"."),[e,!0,!1])},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]};function p(e,t,n,r){}var d=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var S=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},r.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=O(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=O(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",b="substantially different than expected keys";v&&(g+="\n Missing: "+a,b="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,b="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+b+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(S.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=A()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(x(Error)),J=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),P=Symbol("draft"),M=function(e,n,r,i,o,s,a,u){var c=i(e,n);if(c===_)return[void 0,!0,!0];if("object"!=typeof c||null===c)return[c,!1,!1];var f="string"==typeof e?e:n.pk(t(c)?c.toJS():c);if(void 0===f||""===f)return[c,!1,!1];void 0===o[n.key]&&(o[n.key]=Object.create(null));var l=!0,h=!1;if(o[n.key][f]){if(Object.prototype.hasOwnProperty.call(o[n.key][f],P))return u.i=o[n.key][f].i,[o[n.key][f][P],l,h];a.push(c)}else{var p=a.length;a.push(c);var d=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(r);d.setLocal=function(e){var t;return o[n.key][f]=((t={})[P]=e,t.i=p,t)};var y=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new J);return e[t.key][n]}(s,n,f),m=n.denormalize(c,d);o[n.key][f]=m[0],l=m[1],h=m[2];var v=a.slice(-1===u.i?p:u.i);y.has(v)?o[n.key][f]=y.get(v):y.set(v,o[n.key][f]),u.i===p&&(u.i=-1)}return[o[n.key][f],l,h]},T=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};var I=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){if(e[0]){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}}},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(S);return e.DELETED=_,e.Entity=S,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=T(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:M(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=E,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=O(s.indexes);!(v=g()).done;){var b=v.value;b in t[c]||(r[c][b]=t[c][b]={});var k=t[c][b];f&&delete k[f[b]],n[c]&&n[c][u]&&n[c][u][b]!==m[b]&&(k[n[c][u][b]]=_),b in m?k[m[b]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -18,3 +18,4 @@ 'use strict';

function isImmutable(object) {
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || // Immutable.Map
object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
}

@@ -150,2 +151,7 @@ /**

if (!this.isSingleSchema && !schemaKey) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
console.warn("TypeError: Unable to infer schema for " + this.constructor.name + "\nValue: " + JSON.stringify(value, undefined, 2) + ".");
}
return [value, true, false];

@@ -993,4 +999,4 @@ }

var unvisitEntity = function unvisitEntity(id, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(id, schema);
var unvisitEntity = function unvisitEntity(entityOrId, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(entityOrId, schema);

@@ -1005,4 +1011,10 @@ if (entity === DELETED) {

var pk = typeof entityOrId === 'string' ? entityOrId : schema.pk(isImmutable(entity) ? entity.toJS() : entity);
if (pk === undefined || pk === '') {
return [entity, false, false];
}
if (localCache[schema.key] === undefined) {
localCache[schema.key] = {};
localCache[schema.key] = Object.create(null);
}

@@ -1013,3 +1025,3 @@

if (!localCache[schema.key][id]) {
if (!localCache[schema.key][pk]) {
var trackingIndex = dependencies.length;

@@ -1022,10 +1034,10 @@ dependencies.push(entity);

return localCache[schema.key][id] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
return localCache[schema.key][pk] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
};
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, id);
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, pk);
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];
localCache[schema.key][pk] = _schema$denormalize[0];
found = _schema$denormalize[1];

@@ -1038,5 +1050,5 @@ deleted = _schema$denormalize[2];

if (!globalCacheEntry.has(localKey)) {
globalCacheEntry.set(localKey, localCache[schema.key][id]);
globalCacheEntry.set(localKey, localCache[schema.key][pk]);
} else {
localCache[schema.key][id] = globalCacheEntry.get(localKey);
localCache[schema.key][pk] = globalCacheEntry.get(localKey);
} // start of cycle - reset cycle detection

@@ -1050,5 +1062,5 @@

// cycle detected
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][id], DRAFT)) {
cycleIndex.i = localCache[schema.key][id].i;
return [localCache[schema.key][id][DRAFT], found, deleted];
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][pk], DRAFT)) {
cycleIndex.i = localCache[schema.key][pk].i;
return [localCache[schema.key][pk][DRAFT], found, deleted];
} else {

@@ -1060,3 +1072,3 @@ // with no cycle, globalCacheEntry will have already been set

return [localCache[schema.key][id], found, deleted];
return [localCache[schema.key][pk], found, deleted];
};

@@ -1090,3 +1102,3 @@

if (isEntity(schema)) {
// unvisitEntity just can't handle undefined
// unvisitEntity only works with valid input of string
if (input === undefined) {

@@ -1283,5 +1295,5 @@ return [input, false, false];

else if ( // eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
}

@@ -1388,2 +1400,3 @@ } // set this after index updates so we know what indexes to remove from

_proto.infer = function infer(args, indexes, recurse) {
if (!args[0]) return undefined;
var attr = this.getSchemaAttribute(args[0], undefined, '');

@@ -1390,0 +1403,0 @@ var discriminatedSchema = this.schema[attr]; // Was unable to infer the entity's schema from params

@@ -1,1 +0,1 @@

"use strict";function e(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function t(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var s=function(){function t(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=t.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){if(void 0===t)return[t,!1,!1];var r=e(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:e(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):[t,!0,!1]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},c=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},f=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},l=function(e,t,n){e=a(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(c).map((function(e){return e[0]})):t,i,r]};function h(e,t,n,r){}var p=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return u(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(c).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(s),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},y=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],u=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function m(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var v=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return m(this.schema,e,t,n)},e}();function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 O=Symbol("Defined Members"),k=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[k]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,O,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,k,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[O].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=b(e[O]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[O]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return m(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},o(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();w.schema={};var j=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},i.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=b(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=b(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",O="substantially different than expected keys";v&&(g+="\n Missing: "+a,O="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,O="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+O+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},i.expiresAt=function(e,t){return e.expiresAt},i.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},i.denormalize=function(n,r){var i=this,o=e(n)?n:this.fromJS(n instanceof w?this.toObjectDefined(n):n);if(null==r.setLocal||r.setLocal(o),e(n)){var s=t(this.schema,n,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],s=Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(s,t),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(n,e)&&!i.defaults[e]||(f=!0),Object.prototype.hasOwnProperty.call(n,e)&&n[e]!==u&&(o[e]=u)})),[o,!0,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(w);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(j.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,r){return(z=x()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function A(e){var t="function"==typeof Map?new Map:void 0;return(A=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return z(e,arguments,_(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var N=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return r(t,e),t}(A(Error)),V=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new N,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),J=Symbol("draft"),P=function(e,t,n,r,i,o,s,a){var u=r(e,t);if(u===E)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===i[t.key]&&(i[t.key]={});var c=!0,f=!1;if(i[t.key][e]){if(Object.prototype.hasOwnProperty.call(i[t.key][e],J))return a.i=i[t.key][e].i,[i[t.key][e][J],c,f];s.push(u)}else{var l=s.length;s.push(u);var h=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(n);h.setLocal=function(n){var r;return i[t.key][e]=((r={})[J]=n,r.i=l,r)};var p=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new V);return e[t.key][n]}(o,t,e),d=t.denormalize(u,h);i[t.key][e]=d[0],c=d[1],f=d[2];var y=s.slice(-1===a.i?l:a.i);p.has(y)?i[t.key][e]=p.get(y):p.set(y,i[t.key][e]),a.i===l&&(a.i=-1)}return[i[t.key][e],c,f]},M=function(t){var n=e(t);return function(e,r){var i=r.key;return"object"==typeof e?e:n?t.getIn([i,e]):t[i]&&t[i][e]}};var T=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?f:d)(i,t,n,r,e,o,s):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(s),L=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(s),R=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,E,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},o(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),U=Object.freeze({__proto__:null,Union:I,Values:L,Array:p,Object:v,Delete:R}),F=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(j);exports.DELETED=E,exports.Entity=j,exports.FlatEntity=F,exports.SimpleRecord=w,exports.WeakListMap=V,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=M(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?l:y)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:P(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},exports.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?h:m)(t,n,r,e):t},exports.isEntity=S,exports.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=b(s.indexes);!(v=g()).done;){var O=v.value;O in t[c]||(r[c][O]=t[c][O]={});var k=t[c][O];f&&delete k[f[O]],n[c]&&n[c][u]&&n[c][u][O]!==m[O]&&(k[n[c][u][O]]=E),O in m?k[m[O]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+O+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:T(e,e,void 0,t,f,{}),entityMeta:c}},exports.schema=U;
"use strict";function e(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function t(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var s=function(){function t(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=t.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){if(void 0===t)return[t,!1,!1];var r=e(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:e(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):("production"!==process.env.NODE_ENV&&console.warn("TypeError: Unable to infer schema for "+this.constructor.name+"\nValue: "+JSON.stringify(t,void 0,2)+"."),[t,!0,!1])},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},c=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},f=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},l=function(e,t,n){e=a(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(c).map((function(e){return e[0]})):t,i,r]};function h(e,t,n,r){}var p=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return u(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(c).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(s),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},y=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],u=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function m(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var v=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return m(this.schema,e,t,n)},e}();function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 O=Symbol("Defined Members"),k=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[k]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,O,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,k,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[O].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=b(e[O]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[O]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return m(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},o(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();w.schema={};var j=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},i.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=b(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=b(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",O="substantially different than expected keys";v&&(g+="\n Missing: "+a,O="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,O="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+O+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},i.expiresAt=function(e,t){return e.expiresAt},i.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},i.denormalize=function(n,r){var i=this,o=e(n)?n:this.fromJS(n instanceof w?this.toObjectDefined(n):n);if(null==r.setLocal||r.setLocal(o),e(n)){var s=t(this.schema,n,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],s=Object.prototype.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(s,t),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(n,e)&&!i.defaults[e]||(f=!0),Object.prototype.hasOwnProperty.call(n,e)&&n[e]!==u&&(o[e]=u)})),[o,!0,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(w);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(j.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,r){return(z=x()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function A(e){var t="function"==typeof Map?new Map:void 0;return(A=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return z(e,arguments,_(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var N=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return r(t,e),t}(A(Error)),V=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new N,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),J=Symbol("draft"),P=function(t,n,r,i,o,s,a,u){var c=i(t,n);if(c===E)return[void 0,!0,!0];if("object"!=typeof c||null===c)return[c,!1,!1];var f="string"==typeof t?t:n.pk(e(c)?c.toJS():c);if(void 0===f||""===f)return[c,!1,!1];void 0===o[n.key]&&(o[n.key]=Object.create(null));var l=!0,h=!1;if(o[n.key][f]){if(Object.prototype.hasOwnProperty.call(o[n.key][f],J))return u.i=o[n.key][f].i,[o[n.key][f][J],l,h];a.push(c)}else{var p=a.length;a.push(c);var d=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(r);d.setLocal=function(e){var t;return o[n.key][f]=((t={})[J]=e,t.i=p,t)};var y=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new V);return e[t.key][n]}(s,n,f),m=n.denormalize(c,d);o[n.key][f]=m[0],l=m[1],h=m[2];var v=a.slice(-1===u.i?p:u.i);y.has(v)?o[n.key][f]=y.get(v):y.set(v,o[n.key][f]),u.i===p&&(u.i=-1)}return[o[n.key][f],l,h]},M=function(t){var n=e(t);return function(e,r){var i=r.key;return"object"==typeof e?e:n?t.getIn([i,e]):t[i]&&t[i][e]}};var T=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?f:d)(i,t,n,r,e,o,s):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){if(e[0]){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}}},t}(s),L=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(s),R=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,E,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},o(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),U=Object.freeze({__proto__:null,Union:I,Values:L,Array:p,Object:v,Delete:R}),F=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(j);exports.DELETED=E,exports.Entity=j,exports.FlatEntity=F,exports.SimpleRecord=w,exports.WeakListMap=V,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=M(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?l:y)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:P(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},exports.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?h:m)(t,n,r,e):t},exports.isEntity=S,exports.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=b(s.indexes);!(v=g()).done;){var O=v.value;O in t[c]||(r[c][O]=t[c][O]={});var k=t[c][O];f&&delete k[f[O]],n[c]&&n[c][u]&&n[c][u][O]!==m[O]&&(k[n[c][u][O]]=E),O in m?k[m[O]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+O+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:T(e,e,void 0,t,f,{}),entityMeta:c}},exports.schema=U;

@@ -20,3 +20,4 @@ (function (global, factory) {

function isImmutable(object) {
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || // Immutable.Map
object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
}

@@ -152,2 +153,7 @@ /**

if (!this.isSingleSchema && !schemaKey) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
console.warn("TypeError: Unable to infer schema for " + this.constructor.name + "\nValue: " + JSON.stringify(value, undefined, 2) + ".");
}
return [value, true, false];

@@ -995,4 +1001,4 @@ }

var unvisitEntity = function unvisitEntity(id, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(id, schema);
var unvisitEntity = function unvisitEntity(entityOrId, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) {
var entity = getEntity(entityOrId, schema);

@@ -1007,4 +1013,10 @@ if (entity === DELETED) {

var pk = typeof entityOrId === 'string' ? entityOrId : schema.pk(isImmutable(entity) ? entity.toJS() : entity);
if (pk === undefined || pk === '') {
return [entity, false, false];
}
if (localCache[schema.key] === undefined) {
localCache[schema.key] = {};
localCache[schema.key] = Object.create(null);
}

@@ -1015,3 +1027,3 @@

if (!localCache[schema.key][id]) {
if (!localCache[schema.key][pk]) {
var trackingIndex = dependencies.length;

@@ -1024,10 +1036,10 @@ dependencies.push(entity);

return localCache[schema.key][id] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
return localCache[schema.key][pk] = (_localCache$schema$ke = {}, _localCache$schema$ke[DRAFT] = entityCopy, _localCache$schema$ke.i = trackingIndex, _localCache$schema$ke);
};
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, id);
var globalCacheEntry = getGlobalCacheEntry(entityCache, schema, pk);
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];
localCache[schema.key][pk] = _schema$denormalize[0];
found = _schema$denormalize[1];

@@ -1040,5 +1052,5 @@ deleted = _schema$denormalize[2];

if (!globalCacheEntry.has(localKey)) {
globalCacheEntry.set(localKey, localCache[schema.key][id]);
globalCacheEntry.set(localKey, localCache[schema.key][pk]);
} else {
localCache[schema.key][id] = globalCacheEntry.get(localKey);
localCache[schema.key][pk] = globalCacheEntry.get(localKey);
} // start of cycle - reset cycle detection

@@ -1052,5 +1064,5 @@

// cycle detected
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][id], DRAFT)) {
cycleIndex.i = localCache[schema.key][id].i;
return [localCache[schema.key][id][DRAFT], found, deleted];
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][pk], DRAFT)) {
cycleIndex.i = localCache[schema.key][pk].i;
return [localCache[schema.key][pk][DRAFT], found, deleted];
} else {

@@ -1062,3 +1074,3 @@ // with no cycle, globalCacheEntry will have already been set

return [localCache[schema.key][id], found, deleted];
return [localCache[schema.key][pk], found, deleted];
};

@@ -1092,3 +1104,3 @@

if (isEntity(schema)) {
// unvisitEntity just can't handle undefined
// unvisitEntity only works with valid input of string
if (input === undefined) {

@@ -1285,5 +1297,5 @@ return [input, false, false];

else if ( // eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
process.env.NODE_ENV !== 'production') {
console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: " + index + "\nEntity: " + JSON.stringify(entity, undefined, 2));
}
}

@@ -1390,2 +1402,3 @@ } // set this after index updates so we know what indexes to remove from

_proto.infer = function infer(args, indexes, recurse) {
if (!args[0]) return undefined;
var attr = this.getSchemaAttribute(args[0], undefined, '');

@@ -1392,0 +1405,0 @@ var discriminatedSchema = this.schema[attr]; // Was unable to infer the entity's schema from params

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).rest_hooks_normalizr={})}(this,(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!1]},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]};function p(e,t,n,r){}var d=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var S=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},r.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=O(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=O(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",b="substantially different than expected keys";v&&(g+="\n Missing: "+a,b="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,b="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+b+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(S.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=A()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(x(Error)),J=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),P=Symbol("draft"),M=function(e,t,n,r,i,o,s,a){var u=r(e,t);if(u===_)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===i[t.key]&&(i[t.key]={});var c=!0,f=!1;if(i[t.key][e]){if(Object.prototype.hasOwnProperty.call(i[t.key][e],P))return a.i=i[t.key][e].i,[i[t.key][e][P],c,f];s.push(u)}else{var l=s.length;s.push(u);var h=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(n);h.setLocal=function(n){var r;return i[t.key][e]=((r={})[P]=n,r.i=l,r)};var p=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new J);return e[t.key][n]}(o,t,e),d=t.denormalize(u,h);i[t.key][e]=d[0],c=d[1],f=d[2];var y=s.slice(-1===a.i?l:a.i);p.has(y)?i[t.key][e]=p.get(y):p.set(y,i[t.key][e]),a.i===l&&(a.i=-1)}return[i[t.key][e],c,f]},T=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};var I=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(S);e.DELETED=_,e.Entity=S,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=T(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:M(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=E,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=O(s.indexes);!(v=g()).done;){var b=v.value;b in t[c]||(r[c][b]=t[c][b]={});var k=t[c][b];f&&delete k[f[b]],n[c]&&n[c][u]&&n[c][u][b]!==m[b]&&(k[n[c][u][b]]=_),b in m?k[m[b]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).rest_hooks_normalizr={})}(this,(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):("production"!==process.env.NODE_ENV&&console.warn("TypeError: Unable to infer schema for "+this.constructor.name+"\nValue: "+JSON.stringify(e,void 0,2)+"."),[e,!0,!1])},s(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]};function p(e,t,n,r){}var d=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return c(e).map((function(e,a){return s.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=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 k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var S=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);this.validate(a,e);var u=a.pk(t,n);if(void 0!==u&&""!==u){var c=this.key;return c in o||(o[c]={}),u in o[c]||(o[c][u]=[]),o[c][u].some((function(t){return t===e}))?u:(o[c][u].push(e),Object.keys(this.schema).forEach((function(e){if(Object.prototype.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,u),u)}if("production"!==process.env.NODE_ENV){var f=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw f.status=400,f}},r.validate=function(e,t){if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var n,r=new Set(Object.keys(this.defaults)),i=this.keysDefined(e),o=[[],[],[]],s=o[0],a=o[1],u=o[2],c=O(i);!(n=c()).done;){var f=n.value;r.has(f)?s.push(f):u.push(f)}for(var l,h=O(r);!(l=h()).done;){var p=l.value;s.includes(p)||a.push(p)}if(r.size){if(Array.isArray(t)&&u.length){var d="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+a+"\nFirst three members: "+JSON.stringify(t.slice(0,3),null,2);if("warn"!==this.automaticValidation){var y=new Error(d);throw y.status=400,y}console.warn(d)}var m=Math.max(i.length/2,1)<=u.length&&r.size>Math.max(u.length,2)&&Math.pow(s.length,1.5)/2<=u.length,v=s.length<Math.min(1,r.size/2);if(m||v){var g="",b="substantially different than expected keys";v&&(g+="\n Missing: "+a,b="no matching keys found"),m&&(g+="\n Unexpected keys: "+u,b="a large number of unexpected keys found");var k="Attempted to initialize "+this.name+" with "+b+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+s+g+"\n Value: "+JSON.stringify(this.toObjectDefined(e),null,2);if(!(s.length>=4&&m||"warn"===this.automaticValidation)){var w=new Error(k);throw w.status=400,w}console.warn(k)}}}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.prototype.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(S.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function N(e,t,n){return(N=A()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function x(e){var t="function"==typeof Map?new Map:void 0;return(x=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(x(Error)),J=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),P=Symbol("draft"),M=function(e,n,r,i,o,s,a,u){var c=i(e,n);if(c===_)return[void 0,!0,!0];if("object"!=typeof c||null===c)return[c,!1,!1];var f="string"==typeof e?e:n.pk(t(c)?c.toJS():c);if(void 0===f||""===f)return[c,!1,!1];void 0===o[n.key]&&(o[n.key]=Object.create(null));var l=!0,h=!1;if(o[n.key][f]){if(Object.prototype.hasOwnProperty.call(o[n.key][f],P))return u.i=o[n.key][f].i,[o[n.key][f][P],l,h];a.push(c)}else{var p=a.length;a.push(c);var d=function(e){var t=e.og||e,n=function(e,n){return t(e,n)};return n.og=e,n}(r);d.setLocal=function(e){var t;return o[n.key][f]=((t={})[P]=e,t.i=p,t)};var y=function(e,t,n){e[t.key]||(e[t.key]={});e[t.key][n]||(e[t.key][n]=new J);return e[t.key][n]}(s,n,f),m=n.denormalize(c,d);o[n.key][f]=m[0],l=m[1],h=m[2];var v=a.slice(-1===u.i?p:u.i);y.has(v)?o[n.key][f]=y.get(v):y.set(v,o[n.key][f]),u.i===p&&(u.i=-1)}return[o[n.key][f],l,h]},T=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};var I=function e(t,n,r,i,o,s){return t&&i?i.normalize&&"function"==typeof i.normalize?"object"!=typeof t?t:i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):"object"!=typeof t||"object"!=typeof i?t:(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},n.infer=function(e,t,n){if(e[0]){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}}},t}(a),R=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,s){var a,u=e[s],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(S);e.DELETED=_,e.Entity=S,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=function(e,t,n,r){var i=T(e),o=[],s={i:-1};function a(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:M(e,n,a,i,r,t,o,s):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}return function(e,t){var r=a(e,t);return Object(e)!==e?r:(o.push(e),n.has(o)?[n.get(o),r[1],r[2]]:(n.set(o,r[0]),r))}}(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=E,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c=s.key;c in e||(e[c]={},n[c]=Object.assign({},n[c]),i[c]=Object.assign({},i[c]));var f=e[c][u];if(f)e[c][u]=s.merge(f,a);else{var l=s.expiresAt?s.expiresAt(o,a):o.expiresAt,h=n[c][u];if(h){var p,d,y=(null==(p=i[c][u])?void 0:p.date)>o.date;e[c][u]=typeof a!=typeof h?y?h:a:y?s.merge(a,h):s.merge(h,a),i[c][u]=(null==(d=i[c][u])?void 0:d.expiresAt)>=l?i[c][u]:{expiresAt:l,date:o.date}}else e[c][u]=a,i[c][u]={expiresAt:l,date:o.date}}if(Array.isArray(s.indexes)){var m=e[c][u];c in t||(t[c]={},r[c]=Object.assign({},r[c]));for(var v,g=O(s.indexes);!(v=g()).done;){var b=v.value;b in t[c]||(r[c][b]=t[c][b]={});var k=t[c][b];f&&delete k[f[b]],n[c]&&n[c][u]&&n[c][u][b]!==m[b]&&(k[n[c][u][b]]=_),b in m?k[m[b]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[c][u]=e[c][u]}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -1,3 +0,3 @@

import { Denormalize, DenormalizeNullable, Schema, DenormalizeCache } from "./types";
import WeakListMap from "./WeakListMap";
import { Denormalize, DenormalizeNullable, Schema, DenormalizeCache } from './types';
import WeakListMap from './WeakListMap';
declare type DenormalizeReturn<S extends Schema> = [

@@ -4,0 +4,0 @@ denormalized: Denormalize<S>,

@@ -9,4 +9,4 @@ import { isImmutable } from './schemas/ImmutableUtils';

const unvisitEntity = (id, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) => {
const entity = getEntity(id, schema);
const unvisitEntity = (entityOrId, schema, unvisit, getEntity, localCache, entityCache, dependencies, cycleIndex) => {
const entity = getEntity(entityOrId, schema);

@@ -21,4 +21,10 @@ if (entity === DELETED) {

const pk = typeof entityOrId === 'string' ? entityOrId : schema.pk(isImmutable(entity) ? entity.toJS() : entity);
if (pk === undefined || pk === '') {
return [entity, false, false];
}
if (localCache[schema.key] === undefined) {
localCache[schema.key] = {};
localCache[schema.key] = Object.create(null);
}

@@ -29,3 +35,3 @@

if (!localCache[schema.key][id]) {
if (!localCache[schema.key][pk]) {
const trackingIndex = dependencies.length;

@@ -35,3 +41,3 @@ dependencies.push(entity);

wrappedUnvisit.setLocal = entityCopy => localCache[schema.key][id] = {
wrappedUnvisit.setLocal = entityCopy => localCache[schema.key][pk] = {
[DRAFT]: entityCopy,

@@ -41,4 +47,4 @@ i: trackingIndex

const globalCacheEntry = getGlobalCacheEntry(entityCache, schema, id);
[localCache[schema.key][id], found, deleted] = schema.denormalize(entity, wrappedUnvisit); // if in cycle, use the start of the cycle to track all deps
const globalCacheEntry = getGlobalCacheEntry(entityCache, schema, pk);
[localCache[schema.key][pk], found, deleted] = schema.denormalize(entity, wrappedUnvisit); // if in cycle, use the start of the cycle to track all deps
// otherwise, we use our own trackingIndex

@@ -49,5 +55,5 @@

if (!globalCacheEntry.has(localKey)) {
globalCacheEntry.set(localKey, localCache[schema.key][id]);
globalCacheEntry.set(localKey, localCache[schema.key][pk]);
} else {
localCache[schema.key][id] = globalCacheEntry.get(localKey);
localCache[schema.key][pk] = globalCacheEntry.get(localKey);
} // start of cycle - reset cycle detection

@@ -61,5 +67,5 @@

// cycle detected
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][id], DRAFT)) {
cycleIndex.i = localCache[schema.key][id].i;
return [localCache[schema.key][id][DRAFT], found, deleted];
if (Object.prototype.hasOwnProperty.call(localCache[schema.key][pk], DRAFT)) {
cycleIndex.i = localCache[schema.key][pk].i;
return [localCache[schema.key][pk][DRAFT], found, deleted];
} else {

@@ -71,3 +77,3 @@ // with no cycle, globalCacheEntry will have already been set

return [localCache[schema.key][id], found, deleted];
return [localCache[schema.key][pk], found, deleted];
};

@@ -101,3 +107,3 @@

if (isEntity(schema)) {
// unvisitEntity just can't handle undefined
// unvisitEntity only works with valid input of string
if (input === undefined) {

@@ -184,2 +190,2 @@ return [input, false, false];

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZW5vcm1hbGl6ZS50cyJdLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplIiwiYXJyYXlEZW5vcm1hbGl6ZSIsIm9iamVjdERlbm9ybWFsaXplIiwiaXNFbnRpdHkiLCJERUxFVEVEIiwiV2Vha0xpc3RNYXAiLCJEUkFGVCIsIlN5bWJvbCIsInVudmlzaXRFbnRpdHkiLCJpZCIsInNjaGVtYSIsInVudmlzaXQiLCJnZXRFbnRpdHkiLCJsb2NhbENhY2hlIiwiZW50aXR5Q2FjaGUiLCJkZXBlbmRlbmNpZXMiLCJjeWNsZUluZGV4IiwiZW50aXR5IiwidW5kZWZpbmVkIiwia2V5IiwiZm91bmQiLCJkZWxldGVkIiwidHJhY2tpbmdJbmRleCIsImxlbmd0aCIsInB1c2giLCJ3cmFwcGVkVW52aXNpdCIsIndpdGhUcmFja2VkRW50aXRpZXMiLCJzZXRMb2NhbCIsImVudGl0eUNvcHkiLCJpIiwiZ2xvYmFsQ2FjaGVFbnRyeSIsImdldEdsb2JhbENhY2hlRW50cnkiLCJsb2NhbEtleSIsInNsaWNlIiwiaGFzIiwic2V0IiwiZ2V0IiwiT2JqZWN0IiwicHJvdG90eXBlIiwiaGFzT3duUHJvcGVydHkiLCJjYWxsIiwiZ2V0VW52aXNpdCIsImVudGl0aWVzIiwicmVzdWx0Q2FjaGUiLCJnZXRFbnRpdGllcyIsImlucHV0IiwibWV0aG9kIiwiQXJyYXkiLCJpc0FycmF5IiwicmV0IiwiZW50aXR5SXNJbW11dGFibGUiLCJlbnRpdHlPcklkIiwic2NoZW1hS2V5IiwiZ2V0SW4iLCJyZXNvbHZlZEVudGl0aWVzIiwiZGVub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2l0OiBVbnZpc2l0RnVuY3Rpb24pOiBzY2hlbWEuVW52aXNpdEZ1bmN0aW9uIHtcbiAgLy8gZXZlcnkgdGltZSB3ZSBuZXN0LCB3ZSB3YW50IHRvIHVud3JhcCBiYWNrIHRvIHRoZSB0b3AuXG4gIC8vIHRoaXMgaXMgZHVlIHRvIG9ubHkgbmVlZGVkIHRoZSBuZXh0IGxldmVsIG9mIG5lc3RlZCBlbnRpdGllcyBmb3IgbG9va3VwXG4gIGNvbnN0IG9yaWdpbmFsVW52aXNpdCA9IHVudmlzaXQub2cgfHwgdW52aXNpdDtcbiAgY29uc3Qgd3JhcHBlZFVudmlzaXQgPSAoaW5wdXQ6IGFueSwgc2NoZW1hOiBhbnkpID0+XG4gICAgb3JpZ2luYWxVbnZpc2l0KGlucHV0LCBzY2hlbWEpO1xuICB3cmFwcGVkVW52aXNpdC5vZyA9IHVudmlzaXQ7XG4gIHJldHVybiB3cmFwcGVkVW52aXNpdDtcbn1cbiJdfQ==

@@ -1,9 +0,8 @@

import * as schema from "../schema";
import { AbstractInstanceType, Schema, NormalizedIndex } from "../types";
/**
* Represents data that should be deduped by specifying a primary key.
* @see https://resthooks.io/docs/api/Entity
*/
export default abstract class Entity {
import SimpleRecord from './SimpleRecord';
import * as schema from '../schema';
import { AbstractInstanceType, Schema } from '../types';
/** Represents data that should be deduped by specifying a primary key. */
export default abstract class Entity extends SimpleRecord {
static toJSON(): {
key: string;
name: string;

@@ -13,8 +12,3 @@ schema: {

};
key: string;
};
/** Defines nested entities */
static schema: {
[k: string]: Schema;
};
/**

@@ -48,16 +42,4 @@ * A unique identifier for each Entity

static pk<T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string): string | undefined;
/** Creates new instance copying over defined values of arguments */
static merge<T extends typeof Entity>(this: T, existing: Partial<AbstractInstanceType<T>>, incoming: Partial<AbstractInstanceType<T>>): Partial<AbstractInstanceType<T>>;
/** Factory method to convert from Plain JS Objects.
*
* @param [props] Plain Object of properties to assign.
* @param [parent] When normalizing, the object which included the record
* @param [key] When normalizing, the key where this record was found
*/
static fromJS<T extends typeof Entity>(this: T, props?: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T>;
/** Do any transformations when first receiving input */
static process(input: any, parent: any, key: string | undefined): any;
static normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any;
protected static validate(processedEntity: any): string | undefined;
static infer(args: any[], indexes: NormalizedIndex, recurse: any): any;
protected static validate(processedEntity: Entity, input: any): void;
static expiresAt(meta: {

@@ -67,10 +49,6 @@ expiresAt: number;

}, input: any): number;
static denormalize<T extends typeof Entity>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [denormalized: AbstractInstanceType<T>, found: boolean, suspend: boolean];
private static __defaults;
/** All instance defaults set */
protected static get defaults(): any;
/** Used by denormalize to set nested members */
protected static set(entity: any, key: string, value: any): void;
static infer(args: any, indexes: any, infer: any): any;
static denormalize<T extends typeof SimpleRecord>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [AbstractInstanceType<T>, boolean, boolean];
}
export declare function isEntity(schema: Schema): schema is typeof Entity;
//# sourceMappingURL=Entity.d.ts.map

@@ -1,2 +0,2 @@

import Entity from "./Entity";
import Entity from './Entity';
/** Represents data with primary key being from 'id' field. */

@@ -3,0 +3,0 @@ export default class IDEntity extends Entity {

@@ -1,10 +0,12 @@

import { denormalize } from "./denormalize";
import { normalize } from "./normalize";
import WeakListMap from "./WeakListMap";
import * as schema from "./schema";
import Entity, { isEntity } from "./entities/Entity";
export { default as inferResults } from "./inferResults";
export { DELETED } from "./special";
export { AbstractInstanceType, Schema, Normalize, NormalizeNullable, NormalizedIndex, NormalizeReturnType, NormalizedSchema, Denormalize, DenormalizeNullable, DenormalizeReturnType, DenormalizeCache, } from "./types";
export { denormalize, schema, normalize, Entity, isEntity, WeakListMap };
import { denormalize } from './denormalize';
import { normalize } from './normalize';
import WeakListMap from './WeakListMap';
import * as schema from './schema';
import Entity, { isEntity } from './entities/Entity';
import SimpleRecord from './entities/SimpleRecord';
export { default as FlatEntity } from './entities/FlatEntity';
export { default as inferResults } from './inferResults';
export { DELETED } from './special';
export type { AbstractInstanceType, Schema, Normalize, NormalizeNullable, NormalizedIndex, NormalizeReturnType, NormalizedSchema, Denormalize, DenormalizeNullable, DenormalizeReturnType, DenormalizeCache, } from './types';
export { denormalize, schema, normalize, SimpleRecord, Entity, isEntity, WeakListMap, };
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import { NormalizedIndex, NormalizeNullable, Schema } from "./types";
import { NormalizedIndex, NormalizeNullable, Schema } from './types';
/**

@@ -3,0 +3,0 @@ * Build the result parameter to denormalize from schema alone.

@@ -1,2 +0,2 @@

import type { NormalizeNullable, NormalizedSchema, Schema, NormalizedIndex } from "./types";
import type { NormalizeNullable, NormalizedSchema, Schema, NormalizedIndex } from './types';
export declare const normalize: <S extends Schema = Schema, E extends Record<string, Record<string, any> | undefined> = Record<string, Record<string, any>>, R = NormalizeNullable<S>>(input: any, schema?: S | undefined, existingEntities?: Readonly<E>, existingIndexes?: Readonly<NormalizedIndex>, existingEntityMeta?: {

@@ -3,0 +3,0 @@ readonly [entityKey: string]: {

@@ -105,7 +105,7 @@ import { normalize as arrayNormalize } from './schemas/Array';

else if ( // eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'production') {
console.warn(`Index not found in entity. Indexes must be top-level members of your entity.
process.env.NODE_ENV !== 'production') {
console.warn(`Index not found in entity. Indexes must be top-level members of your entity.
Index: ${index}
Entity: ${JSON.stringify(entity, undefined, 2)}`);
}
}
}

@@ -185,2 +185,2 @@ } // set this after index updates so we know what indexes to remove from

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ub3JtYWxpemUudHMiXSwibmFtZXMiOlsibm9ybW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ICAgIGVudGl0eU1ldGEsXG4gICAgbWV0YSxcbiAgKTtcbiAgY29uc3QgdmlzaXRlZEVudGl0aWVzID0ge307XG5cbiAgY29uc3QgcmVzdWx0ID0gdmlzaXQoXG4gICAgaW5wdXQsXG4gICAgaW5wdXQsXG4gICAgdW5kZWZpbmVkLFxuICAgIHNjaGVtYSxcbiAgICBhZGRFbnRpdHksXG4gICAgdmlzaXRlZEVudGl0aWVzLFxuICApO1xuICByZXR1cm4geyBlbnRpdGllcywgaW5kZXhlcywgcmVzdWx0LCBlbnRpdHlNZXRhIH07XG59O1xuIl19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ub3JtYWxpemUudHMiXSwibmFtZXMiOlsibm9ybWFsaXplIiwiYXJyYXlOb3JtYWxpemUiLCJvYmplY3ROb3JtYWxpemUiLCJERUxFVEVEIiwidmlzaXQiLCJ2YWx1ZSIsInBhcmVudCIsImtleSIsInNjaGVtYSIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsIm1ldGhvZCIsIkFycmF5IiwiaXNBcnJheSIsImFkZEVudGl0aWVzIiwiZW50aXRpZXMiLCJpbmRleGVzIiwiZXhpc3RpbmdFbnRpdGllcyIsImV4aXN0aW5nSW5kZXhlcyIsImVudGl0eU1ldGEiLCJtZXRhIiwicHJvY2Vzc2VkRW50aXR5IiwiaWQiLCJzY2hlbWFLZXkiLCJleGlzdGluZ0VudGl0eSIsIm1lcmdlIiwiZW50aXR5RXhwaXJlc0F0IiwiZXhwaXJlc0F0IiwiaW5TdG9yZUVudGl0eSIsInByZWZlckV4aXN0aW5nIiwiZGF0ZSIsImVudGl0eSIsImluZGV4IiwiaW5kZXhNYXAiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJjb25zb2xlIiwid2FybiIsIkpTT04iLCJzdHJpbmdpZnkiLCJ1bmRlZmluZWQiLCJleHBlY3RlZFNjaGVtY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RpdGllczogRSA9IHt9IGFzIGFueTtcbiAgY29uc3QgbmV3SW5kZXhlczogTm9ybWFsaXplZEluZGV4ID0ge30gYXMgYW55O1xuICBjb25zdCBlbnRpdGllczogRSA9IHsgLi4uZXhpc3RpbmdFbnRpdGllcyB9IGFzIGFueTtcbiAgY29uc3QgaW5kZXhlczogTm9ybWFsaXplZEluZGV4ID0geyAuLi5leGlzdGluZ0luZGV4ZXMgfTtcbiAgY29uc3QgZW50aXR5TWV0YTogYW55ID0geyAuLi5leGlzdGluZ0VudGl0eU1ldGEgfTtcbiAgY29uc3QgYWRkRW50aXR5ID0gYWRkRW50aXRpZXMoXG4gICAgbmV3RW50aXRpZXMsXG4gICAgbmV3SW5kZXhlcyxcbiAgICBlbnRpdGllcyxcbiAgICBpbmRleGVzLFxuICAgIGVudGl0eU1ldGEsXG4gICAgbWV0YSxcbiAgKTtcbiAgY29uc3QgdmlzaXRlZEVudGl0aWVzID0ge307XG5cbiAgY29uc3QgcmVzdWx0ID0gdmlzaXQoXG4gICAgaW5wdXQsXG4gICAgaW5wdXQsXG4gICAgdW5kZWZpbmVkLFxuICAgIHNjaGVtYSxcbiAgICBhZGRFbnRpdHksXG4gICAgdmlzaXRlZEVudGl0aWVzLFxuICApO1xuICByZXR1cm4geyBlbnRpdGllcywgaW5kZXhlcywgcmVzdWx0LCBlbnRpdHlNZXRhIH07XG59O1xuIl19

@@ -57,3 +57,3 @@ import {

unvisit: UnvisitFunction,
): [denormalized: T, found: boolean, suspend: boolean];
): [T, boolean, boolean];
infer(

@@ -101,3 +101,3 @@ args: any[],

unvisit: UnvisitFunction,
): [denormalized: Denormalize<S>[], found: boolean, suspend: boolean];
): [Denormalize<S>[], boolean, boolean];

@@ -134,3 +134,3 @@ _denormalizeNullable(): [Denormalize<S>[] | undefined, false, boolean];

unvisit: UnvisitFunction,
): [denormalized: DenormalizeObject<O>, found: boolean, suspend: boolean];
): [DenormalizeObject<O>, boolean, boolean];

@@ -173,7 +173,3 @@ _denormalizeNullable(): [DenormalizeNullableObject<O>, false, boolean];

unvisit: UnvisitFunction,
): [
denormalized: AbstractInstanceType<Choices[keyof Choices]>,
found: boolean,
suspend: boolean,
];
): [AbstractInstanceType<Choices[keyof Choices]>, boolean, boolean];

@@ -238,8 +234,8 @@ _denormalizeNullable(): [

): [
denormalized: Record<
Record<
string,
Choices extends EntityMap<infer T> ? T : Denormalize<Choices>
>,
found: boolean,
suspend: boolean,
boolean,
boolean,
];

@@ -246,0 +242,0 @@

@@ -1,9 +0,5 @@

import { SchemaClass, UnvisitFunction, EntityInterface } from "../schema";
import type { AbstractInstanceType } from "../types";
/**
* Marks entity as deleted.
* @see https://resthooks.io/docs/api/Delete
*/
import { SchemaClass, UnvisitFunction, EntityInterface } from '../schema';
import type { AbstractInstanceType } from '..';
export default class Delete<E extends EntityInterface & {
process: any;
fromJS: any;
}> implements SchemaClass {

@@ -15,3 +11,3 @@ private _entity;

infer(args: any, indexes: any, recurse: any): any;
denormalize(id: string, unvisit: UnvisitFunction): [denormalized: AbstractInstanceType<E>, found: boolean, suspend: boolean];
denormalize(id: string, unvisit: UnvisitFunction): [AbstractInstanceType<E>, boolean, boolean];
_denormalizeNullable(): [

@@ -18,0 +14,0 @@ AbstractInstanceType<E> | undefined,

@@ -14,3 +14,4 @@ /**

export function isImmutable(object) {
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
return !!(object && typeof object.hasOwnProperty === 'function' && (Object.hasOwnProperty.call(object, '__ownerID') || // Immutable.Map
object._map && Object.hasOwnProperty.call(object._map, '__ownerID'))); // Immutable.Record
}

@@ -51,2 +52,2 @@ /**

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL0ltbXV0YWJsZVV0aWxzLmpzIl0sIm5hbWVzIjpbImlzSW1td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uXG4gICAgICBjb25zdCBbaXRlbSwgZm91bmRJdGVtLCBkZWxldGVkSXRlbV0gPSB1bnZpc2l0KFxuICAgICAgICBvYmplY3QuZ2V0KHN0cmluZ0tleSksXG4gICAgICAgIHNjaGVtYVtzdHJpbmdLZXldLFxuICAgICAgKTtcbiAgICAgIGlmICghZm91bmRJdGVtKSB7XG4gICAgICAgIGZvdW5kID0gZmFsc2U7XG4gICAgICB9XG4gICAgICBpZiAoZGVsZXRlZEl0ZW0pIHtcbiAgICAgICAgZGVsZXRlZCA9IHRydWU7XG4gICAgICB9XG4gICAgICBpZiAob2JqZWN0LmhhcyhzdHJpbmdLZXkpKSB7XG4gICAgICAgIHJldHVybiBvYmplY3Quc2V0KHN0cmluZ0tleSwgaXRlbSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICByZXR1cm4gb2JqZWN0O1xuICAgICAgfVxuICAgIH0sIGlucHV0KSxcbiAgICBmb3VuZCxcbiAgICBkZWxldGVkLFxuICBdO1xufVxuIl19

@@ -62,2 +62,8 @@ import { isImmutable } from './ImmutableUtils';

if (!this.isSingleSchema && !schemaKey) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
console.warn(`TypeError: Unable to infer schema for ${this.constructor.name}
Value: ${JSON.stringify(value, undefined, 2)}.`);
}
return [value, true, false];

@@ -72,2 +78,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL1BvbHltb3JwaGljLmpzIl0sIm5hbWVzIjpbImlzSW1tdXRhYmxlIiwiUG9seW1vcnBoaWNTY2hlbWEiLCJjb25zdHJ1Y3RvciIsImRlZmluaXRpb24iLCJzY2hlbWFBdHRyaWJ1dGUiLCJfc2NoZW1hQXR0cmlidXRlIiwiaW5wdXQiLCJkZWZpbmUiLCJpc1NpbmdsZVNjaGVtYSIsInNjaGVtYSIsImdldFNjaGVtYUF0dHJpYnV0Z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Wdub3JlIGVsc2UgKi9cbiAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gJ3Byb2R1Y3Rpb24nKSB7XG4gICAgICAgIGNvbnNvbGUud2FybihcbiAgICAgICAgICBgVHlwZUVycm9yOiBVbmFibGUgdG8gaW5mZXIgc2NoZW1hIGZvciAke3RoaXMuY29uc3RydWN0b3IubmFtZX1cblZhbHVlOiAke0pTT04uc3RyaW5naWZ5KHZhbHVlLCB1bmRlZmluZWQsIDIpfS5gLFxuICAgICAgICApO1xuICAgICAgfVxuICAgICAgcmV0dXJuIFt2YWx1ZSwgdHJ1ZSwgZmFsc2VdO1xuICAgIH1cbiAgICBjb25zdCBpZCA9IHRoaXMuaXNTaW5nbGVTY2hlbWFcbiAgICAgID8gdW5kZWZpbmVkXG4gICAgICA6IGlzSW1tdXRhYmxlKHZhbHVlKVxuICAgICAgPyB2YWx1ZS5nZXQoJ2lkJylcbiAgICAgIDogdmFsdWUuaWQ7XG4gICAgY29uc3Qgc2NoZW1hID0gdGhpcy5pc1NpbmdsZVNjaGVtYSA/IHRoaXMuc2NoZW1hIDogdGhpcy5zY2hlbWFbc2NoZW1hS2V5XTtcbiAgICByZXR1cm4gdW52aXNpdChpZCB8fCB2YWx1ZSwgc2NoZW1hKTtcbiAgfVxufVxuIl19

@@ -20,2 +20,3 @@ import PolymorphicSchema from './Polymorphic';

infer(args, indexes, recurse) {
if (!args[0]) return undefined;
const attr = this.getSchemaAttribute(args[0], undefined, '');

@@ -32,2 +33,2 @@ const discriminatedSchema = this.schema[attr]; // Was unable to infer the entity's schema from params

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL1VuaW9uLmpzIl0sIm5hbWVzIjpbIlBvbHltb3JwaGljU2NoZW1hIiwiVW5pb25TY2hlbWEiLCJjb25zdHJ1Y3RvciIsImRlZmluaXRpb24iLCJzY2hlbWFBdHR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nQsIGtleSwgdmlzaXQsIGFkZEVudGl0eSwgdmlzaXRlZEVudGl0aWVzKSB7XG4gICAgcmV0dXJuIHRoaXMubm9ybWFsaXplVmFsdWUoXG4gICAgICBpbnB1dCxcbiAgICAgIHBhcmVudCxcbiAgICAgIGtleSxcbiAgICAgIHZpc2l0LFxuICAgICAgYWRkRW50aXR5LFxuICAgICAgdmlzaXRlZEVudGl0aWVzLFxuICAgICk7XG4gIH1cblxuICBkZW5vcm1hbGl6ZShpbnB1dCwgdW52aXNpdCkge1xuICAgIHJldHVybiB0aGlzLmRlbm9ybWFsaXplVmFsdWUoaW5wdXQsIHVudmlzaXQpO1xuICB9XG5cbiAgaW5mZXIoYXJncywgaW5kZXhlcywgcmVjdXJzZSkge1xuICAgIGNvbnN0IGF0dHIgPSB0aGlzLmdldFNjaGVtYUF0dHJpYnV0ZShhcmdzWzBdLCB1bmRlZmluZWQsICcnKTtcbiAgICBjb25zdCBkaXNjcmltaW5hdGVkU2NoZW1hID0gdGhpcy5zY2hlbWFbYXR0cl07XG5cbiAgICAvLyBXYXMgdW5hYmxlIHRvIGluZmVyIHRoZSBlbnRpdHkncyBzY2hlbWEgZnJvbSBwYXJhbXNcbiAgICBpZiAoZGlzY3JpbWluYXRlZFNjaGVtYSA9PT0gdW5kZWZpbmVkKSByZXR1cm4gdW5kZWZpbmVkO1xuICAgIHJldHVybiB7XG4gICAgICBpZDogcmVjdXJzZShkaXNjcmltaW5hdGVkU2NoZW1hLCBhcmdzLCBpbmRleGVzKSxcbiAgICAgIHNjaGVtYTogYXR0cixcbiAgICB9O1xuICB9XG59XG4iXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL1VuaW9uLmpzIl0sIm5hbWVzIjpbIlBvbHltb3JwaGljU2NoZW1hIiwiVW5pb25TY2hlbWEiLCJjb25zdHJ1Y3RvciIsImRlZmluaXRpb24iLCJzY2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VmaW5pdGlvbiwgc2NoZW1hQXR0cmlidXRlKTtcbiAgfVxuXG4gIG5vcm1hbGl6ZShpbnB1dCwgcGFyZW50LCBrZXksIHZpc2l0LCBhZGRFbnRpdHksIHZpc2l0ZWRFbnRpdGllcykge1xuICAgIHJldHVybiB0aGlzLm5vcm1hbGl6ZVZhbHVlKFxuICAgICAgaW5wdXQsXG4gICAgICBwYXJlbnQsXG4gICAgICBrZXksXG4gICAgICB2aXNpdCxcbiAgICAgIGFkZEVudGl0eSxcbiAgICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgICApO1xuICB9XG5cbiAgZGVub3JtYWxpemUoaW5wdXQsIHVudmlzaXQpIHtcbiAgICByZXR1cm4gdGhpcy5kZW5vcm1hbGl6ZVZhbHVlKGlucHV0LCB1bnZpc2l0KTtcbiAgfVxuXG4gIGluZmVyKGFyZ3MsIGluZGV4ZXMsIHJlY3Vyc2UpIHtcbiAgICBpZiAoIWFyZ3NbMF0pIHJldHVybiB1bmRlZmluZWQ7XG4gICAgY29uc3QgYXR0ciA9IHRoaXMuZ2V0U2NoZW1hQXR0cmlidXRlKGFyZ3NbMF0sIHVuZGVmaW5lZCwgJycpO1xuICAgIGNvbnN0IGRpc2NyaW1pbmF0ZWRTY2hlbWEgPSB0aGlzLnNjaGVtYVthdHRyXTtcblxuICAgIC8vIFdhcyB1bmFibGUgdG8gaW5mZXIgdGhlIGVudGl0eSdzIHNjaGVtYSBmcm9tIHBhcmFtc1xuICAgIGlmIChkaXNjcmltaW5hdGVkU2NoZW1hID09PSB1bmRlZmluZWQpIHJldHVybiB1bmRlZmluZWQ7XG4gICAgcmV0dXJuIHtcbiAgICAgIGlkOiByZWN1cnNlKGRpc2NyaW1pbmF0ZWRTY2hlbWEsIGFyZ3MsIGluZGV4ZXMpLFxuICAgICAgc2NoZW1hOiBhdHRyLFxuICAgIH07XG4gIH1cbn1cbiJdfQ==

@@ -1,3 +0,3 @@

import type { default as schema, EntityInterface } from "./schema";
import WeakListMap from "./WeakListMap";
import type { default as schema, EntityInterface } from './schema';
import WeakListMap from './WeakListMap';
export declare type AbstractInstanceType<T> = T extends {

@@ -4,0 +4,0 @@ prototype: infer U;

{
"name": "@rest-hooks/normalizr",
"version": "7.5.1",
"version": "7.5.2",
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications",

@@ -89,3 +89,3 @@ "homepage": "https://github.com/coinbase/rest-hooks/tree/master/packages/normalizr#readme",

},
"gitHead": "0a735a3a198039145cfd5244319c0e228610100b"
"gitHead": "2e6c2e438ffb6bbe6cb2ef15fc2d1db5e6568fd0"
}

@@ -1,3 +0,3 @@

import { Denormalize, DenormalizeNullable, Schema, DenormalizeCache } from "./types";
import WeakListMap from "./WeakListMap";
import { Denormalize, DenormalizeNullable, Schema, DenormalizeCache } from './types';
import WeakListMap from './WeakListMap';
declare type DenormalizeReturn<S extends Schema> = [

@@ -4,0 +4,0 @@ /*denormalized*/ Denormalize<S>,

@@ -1,9 +0,8 @@

import * as schema from "../schema";
import { AbstractInstanceType, Schema, NormalizedIndex } from "../types";
/**
* Represents data that should be deduped by specifying a primary key.
* @see https://resthooks.io/docs/api/Entity
*/
export default abstract class Entity {
import SimpleRecord from './SimpleRecord';
import * as schema from '../schema';
import { AbstractInstanceType, Schema } from '../types';
/** Represents data that should be deduped by specifying a primary key. */
export default abstract class Entity extends SimpleRecord {
static toJSON(): {
key: string;
name: string;

@@ -13,8 +12,3 @@ schema: {

};
key: string;
};
/** Defines nested entities */
static schema: {
[k: string]: Schema;
};
/**

@@ -48,16 +42,4 @@ * A unique identifier for each Entity

static pk<T extends typeof Entity>(this: T, value: Partial<AbstractInstanceType<T>>, parent?: any, key?: string): string | undefined;
/** Creates new instance copying over defined values of arguments */
static merge<T extends typeof Entity>(this: T, existing: Partial<AbstractInstanceType<T>>, incoming: Partial<AbstractInstanceType<T>>): Partial<AbstractInstanceType<T>>;
/** Factory method to convert from Plain JS Objects.
*
* @param [props] Plain Object of properties to assign.
* @param [parent] When normalizing, the object which included the record
* @param [key] When normalizing, the key where this record was found
*/
static fromJS<T extends typeof Entity>(this: T, props?: Partial<AbstractInstanceType<T>>): AbstractInstanceType<T>;
/** Do any transformations when first receiving input */
static process(input: any, parent: any, key: string | undefined): any;
static normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any;
protected static validate(processedEntity: any): string | undefined;
static infer(args: any[], indexes: NormalizedIndex, recurse: any): any;
protected static validate(processedEntity: Entity, input: any): void;
static expiresAt(meta: {

@@ -67,14 +49,10 @@ expiresAt: number;

}, input: any): number;
static denormalize<T extends typeof Entity>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [
/*denormalized*/ AbstractInstanceType<T>,
/*found*/ boolean,
/*suspend*/ boolean
static infer(args: any, indexes: any, infer: any): any;
static denormalize<T extends typeof SimpleRecord>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [
AbstractInstanceType<T>,
boolean,
boolean
];
private static __defaults;
/*All instance defaults set */
protected static readonly defaults: any;
/** Used by denormalize to set nested members */
protected static set(entity: any, key: string, value: any): void;
}
export declare function isEntity(schema: Schema): schema is typeof Entity;
//# sourceMappingURL=Entity.d.ts.map

@@ -1,2 +0,2 @@

import Entity from "./Entity";
import Entity from './Entity';
/** Represents data with primary key being from 'id' field. */

@@ -3,0 +3,0 @@ export default class IDEntity extends Entity {

@@ -1,10 +0,12 @@

import { denormalize } from "./denormalize";
import { normalize } from "./normalize";
import WeakListMap from "./WeakListMap";
import * as schema from "./schema";
import Entity, { isEntity } from "./entities/Entity";
export { default as inferResults } from "./inferResults";
export { DELETED } from "./special";
export { AbstractInstanceType, Schema, Normalize, NormalizeNullable, NormalizedIndex, NormalizeReturnType, NormalizedSchema, Denormalize, DenormalizeNullable, DenormalizeReturnType, DenormalizeCache, } from "./types";
export { denormalize, schema, normalize, Entity, isEntity, WeakListMap };
import { denormalize } from './denormalize';
import { normalize } from './normalize';
import WeakListMap from './WeakListMap';
import * as schema from './schema';
import Entity, { isEntity } from './entities/Entity';
import SimpleRecord from './entities/SimpleRecord';
export { default as FlatEntity } from './entities/FlatEntity';
export { default as inferResults } from './inferResults';
export { DELETED } from './special';
export { AbstractInstanceType, Schema, Normalize, NormalizeNullable, NormalizedIndex, NormalizeReturnType, NormalizedSchema, Denormalize, DenormalizeNullable, DenormalizeReturnType, DenormalizeCache, } from './types';
export { denormalize, schema, normalize, SimpleRecord, Entity, isEntity, WeakListMap, };
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import { NormalizedIndex, NormalizeNullable, Schema } from "./types";
import { NormalizedIndex, NormalizeNullable, Schema } from './types';
/**

@@ -3,0 +3,0 @@ * Build the result parameter to denormalize from schema alone.

@@ -1,2 +0,2 @@

import { NormalizeNullable, NormalizedSchema, Schema, NormalizedIndex } from "./types";
import { NormalizeNullable, NormalizedSchema, Schema, NormalizedIndex } from './types';
export declare const normalize: <S extends Schema = Schema, E extends Record<string, Record<string, any> | undefined> = Record<string, Record<string, any>>, R = NormalizeNullable<S>>(input: any, schema?: S | undefined, existingEntities?: Readonly<E>, existingIndexes?: Readonly<NormalizedIndex>, existingEntityMeta?: {

@@ -3,0 +3,0 @@ readonly [entityKey: string]: {

@@ -25,5 +25,5 @@ import { Schema, AbstractInstanceType, Normalize, NormalizeNullable, Denormalize, DenormalizeNullable, DenormalizeObject, DenormalizeNullableObject, NormalizeObject, NormalizedNullableObject, UnvisitFunction, EntityMap, NormalizedIndex, } from './types';

input: {} | undefined, unvisit: UnvisitFunction): [
/*denormalized*/ T,
/*found*/ boolean,
/*suspend*/ boolean
T,
boolean,
boolean
];

@@ -58,5 +58,5 @@ infer(args: any[], indexes: NormalizedIndex, recurse: (...args: any) => any): any;

input: {} | undefined, unvisit: UnvisitFunction): [
/*denormalized*/ Denormalize<S>[],
/*found*/ boolean,
/*suspend*/ boolean
Denormalize<S>[],
boolean,
boolean
];

@@ -79,5 +79,5 @@ _denormalizeNullable(): [

input: {} | undefined, unvisit: UnvisitFunction): [
/*denormalized*/ DenormalizeObject<O>,
/*found*/ boolean,
/*suspend*/ boolean
DenormalizeObject<O>,
boolean,
boolean
];

@@ -102,5 +102,5 @@ _denormalizeNullable(): [

input: {} | undefined, unvisit: UnvisitFunction): [
/*denormalized*/ AbstractInstanceType<Choices[keyof Choices]>,
/*found*/ boolean,
/*suspend*/ boolean
AbstractInstanceType<Choices[keyof Choices]>,
boolean,
boolean
];

@@ -126,5 +126,5 @@ _denormalizeNullable(): [

input: {} | undefined, unvisit: UnvisitFunction): [
/*denormalized*/ Record<string, Choices extends EntityMap<infer T> ? T : Denormalize<Choices>>,
/*found*/ boolean,
/*suspend*/ boolean
Record<string, Choices extends EntityMap<infer T> ? T : Denormalize<Choices>>,
boolean,
boolean
];

@@ -131,0 +131,0 @@ _denormalizeNullable(): [

@@ -1,9 +0,5 @@

import { SchemaClass, UnvisitFunction, EntityInterface } from "../schema";
import { AbstractInstanceType } from "../types";
/**
* Marks entity as deleted.
* @see https://resthooks.io/docs/api/Delete
*/
import { SchemaClass, UnvisitFunction, EntityInterface } from '../schema';
import { AbstractInstanceType } from '..';
export default class Delete<E extends EntityInterface & {
process: any;
fromJS: any;
}> implements SchemaClass {

@@ -16,5 +12,5 @@ private _entity;

denormalize(id: string, unvisit: UnvisitFunction): [
/*denormalized*/ AbstractInstanceType<E>,
/*found*/ boolean,
/*suspend*/ boolean
AbstractInstanceType<E>,
boolean,
boolean
];

@@ -21,0 +17,0 @@ _denormalizeNullable(): [

@@ -1,3 +0,3 @@

import { default as schema, EntityInterface } from "./schema";
import WeakListMap from "./WeakListMap";
import { default as schema, EntityInterface } from './schema';
import WeakListMap from './WeakListMap';
export declare type AbstractInstanceType<T> = T extends {

@@ -4,0 +4,0 @@ prototype: infer U;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc