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.0.7 to 6.0.8-beta.0

9

CHANGELOG.md

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

### [6.0.8-beta.0](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.0.7...@rest-hooks/normalizr@6.0.8-beta.0) (2021-04-05)
### 💅 Enhancement
* All schema members are optional by default ([#716](https://github.com/coinbase/rest-hooks/issues/716)) ([b8c6443](https://github.com/coinbase/rest-hooks/commit/b8c64438bb34bc1f9e9bc1461bd7e4d3bb4e330e))
### [6.0.7](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.0.6...@rest-hooks/normalizr@6.0.7) (2021-04-04)

@@ -8,0 +17,0 @@

20

dist/normalizr.amd.js

@@ -172,5 +172,5 @@ define(['exports'], function (exports) { 'use strict';

var filterEmpty = function filterEmpty(_ref) {
var foundItem = _ref[1],
var item = _ref[0],
deletedItem = _ref[2];
return foundItem && !deletedItem;
return item !== undefined && !deletedItem;
};

@@ -692,6 +692,6 @@

_denormEntity = _denormalizeImmutable[0],
_found = _denormalizeImmutable[1],
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

@@ -702,3 +702,2 @@

var deleted = false;
var found = true;
var denormEntity = input; // note: iteration order must be stable

@@ -712,11 +711,4 @@

value = _unvisit[0],
foundItem = _unvisit[1],
deletedItem = _unvisit[2]; // members who default to falsy values are considered 'optional'
// if falsy value, and default is actually set then it is optional so pass through
deletedItem = _unvisit[2];
if (!foundItem && !(key in instance && !instance[key])) {
found = false;
}
if (deletedItem && !(key in instance && !instance[key])) {

@@ -730,3 +722,3 @@ deleted = true;

});
return [denormEntity, found, deleted];
return [denormEntity, true, deleted];
};

@@ -733,0 +725,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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){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,!0]},a(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[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},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 a=this;return c(e).map((function(e,s){return a.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}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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(s),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=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(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 a(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,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);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 s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}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}(s),T=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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(s),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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),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:I,Values:T,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={},a=V(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){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,!0]},a(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,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},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 a=this;return c(e).map((function(e,s){return a.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}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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(s),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=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,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,a=r(o,n),s=a[0];!a[2]||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&l[t]!==s&&(l[t]=s)})),[l,!0,f]},a(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 a(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,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);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 s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}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}(s),T=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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(s),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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),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:I,Values:T,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={},a=V(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -173,5 +173,5 @@ var rest_hooks_normalizr = (function (exports) {

var filterEmpty = function filterEmpty(_ref) {
var foundItem = _ref[1],
var item = _ref[0],
deletedItem = _ref[2];
return foundItem && !deletedItem;
return item !== undefined && !deletedItem;
};

@@ -693,6 +693,6 @@

_denormEntity = _denormalizeImmutable[0],
_found = _denormalizeImmutable[1],
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

@@ -703,3 +703,2 @@

var deleted = false;
var found = true;
var denormEntity = input; // note: iteration order must be stable

@@ -713,11 +712,4 @@

value = _unvisit[0],
foundItem = _unvisit[1],
deletedItem = _unvisit[2]; // members who default to falsy values are considered 'optional'
// if falsy value, and default is actually set then it is optional so pass through
deletedItem = _unvisit[2];
if (!foundItem && !(key in instance && !instance[key])) {
found = false;
}
if (deletedItem && !(key in instance && !instance[key])) {

@@ -731,3 +723,3 @@ deleted = true;

});
return [denormEntity, found, deleted];
return [denormEntity, true, deleted];
};

@@ -734,0 +726,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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){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,!0]},a(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[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},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 a=this;return c(e).map((function(e,s){return a.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}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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(s),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=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(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 a(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,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);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 s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}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}(s),T=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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(s),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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),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:I,Values:T,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=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={},a=V(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){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,!0]},a(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,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},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 a=this;return c(e).map((function(e,s){return a.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}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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(s),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=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,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,a=r(o,n),s=a[0];!a[2]||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&l[t]!==s&&(l[t]=s)})),[l,!0,f]},a(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 a(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,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);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 s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}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}(s),T=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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(s),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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),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:I,Values:T,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=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={},a=V(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -174,5 +174,5 @@ 'use strict';

var filterEmpty = function filterEmpty(_ref) {
var foundItem = _ref[1],
var item = _ref[0],
deletedItem = _ref[2];
return foundItem && !deletedItem;
return item !== undefined && !deletedItem;
};

@@ -694,6 +694,6 @@

_denormEntity = _denormalizeImmutable[0],
_found = _denormalizeImmutable[1],
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

@@ -704,3 +704,2 @@

var deleted = false;
var found = true;
var denormEntity = input; // note: iteration order must be stable

@@ -714,11 +713,4 @@

value = _unvisit[0],
foundItem = _unvisit[1],
deletedItem = _unvisit[2]; // members who default to falsy values are considered 'optional'
// if falsy value, and default is actually set then it is optional so pass through
deletedItem = _unvisit[2];
if (!foundItem && !(key in instance && !instance[key])) {
found = false;
}
if (deletedItem && !(key in instance && !instance[key])) {

@@ -732,3 +724,3 @@ deleted = true;

});
return [denormEntity, found, deleted];
return [denormEntity, true, deleted];
};

@@ -735,0 +727,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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){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,!0]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),s=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[1],n=e[2];return t&&!n},f=function(e,t,n,r,i,o,a){return e=s(e),u(t).map((function(t,s){return i(t,n,r,e,o,a)}))},l=function(e,t,n){e=s(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 a=this;return u(e).map((function(e,s){return a.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}(a),p=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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="",_="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 x="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(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var N=new Error(x);throw N.status=400,N}console.warn(x)}}}var A=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),A)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=n;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],o=i.hasDefined(n,e)?n[e]:void 0,a=r(o,t),s=a[0],u=a[1],p=a[2];u||e in c&&!c[e]||(l=!1),!p||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&h[e]!==s&&(h[e]=s)})),[h,l,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 _(e){var t="function"==typeof Map?new Map:void 0;return(_=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 x=function(){this.children=new WeakMap},N=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}(_(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 N;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new x,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 a(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,a){var s=i(t,n);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][t]){var f=[s],l=J(r,f);a[n.key]||(a[n.key]={}),a[n.key][t]||(a[n.key][t]=new A);var h=a[n.key][t],p=e(s)?s:n.fromJS(s);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 s=[],u=J(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,a):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}(a),I=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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(a),T=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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,E,a,t,n),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:P,Values:I,Array:h,Object:m,Delete:T}),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={},a=D(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:M(e,e,void 0,t,s,{})}},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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){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,!0]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),s=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,a){return e=s(e),u(t).map((function(t,s){return i(t,n,r,e,o,a)}))},l=function(e,t,n){e=s(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 a=this;return u(e).map((function(e,s){return a.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}(a),p=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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="",_="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 x="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(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var N=new Error(x);throw N.status=400,N}console.warn(x)}}}var A=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),A)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,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,a=r(o,t),s=a[0];!a[2]||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&l[e]!==s&&(l[e]=s)})),[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 _(e){var t="function"==typeof Map?new Map:void 0;return(_=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 x=function(){this.children=new WeakMap},N=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}(_(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 N;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new x,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 a(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,a){var s=i(t,n);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][t]){var f=[s],l=J(r,f);a[n.key]||(a[n.key]={}),a[n.key][t]||(a[n.key][t]=new A);var h=a[n.key][t],p=e(s)?s:n.fromJS(s);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 s=[],u=J(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,a):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}(a),I=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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(a),T=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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,E,a,t,n),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:P,Values:I,Array:h,Object:m,Delete:T}),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={},a=D(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:M(e,e,void 0,t,s,{})}},exports.schema=L;

@@ -176,5 +176,5 @@ (function (global, factory) {

var filterEmpty = function filterEmpty(_ref) {
var foundItem = _ref[1],
var item = _ref[0],
deletedItem = _ref[2];
return foundItem && !deletedItem;
return item !== undefined && !deletedItem;
};

@@ -696,6 +696,6 @@

_denormEntity = _denormalizeImmutable[0],
_found = _denormalizeImmutable[1],
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

@@ -706,3 +706,2 @@

var deleted = false;
var found = true;
var denormEntity = input; // note: iteration order must be stable

@@ -716,11 +715,4 @@

value = _unvisit[0],
foundItem = _unvisit[1],
deletedItem = _unvisit[2]; // members who default to falsy values are considered 'optional'
// if falsy value, and default is actually set then it is optional so pass through
deletedItem = _unvisit[2];
if (!foundItem && !(key in instance && !instance[key])) {
found = false;
}
if (deletedItem && !(key in instance && !instance[key])) {

@@ -734,3 +726,3 @@ deleted = true;

});
return [denormEntity, found, deleted];
return [denormEntity, true, deleted];
};

@@ -737,0 +729,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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){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,!0]},a(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[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},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 a=this;return c(e).map((function(e,s){return a.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}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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(s),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=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),x)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(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,n,r,i){var o=J(e);function a(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,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new D);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);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 s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):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}(s),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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(s),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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),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={},a=V(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},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 a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,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 a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=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 a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){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,!0]},a(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,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},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 a=this;return c(e).map((function(e,s){return a.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}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!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&&(s=!0),u||(a=!1)})),[o,a,s]},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,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,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 a=this;if("string"==typeof e)return e;var s=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(s),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(s),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=s.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(s,e)){var t=a.schema[e];s[e]=r(s[e],s,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(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),x)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource 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),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,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,a=r(o,n),s=a[0];!a[2]||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&l[t]!==s&&(l[t]=s)})),[l,!0,f]},a(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,n,r,i){var o=J(e);function a(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,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new D);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);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 s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,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,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):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}(s),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 a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.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,a){var s,u=e[a],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,((s={})[a]=f,s))}),{}),r,i]},t}(s),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 a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),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={},a=V(n,r,i,o);return[].concat(a(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={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);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,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));

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

let deleted = false;
let found = true;
const denormEntity = input; // note: iteration order must be stable

@@ -211,9 +210,4 @@

const nextInput = this.hasDefined(input, key) ? input[key] : undefined;
const [value, foundItem, deletedItem] = unvisit(nextInput, schema); // members who default to falsy values are considered 'optional'
// if falsy value, and default is actually set then it is optional so pass through
const [value,, deletedItem] = unvisit(nextInput, schema);
if (!foundItem && !(key in instance && !instance[key])) {
found = false;
}
if (deletedItem && !(key in instance && !instance[key])) {

@@ -227,3 +221,3 @@ deleted = true;

});
return [denormEntity, found, deleted];
return [denormEntity, true, deleted];
}

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

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnRpdGllcy9FbnRpdHkudHMiXSwibmFtZXMiOlsiU2ltcGxlUmVjb3JkIiwiaXNJbW11dGFibGUiLCJkZW5vcm1hbGl6ZUltbXV0YWJsZSIsIkVudGl0eSIsInRvSlNPTiIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIm5hbWUiLCJFcnJvciIsInBrIiwidmFsdWUiLCJwYXJlbnQiLCJwcm90b3R5cGUiLCJjYWxsIiwibm9ybWFsaXplIiwiaW5wdXQiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImZyb21KUyIsImF1dG9tYXRpY1ZhbGlkYXRpb24iLCJpbnN0YW5jZVNhbXBsZSIsImtleXNPZlJlY29yZCIsIlNldCIsIk9iamVjdCIsImtleXMiLCJrZXlzT2ZQcm9wcyIsImtleXNEZWZpbmVkIiwiZm91bmQiLCJtaXNzaW5nIiwidW5leHBlY3RlZCIsImtleU9mUHJvcHMiLCJoYXMiLCJwdXNoIiwia2V5T2ZSZWNvcmQiLCJpbmNsdWRlcyIsInNpemUiLCJBcnJheSIsImlzQXJyYXkiLCJsZW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0ZWRdO1xuICB9XG59XG5cbmlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gJ3Byb2R1Y3Rpb24nKSB7XG4gIC8vIGZvciB0aG9zZSBub3QgdXNpbmcgVHlwZVNjcmlwdCB0aGlzIGlzIGEgZ29vZCBjYXRjaCB0byBlbnN1cmUgdGhleSBhcmUgZGVmaW5pbmdcbiAgLy8gdGhlIGFic3RyYWN0IG1lbWJlcnNcbiAgRW50aXR5LmZyb21KUyA9IGZ1bmN0aW9uIGZyb21KUzxUIGV4dGVuZHMgdHlwZW9mIFNpbXBsZVJlY29yZD4oXG4gICAgdGhpczogVCxcbiAgICBwcm9wczogUGFydGlhbDxBYnN0cmFjdEluc3RhbmNlVHlwZTxUPj4sXG4gICk6IEFic3RyYWN0SW5zdGFuY2VUeXBlPFQ+IHtcbiAgICBpZiAoKHRoaXMgYXMgYW55KS5wcm90b3R5cGUucGsgPT09IHVuZGVmaW5lZClcbiAgICAgIHRocm93IG5ldyBFcnJvcignY2Fubm90IGNvbnN0cnVjdCBvbiBhYnN0cmFjdCB0eXBlcycpO1xuICAgIHJldHVybiBTaW1wbGVSZWNvcmQuZnJvbUpTLmNhbGwodGhpcywgcHJvcHMpIGFzIGFueTtcbiAgfTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGlzRW50aXR5KHNjaGVtYTogU2NoZW1hKTogc2NoZW1hIGlzIHR5cGVvZiBFbnRpdHkge1xuICByZXR1cm4gc2NoZW1hICE9PSBudWxsICYmIChzY2hlbWEgYXMgYW55KS5wayAhPT0gdW5kZWZpbmVkO1xufVxuIl19

@@ -15,3 +15,3 @@ import PolymorphicSchema from "./Polymorphic";

const filterEmpty = ([, foundItem, deletedItem]) => foundItem && !deletedItem;
const filterEmpty = ([item,, deletedItem]) => item !== undefined && !deletedItem;

@@ -54,2 +54,2 @@ export const normalize = (schema, input, parent, key, visit, addEntity, visitedEntities) => {

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJza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AoKFt2YWx1ZV0pID0+IHZhbHVlKVxuICAgICAgICA6IGlucHV0LFxuICAgICAgZm91bmQsXG4gICAgICBkZWxldGVkLFxuICAgIF07XG4gIH1cbn1cbiJdfQ==
{
"name": "@rest-hooks/normalizr",
"version": "6.0.7",
"version": "6.0.8-beta.0",
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications",

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

},
"gitHead": "5751520320d27212b1ffd21b2303649f312f412c"
"gitHead": "b8c64438bb34bc1f9e9bc1461bd7e4d3bb4e330e"
}

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