Huge News!Announcing our $40M Series B led by Abstract Ventures.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 6.1.1 to 7.0.0

15

CHANGELOG.md

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

## [7.0.0](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.1.1...@rest-hooks/normalizr@7.0.0) (2021-05-24)
### ⚠ 💥 BREAKING CHANGES
* normalize arg addEntity is now addEntity(schema,
processed, id)
### 💅 Enhancement
* Remove dependency on fromJS() from denormalize ([#805](https://github.com/coinbase/rest-hooks/issues/805)) ([4387aeb](https://github.com/coinbase/rest-hooks/commit/4387aeb8f050b54a2059bc21f1060a49f539e4f6))
* Simplify normalize addEntity function ([#820](https://github.com/coinbase/rest-hooks/issues/820)) ([18a805d](https://github.com/coinbase/rest-hooks/commit/18a805d3b6990beadf5426ce28448fd9ee47ad9a))
### [6.1.1](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.1.0...@rest-hooks/normalizr@6.1.1) (2021-04-25)

@@ -8,0 +23,0 @@

77

dist/normalizr.amd.js

@@ -360,24 +360,20 @@ define(['exports'], function (exports) { 'use strict';

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
return {
done: false,
value: o[i++]
};
};
}
it = o[Symbol.iterator]();
return it.next.bind(it);
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -691,3 +687,3 @@

});
addEntity(this, processedEntity, processedEntity, parent, key);
addEntity(this, processedEntity, id);
return id;

@@ -697,13 +693,19 @@ };

Entity.denormalize = function denormalize(input, unvisit) {
var _this2 = this;
var _unvisit$setLocal,
_this2 = this;
// TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// TODO: remove immutable case once we stop storing instances in normalized cache
var entityCopy = isImmutable(input) ? input : this.fromJS(input instanceof SimpleRecord ? this.toObjectDefined(input) : input); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
(_unvisit$setLocal = unvisit.setLocal) === null || _unvisit$setLocal === void 0 ? void 0 : _unvisit$setLocal.call(unvisit, entityCopy); // TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// itself in cache. Once we offer full memoization, we will store raw objects and this can be consolidated with SimpleRecord
if (isImmutable(input)) {
var _denormalizeImmutable = denormalizeImmutable(this.schema, input, unvisit),
_denormEntity = _denormalizeImmutable[0],
denormEntity = _denormalizeImmutable[0],
found = _denormalizeImmutable[1],
_deleted = _denormalizeImmutable[2];
return [this.fromJS(_denormEntity.toObject()), found, _deleted];
return [this.fromJS(denormEntity.toObject()), found, _deleted];
} // TODO: This creates unneeded memory pressure

@@ -713,8 +715,7 @@

var instance = new this();
var deleted = false;
var denormEntity = input; // note: iteration order must be stable
var deleted = false; // note: iteration order must be stable
Object.keys(this.schema).forEach(function (key) {
var schema = _this2.schema[key];
var nextInput = _this2.hasDefined(input, key) ? input[key] : undefined;
var nextInput = Object.hasOwnProperty.call(input, key) ? input[key] : undefined;

@@ -725,11 +726,11 @@ var _unvisit = unvisit(nextInput, schema),

if (deletedItem && !(key in instance && !instance[key])) {
if (deletedItem && !(Object.hasOwnProperty.call(input, key) && !instance[key])) {
deleted = true;
}
if (_this2.hasDefined(input, key) && denormEntity[key] !== value) {
denormEntity[key] = value;
if (Object.hasOwnProperty.call(input, key) && input[key] !== value) {
entityCopy[key] = value;
}
});
return [denormEntity, true, deleted];
return [entityCopy, true, deleted];
};

@@ -955,12 +956,13 @@

var wrappedUnvisit = withTrackedEntities(unvisit, globalKey);
wrappedUnvisit.setLocal = function (entityCopy) {
return localCache[schema.key][id] = entityCopy;
};
if (!entityCache[schema.key]) entityCache[schema.key] = {};
if (!entityCache[schema.key][id]) entityCache[schema.key][id] = new WeakListMap();
var globalCacheEntry = entityCache[schema.key][id];
var entityCopy = isImmutable(entity) ? entity : schema.fromJS(entity); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
localCache[schema.key][id] = entityCopy;
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
var _schema$denormalize = schema.denormalize(entityCopy, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];

@@ -1122,5 +1124,4 @@ found = _schema$denormalize[1];

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes) {
return function (schema, processedEntity, value, parent, key) {
return function (schema, processedEntity, id) {
var schemaKey = schema.key;
var id = schema.pk(value, parent, key);

@@ -1337,3 +1338,3 @@ if (!(schemaKey in entities)) {

addEntity(this._entity, DELETED, processedEntity, parent, key);
addEntity(this._entity, DELETED, id);
return id;

@@ -1340,0 +1341,0 @@ };

@@ -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]},p=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]},t}(a),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},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]},y=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 m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(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.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},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,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{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[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},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.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",N="substantially different than expected keys";j&&(z+="\n Missing: "+d,N="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,N="a large number of unexpected keys found");var _="Attempted to initialize "+this.name+" with "+N+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(_);throw A.status=400,A}console.warn(_)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,a,t,n),D)}if("production"!==process.env.NODE_ENV){var V=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 V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),s=o[0],a=o[1],u=o[2];return[this.fromJS(s.toObject()),a,u]}var c=new this,f=!1,l=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,s=r(o,n),a=s[0];!s[2]||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&l[t]!==a&&(l[t]=a)})),[l,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){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=z()?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 _(e){var t="function"==typeof Map?new Map:void 0;return(_=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,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=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 i(t,e),t}(_(Error)),x=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 A,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}(),V=function(e,n,r,i){var o=J(e);function s(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,s){var a=i(e,n);if(a===S)return[void 0,!0,!0];if("object"!=typeof a||null===a)return[a,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[a],l=M(r,f);s[n.key]||(s[n.key]={}),s[n.key][e]||(s[n.key][e]=new x);var h=s[n.key][e],p=t(a)?a:n.fromJS(a);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var a=[],u=M(s,a);return function(e,t){a.push(e);var n=s(e,t);return Object(e)!==e?n:r.has(a)?[r.get(a),n[1],n[2]]:(r.set(a,n[0]),n)}},J=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]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=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)},t}(a),I=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]},t}(a),L=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),a=s.pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===a||""===a)){var u,c=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!=(u=this._entity.name)?u:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw c.status=400,c}return i(this._entity,S,s,t,n),a},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},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o,s,a){var u=r.key,c=r.pk(o,s,a);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:P(e,e,void 0,t,a,{})}},e.schema=U,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]):[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]},p=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]},t}(a),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},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]},y=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 m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(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 v(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)?v(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 b=Symbol("Defined Members"),O=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[O]},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,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{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[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},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.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();w.schema={};var k=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(k);throw E.status=400,E}console.warn(k)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",N="substantially different than expected keys";j&&(z+="\n Missing: "+d,N="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,N="a large number of unexpected keys found");var _="Attempted to initialize "+this.name+" with "+N+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(_);throw A.status=400,A}console.warn(_)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,D),D)}if("production"!==process.env.NODE_ENV){var V=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 V.status=400,V}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof w?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(w);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){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=z()?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 _(e){var t="function"==typeof Map?new Map:void 0;return(_=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,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=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 i(t,e),t}(_(Error)),x=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 A,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}(),V=function(e,t,n,r){var i=J(e);function o(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]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new x);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=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]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=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)},t}(a),I=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]},t}(a),L=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._entity,S,s),s},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},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);e.DELETED=S,e.Entity=k,e.FlatEntity=F,e.SimpleRecord=w,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -361,24 +361,20 @@ var rest_hooks_normalizr = (function (exports) {

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
return {
done: false,
value: o[i++]
};
};
}
it = o[Symbol.iterator]();
return it.next.bind(it);
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -692,3 +688,3 @@

});
addEntity(this, processedEntity, processedEntity, parent, key);
addEntity(this, processedEntity, id);
return id;

@@ -698,13 +694,19 @@ };

Entity.denormalize = function denormalize(input, unvisit) {
var _this2 = this;
var _unvisit$setLocal,
_this2 = this;
// TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// TODO: remove immutable case once we stop storing instances in normalized cache
var entityCopy = isImmutable(input) ? input : this.fromJS(input instanceof SimpleRecord ? this.toObjectDefined(input) : input); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
(_unvisit$setLocal = unvisit.setLocal) === null || _unvisit$setLocal === void 0 ? void 0 : _unvisit$setLocal.call(unvisit, entityCopy); // TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// itself in cache. Once we offer full memoization, we will store raw objects and this can be consolidated with SimpleRecord
if (isImmutable(input)) {
var _denormalizeImmutable = denormalizeImmutable(this.schema, input, unvisit),
_denormEntity = _denormalizeImmutable[0],
denormEntity = _denormalizeImmutable[0],
found = _denormalizeImmutable[1],
_deleted = _denormalizeImmutable[2];
return [this.fromJS(_denormEntity.toObject()), found, _deleted];
return [this.fromJS(denormEntity.toObject()), found, _deleted];
} // TODO: This creates unneeded memory pressure

@@ -714,8 +716,7 @@

var instance = new this();
var deleted = false;
var denormEntity = input; // note: iteration order must be stable
var deleted = false; // note: iteration order must be stable
Object.keys(this.schema).forEach(function (key) {
var schema = _this2.schema[key];
var nextInput = _this2.hasDefined(input, key) ? input[key] : undefined;
var nextInput = Object.hasOwnProperty.call(input, key) ? input[key] : undefined;

@@ -726,11 +727,11 @@ var _unvisit = unvisit(nextInput, schema),

if (deletedItem && !(key in instance && !instance[key])) {
if (deletedItem && !(Object.hasOwnProperty.call(input, key) && !instance[key])) {
deleted = true;
}
if (_this2.hasDefined(input, key) && denormEntity[key] !== value) {
denormEntity[key] = value;
if (Object.hasOwnProperty.call(input, key) && input[key] !== value) {
entityCopy[key] = value;
}
});
return [denormEntity, true, deleted];
return [entityCopy, true, deleted];
};

@@ -956,12 +957,13 @@

var wrappedUnvisit = withTrackedEntities(unvisit, globalKey);
wrappedUnvisit.setLocal = function (entityCopy) {
return localCache[schema.key][id] = entityCopy;
};
if (!entityCache[schema.key]) entityCache[schema.key] = {};
if (!entityCache[schema.key][id]) entityCache[schema.key][id] = new WeakListMap();
var globalCacheEntry = entityCache[schema.key][id];
var entityCopy = isImmutable(entity) ? entity : schema.fromJS(entity); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
localCache[schema.key][id] = entityCopy;
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
var _schema$denormalize = schema.denormalize(entityCopy, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];

@@ -1123,5 +1125,4 @@ found = _schema$denormalize[1];

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes) {
return function (schema, processedEntity, value, parent, key) {
return function (schema, processedEntity, id) {
var schemaKey = schema.key;
var id = schema.pk(value, parent, key);

@@ -1338,3 +1339,3 @@ if (!(schemaKey in entities)) {

addEntity(this._entity, DELETED, processedEntity, parent, key);
addEntity(this._entity, DELETED, id);
return id;

@@ -1341,0 +1342,0 @@ };

@@ -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]},p=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]},t}(a),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},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]},y=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 m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(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.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},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,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{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[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},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.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var V=this.key;return V in o||(o[V]={}),D in o[V]||(o[V][D]=[]),o[V][D].some((function(t){return t===e}))?D:(o[V][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,a,t,n),D)}if("production"!==process.env.NODE_ENV){var x=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 x.status=400,x}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),s=o[0],a=o[1],u=o[2];return[this.fromJS(s.toObject()),a,u]}var c=new this,f=!1,l=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,s=r(o,n),a=s[0];!s[2]||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&l[t]!==a&&(l[t]=a)})),[l,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){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 _(e,t,n){return(_=z()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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 _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=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 i(t,e),t}(N(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 A,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}(),x=function(e,n,r,i){var o=J(e);function s(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,s){var a=i(e,n);if(a===S)return[void 0,!0,!0];if("object"!=typeof a||null===a)return[a,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[a],l=M(r,f);s[n.key]||(s[n.key]={}),s[n.key][e]||(s[n.key][e]=new V);var h=s[n.key][e],p=t(a)?a:n.fromJS(a);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var a=[],u=M(s,a);return function(e,t){a.push(e);var n=s(e,t);return Object(e)!==e?n:r.has(a)?[r.get(a),n[1],n[2]]:(r.set(a,n[0]),n)}},J=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]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=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)},t}(a),I=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]},t}(a),L=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),a=s.pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===a||""===a)){var u,c=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!=(u=this._entity.name)?u:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw c.status=400,c}return i(this._entity,S,s,t,n),a},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},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=V,e.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=x(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o,s,a){var u=r.key,c=r.pk(o,s,a);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:P(e,e,void 0,t,a,{})}},e.schema=U,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]):[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]},p=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]},t}(a),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},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]},y=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 m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(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 v(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)?v(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 b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},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,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{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[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},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.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var V=this.key;return V in o||(o[V]={}),D in o[V]||(o[V][D]=[]),o[V][D].some((function(t){return t===e}))?D:(o[V][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,D),D)}if("production"!==process.env.NODE_ENV){var x=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 x.status=400,x}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof k?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){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 _(e,t,n){return(_=z()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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 _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=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 i(t,e),t}(N(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 A,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}(),x=function(e,t,n,r){var i=J(e);function o(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]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new V);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=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]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=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)},t}(a),I=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]},t}(a),L=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._entity,S,s),s},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},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=V,e.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=x(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -362,24 +362,20 @@ 'use strict';

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
return {
done: false,
value: o[i++]
};
};
}
it = o[Symbol.iterator]();
return it.next.bind(it);
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -693,3 +689,3 @@

});
addEntity(this, processedEntity, processedEntity, parent, key);
addEntity(this, processedEntity, id);
return id;

@@ -699,13 +695,19 @@ };

Entity.denormalize = function denormalize(input, unvisit) {
var _this2 = this;
var _unvisit$setLocal,
_this2 = this;
// TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// TODO: remove immutable case once we stop storing instances in normalized cache
var entityCopy = isImmutable(input) ? input : this.fromJS(input instanceof SimpleRecord ? this.toObjectDefined(input) : input); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
(_unvisit$setLocal = unvisit.setLocal) === null || _unvisit$setLocal === void 0 ? void 0 : _unvisit$setLocal.call(unvisit, entityCopy); // TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// itself in cache. Once we offer full memoization, we will store raw objects and this can be consolidated with SimpleRecord
if (isImmutable(input)) {
var _denormalizeImmutable = denormalizeImmutable(this.schema, input, unvisit),
_denormEntity = _denormalizeImmutable[0],
denormEntity = _denormalizeImmutable[0],
found = _denormalizeImmutable[1],
_deleted = _denormalizeImmutable[2];
return [this.fromJS(_denormEntity.toObject()), found, _deleted];
return [this.fromJS(denormEntity.toObject()), found, _deleted];
} // TODO: This creates unneeded memory pressure

@@ -715,8 +717,7 @@

var instance = new this();
var deleted = false;
var denormEntity = input; // note: iteration order must be stable
var deleted = false; // note: iteration order must be stable
Object.keys(this.schema).forEach(function (key) {
var schema = _this2.schema[key];
var nextInput = _this2.hasDefined(input, key) ? input[key] : undefined;
var nextInput = Object.hasOwnProperty.call(input, key) ? input[key] : undefined;

@@ -727,11 +728,11 @@ var _unvisit = unvisit(nextInput, schema),

if (deletedItem && !(key in instance && !instance[key])) {
if (deletedItem && !(Object.hasOwnProperty.call(input, key) && !instance[key])) {
deleted = true;
}
if (_this2.hasDefined(input, key) && denormEntity[key] !== value) {
denormEntity[key] = value;
if (Object.hasOwnProperty.call(input, key) && input[key] !== value) {
entityCopy[key] = value;
}
});
return [denormEntity, true, deleted];
return [entityCopy, true, deleted];
};

@@ -957,12 +958,13 @@

var wrappedUnvisit = withTrackedEntities(unvisit, globalKey);
wrappedUnvisit.setLocal = function (entityCopy) {
return localCache[schema.key][id] = entityCopy;
};
if (!entityCache[schema.key]) entityCache[schema.key] = {};
if (!entityCache[schema.key][id]) entityCache[schema.key][id] = new WeakListMap();
var globalCacheEntry = entityCache[schema.key][id];
var entityCopy = isImmutable(entity) ? entity : schema.fromJS(entity); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
localCache[schema.key][id] = entityCopy;
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
var _schema$denormalize = schema.denormalize(entityCopy, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];

@@ -1124,5 +1126,4 @@ found = _schema$denormalize[1];

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes) {
return function (schema, processedEntity, value, parent, key) {
return function (schema, processedEntity, id) {
var schemaKey = schema.key;
var id = schema.pk(value, parent, key);

@@ -1339,3 +1340,3 @@ if (!(schemaKey in entities)) {

addEntity(this._entity, DELETED, processedEntity, parent, key);
addEntity(this._entity, DELETED, id);
return id;

@@ -1342,0 +1343,0 @@ };

@@ -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]},h=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]},t}(s),p=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},d=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]},m=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 p.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 d.apply(void 0,[this.schema].concat(t))},e}();function y(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 v(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(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)?y(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.")}return(n=e[Symbol.iterator]()).next.bind(n)}var g=Symbol("Defined Members"),b=Symbol("unq"),O=function(){function e(){}return e.prototype.toString=function(){return this[b]},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,g,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,b,{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[g].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=v(e[g]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[g]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();O.schema={};var k=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(u=y()).done;){var g=u.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",N="substantially different than expected keys";j&&(z+="\n Missing: "+d,N="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,N="a large number of unexpected keys found");var _="Attempted to initialize "+this.name+" with "+N+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var x=new Error(_);throw x.status=400,x}console.warn(_)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var D=this.key;return D in o||(o[D]={}),A in o[D]||(o[D][A]=[]),o[D][A].some((function(t){return t===e}))?A:(o[D][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,a,t,n),A)}if("production"!==process.env.NODE_ENV){var V=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 V.status=400,V}},i.denormalize=function(n,r){var i=this;if(e(n)){var o=t(this.schema,n,r),s=o[0],a=o[1],u=o[2];return[this.fromJS(s.toObject()),a,u]}var c=new this,f=!1,l=n;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],o=i.hasDefined(n,e)?n[e]:void 0,s=r(o,t),a=s[0];!s[2]||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&l[e]!==a&&(l[e]=a)})),[l,!0,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(O);function w(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(){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=j()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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,S(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var _=function(){this.children=new WeakMap},x=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}(N(Error)),A=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 x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new _,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}(),D=function(t,n,r,i){var o=V(t);function s(t,r){if(!r)return[t,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return t instanceof r?[t,!0,!1]:[new r(t),!0,!1];if("object"==typeof r)return(Array.isArray(r)?l:d)(r,t,u)}return null===t?[t,!0,!1]:w(r)?void 0===t?[t,!1,!1]:function(t,n,r,i,o,s){var a=i(t,n);if(a===E)return[void 0,!0,!0];if("object"!=typeof a||null===a)return[a,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][t]){var f=[a],l=J(r,f);s[n.key]||(s[n.key]={}),s[n.key][t]||(s[n.key][t]=new A);var h=s[n.key][t],p=e(a)?a:n.fromJS(a);o[n.key][t]=p;var d=n.denormalize(p,l);o[n.key][t]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][t]=h.get(f):h.set(f,o[n.key][t])}return[o[n.key][t],u,c]}(t,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(t,u):[t,!0,!1]}var a=[],u=J(s,a);return function(e,t){a.push(e);var n=s(e,t);return Object(e)!==e?n:r.has(a)?[r.get(a),n[1],n[2]]:(r.set(a,n[0]),n)}},V=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]}};function J(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&w(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,s):t};var P=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)},t}(s),T=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]},t}(s),I=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),a=s.pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===a||""===a)){var u,c=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!=(u=this._entity.name)?u:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw c.status=400,c}return i(this._entity,E,s,t,n),a},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},e}(),L=Object.freeze({__proto__:null,Union:P,Values:T,Array:h,Object:m,Delete:I}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);exports.DELETED=E,exports.Entity=k,exports.FlatEntity=U,exports.SimpleRecord=O,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=D(n,r,i,o);return[].concat(s(e,t),[o])},exports.isEntity=w,exports.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o,s,a){var u=r.key,c=r.pk(o,s,a);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=E),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},exports.schema=L;
"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]},h=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]},t}(s),p=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},d=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]},m=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 p.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 d.apply(void 0,[this.schema].concat(t))},e}();function y(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 v(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 y(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)?y(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 g=Symbol("Defined Members"),b=Symbol("unq"),O=function(){function e(){}return e.prototype.toString=function(){return this[b]},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,g,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,b,{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[g].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=v(e[g]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[g]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();O.schema={};var w=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(u=y()).done;){var g=u.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(k);throw E.status=400,E}console.warn(k)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",N="substantially different than expected keys";j&&(z+="\n Missing: "+d,N="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,N="a large number of unexpected keys found");var _="Attempted to initialize "+this.name+" with "+N+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var x=new Error(_);throw x.status=400,x}console.warn(_)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var D=this.key;return D in o||(o[D]={}),A in o[D]||(o[D][A]=[]),o[D][A].some((function(t){return t===e}))?A:(o[D][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,A),A)}if("production"!==process.env.NODE_ENV){var V=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 V.status=400,V}},i.denormalize=function(n,r){var i,o=this,s=e(n)?n:this.fromJS(n instanceof O?this.toObjectDefined(n):n);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),e(n)){var a=t(this.schema,n,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(e){var t=o.schema[e],i=Object.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(i,t),u=a[0];!a[2]||Object.hasOwnProperty.call(n,e)&&!l[e]||(h=!0),Object.hasOwnProperty.call(n,e)&&n[e]!==u&&(s[e]=u)})),[s,!0,h]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(O);function k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(){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=j()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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,S(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var _=function(){this.children=new WeakMap},x=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}(N(Error)),A=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 x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new _,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}(),D=function(e,t,n,r){var i=V(e);function o(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:d)(n,e,a)}return null===e?[e,!0,!1]:k(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=J(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new A);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=J(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},V=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]}};function J(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&k(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,s):t};var M=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)},t}(s),T=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]},t}(s),I=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._entity,E,s),s},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},e}(),L=Object.freeze({__proto__:null,Union:M,Values:T,Array:h,Object:m,Delete:I}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);exports.DELETED=E,exports.Entity=w,exports.FlatEntity=U,exports.SimpleRecord=O,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=D(n,r,i,o);return[].concat(s(e,t),[o])},exports.isEntity=k,exports.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=v(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=E),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:P(e,e,void 0,t,a,{})}},exports.schema=L;

@@ -364,24 +364,20 @@ (function (global, factory) {

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
return {
done: false,
value: o[i++]
};
};
}
it = o[Symbol.iterator]();
return it.next.bind(it);
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}

@@ -695,3 +691,3 @@

});
addEntity(this, processedEntity, processedEntity, parent, key);
addEntity(this, processedEntity, id);
return id;

@@ -701,13 +697,19 @@ };

Entity.denormalize = function denormalize(input, unvisit) {
var _this2 = this;
var _unvisit$setLocal,
_this2 = this;
// TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// TODO: remove immutable case once we stop storing instances in normalized cache
var entityCopy = isImmutable(input) ? input : this.fromJS(input instanceof SimpleRecord ? this.toObjectDefined(input) : input); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
(_unvisit$setLocal = unvisit.setLocal) === null || _unvisit$setLocal === void 0 ? void 0 : _unvisit$setLocal.call(unvisit, entityCopy); // TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// itself in cache. Once we offer full memoization, we will store raw objects and this can be consolidated with SimpleRecord
if (isImmutable(input)) {
var _denormalizeImmutable = denormalizeImmutable(this.schema, input, unvisit),
_denormEntity = _denormalizeImmutable[0],
denormEntity = _denormalizeImmutable[0],
found = _denormalizeImmutable[1],
_deleted = _denormalizeImmutable[2];
return [this.fromJS(_denormEntity.toObject()), found, _deleted];
return [this.fromJS(denormEntity.toObject()), found, _deleted];
} // TODO: This creates unneeded memory pressure

@@ -717,8 +719,7 @@

var instance = new this();
var deleted = false;
var denormEntity = input; // note: iteration order must be stable
var deleted = false; // note: iteration order must be stable
Object.keys(this.schema).forEach(function (key) {
var schema = _this2.schema[key];
var nextInput = _this2.hasDefined(input, key) ? input[key] : undefined;
var nextInput = Object.hasOwnProperty.call(input, key) ? input[key] : undefined;

@@ -729,11 +730,11 @@ var _unvisit = unvisit(nextInput, schema),

if (deletedItem && !(key in instance && !instance[key])) {
if (deletedItem && !(Object.hasOwnProperty.call(input, key) && !instance[key])) {
deleted = true;
}
if (_this2.hasDefined(input, key) && denormEntity[key] !== value) {
denormEntity[key] = value;
if (Object.hasOwnProperty.call(input, key) && input[key] !== value) {
entityCopy[key] = value;
}
});
return [denormEntity, true, deleted];
return [entityCopy, true, deleted];
};

@@ -959,12 +960,13 @@

var wrappedUnvisit = withTrackedEntities(unvisit, globalKey);
wrappedUnvisit.setLocal = function (entityCopy) {
return localCache[schema.key][id] = entityCopy;
};
if (!entityCache[schema.key]) entityCache[schema.key] = {};
if (!entityCache[schema.key][id]) entityCache[schema.key][id] = new WeakListMap();
var globalCacheEntry = entityCache[schema.key][id];
var entityCopy = isImmutable(entity) ? entity : schema.fromJS(entity); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
localCache[schema.key][id] = entityCopy;
var _schema$denormalize = schema.denormalize(entity, wrappedUnvisit);
var _schema$denormalize = schema.denormalize(entityCopy, wrappedUnvisit);
localCache[schema.key][id] = _schema$denormalize[0];

@@ -1126,5 +1128,4 @@ found = _schema$denormalize[1];

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes) {
return function (schema, processedEntity, value, parent, key) {
return function (schema, processedEntity, id) {
var schemaKey = schema.key;
var id = schema.pk(value, parent, key);

@@ -1341,3 +1342,3 @@ if (!(schemaKey in entities)) {

addEntity(this._entity, DELETED, processedEntity, parent, key);
addEntity(this._entity, DELETED, id);
return id;

@@ -1344,0 +1345,0 @@ };

@@ -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]},p=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]},t}(a),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},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]},y=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 m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(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)?v(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.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},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,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{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[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},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.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=a.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,a,t,n),D)}if("production"!==process.env.NODE_ENV){var V=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 V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),s=o[0],a=o[1],u=o[2];return[this.fromJS(s.toObject()),a,u]}var c=new this,f=!1,l=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,s=r(o,n),a=s[0];!s[2]||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&l[t]!==a&&(l[t]=a)})),[l,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){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 _(e,t,n){return(_=z()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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 _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=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 i(t,e),t}(N(Error)),x=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 A,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}(),V=function(e,n,r,i){var o=J(e);function s(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,s){var a=i(e,n);if(a===S)return[void 0,!0,!0];if("object"!=typeof a||null===a)return[a,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[a],l=M(r,f);s[n.key]||(s[n.key]={}),s[n.key][e]||(s[n.key][e]=new x);var h=s[n.key][e],p=t(a)?a:n.fromJS(a);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var a=[],u=M(s,a);return function(e,t){a.push(e);var n=s(e,t);return Object(e)!==e?n:r.has(a)?[r.get(a),n[1],n[2]]:(r.set(a,n[0]),n)}},J=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]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var T=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var P=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)},t}(a),I=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]},t}(a),L=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),a=s.pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===a||""===a)){var u,c=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!=(u=this._entity.name)?u:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw c.status=400,c}return i(this._entity,S,s,t,n),a},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},e}(),U=Object.freeze({__proto__:null,Union:P,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o,s,a){var u=r.key,c=r.pk(o,s,a);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:T(e,e,void 0,t,a,{})}},e.schema=U,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]):[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]},p=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]},t}(a),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},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]},y=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 m.apply(void 0,[this.schema].concat(t))},e}();function v(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 g(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 v(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)?v(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 b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},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,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{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[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},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.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,s=!0;return Object.keys(this.schema).forEach((function(e){var a=t(i[e],n.schema[e]),u=a[0],c=a[1],f=a[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(s=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),s,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=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);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(a),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="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: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\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: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var x=a.pk(t,n);if(void 0!==x&&""!==x){var D=this.key;return D in o||(o[D]={}),x in o[D]||(o[D][x]=[]),o[D][x].some((function(t){return t===e}))?x:(o[D][x].push(e),Object.keys(this.schema).forEach((function(e){if(Object.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,x),x)}if("production"!==process.env.NODE_ENV){var V=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 V.status=400,V}},r.denormalize=function(e,r){var i,o=this,s=t(e)?e:this.fromJS(e instanceof k?this.toObjectDefined(e):e);if(null===(i=r.setLocal)||void 0===i||i.call(r,s),t(e)){var a=n(this.schema,e,r),u=a[0],c=a[1],f=a[2];return[this.fromJS(u.toObject()),c,f]}var l=new this,h=!1;return Object.keys(this.schema).forEach((function(t){var n=o.schema[t],i=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(i,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!l[t]||(h=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(s[t]=u)})),[s,!0,h]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){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 _(e,t,n){return(_=z()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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 _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},x=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}(N(Error)),D=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 x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,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}(),V=function(e,t,n,r){var i=J(e);function o(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]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=P(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new D);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=P(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},J=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]}};function P(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,s):t};var T=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)},t}(a),I=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]},t}(a),L=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._entity,S,s),s},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},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=D,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new D),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=V(n,r,i,o);return[].concat(s(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){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 "'+i+'", 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 "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},s={},a=function(e,t,n,r){return function(r,i,o){var s=r.key;s in e||(e[s]={});var a=e[s][o];if(e[s][o]=a?r.merge(a,i):i,Array.isArray(r.indexes)){var u=e[s][o];s in t||(t[s]={});for(var c,f=g(r.indexes);!(c=f()).done;){var l=c.value;l in t[s]||(t[s][l]={});var h=t[s][l];a&&delete h[a[l]],n[s]&&n[s][o]&&n[s][o][l]!==u[l]&&(h[n[s][o][l]]=S),l in u?h[u[l]]=o:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+l+"\nEntity: "+JSON.stringify(u,void 0,2))}}}}(o,s,n);return{entities:o,indexes:s,result:M(e,e,void 0,t,a,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -29,11 +29,10 @@ import { isImmutable } from './schemas/ImmutableUtils';

const wrappedUnvisit = withTrackedEntities(unvisit, globalKey);
wrappedUnvisit.setLocal = entityCopy => localCache[schema.key][id] = entityCopy;
if (!entityCache[schema.key]) entityCache[schema.key] = {};
if (!entityCache[schema.key][id]) entityCache[schema.key][id] = new WeakListMap();
const globalCacheEntry = entityCache[schema.key][id];
const entityCopy = isImmutable(entity) ? entity : schema.fromJS(entity); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
[localCache[schema.key][id], found, deleted] = schema.denormalize(entity, wrappedUnvisit);
localCache[schema.key][id] = entityCopy;
[localCache[schema.key][id], found, deleted] = schema.denormalize(entityCopy, wrappedUnvisit);
if (!globalCacheEntry.has(globalKey)) {

@@ -164,2 +163,2 @@ globalCacheEntry.set(globalKey, localCache[schema.key][id]);

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

@@ -42,5 +42,5 @@ import SimpleRecord from './SimpleRecord';

static normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any;
static denormalize<T extends typeof SimpleRecord>(this: T, input: AbstractInstanceType<T>, unvisit: schema.UnvisitFunction): [AbstractInstanceType<T>, boolean, boolean];
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

@@ -189,3 +189,3 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

});
addEntity(this, processedEntity, processedEntity, parent, key);
addEntity(this, processedEntity, id);
return id;

@@ -195,4 +195,11 @@ }

static denormalize(input, unvisit) {
// TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
var _unvisit$setLocal;
// TODO: remove immutable case once we stop storing instances in normalized cache
const entityCopy = isImmutable(input) ? input : this.fromJS(input instanceof SimpleRecord ? this.toObjectDefined(input) : input); // Need to set this first so that if it is referenced further within the
// denormalization the reference will already exist.
(_unvisit$setLocal = unvisit.setLocal) === null || _unvisit$setLocal === void 0 ? void 0 : _unvisit$setLocal.call(unvisit, entityCopy); // TODO: this entire function is redundant with SimpleRecord, however right now we're storing the Entity instance
// itself in cache. Once we offer full memoization, we will store raw objects and this can be consolidated with SimpleRecord
if (isImmutable(input)) {

@@ -205,19 +212,18 @@ const [denormEntity, found, deleted] = denormalizeImmutable(this.schema, input, unvisit);

const instance = new this();
let deleted = false;
const denormEntity = input; // note: iteration order must be stable
let deleted = false; // note: iteration order must be stable
Object.keys(this.schema).forEach(key => {
const schema = this.schema[key];
const nextInput = this.hasDefined(input, key) ? input[key] : undefined;
const nextInput = Object.hasOwnProperty.call(input, key) ? input[key] : undefined;
const [value,, deletedItem] = unvisit(nextInput, schema);
if (deletedItem && !(key in instance && !instance[key])) {
if (deletedItem && !(Object.hasOwnProperty.call(input, key) && !instance[key])) {
deleted = true;
}
if (this.hasDefined(input, key) && denormEntity[key] !== value) {
denormEntity[key] = value;
if (Object.hasOwnProperty.call(input, key) && input[key] !== value) {
entityCopy[key] = value;
}
});
return [denormEntity, true, deleted];
return [entityCopy, true, deleted];
}

@@ -239,2 +245,2 @@

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

@@ -130,2 +130,2 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

SimpleRecord.schema = {};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnRpdGllcy9TaW1wbGVSZWNvcmQudHMiXSwibmFtZXMiOlsibm9ybWFsaXplIiwiRGVmaW5lZE1lbWJlcnNLZXkiLCJTeW1ib2wiLCJVbmlxdWVJZGVudGlmaWVyS2V5IiwiU2ltcGxlUmVjb3JkIiwidG9TdHJpbmciLCJ0b0pTT04iLCJuYW1lIiwic2NoZW1hIiwiZnJvbUpTIiwicHJvcHMiLCJwYXJlbnQiLCJrZXkiLCJpbnN0YW5jZSIsImNvbnN0cnVjdG9yIiwidG9PYmplY3REZWZpbmVkIiwiT2JqZWN0IiwiYXNzaWduIiwiZGVmaW5lUHJvcGVydHkiLCJ2YWx1ZSIsImtleXMiLCJ3cml0YWJsZSIsIk1hdGgiLCJyYW5kb20iLCJtZXJnZSIsImV4aXN0aW5nIiwiaW5jb21pbmciLCJoYXNEZWZpbmVkIiwiaW5jbHVkZXMiLCJkZWZpbmVkIiwibWVtYmVyIiwia2V5c0RlZmluZWQiLCJhcmdzIiwiZGVub3JtYWxpemUiLCJpbnB1dCIsInVudmlzaXQiLCJvYmplY3QiLCJkZWxldGVkIiwiZm91bmQiLCJmb3JFYWNoIiwiaXRlbSIsImZvdW5kSXRlbSIsImRlbGV0ZWRJdGVtIiwidW5kZWZpbmVkIiwiYXNTY2hlbWEiLCJwcm9jZXNzIiwiZW52IiwiTk9ERV9FTlYiLCJjb25zb2xlIiwiZXJyb3IiXSwibWFwcGluZ3MiOiJBQUFBO0FBRUEsU0FBU0EsU0FBVCxRQUEwQixtQkFB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oJ2FzU2NoZW1hKCkgaXMgZGVwcmVjYXRlZCAtIHVzZSBFbnRpdHkgZGlyZWN0bHkgaW5zdGVhZC4nKTtcbiAgICB9XG4gICAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgICByZXR1cm4gdGhpcztcbiAgfVxufVxuIl19

@@ -23,5 +23,4 @@ import { normalize as arrayNormalize } from './schemas/Array';

const addEntities = (entities, indexes, existingEntities, existingIndexes) => (schema, processedEntity, value, parent, key) => {
const addEntities = (entities, indexes, existingEntities, existingIndexes) => (schema, processedEntity, id) => {
const schemaKey = schema.key;
const id = schema.pk(value, parent, key);

@@ -134,2 +133,2 @@ if (!(schemaKey in entities)) {

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

@@ -38,3 +38,3 @@ import {

export type Serializable<
T extends { toJSON(): string } = { toJSON(): string }
T extends { toJSON(): string } = { toJSON(): string },
> = {

@@ -101,3 +101,4 @@ prototype: T;

export class Object<O extends Record<string, any> = Record<string, Schema>>
implements SchemaClass {
implements SchemaClass
{
constructor(definition: O);

@@ -104,0 +105,0 @@ define(definition: Schema): void;

@@ -37,3 +37,3 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

addEntity(this._entity, DELETED, processedEntity, parent, key);
addEntity(this._entity, DELETED, id);
return id;

@@ -65,2 +65,2 @@ }

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY2hlbWFzL0RlbGV0ZS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XBlPEU+IHwgdW5kZWZpbmVkLFxuICAgIGJvb2xlYW4sXG4gICAgZmFsc2UsXG4gIF0ge1xuICAgIHJldHVybiBbXSBhcyBhbnk7XG4gIH1cblxuICAvKiBpc3RhbmJ1bCBpZ25vcmUgbmV4dCAqL1xuICBfbm9ybWFsaXplTnVsbGFibGUoKTogc3RyaW5nIHwgdW5kZWZpbmVkIHtcbiAgICByZXR1cm4gW10gYXMgYW55O1xuICB9XG5cbiAgLyogaXN0YW5idWwgaWdub3JlIG5leHQgKi9cbiAgbWVyZ2UoZXhpc3Rpbmc6IGFueSwgaW5jb21pbmc6IGFueSkge1xuICAgIHJldHVybiBpbmNvbWluZztcbiAgfVxufVxuIl19

@@ -36,2 +36,3 @@ import type { default as schema, EntityInterface } from './schema';

og?: UnvisitFunction;
setLocal?: (entity: any) => void;
}

@@ -38,0 +39,0 @@ export interface DenormalizeCache {

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

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

},
"gitHead": "05cd4da122d9f77eb917fc06dcf6a82d39e13b6f"
"gitHead": "7ed918973d3410b7d21b32187049470d081816fb"
}

@@ -42,3 +42,3 @@ import SimpleRecord from './SimpleRecord';

static normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any;
static denormalize<T extends typeof SimpleRecord>(this: T, input: AbstractInstanceType<T>, unvisit: schema.UnvisitFunction): [
static denormalize<T extends typeof SimpleRecord>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [
AbstractInstanceType<T>,

@@ -45,0 +45,0 @@ boolean,

@@ -40,2 +40,3 @@ import { default as schema, EntityInterface } from './schema';

og?: UnvisitFunction;
setLocal?: (entity: any) => void;
}

@@ -42,0 +43,0 @@ export interface DenormalizeCache {

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