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

@rest-hooks/normalizr

Package Overview
Dependencies
Maintainers
2
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rest-hooks/normalizr - npm Package Compare versions

Comparing version 6.0.1 to 6.0.2

9

CHANGELOG.md

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

### [6.0.2](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.0.1...@rest-hooks/normalizr@6.0.2) (2021-02-04)
### 📦 Package
* Relax @babel/runtime requirement to ^7.7.2 ([#513](https://github.com/coinbase/rest-hooks/issues/513)) ([cc95b21](https://github.com/coinbase/rest-hooks/commit/cc95b219fbddebfbf334728887ca6d2fa070fce1))
### [6.0.1](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.0.0...@rest-hooks/normalizr@6.0.1) (2021-01-24)

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

20

dist/normalizr.amd.js

@@ -58,6 +58,15 @@ define(['exports'], function (exports) { 'use strict';

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
_setPrototypeOf(subClass, superClass);
}

@@ -754,11 +763,2 @@

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeFunction(fn) {

@@ -765,0 +765,0 @@ return Function.toString.call(fn).indexOf("[native code]") !== -1;

@@ -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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):t}),t),r,i]}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=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}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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]},o(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]},s=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=u(e),s(t).map((function(t,u){return i(t,n,r,e,o,a)}))},l=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(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 s(e).map((function(e,u){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 u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},d=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],s=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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 u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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 w=function(e){function i(){return e.apply(this,arguments)||this}return r(i,e),i.toJSON=function(){return Object.assign({},e.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 u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(s=y()).done;){var g=s.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=u.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(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,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}},i.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==u&&(h[t]=u)})),[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 k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&j(i,n.prototype),i}).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,r)}function r(){return _(e,arguments,E(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),j(r,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 r(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)?l:d)(r,e,s)}return null===e?[e,!0,!1]:k(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var u=i(e,n);if(u===S)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][e]){var f=[u],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(u)?u:n.fromJS(u);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],s=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],s,c]}(e,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,s):[e,!0,!1]}var u=[],s=M(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&k(r)&&t.push(i[0]),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)?f:p)(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}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),T=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),u=a.pk(t,n);return i(this._entity,S,a,t,n),u},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}(),R=Object.freeze({__proto__:null,Union:I,Values:T,Array:h,Object:m,Delete:L}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=U,e.SimpleRecord=O,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");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=k,e.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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,u,{})}},e.schema=R,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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):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 u=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 u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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}(),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]},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=s(e),c(t).map((function(t,u){return i(t,n,r,e,o,a)}))},h=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(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,u){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}(u),d=function(e,t,n,r,i,o,a){var u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],s=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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"),w=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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}();w.schema={};var k=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(s=y()).done;){var v=s.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=u.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(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,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],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==u&&(h[t]=u)})),[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}(w);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var E=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 Date.prototype.toString.call(Reflect.construct(Date,[],(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,s)}return null===e?[e,!0,!1]:S(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var u=i(e,n);if(u===E)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][e]){var f=[u],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(u)?u:n.fromJS(u);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],s=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],s,c]}(e,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,s):[e,!0,!1]}var u=[],s=M(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&S(r)&&t.push(i[0]),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}(u),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,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(u),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),u=a.pk(t,n);return i(this._entity,E,a,t,n),u},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}(),R=Object.freeze({__proto__:null,Union:I,Values:T,Array:p,Object:y,Delete:L}),U=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);e.DELETED=E,e.Entity=k,e.FlatEntity=U,e.SimpleRecord=w,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");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=S,e.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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:P(e,e,void 0,t,u,{})}},e.schema=R,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -59,6 +59,15 @@ var rest_hooks_normalizr = (function (exports) {

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
_setPrototypeOf(subClass, superClass);
}

@@ -755,11 +764,2 @@

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeFunction(fn) {

@@ -766,0 +766,0 @@ return Function.toString.call(fn).indexOf("[native code]") !== -1;

@@ -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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):t}),t),r,i]}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=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}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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]},o(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]},s=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=u(e),s(t).map((function(t,u){return i(t,n,r,e,o,a)}))},l=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(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 s(e).map((function(e,u){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 u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},d=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],s=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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 u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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 w=function(e){function i(){return e.apply(this,arguments)||this}return r(i,e),i.toJSON=function(){return Object.assign({},e.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 u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(s=y()).done;){var g=s.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=u.pk(t,n);if(void 0!==D&&""!==D){var V=this.key;return V in o||(o[V]={}),D in o[V]||(o[V][D]=[]),o[V][D].some((function(t){return t===e}))?D:(o[V][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,t,n),D)}if("production"!==process.env.NODE_ENV){var x=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 x.status=400,x}},i.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==u&&(h[t]=u)})),[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 k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&j(i,n.prototype),i}).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,r)}function r(){return _(e,arguments,E(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),j(r,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 r(t,e),t}(N(Error)),V=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),x=function(e,n,r,i){var o=J(e);function 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)?l:d)(r,e,s)}return null===e?[e,!0,!1]:k(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var u=i(e,n);if(u===S)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][e]){var f=[u],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new V);var h=a[n.key][e],p=t(u)?u:n.fromJS(u);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],s=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],s,c]}(e,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,s):[e,!0,!1]}var u=[],s=M(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&k(r)&&t.push(i[0]),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)?f:p)(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}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),T=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),u=a.pk(t,n);return i(this._entity,S,a,t,n),u},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}(),R=Object.freeze({__proto__:null,Union:I,Values:T,Array:h,Object:m,Delete:L}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=U,e.SimpleRecord=O,e.WeakListMap=V,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");if(void 0===e)return[void 0,!1,!1,{}];var o={},a=x(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=k,e.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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,u,{})}},e.schema=R,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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):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 u=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 u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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}(),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]},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=s(e),c(t).map((function(t,u){return i(t,n,r,e,o,a)}))},h=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(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,u){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}(u),d=function(e,t,n,r,i,o,a){var u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],s=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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"),w=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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}();w.schema={};var k=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(s=y()).done;){var v=s.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=u.pk(t,n);if(void 0!==D&&""!==D){var V=this.key;return V in o||(o[V]={}),D in o[V]||(o[V][D]=[]),o[V][D].some((function(t){return t===e}))?D:(o[V][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,t,n),D)}if("production"!==process.env.NODE_ENV){var x=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 x.status=400,x}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==u&&(h[t]=u)})),[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}(w);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var E=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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),V=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),x=function(e,n,r,i){var o=J(e);function 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,s)}return null===e?[e,!0,!1]:S(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var u=i(e,n);if(u===E)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][e]){var f=[u],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new V);var h=a[n.key][e],p=t(u)?u:n.fromJS(u);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],s=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],s,c]}(e,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,s):[e,!0,!1]}var u=[],s=M(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&S(r)&&t.push(i[0]),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}(u),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,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(u),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),u=a.pk(t,n);return i(this._entity,E,a,t,n),u},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}(),R=Object.freeze({__proto__:null,Union:I,Values:T,Array:p,Object:y,Delete:L}),U=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);return e.DELETED=E,e.Entity=k,e.FlatEntity=U,e.SimpleRecord=w,e.WeakListMap=V,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");if(void 0===e)return[void 0,!1,!1,{}];var o={},a=x(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=S,e.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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:P(e,e,void 0,t,u,{})}},e.schema=R,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -60,6 +60,15 @@ 'use strict';

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
_setPrototypeOf(subClass, superClass);
}

@@ -756,11 +765,2 @@

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeFunction(fn) {

@@ -767,0 +767,0 @@ return Function.toString.call(fn).indexOf("[native code]") !== -1;

@@ -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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):t}),t),r,i]}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function r(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 i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var o=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 u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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]},i(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},s=function(e){var t=e[1],n=e[2];return t&&!n},c=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},f=function(e,t,n){e=a(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(s).map((function(e){return e[0]})):t,i,r]},l=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.normalize=function(e,t,n,r,i,o){var a=this;return u(e).map((function(e,u){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},r.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(s).map((function(e){return e[0]})):e,i,r]},t}(o),h=function(e,t,n,r,i,o,a){var u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},p=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],s=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},d=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 h.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 p.apply(void 0,[this.schema].concat(t))},e}();function m(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 y(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 m(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)?m(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 v=Symbol("Defined Members"),g=Symbol("unq"),b=function(){function e(){}return e.prototype.toString=function(){return this[g]},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,v,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,g,{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[v].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=y(e[v]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[v]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.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 u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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}();b.schema={};var O=function(r){function o(){return r.apply(this,arguments)||this}return n(o,r),o.toJSON=function(){return Object.assign({},r.toJSON.call(this),{key:this.key})},o.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},o.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],v=y(l);!(s=v()).done;){var g=s.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=y(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var N=new Error(x);throw N.status=400,N}console.warn(x)}}}var A=u.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(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,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}},o.denormalize=function(n,r){var i=this;if(e(n)){var o=t(this.schema,n,r),a=o[0],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||e in c&&!c[e]||(l=!1),!p||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&h[e]!==u&&(h[e]=u)})),[h,l,f]},i(o,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}}]),o}(b);function w(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(O.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return b.fromJS.call(this,e)});var k=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function E(e,t){return(E=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,n){return(z=j()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&E(i,n.prototype),i}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return z(e,arguments,S(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),E(r,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 n(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)?f:p)(r,t,s)}return null===t?[t,!0,!1]:w(r)?void 0===t?[t,!1,!1]:function(t,n,r,i,o,a){var u=i(t,n);if(u===k)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][t]){var f=[u],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(u)?u:n.fromJS(u);o[n.key][t]=p;var d=n.denormalize(p,l);o[n.key][t]=d[0],s=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],s,c]}(t,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(t,s):[t,!0,!1]}var u=[],s=J(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&w(r)&&t.push(i[0]),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)?c:h)(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}n(t,e);var r=t.prototype;return r.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},r.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(o),I=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},r.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(o),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),u=a.pk(t,n);return i(this._entity,k,a,t,n),u},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:l,Object:d,Delete:T}),R=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(O);exports.DELETED=k,exports.Entity=O,exports.FlatEntity=R,exports.SimpleRecord=b,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");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){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=y(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][c][d]]=k),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,u,{})}},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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):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 u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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}(),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]},s=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=u(e),s(t).map((function(t,u){return i(t,n,r,e,o,a)}))},l=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(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 s(e).map((function(e,u){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 u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],s=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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 u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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 w=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(s=y()).done;){var g=s.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var N=new Error(x);throw N.status=400,N}console.warn(x)}}}var A=u.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(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,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],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||e in c&&!c[e]||(l=!1),!p||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&h[e]!==u&&(h[e]=u)})),[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 k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function E(e){return(E=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 Date.prototype.toString.call(Reflect.construct(Date,[],(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,E(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,s)}return null===t?[t,!0,!1]:k(r)?void 0===t?[t,!1,!1]:function(t,n,r,i,o,a){var u=i(t,n);if(u===S)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][t]){var f=[u],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(u)?u:n.fromJS(u);o[n.key][t]=p;var d=n.denormalize(p,l);o[n.key][t]=d[0],s=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],s,c]}(t,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(t,s):[t,!0,!1]}var u=[],s=J(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&k(r)&&t.push(i[0]),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,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),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),u=a.pk(t,n);return i(this._entity,S,a,t,n),u},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}),R=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);exports.DELETED=S,exports.Entity=w,exports.FlatEntity=R,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),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");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=k,exports.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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:M(e,e,void 0,t,u,{})}},exports.schema=L;

@@ -62,6 +62,15 @@ (function (global, factory) {

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
_setPrototypeOf(subClass, superClass);
}

@@ -758,11 +767,2 @@

function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeFunction(fn) {

@@ -769,0 +769,0 @@ return Function.toString.call(fn).indexOf("[native code]") !== -1;

@@ -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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):t}),t),r,i]}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=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}var a=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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]},o(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]},s=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=u(e),s(t).map((function(t,u){return i(t,n,r,e,o,a)}))},l=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(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 s(e).map((function(e,u){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 u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},d=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],s=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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 u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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 w=function(e){function i(){return e.apply(this,arguments)||this}return r(i,e),i.toJSON=function(){return Object.assign({},e.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 u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(s=y()).done;){var g=s.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=u.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(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,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}},i.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==u&&(h[t]=u)})),[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 k(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&j(i,n.prototype),i}).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,r)}function r(){return _(e,arguments,E(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),j(r,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 r(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)?l:d)(r,e,s)}return null===e?[e,!0,!1]:k(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var u=i(e,n);if(u===S)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][e]){var f=[u],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(u)?u:n.fromJS(u);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],s=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],s,c]}(e,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,s):[e,!0,!1]}var u=[],s=M(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&k(r)&&t.push(i[0]),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)?f:p)(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}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,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(a),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),u=a.pk(t,n);return i(this._entity,S,a,t,n),u},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}(),R=Object.freeze({__proto__:null,Union:T,Values:I,Array:h,Object:m,Delete:L}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=U,e.SimpleRecord=O,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");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=k,e.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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,u,{})}},e.schema=R,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,u=n(t.get(a),e[a]),s=u[0],c=u[1],f=u[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,s):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 u=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 u=r(e,t,n,a,i,o);return this.isSingleSchema||null==u?u:{id:u,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}(),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]},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=s(e),c(t).map((function(t,u){return i(t,n,r,e,o,a)}))},h=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(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,u){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}(u),d=function(e,t,n,r,i,o,a){var u=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],s=i(t[n],t,n,r,o,a);null==s?delete u[n]:u[n]=s})),u},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,u=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],s=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(u=!0),s||(a=!1)})),[o,a,u]},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"),w=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var u=t(i[e],n.schema[e]),s=u[0],c=u[1],f=u[2];void 0!==i[e]&&(i[e]=s),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}();w.schema={};var k=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var u=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var s,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(u),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(s=y()).done;){var v=s.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var w=b.value;p.includes(w)||d.push(w)}if(f.size){if(Array.isArray(e)&&m.length){var k="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var S=new Error(k);throw S.status=400,S}console.warn(k)}var E=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(E||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),E&&(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(u),null,2);if(!(p.length>=4&&E||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=u.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(u,e)){var t=a.schema[e];u[e]=r(u[e],u,e,t,i,o)}})),i(this,u,u,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],u=o[1],s=o[2];return[this.fromJS(a.toObject()),u,s]}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),u=a[0],s=a[1],p=a[2];s||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==u&&(h[t]=u)})),[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}(w);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var E=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 Date.prototype.toString.call(Reflect.construct(Date,[],(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,s)}return null===e?[e,!0,!1]:S(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var u=i(e,n);if(u===E)return[void 0,!0,!0];if("object"!=typeof u||null===u)return[u,!1,!1];void 0===o[n.key]&&(o[n.key]={});var s=!0,c=!1;if(!o[n.key][e]){var f=[u],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(u)?u:n.fromJS(u);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],s=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],s,c]}(e,r,s,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,s):[e,!0,!1]}var u=[],s=M(a,u);return function(e,t){u.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(u)?[r.get(u),n[1],n[2]]:(r.set(u,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);return i[0]&&r&&S(r)&&t.push(i[0]),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}(u),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,u){var s,c=e[n];return null!=c?Object.assign({},t,((s={})[n]=a.normalizeValue(c,e,n,r,i,o),s)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var u,s=e[a],c=n.denormalizeValue(s,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((u={})[a]=f,u))}),{}),r,i]},t}(u),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),u=a.pk(t,n);return i(this._entity,E,a,t,n),u},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}(),R=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),U=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);e.DELETED=E,e.Entity=k,e.FlatEntity=U,e.SimpleRecord=w,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),"production"!==process.env.NODE_ENV&&void 0===t)throw new Error("schema needed");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=S,e.normalize=function(e,t,n,r){void 0===n&&(n={});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={},u=function(e,t,n,r){return function(r,i,o,a,u){var s=r.key,c=r.pk(o,a,u);s in e||(e[s]={});var f=e[s][c];if(e[s][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[s][c];s in t||(t[s]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[s]||(t[s][d]={});var m=t[s][d];f&&delete m[f[d]],n[s]&&n[s][c]&&n[s][c][d]!==l[d]&&(m[n[s][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:P(e,e,void 0,t,u,{})}},e.schema=R,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@rest-hooks/normalizr",
"version": "6.0.1",
"version": "6.0.2",
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications",

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

"dependencies": {
"@babel/runtime": "^7.12.0"
"@babel/runtime": "^7.7.2"
},
"gitHead": "a031da2ace9ba826dd1acc50b50cec4d42cc6a85"
"gitHead": "369b160447e065fa1bcf12268b94ac25751c0e34"
}
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