ba-js-common-header 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14169,7 +14169,7 @@ function makeServer() {
14169
14169
  this.passthrough("https://exceptions.hubspot.com/**");
14170
14170
  this.passthrough("https://api.hubspot.com/**");
14171
14171
  this.passthrough("https://forms.hubspot.com/**");
14172
- this.passthrough("/hotel_admin/json/**");
14172
+ this.passthrough("/hotel_admin/json/title_bar.jsp");
14173
14173
  }
14174
14174
  });
14175
14175
  }
@@ -23,7 +23,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
23
23
  relationships are defined, and create a serializer for the parent
24
24
  model, adding the relationships there.`),a.map(function(u){return u.all()})}}]),r}(Aa),_A=function(e){xn(r,e);var t=Cn(r);function r(){return vt(this,r),t.apply(this,arguments)}return xt(r,[{key:"handleStringShorthand",value:function(i,a){var o=this.shorthand,s=Te(o);Re(a,"The route handler for ".concat(i.url," is trying to access the ").concat(s," model, but that model doesn't exist."));var u=this._getAttrsForRequest(i,a.camelizedModelName);return a.create(u)}}]),r}(Aa),wA=function(e){xn(r,e);var t=Cn(r);function r(){return vt(this,r),t.apply(this,arguments)}return xt(r,[{key:"handleStringShorthand",value:function(i,a){var o=this.shorthand,s=Te(o);Re(a,"The route handler for ".concat(i.url," is trying to access the ").concat(s," model, but that model doesn't exist."));var u=this._getIdForRequest(i),f=a.find(u);if(!f)return new gn(404);var p=this._getAttrsForRequest(i,a.camelizedModelName);return f.update(p)}}]),r}(Aa),OA=function(e){xn(r,e);var t=Cn(r);function r(){return vt(this,r),t.apply(this,arguments)}return xt(r,[{key:"handleStringShorthand",value:function(i,a){var o=this.shorthand,s=Te(o);Re(a,"The route handler for ".concat(i.url," is trying to access the ").concat(s," model, but that model doesn't exist."));var u=this._getIdForRequest(i),f=a.find(u);if(!f)return new gn(404);f.destroy()}},{key:"handleArrayShorthand",value:function(i,a){var o=this,s=this._getIdForRequest(i),u=a[0].find(s),f=a.slice(1).map(function(p){return o._container.inflector.pluralize(p.camelizedModelName)});f.forEach(function(p){return u[p].destroy()}),u.destroy()}}]),r}(Aa),SA=function(e){xn(r,e);var t=Cn(r);function r(){return vt(this,r),t.apply(this,arguments)}return xt(r,[{key:"handleStringShorthand",value:function(i,a){var o=this.shorthand,s=Te(o);Re(a,"The route handler for ".concat(i.url," is trying to access the ").concat(s," model, but that model doesn't exist."));var u=this._getIdForRequest(i);if(u){var f=a.find(u);return f?new gn(204):new gn(404)}else if(this.options.coalesce&&i.queryParams&&i.queryParams.ids){var p=a.find(i.queryParams.ids);return p?new gn(204):new gn(404)}else return new gn(204)}}]),r}(Aa),AA={get:200,put:204,post:201,delete:204};function PA(e){var t=e.verb,r=e.schema,n=e.serializerOrRegistry,i=e.path,a=e.rawHandler,o=e.options,s,u=[r,n,a,i,o],f=nr(a);return f==="function"?s=En(Yp,u):f==="object"&&a?s=En(vA,u):t==="get"?s=En(bA,u):t==="post"?s=En(_A,u):t==="put"||t==="patch"?s=En(wA,u):t==="delete"?s=En(OA,u):t==="head"&&(s=En(SA,u)),s}var Qp=function(){function e(t){var r=t.schema,n=t.verb,i=t.rawHandler,a=t.customizedCode,o=t.options,s=t.path,u=t.serializerOrRegistry;vt(this,e),this.verb=n,this.customizedCode=a,this.serializerOrRegistry=u,this.handler=PA({verb:n,schema:r,path:s,serializerOrRegistry:u,rawHandler:i,options:o})}return xt(e,[{key:"handle",value:function(r){var n=this;return this._getMirageResponseForRequest(r).then(function(i){return n.serialize(i,r)}).then(function(i){return i.toRackResponse()})}},{key:"_getMirageResponseForRequest",value:function(r){var n;try{this.handler instanceof Yp&&this.handler.setRequest(r),n=this.handler.handle(r)}catch(a){if(a instanceof Qo)n=new gn(500,{},a);else{var i=a.message||a;n=new gn(500,{},{message:i,stack:"Mirage: Your ".concat(r.method," handler for the url ").concat(r.url,` threw an error:
25
25
 
26
- `).concat(a.stack||a)})}}return this._toMirageResponse(n)}},{key:"_toMirageResponse",value:function(r){var n=this,i;return new Promise(function(a,o){Promise.resolve(r).then(function(s){if(s instanceof gn)i=r;else{var u=n._getCodeForResponse(s);i=new gn(u,{},s)}a(i)}).catch(o)})}},{key:"_getCodeForResponse",value:function(r){var n;return this.customizedCode?n=this.customizedCode:(n=AA[this.verb],n===204&&r!==void 0&&r!==""&&(n=200)),n}},{key:"serialize",value:function(r,n){return r.data=this.serializerOrRegistry.serialize(r.data,n),r}}]),e}();function Jp(e,t){var r=function(n){xn(a,n);var i=Cn(a);function a(){var o;vt(this,a);for(var s=arguments.length,u=new Array(s),f=0;f<s;f++)u[f]=arguments[f];if(o=i.call.apply(i,[this].concat(u)),e&&n2(e,"constructor")){var p;(p=e.constructor).call.apply(p,[Kp(o)].concat(u))}return o}return a}(this);return Object.assign(r,this,t),e&&Object.assign(r.prototype,e),r}var Xo=function(){function e(t,r,n,i){var a=this;return vt(this,e),Re(t,"A model requires a schema"),Re(r,"A model requires a modelName"),this._schema=t,this.modelName=r,this.fks=i||[],this.attrs={},n=n||{},this.fks.forEach(function(o){a.attrs[o]=n[o]!==void 0?n[o]:null}),Object.keys(n).forEach(function(o){var s=n[o];a._validateAttr(o,s),a._setupAttr(o,s),a._setupRelationship(o,s)}),this}return xt(e,[{key:"save",value:function(){var r=this._schema.toInternalCollectionName(this.modelName);return this.isNew()?(this.attrs=this._schema.db[r].insert(this.attrs),this._definePlainAttribute("id")):(this._schema.isSaving[this.toString()]=!0,this._schema.db[r].update(this.attrs.id,this.attrs)),this._saveAssociations(),this._schema.isSaving[this.toString()]=!1,this}},{key:"update",value:function(r,n){var i;return r==null?this:(nr(r)==="object"?i=r:(i={})[r]=n,Object.keys(i).forEach(function(a){!this.associationKeys.has(a)&&!this.associationIdKeys.has(a)&&this._definePlainAttribute(a),this[a]=i[a]},this),this.save(),this)}},{key:"destroy",value:function(){if(this.isSaved()){this._disassociateFromDependents();var r=this._schema.toInternalCollectionName(this.modelName);this._schema.db[r].remove(this.attrs.id)}}},{key:"isNew",value:function(){var r=!1,n=this.attrs.id!==void 0&&this.attrs.id!==null;if(n){var i=this._schema.toInternalCollectionName(this.modelName),a=this._schema.db[i].find(this.attrs.id);a&&(r=!0)}return!r}},{key:"isSaved",value:function(){return!this.isNew()}},{key:"reload",value:function(){if(this.id){var r=this._schema.toInternalCollectionName(this.modelName),n=this._schema.db[r].find(this.id);Object.keys(n).filter(function(i){return i!=="id"}).forEach(function(i){this.attrs[i]=n[i]},this)}return this._tempAssociations={},this}},{key:"toJSON",value:function(){return aA({},this.attrs)}},{key:"associations",get:function(){return this._schema.associationsFor(this.modelName)}},{key:"associationFor",value:function(r){return this.associations[r]}},{key:"inverseFor",value:function(r){return this._explicitInverseFor(r)||this._implicitInverseFor(r)}},{key:"_explicitInverseFor",value:function(r){this._checkForMultipleExplicitInverses(r);var n=this._schema.associationsFor(this.modelName),i=r.opts.inverse,a=i?n[i]:null,o=a&&a.isPolymorphic,s=a&&a.modelName===r.ownerModelName,u=a&&a.opts.inverse;return u&&a.opts.inverse!==r.name&&Re(!1,"You specified an inverse of ".concat(i," for ").concat(r.name,", but it does not match ").concat(a.modelName," ").concat(a.name,"'s inverse")),o||s?a:null}},{key:"_checkForMultipleExplicitInverses",value:function(r){var n=this._schema.associationsFor(this.modelName),i=Object.keys(n).filter(function(a){var o=n[a],s=r.ownerModelName===o.modelName,u=r.name===o.opts.inverse;return s&&u});Re(i.length<=1,"The ".concat(this.modelName," model has defined multiple explicit inverse associations for the ").concat(r.ownerModelName,".").concat(r.name," association."))}},{key:"_implicitInverseFor",value:function(r){var n=this,i=this._schema.associationsFor(this.modelName),a=r.ownerModelName;return yc(i).filter(function(o){return o.modelName===a}).reduce(function(o,s){var u=s.opts.inverse,f=u===void 0,p=u===r.name,d=f||p;return d&&(Re(!o,"The ".concat(n.modelName," model has multiple possible inverse associations for the ").concat(r.ownerModelName,".").concat(r.name," association.")),o=s),o},null)}},{key:"hasInverseFor",value:function(r){return!!this.inverseFor(r)}},{key:"alreadyAssociatedWith",value:function(r,n){var i=this[n.name];if(i&&r)return i instanceof e?i.isSaved()&&r.isSaved()?i.toString()===r.toString():i===r:i.includes(r)}},{key:"associate",value:function(r,n){if(!this.alreadyAssociatedWith(r,n)){var i=n.name;n instanceof Sa?this[i].includes(r)||this[i].add(r):this[i]=r}}},{key:"disassociate",value:function(r,n){var i=n.getForeignKey();if(n instanceof Sa){var a;if(n.isPolymorphic){var o=this[i].find(function(s){var u=s.type,f=s.id;return u===r.modelName&&f===r.id});a=o&&this[i].indexOf(o)}else a=this[i].map(function(s){return s.toString()}).indexOf(r.id.toString());a>-1&&this.attrs[i].splice(a,1)}else this.attrs[i]=null}},{key:"isSaving",get:function(){return this._schema.isSaving[this.toString()]}},{key:"_setupAttr",value:function(r,n){var i=this.associationKeys.has(r)||this.associationIdKeys.has(r);i||(this.attrs[r]=n,this._definePlainAttribute(r))}},{key:"_definePlainAttribute",value:function(r){var n=Object.getOwnPropertyDescriptor(this,r);n&&n.get||(Object.prototype.hasOwnProperty.call(this.attrs,r)||(this.attrs[r]=null),Object.defineProperty(this,r,{get:function(){return this.attrs[r]},set:function(a){this.attrs[r]=a}}))}},{key:"_setupRelationship",value:function(r,n){var i=this.associationIdKeys.has(r)||this.fks.includes(r),a=this.associationKeys.has(r);i&&(n!=null&&this._validateForeignKeyExistsInDatabase(r,n),this.attrs[r]=n),a&&(this[r]=n)}},{key:"_validateAttr",value:function(r,n){if(this.associationKeys.has(r)){var i=this.associationFor(r),a=n===null;if(i instanceof Sa){var o=n instanceof Vn||n instanceof an,s=Array.isArray(n)&&n.every(function(A){return A instanceof e});Re(o||s||a,"You're trying to create a ".concat(this.modelName,' model and you passed in "').concat(n,'" under the ').concat(r," key, but that key is a HasMany relationship. You must pass in a Collection, PolymorphicCollection, array of Models, or null."))}else i instanceof Oa&&Re(n instanceof e||a,"You're trying to create a ".concat(this.modelName,' model and you passed in "').concat(n,'" under the ').concat(r," key, but that key is a BelongsTo relationship. You must pass in a Model or null."))}if(this.associationIdKeys.has(r)&&r.endsWith("Ids")){var u=Array.isArray(n),f=n===null;Re(u||f,"You're trying to create a ".concat(this.modelName,' model and you passed in "').concat(n,'" under the ').concat(r," key, but that key is a foreign key for a HasMany relationship. You must pass in an array of ids or null."))}{var p=n instanceof e||n instanceof Vn||n instanceof an,d=Array.isArray(n)&&n.length&&n.every(function(A){return A instanceof e});if(p||d){var y=n;Re(this.associationKeys.has(r),"You're trying to create a ".concat(this.modelName," model and you passed in a ").concat(y.toString()," under the ").concat(r," key, but you haven't defined that key as an association on your model."))}}}},{key:"_validateForeignKeyExistsInDatabase",value:function(r,n){var i=this;if(Array.isArray(n)){var a=this.hasManyAssociationFks[r],o;a.isPolymorphic?(o=n.map(function(d){var y=d.type,A=d.id;return i._schema.db[i._schema.toInternalCollectionName(y)].find(A)}),o=jo(o)):o=this._schema.db[this._schema.toInternalCollectionName(a.modelName)].find(n);var s=a.isPolymorphic?n.map(function(d){return"".concat(d.type,":").concat(d.id)}).join(","):n;Re(o.length===n.length,"You're instantiating a ".concat(this.modelName," that has a ").concat(r," of ").concat(s,", but some of those records don't exist in the database."))}else{var u=this.belongsToAssociationFks[r],f;u.isPolymorphic?f=this._schema.db[this._schema.toInternalCollectionName(n.type)].find(n.id):f=this._schema.db[this._schema.toInternalCollectionName(u.modelName)].find(n);var p=u.isPolymorphic?"".concat(n.type,":").concat(n.id):n;Re(f,"You're instantiating a ".concat(this.modelName," that has a ").concat(r," of ").concat(p,", but that record doesn't exist in the database."))}}},{key:"_saveAssociations",value:function(){this._saveBelongsToAssociations(),this._saveHasManyAssociations()}},{key:"_saveBelongsToAssociations",value:function(){var r=this;yc(this.belongsToAssociations).forEach(function(n){r._disassociateFromOldInverses(n),r._saveNewAssociates(n),r._associateWithNewInverses(n)})}},{key:"_saveHasManyAssociations",value:function(){var r=this;yc(this.hasManyAssociations).forEach(function(n){r._disassociateFromOldInverses(n),r._saveNewAssociates(n),r._associateWithNewInverses(n)})}},{key:"_disassociateFromOldInverses",value:function(r){r instanceof Sa?this._disassociateFromHasManyInverses(r):r instanceof Oa&&this._disassociateFromBelongsToInverse(r)}},{key:"_disassociateFromHasManyInverses",value:function(r){var n=this,i=r.getForeignKey(),a=this._tempAssociations&&this._tempAssociations[r.name],o=this.attrs[i];if(a&&o){var s;r.isPolymorphic?s=o.map(function(u){var f=u.type,p=u.id;return n._schema[n._schema.toCollectionName(f)].find(p)}):s=this._schema[this._schema.toCollectionName(r.modelName)].find(o||[]).models,s.filter(function(u){return!u.isSaving&&!a.includes(u)&&u.hasInverseFor(r)}).forEach(function(u){var f=u.inverseFor(r);u.disassociate(n,f),u.save()})}}},{key:"_disassociateFromBelongsToInverse",value:function(r){var n=r.getForeignKey(),i=this._tempAssociations&&this._tempAssociations[r.name],a=this.attrs[n];if(i!==void 0&&a){var o;if(r.isPolymorphic?o=this._schema[this._schema.toCollectionName(a.type)].find(a.id):o=this._schema[this._schema.toCollectionName(r.modelName)].find(a),o.hasInverseFor(r)){var s=o.inverseFor(r);o.disassociate(this,s),o._updateInDb(o.attrs)}}}},{key:"_disassociateFromDependents",value:function(){var r=this;this._schema.dependentAssociationsFor(this.modelName).forEach(function(n){n.disassociateAllDependentsFromTarget(r)})}},{key:"_saveNewAssociates",value:function(r){var n=r.getForeignKey(),i=this._tempAssociations&&this._tempAssociations[r.name];if(i!==void 0){if(this.__isSavingNewChildren=!0,delete this._tempAssociations[r.name],i instanceof Vn)i.models.filter(function(o){return!o.isSaving}).forEach(function(o){o.save()}),this._updateInDb(rn({},n,i.models.map(function(o){return o.id})));else if(i instanceof an)i.models.filter(function(o){return!o.isSaving}).forEach(function(o){o.save()}),this._updateInDb(rn({},n,i.models.map(function(o){return{type:o.modelName,id:o.id}})));else if(i===null)this._updateInDb(rn({},n,null));else if(this.equals(i))this._updateInDb(rn({},n,this.id));else if(!i.isSaving){i.save(),this._syncTempAssociations(i);var a;r.isPolymorphic?a={id:i.id,type:i.modelName}:a=i.id,this._updateInDb(rn({},n,a))}this.__isSavingNewChildren=!1}}},{key:"_associateWithNewInverses",value:function(r){var n=this;if(!this.__isSavingNewChildren){var i=this[r.name];i instanceof e?this._associateModelWithInverse(i,r):(i instanceof Vn||i instanceof an)&&i.models.forEach(function(a){n._associateModelWithInverse(a,r)}),delete this._tempAssociations[r.name]}}},{key:"_associateModelWithInverse",value:function(r,n){var i=this;if(r.hasInverseFor(n)){var a=r.inverseFor(n),o=a.getForeignKey(),s=this.id;if(a instanceof Oa){var u;a.isPolymorphic?u={type:this.modelName,id:s}:u=s,this._schema.db[this._schema.toInternalCollectionName(r.modelName)].update(r.id,rn({},o,u))}else{var f=this._schema.db[this._schema.toInternalCollectionName(r.modelName)],p=f.find(r.id)[a.getForeignKey()]||[],d=Object.assign([],p),y,A;a.isPolymorphic?(y={type:this.modelName,id:s},A=d.some(function(P){return P.type==i.modelName&&P.id==s})):(y=s,A=d.includes(s)),A||d.push(y),f.update(r.id,rn({},o,d))}}}},{key:"_updateInDb",value:function(r){this.attrs=this._schema.db[this._schema.toInternalCollectionName(this.modelName)].update(this.attrs.id,r)}},{key:"_syncTempAssociations",value:function(r){var n=this;Object.keys(this._tempAssociations).forEach(function(i){n._tempAssociations[i]&&n._tempAssociations[i].toString()===r.toString()&&(n._tempAssociations[i]=r)})}},{key:"toString",value:function(){var r=this.id?"(".concat(this.id,")"):"";return"model:".concat(this.modelName).concat(r)}},{key:"equals",value:function(r){return this.toString()===r.toString()}}]),e}();Xo.extend=Jp,Xo.findBelongsToAssociation=function(e){return this.prototype.belongsToAssociations[e]};var Yn=function(){function e(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};vt(this,e),this.registry=t,this.type=r,this.request=n,this.attrs=this.attrs||void 0,this.include=this.include||[],this.root=this.root||void 0,this.embed=this.embed||void 0,this.serializeIds=this.serializeIds||void 0}return xt(e,[{key:"serialize",value:function(r){return this.primaryResource=r,this.buildPayload(r)}},{key:"normalize",value:function(r){return r}},{key:"buildPayload",value:function(r,n,i,a){if(!r&&vc(n))return a;if(r){var o=this.getHashForPrimaryResource(r),s=nn(o,2),u=s[0],f=s[1],p=this.isCollection(r)?r.models:[r];return this.buildPayload(void 0,f,p,u)}else{var d=n.shift(),y=this.getHashForIncludedResource(d),A=nn(y,2),P=A[0],C=A[1],v=C.filter(function(M){return!i.map(function(L){return L.toString()}).includes(M.toString())}).concat(n),I=(this.isCollection(d)?d.models:[d]).concat(i),T=this.mergePayloads(a,P);return this.buildPayload(void 0,v,I,T)}}},{key:"getHashForPrimaryResource",value:function(r){var n=this.getHashForResource(r),i=nn(n,2),a=i[0],o=i[1],s;if(this.root){Re(!(r instanceof an),"The base Serializer class cannot serialize a top-level PolymorphicCollection when root is true, since PolymorphicCollections have no type.");var u=this.serializerFor(r.modelName),f=u.keyForResource(r);s=rn({},f,a)}else s=a;return[s,o]}},{key:"getHashForIncludedResource",value:function(r){var n,i;if(r instanceof an)n={},i=r.models;else{var a=this.serializerFor(r.modelName),o=a.getHashForResource(r),s=nn(o,2),u=s[0],f=s[1],p=a.keyForRelationship(r.modelName);n=Array.isArray(u)?rn({},p,u):rn({},p,[u]),i=f}return[n,i]}},{key:"getHashForResource",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s,u;if(o||(u=this),o&&r.modelName&&(u=this.serializerFor(r.modelName)),this.isModel(r)?s=u._hashForModel(r,i,a):s=r.models.map(function(p){var d=u;return d||(d=n.serializerFor(p.modelName)),d._hashForModel(p,i,a)}),this.embed)return[s,[]];var f=bp(jo(Dd(u.getKeysForIncluded().map(function(p){return n.isCollection(r)?r.models.map(function(d){return d[p]}):r[p]}))),function(p){return p.toString()});return[s,f]}},{key:"mergePayloads",value:function(r,n){var i,a=Object.keys(n),o=nn(a,1),s=o[0];return r[s]?(i=r,i[s]=r[s].concat(n[s])):i=Object.assign(r,n),i}},{key:"keyForResource",value:function(r){var n=r.modelName;return this.isModel(r)?this.keyForModel(n):this.keyForCollection(n)}},{key:"keyForModel",value:function(r){return Te(r)}},{key:"keyForCollection",value:function(r){return this._container.inflector.pluralize(this.keyForModel(r))}},{key:"_hashForModel",value:function(r,n){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=this._attrsForModel(r);if(n&&r.fks.forEach(function(u){delete o[u]}),this.embed){var s=Object.assign({},a);return s[r.modelName]=s[r.modelName]||{},s[r.modelName][r.id]=!0,this.getKeysForIncluded().forEach(function(u){var f=r[u];if(f&&!vp(s,"".concat(f.modelName,".").concat(f.id))){var p=i.getHashForResource(f,!0,s,!0),d=nn(p,1),y=d[0],A=i.keyForEmbeddedRelationship(u);if(o[A]=y,i.isModel(f)){var P="".concat(Te(u),"Id");delete o[P]}}}),o}else return this._maybeAddAssociationIds(r,o)}},{key:"_attrsForModel",value:function(r){var n={};return this.attrs?n=this.attrs.reduce(function(i,a){return i[a]=r[a],i},{}):n=Object.assign(n,r.attrs),r.fks.forEach(function(i){return delete n[i]}),this._formatAttributeKeys(n)}},{key:"_maybeAddAssociationIds",value:function(r,n){var i=this,a=Object.assign({},n);return this.serializeIds==="always"?r.associationKeys.forEach(function(o){var s=r[o],u=r.associationFor(o);if(i.isCollection(s)){var f=i.keyForRelationshipIds(o);a[f]=r["".concat(i._container.inflector.singularize(o),"Ids")]}else if(i.isModel(s)&&u.isPolymorphic){var p=i.keyForPolymorphicForeignKeyType(o),d=i.keyForPolymorphicForeignKeyId(o);a[p]=r["".concat(o,"Id")].type,a[d]=r["".concat(o,"Id")].id}else if(s){var y=i.keyForForeignKey(o);a[y]=r["".concat(o,"Id")]}}):this.serializeIds==="included"&&this.getKeysForIncluded().forEach(function(o){var s=r[o],u=r.associationFor(o);if(i.isCollection(s)){var f=i.keyForRelationshipIds(o);a[f]=r["".concat(i._container.inflector.singularize(o),"Ids")]}else if(i.isModel(s)&&u.isPolymorphic){var p=i.keyForPolymorphicForeignKeyType(o),d=i.keyForPolymorphicForeignKeyId(o);a[p]=r["".concat(o,"Id")].type,a[d]=r["".concat(o,"Id")].id}else if(i.isModel(s)){var y=i.keyForForeignKey(o);a[y]=r["".concat(o,"Id")]}}),a}},{key:"keyForAttribute",value:function(r){return r}},{key:"keyForRelationship",value:function(r){return Te(this._container.inflector.pluralize(r))}},{key:"keyForEmbeddedRelationship",value:function(r){return Te(r)}},{key:"keyForRelationshipIds",value:function(r){return"".concat(this._container.inflector.singularize(Te(r)),"Ids")}},{key:"keyForForeignKey",value:function(r){return"".concat(Te(r),"Id")}},{key:"keyForPolymorphicForeignKeyId",value:function(r){return"".concat(Te(r),"Id")}},{key:"keyForPolymorphicForeignKeyType",value:function(r){return"".concat(Te(r),"Type")}},{key:"isModel",value:function(r){return r instanceof Xo}},{key:"isCollection",value:function(r){return r instanceof Vn||r instanceof an}},{key:"isModelOrCollection",value:function(r){return this.isModel(r)||this.isCollection(r)}},{key:"serializerFor",value:function(r){return this.registry.serializerFor(r)}},{key:"getKeysForIncluded",value:function(){return A1(this.include)?this.include(this.request,this.primaryResource):this.include}},{key:"schema",get:function(){return this.registry.schema}},{key:"_formatAttributeKeys",value:function(r){var n={};for(var i in r){var a=this.keyForAttribute(i);n[a]=r[i]}return n}},{key:"getCoalescedIds",value:function(){}}]),e}();Yn.prototype.include=[],Yn.prototype.root=!0,Yn.prototype.embed=!1,Yn.prototype.serializeIds="included",Yn.extend=Jp;var Xp=function(e){xn(r,e);var t=Cn(r);function r(){var n;return vt(this,r),n=t.apply(this,arguments),n.alwaysIncludeLinkageData=n.alwaysIncludeLinkageData||void 0,n}return xt(r,[{key:"keyForModel",value:function(i){return Ot(i)}},{key:"keyForCollection",value:function(i){return Ot(i)}},{key:"keyForAttribute",value:function(i){return Ot(i)}},{key:"keyForRelationship",value:function(i){return Ot(i)}},{key:"links",value:function(){}},{key:"getHashForPrimaryResource",value:function(i){this._createRequestedIncludesGraph(i);var a=this.getHashForResource(i),o={data:a},s=this.getAddToIncludesForResource(i);return[o,s]}},{key:"getHashForIncludedResource",value:function(i){var a=this.serializerFor(i.modelName),o=a.getHashForResource(i),s={included:this.isModel(i)?[o]:o},u=[];return this.hasQueryParamIncludes()||(u=this.getAddToIncludesForResource(i)),[s,u]}},{key:"getHashForResource",value:function(i){var a=this,o;return this.isModel(i)?o=this.getResourceObjectForModel(i):o=i.models.map(function(s){return a.getResourceObjectForModel(s)}),o}},{key:"getAddToIncludesForResource",value:function(i){var a;if(this.hasQueryParamIncludes())a=this.request.queryParams.include.split(",");else{var o=this.serializerFor(i.modelName);a=o.getKeysForIncluded()}return this.getAddToIncludesForResourceAndPaths(i,a)}},{key:"getAddToIncludesForResourceAndPaths",value:function(i,a){var o=this,s=[];return a.forEach(function(u){var f=u.split("."),p=o.getIncludesForResourceAndPath.apply(o,[i].concat(Vo(f)));s.push(p)}),bp(jo(Dd(s)),function(u){return u.toString()})}},{key:"getIncludesForResourceAndPath",value:function(i){for(var a=this,o=arguments.length,s=new Array(o>1?o-1:0),u=1;u<o;u++)s[u-1]=arguments[u];var f=Te(s.shift()),p=[],d=[];if(this.isModel(i)){var y=i[f];this.isModel(y)?d=[y]:this.isCollection(y)&&(d=y.models)}else i.models.forEach(function(A){var P=A[f];a.isModel(P)?d.push(P):a.isCollection(P)&&(d=d.concat(P.models))});return p=p.concat(d),s.length&&d.forEach(function(A){p=p.concat(a.getIncludesForResourceAndPath.apply(a,[A].concat(s)))}),p}},{key:"getResourceObjectForModel",value:function(i){var a=this._attrsForModel(i,!0);delete a.id;var o={type:this.typeKeyForModel(i),id:i.id,attributes:a};return this._maybeAddRelationshipsToResourceObjectForModel(o,i)}},{key:"_maybeAddRelationshipsToResourceObjectForModel",value:function(i,a){var o=this,s={};return a.associationKeys.forEach(function(u){var f=a[u],p=o.keyForRelationship(u),d={};if(o.hasLinksForRelationship(a,u)){var y=o.serializerFor(a.modelName),A=y.links(a);d.links=A[u]}if(o.alwaysIncludeLinkageData||o.shouldIncludeLinkageData(u,a)||o._relationshipIsIncludedForModel(u,a)){var P=null;o.isModel(f)?P={type:o.typeKeyForModel(f),id:f.id}:o.isCollection(f)&&(P=f.models.map(function(C){return{type:o.typeKeyForModel(C),id:C.id}})),d.data=P}vc(d)||(s[p]=d)}),vc(s)||(i.relationships=s),i}},{key:"hasLinksForRelationship",value:function(i,a){var o=this.serializerFor(i.modelName),s=o.links&&o.links(i);return s&&s[a]!=null}},{key:"_relationshipIsIncludedForModel",value:function(i,a){if(this.hasQueryParamIncludes()){var o=this.request._includesGraph,s=this._graphKeyForModel(a),u;return o.data[s]?u=o.data[s]:o.included[this._container.inflector.pluralize(a.modelName)]&&(u=o.included[this._container.inflector.pluralize(a.modelName)][s]),u&&u.relationships&&Object.prototype.hasOwnProperty.call(u.relationships,Ot(i))}else{var f=this.getKeysForIncluded();return f.includes(i)}}},{key:"_createRequestedIncludesGraph",value:function(i){var a=this,o={data:{}};if(this.isModel(i)){var s=this._graphKeyForModel(i);o.data[s]={},this._addPrimaryModelToRequestedIncludesGraph(o,i)}else this.isCollection(i)&&i.models.forEach(function(u){var f=a._graphKeyForModel(u);o.data[f]={},a._addPrimaryModelToRequestedIncludesGraph(o,u)});this.request._includesGraph=o}},{key:"_addPrimaryModelToRequestedIncludesGraph",value:function(i,a){var o=this;if(this.hasQueryParamIncludes()){var s=this._graphKeyForModel(a),u=this.getQueryParamIncludes();u.split(",").filter(function(f){return!!f.trim()}).forEach(function(f){i.data[s].relationships=i.data[s].relationships||{};var p=f.split(".").map(Ot),d=p[0],y=d,A=Te(d),P=a.associationKeys.has(A);Re(P,'You tried to include "'.concat(d,'" with ').concat(a,' but no association named "').concat(A,'" is defined on the model.'));var C=a[A],v;o.isModel(C)?v=o._graphKeyForModel(C):o.isCollection(C)?v=C.models.map(o._graphKeyForModel):v=null,i.data[s].relationships[y]=v,C&&o._addResourceToRequestedIncludesGraph(i,C,p.slice(1))})}}},{key:"_addResourceToRequestedIncludesGraph",value:function(i,a,o){var s=this;i.included=i.included||{};var u=this.isCollection(a)?a.models:[a];u.forEach(function(f){var p=s._container.inflector.pluralize(f.modelName);i.included[p]=i.included[p]||{},s._addModelToRequestedIncludesGraph(i,f,o)})}},{key:"_addModelToRequestedIncludesGraph",value:function(i,a,o){var s=this._container.inflector.pluralize(a.modelName),u=this._graphKeyForModel(a);i.included[s][u]=i.included[s][u]||{},o.length&&this._addResourceRelationshipsToRequestedIncludesGraph(i,s,u,a,o)}},{key:"_addResourceRelationshipsToRequestedIncludesGraph",value:function(i,a,o,s,u){i.included[a][o].relationships=i.included[a][o].relationships||{};var f=u[0],p=s[Te(f)],d;this.isModel(p)?d=this._graphKeyForModel(p):this.isCollection(p)&&(d=p.models.map(this._graphKeyForModel)),i.included[a][o].relationships[f]=d,p&&this._addResourceToRequestedIncludesGraph(i,p,u.slice(1))}},{key:"_graphKeyForModel",value:function(i){return"".concat(i.modelName,":").concat(i.id)}},{key:"getQueryParamIncludes",value:function(){return vp(this,"request.queryParams.include")}},{key:"hasQueryParamIncludes",value:function(){return!!this.getQueryParamIncludes()}},{key:"typeKeyForModel",value:function(i){return Ot(this._container.inflector.pluralize(i.modelName))}},{key:"getCoalescedIds",value:function(i){var a=i.queryParams&&i.queryParams["filter[id]"];return typeof a=="string"?a.split(","):a}},{key:"shouldIncludeLinkageData",value:function(i,a){return!1}}]),r}(Yn);Xp.prototype.alwaysIncludeLinkageData=!1;var Zp=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.schema=t,this._serializerMap=r}return xt(e,[{key:"normalize",value:function(r,n){return this.serializerFor(n).normalize(r)}},{key:"serialize",value:function(r,n){var i=this;if(this.request=n,this._isModelOrCollection(r)){var a=this.serializerFor(r.modelName);return a.serialize(r,n)}else return Array.isArray(r)&&r.some(this._isCollection)?r.reduce(function(o,s){var u=i.serializerFor(s.modelName);return u.embed?o[i._container.inflector.pluralize(s.modelName)]=u.serialize(s,n):o=Object.assign(o,u.serialize(s,n)),o},{}):r}},{key:"serializerFor",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.explicit,a=i===void 0?!1:i,o=r&&this._serializerMap&&this._serializerMap[Te(r)];return a?Re(!!o,"You passed in ".concat(r," as an explicit serializer type but that serializer doesn't exist.")):(o=o||this._serializerMap.application||Yn,Re(!o||o.prototype.embed||o.prototype.root||new o instanceof Xp,"You cannot have a serializer that sideloads (embed: false) and disables the root (root: false).")),new o(this,r,this.request)}},{key:"_isModel",value:function(r){return r instanceof Xo}},{key:"_isCollection",value:function(r){return r instanceof Vn||r instanceof an}},{key:"_isModelOrCollection",value:function(r){return this._isModel(r)||this._isCollection(r)}},{key:"registerSerializers",value:function(r){var n=this._serializerMap||{};this._serializerMap=Object.assign(n,r)}},{key:"getCoalescedIds",value:function(r,n){return this.serializerFor(n).getCoalescedIds(r)}}]),e}(),jc={},Lc={},zc={},eg=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),Re(t,"A schema requires a db"),this.db=t,this._registry={},this._dependentAssociations={polymorphic:[]},this.registerModels(r),this.isSaving={}}return xt(e,[{key:"registerModels",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};KO(n,function(i,a){r.registerModel(a,n[a])})}},{key:"registerModel",value:function(r,n){var i=this,a=Te(r),o=Ot(a);n=n.extend(),this._registry[a]=this._registry[a]||{class:null,foreignKeys:[]},this._registry[a].class=n,n.prototype._schema=this,n.prototype.modelName=o,n.prototype.hasManyAssociations={},n.prototype.hasManyAssociationFks={},n.prototype.belongsToAssociations={},n.prototype.belongsToAssociationFks={},n.prototype.associationKeys=new Set,n.prototype.associationIdKeys=new Set,n.prototype.dependentAssociations=[];var s={};for(var u in n.prototype)if(n.prototype[u]instanceof wa){var f=n.prototype[u];f.name=u,f.modelName=f.modelName||this.toModelName(u),f.ownerModelName=o,f.setSchema(this);var p=f.getForeignKeyArray(),d=nn(p,2),y=d[0],A=d[1];s[y]=s[y]||[],Re(!s[y].includes(A),"Your '".concat(r,"' model definition has multiple possible inverse relationships of type '").concat(y,"'. Please use explicit inverses.")),s[y].push(A),this._addForeignKeyToRegistry(y,A),f.addMethodsToModelClass(n,u)}var P=this.toCollectionName(o);return this.db[P]||this.db.createCollection(P),this[P]={camelizedModelName:a,new:function(v){return i.new(a,v)},create:function(v){return i.create(a,v)},all:function(v){return i.all(a,v)},find:function(v){return i.find(a,v)},findBy:function(v){return i.findBy(a,v)},findOrCreateBy:function(v){return i.findOrCreateBy(a,v)},where:function(v){return i.where(a,v)},none:function(v){return i.none(a,v)},first:function(v){return i.first(a,v)}},this}},{key:"modelFor",value:function(r){return this._registry[r]}},{key:"new",value:function(r,n){return this._instantiateModel(Ot(r),n)}},{key:"create",value:function(r,n){return this.new(r,n).save()}},{key:"all",value:function(r){var n=this.collectionForType(r);return this._hydrate(n,Ot(r))}},{key:"none",value:function(r){return this._hydrate([],Ot(r))}},{key:"find",value:function(r,n){var i=this.collectionForType(r),a=i.find(n);return Array.isArray(n)&&Re(a.length===n.length,"Couldn't find all ".concat(this._container.inflector.pluralize(r)," with ids: (").concat(n.join(","),") (found ").concat(a.length," results, but was looking for ").concat(n.length,")")),this._hydrate(a,Ot(r))}},{key:"findBy",value:function(r,n){var i=this.collectionForType(r),a=i.findBy(n);return this._hydrate(a,Ot(r))}},{key:"findOrCreateBy",value:function(r,n){var i=this.collectionForType(r),a=i.findBy(n),o;return a?o=this._hydrate(a,Ot(r)):o=this.create(r,n),o}},{key:"where",value:function(r,n){var i=this.collectionForType(r),a=i.where(n);return this._hydrate(a,Ot(r))}},{key:"first",value:function(r){var n=this.collectionForType(r),i=n[0];return this._hydrate(i,Ot(r))}},{key:"modelClassFor",value:function(r){var n=this._registry[Te(r)];return Re(n,"Model not registered: ".concat(r)),n.class.prototype}},{key:"addDependentAssociation",value:function(r,n){r.isPolymorphic?this._dependentAssociations.polymorphic.push(r):(this._dependentAssociations[n]=this._dependentAssociations[n]||[],this._dependentAssociations[n].push(r))}},{key:"dependentAssociationsFor",value:function(r){var n=this._dependentAssociations[r]||[],i=this._dependentAssociations.polymorphic||[];return n.concat(i)}},{key:"associationsFor",value:function(r){var n=this.modelClassFor(r);return Object.assign({},n.belongsToAssociations,n.hasManyAssociations)}},{key:"hasModelForModelName",value:function(r){return this.modelFor(Te(r))}},{key:"collectionForType",value:function(r){var n=this.toCollectionName(r);return Re(this.db[n],"You're trying to find model(s) of type ".concat(r," but this collection doesn't exist in the database.")),this.db[n]}},{key:"toCollectionName",value:function(r){if(typeof jc[r]!="string"){var n=Ot(r),i=Te(this._container.inflector.pluralize(n));jc[r]=i}return jc[r]}},{key:"toInternalCollectionName",value:function(r){if(typeof Lc[r]!="string"){var n="_".concat(this.toCollectionName(r));Lc[r]=n}return Lc[r]}},{key:"toModelName",value:function(r){if(typeof zc[r]!="string"){var n=Ot(r),i=this._container.inflector.singularize(n);zc[r]=i}return zc[r]}},{key:"_addForeignKeyToRegistry",value:function(r,n){this._registry[r]=this._registry[r]||{class:null,foreignKeys:[]};var i=this._registry[r].foreignKeys;i.includes(n)||i.push(n)}},{key:"_instantiateModel",value:function(r,n){var i=this._modelFor(r),a=this._foreignKeysFor(r);return new i(this,r,n,a)}},{key:"_modelFor",value:function(r){return this._registry[Te(r)].class}},{key:"_foreignKeysFor",value:function(r){return this._registry[Te(r)].foreignKeys}},{key:"_hydrate",value:function(r,n){if(Array.isArray(r)){var i=r.map(function(a){return this._instantiateModel(n,a)},this);return new Vn(n,i)}else return r?this._instantiateModel(n,r):null}}]),e}(),IA={Db:Vp,Association:wa,RouteHandler:Qp,BaseRouteHandler:Jo,Serializer:Yn,SerializerRegistry:Zp,Schema:eg},xA={singularize:ph,pluralize:hh},tg=function(){function e(){vt(this,e),this.inflector=xA}return xt(e,[{key:"register",value:function(r,n){this[r]=n}},{key:"create",value:function(r){var n=IA[r];n.prototype._container=this;for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];return En(n,a)}}]),e}(),Mi=new tg;Vp.prototype._container=Mi,wa.prototype._container=Mi,Jo.prototype._container=Mi,Qp.prototype._container=Mi,Yn.prototype._container=Mi,Zp.prototype._container=Mi,eg.prototype._container=Mi;var Hc={};function EA(e){if(typeof window!="undefined")return new To(function(){this.passthroughRequest=function(r,n,i){e.shouldLog()&&console.log("Mirage: Passthrough request for ".concat(r.toUpperCase()," ").concat(i.url))},this.handledRequest=function(r,n,i){if(e.shouldLog()){console.groupCollapsed("Mirage: [".concat(i.status,"] ").concat(r.toUpperCase()," ").concat(i.url));var a=i.requestBody,o=i.responseText,s,u;try{s=JSON.parse(a)}catch{s=a}try{u=JSON.parse(o)}catch{u=o}console.groupCollapsed("Response"),console.log(u),console.groupEnd(),console.groupCollapsed("Request (data)"),console.log(s),console.groupEnd(),console.groupCollapsed("Request (raw)"),console.log(i),console.groupEnd(),console.groupEnd()}};var t=this.checkPassthrough;this.checkPassthrough=function(r){var n=e.passthroughChecks.some(function(a){return a(r)});if(n){var i=r.url.includes("?")?r.url.substr(0,r.url.indexOf("?")):r.url;this[r.method.toLowerCase()](i,this.passthrough)}return t.apply(this,arguments)},this.unhandledRequest=function(r,n){n=decodeURI(n),Re("Your app tried to ".concat(r," '").concat(n,"', but there was no route defined to handle this request. Define a route for this endpoint in your routes() config. Did you forget to define a namespace?"))}},{trackRequests:e.shouldTrackRequests()})}var Uc={coalesce:!1,timing:void 0},CA={singularize:ph,pluralize:hh},RA=["http://localhost:0/chromecheckurl","http://localhost:30820/socket.io",function(e){return/.+\.hot-update.json$/.test(e.url)}];function TA(e){if(!e||nr(e)!=="object")return!1;for(var t=Object.keys(Uc),r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];if(t.indexOf(i)>-1)return!0}return!1}function MA(e){var t=e.splice(-1),r=nn(t,1),n=r[0];TA(n)?n=Ec({},Uc,n):(e.push(n),n=Uc);for(var i=2-e.length;i-- >0;)e.push(void 0);return e.push(n),e}function FA(e){return new $A(e)}var $A=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(this,e),this._container=new tg,this.config(t),this.db=this.db||void 0,this.schema=this.schema||void 0}return xt(e,[{key:"config",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.passthroughChecks=this.passthroughChecks||[];var n=r.environment&&this.environment&&this.environment!==r.environment;Re(!n,"You cannot modify Mirage's environment once the server is created"),this.environment=r.environment||this.environment||"development",r.routes&&(Re(!r.baseConfig,"The routes option is an alias for the baseConfig option. You can't pass both options into your server definition."),r.baseConfig=r.routes),r.seeds&&(Re(!r.scenarios,"The seeds option is an alias for the scenarios.default option. You can't pass both options into your server definition."),r.scenarios={default:r.seeds}),this._config=r,this.namespace=this.namespace||r.namespace||"",this.inflector=r.inflector||CA,this._container.register("inflector",this.inflector),this.urlPrefix=this.urlPrefix||r.urlPrefix||"",this.timing=this.timing||r.timing||400,this.logging=this.logging!==void 0?this.logging:void 0,this.testConfig=this.testConfig||void 0,this.trackRequests=r.trackRequests,this._defineRouteHandlerHelpers(),this.db?this.db.registerIdentityManagers(r.identityManagers):this.db=this._container.create("Db",void 0,r.identityManagers),this.schema?(this.schema.registerModels(r.models),this.serializerOrRegistry.registerSerializers(r.serializers||{})):(this.schema=this._container.create("Schema",this.db,r.models),this.serializerOrRegistry=this._container.create("SerializerRegistry",this.schema,r.serializers));var i=this._hasModulesOfType(r,"factories"),a=r.scenarios&&Object.prototype.hasOwnProperty.call(r.scenarios,"default"),o=r.trackRequests!==void 0&&this.pretender;Re(!o,"You cannot modify Pretender's request tracking once the server is created"),this.pretender=this.pretender||r.pretender||EA(this),r.baseConfig&&this.loadConfig(r.baseConfig),this.isTest()&&(r.testConfig&&this.loadConfig(r.testConfig),typeof window!="undefined"&&(window.server=this)),this.isTest()&&i?this.loadFactories(r.factories):!this.isTest()&&a?(this.loadFactories(r.factories),r.scenarios.default(this)):this.loadFixtures();var s=typeof r.useDefaultPassthroughs!="undefined"?r.useDefaultPassthroughs:!0;s&&this._configureDefaultPassthroughs()}},{key:"isTest",value:function(){return this.environment==="test"}},{key:"shouldLog",value:function(){return typeof this.logging!="undefined"?this.logging:!this.isTest()}},{key:"shouldTrackRequests",value:function(){return Boolean(this.trackRequests)}},{key:"loadConfig",value:function(r){r.call(this),this.timing=this.isTest()?0:this.timing||0}},{key:"passthrough",value:function(){for(var r=this,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];if(typeof window!="undefined"){var o=["get","post","put","delete","patch","options","head"],s=i[i.length-1];i.length===0?i=["/**","/"]:Array.isArray(s)&&(o=i.pop()),i.forEach(function(u){typeof u=="function"?r.passthroughChecks.push(u):o.forEach(function(f){var p=r._getFullPath(u);r.pretender[f](p,r.pretender.passthrough)})})}}},{key:"loadFixtures",value:function(){for(var r=this._config.fixtures,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];if(i.length){var o=i.map(Te),s=o.filter(function(u){return!r[u]});if(s.length)throw new Error("Fixtures not found: ".concat(s.join(", ")));r=_S.apply(void 0,[r].concat(Vo(o)))}this.db.loadData(r)}},{key:"loadFactories",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=this._factoryMap||{};this._factoryMap=Ec(i,n),Object.keys(n).forEach(function(a){var o=r.schema.toCollectionName(a);r.db.createCollection(o)})}},{key:"factoryFor",value:function(r){var n=Te(r);if(this._factoryMap&&this._factoryMap[n])return this._factoryMap[n]}},{key:"build",value:function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];var o=i.filter(function(C){return C&&typeof C=="string"}),s=Rc(i,function(C){return Iu(C)}),u=Te(r);this.factorySequences=this.factorySequences||{},this.factorySequences[u]=this.factorySequences[u]+1||0;var f=this.factoryFor(r);if(f){f=f.extend({});var p=f.attrs||{};this._validateTraits(o,f,r);var d=this._mergeExtensions(p,o,s);this._mapAssociationsFromAttributes(r,p,s),this._mapAssociationsFromAttributes(r,d);var y=f.extend(d),A=new y,P=this.factorySequences[u];return A.build(P)}else return s}},{key:"buildList",value:function(r,n){Re(Up(n),"second argument has to be an integer, you passed: ".concat(nr(n)));for(var i=[],a=arguments.length,o=new Array(a>2?a-2:0),s=2;s<a;s++)o[s-2]=arguments[s];for(var u=[r].concat(o),f=0;f<n;f++)i.push(this.build.apply(this,u));return i}},{key:"create",value:function(r){var n=this;Re(this._modelOrFactoryExistsForType(r),"You called server.create('".concat(r,"') but no model or factory was found. Make sure you're passing in the singularized version of the model or factory name."));for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];var s=a.filter(function(v){return v&&typeof v=="string"}),u=Rc(a,function(v){return Iu(v)}),f=Rc(a,function(v){return v&&Array.isArray(v)}),p=this.build.apply(this,[r].concat(Vo(s),[u])),d;if(this.schema&&this.schema[this.schema.toCollectionName(r)]){var y=this.schema[this.schema.toCollectionName(r)];d=y.create(p)}else{var A,P;f?A=f:(P=this.schema?this.schema.toInternalCollectionName(r):"_".concat(this.inflector.pluralize(r)),A=this.db[P]),Re(A,"You called server.create('".concat(r,"') but no model or factory was found.")),d=A.insert(p)}var C=this.factoryFor(r);return C&&C.extractAfterCreateCallbacks({traits:s}).forEach(function(v){v(d,n)}),d}},{key:"createList",value:function(r,n){Re(this._modelOrFactoryExistsForType(r),"You called server.createList('".concat(r,"') but no model or factory was found. Make sure you're passing in the singularized version of the model or factory name.")),Re(Up(n),"second argument has to be an integer, you passed: ".concat(nr(n)));for(var i=[],a=this.schema?this.schema.toInternalCollectionName(r):"_".concat(this.inflector.pluralize(r)),o=this.db[a],s=arguments.length,u=new Array(s>2?s-2:0),f=2;f<s;f++)u[f-2]=arguments[f];for(var p=[r].concat(u,[o]),d=0;d<n;d++)i.push(this.create.apply(this,p));return i}},{key:"shutdown",value:function(){typeof window!="undefined"&&this.pretender.shutdown(),typeof window!="undefined"&&this.environment==="test"&&(window.server=void 0)}},{key:"resource",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.only,o=i.except,s=i.path;if(r=this.inflector.pluralize(r),s=s||"/".concat(r),a=a||[],o=o||[],a.length>0&&o.length>0)throw"cannot use both :only and :except options";var u={index:{methods:["get"],path:"".concat(s)},show:{methods:["get"],path:"".concat(s,"/:id")},create:{methods:["post"],path:"".concat(s)},update:{methods:["put","patch"],path:"".concat(s,"/:id")},delete:{methods:["del"],path:"".concat(s,"/:id")}},f=Object.keys(u),p=a.length>0&&a||o.length>0&&f.filter(function(d){return o.indexOf(d)===-1})||f;p.forEach(function(d){var y=u[d];y.methods.forEach(function(A){return s===r?n[A](y.path):n[A](y.path,r)})})}},{key:"_defineRouteHandlerHelpers",value:function(){var r=this;[["get"],["post"],["put"],["delete","del"],["patch"],["head"],["options"]].forEach(function(n){var i=nn(n,2),a=i[0],o=i[1];r[a]=function(s){for(var u=arguments.length,f=new Array(u>1?u-1:0),p=1;p<u;p++)f[p-1]=arguments[p];var d=MA(f),y=nn(d,3),A=y[0],P=y[1],C=y[2];return r._registerRouteHandler(a,s,A,P,C)},o&&(r[o]=r[a])})}},{key:"_serialize",value:function(r){return typeof r=="string"?r:JSON.stringify(r)}},{key:"_registerRouteHandler",value:function(r,n,i,a,o){var s=this,u=this._container.create("RouteHandler",{schema:this.schema,verb:r,rawHandler:i,customizedCode:a,options:o,path:n,serializerOrRegistry:this.serializerOrRegistry}),f=this._getFullPath(n),p=o.timing!==void 0?o.timing:function(){return s.timing};if(this.pretender)return this.pretender[r](f,function(d){return u.handle(d).then(function(y){var A=nn(y,3),P=A[0],C=A[1],v=A[2];return[P,C,s._serialize(v)]})},p)}},{key:"_hasModulesOfType",value:function(r,n){var i=r[n];return i?Object.keys(i).length>0:!1}},{key:"_getFullPath",value:function(r){r=r[0]==="/"?r.slice(1):r;var n="",i=this.urlPrefix?this.urlPrefix.trim():"",a="";if(this.urlPrefix&&this.namespace&&(this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]==="/"&&(a=this.namespace.substring(0,this.namespace.length-1).substring(1)),this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a=this.namespace.substring(1)),this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]==="/"&&(a=this.namespace.substring(0,this.namespace.length-1)),this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a=this.namespace)),this.namespace&&!this.urlPrefix){if(this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]==="/"&&(a=this.namespace.substring(0,this.namespace.length-1)),this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a=this.namespace),this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]==="/"){var o=this.namespace.substring(0,this.namespace.length-1);a="/".concat(o)}this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a="/".concat(this.namespace))}return this.namespace||(a=""),/^https?:\/\//.test(r)?n+=r:(i.length&&(n+=i[i.length-1]==="/"?i:"".concat(i,"/")),n+=a,n[n.length-1]!=="/"&&(n+="/"),n+=r,/^https?:\/\//.test(n)||(n="/".concat(n),n=n.replace(/\/+/g,"/"))),n}},{key:"_configureDefaultPassthroughs",value:function(){var r=this;RA.forEach(function(n){r.passthrough(n)})}},{key:"_typeIsPluralForModel",value:function(r){if(typeof Hc[r]!="boolean"){var n=this._modelOrFactoryExistsForTypeOrCollectionName(r),i=r===this.inflector.pluralize(r),a=this.inflector.singularize(r)===this.inflector.pluralize(r),o=i&&!a&&n;Hc[r]=o}return Hc[r]}},{key:"_modelOrFactoryExistsForType",value:function(r){var n=this.schema&&this.schema.modelFor(Te(r)),i=this.db[this.schema.toInternalCollectionName(r)];return(n||i)&&!this._typeIsPluralForModel(r)}},{key:"_modelOrFactoryExistsForTypeOrCollectionName",value:function(r){var n=this.schema&&this.schema.modelFor(Te(r)),i=this.db[this.schema.toInternalCollectionName(r)];return n||i}},{key:"_validateTraits",value:function(r,n,i){r.forEach(function(a){if(!n.isTrait(a))throw new Error("'".concat(a,"' trait is not registered in '").concat(i,"' factory"))})}},{key:"_mergeExtensions",value:function(r,n,i){var a=n.map(function(o){return r[o].extension});return a.push(i||{}),a.reduce(function(o,s){return Ec(o,s)},{})}},{key:"_mapAssociationsFromAttributes",value:function(r,n){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(n||{}).filter(function(o){return yA(n[o])}).forEach(function(o){var s=i.schema.modelClassFor(r),u=s.associationFor(o);Re(u&&u instanceof Oa,"You're using the `association` factory helper on the '".concat(o,"' attribute of your ").concat(r," factory, but that attribute is not a `belongsTo` association."));var f=u&&u instanceof Oa&&u.modelName===r;Re(!f,"You're using the association() helper on your ".concat(r," factory for ").concat(o,", which is a belongsTo self-referential relationship. You can't do this as it will lead to infinite recursion. You can move the helper inside of a trait and use it selectively."));var p=u&&u.opts&&u.opts.polymorphic;Re(!p,"You're using the association() helper on your ".concat(r," factory for ").concat(o,", which is a polymorphic relationship. This is not currently supported."));var d=n[o],y="".concat(Te(o),"Id");a[o]||(n[y]=i.create.apply(i,[u.modelName].concat(Vo(d.traitsAndOverrides))).id),delete n[o]})}}]),e}(),NA=Yn.extend({serializeIds:"always",normalizeIds:!0,keyForModel:function(t){return Gn(t)},keyForAttribute:function(t){return Gn(t)},keyForRelationship:function(t){return this._container.inflector.pluralize(Gn(t))},keyForEmbeddedRelationship:function(t){return Gn(t)},keyForRelationshipIds:function(t){return"".concat(Gn(this._container.inflector.singularize(t)),"_ids")},keyForForeignKey:function(t){return"".concat(Gn(t),"_id")},keyForPolymorphicForeignKeyId:function(t){return"".concat(Gn(t),"_id")},keyForPolymorphicForeignKeyType:function(t){return"".concat(Gn(t),"_type")},normalize:function(t){var r=this,n=Object.keys(t)[0],i=t[n],a=Te(n),o=this.schema.modelClassFor(a),s=o.belongsToAssociations,u=o.hasManyAssociations,f=Object.keys(s),p=Object.keys(u),d={data:{type:this._container.inflector.pluralize(n),attributes:{}}};i.id&&(d.data.id=i.id);var y={};return Object.keys(i).forEach(function(A){if(A!=="id")if(r.normalizeIds)if(f.includes(A)){var P=s[A],C=P.modelName;y[Ot(A)]={data:{type:C,id:i[A]}}}else if(p.includes(A)){var v=u[A],I=v.modelName,T=i[A].map(function(M){return{type:I,id:M}});y[Ot(A)]={data:T}}else d.data.attributes[Ot(A)]=i[A];else d.data.attributes[Ot(A)]=i[A]}),Object.keys(y).length&&(d.data.relationships=y),d},getCoalescedIds:function(t){return t.queryParams&&t.queryParams.ids}});NA.extend({serializeIds:"always",keyForModel:function(t){return Te(t)},keyForAttribute:function(t){return Te(t)},keyForRelationship:function(t){return Te(this._container.inflector.pluralize(t))},keyForEmbeddedRelationship:function(t){return Te(t)},keyForRelationshipIds:function(t){return Te(this._container.inflector.pluralize(t))},keyForForeignKey:function(t){return Te(this._container.inflector.singularize(t))},getCoalescedIds:function(t){return t.queryParams&&t.queryParams.ids}});function DA(){return FA({routes(){this.namespace="api",this.get("/titlebar",()=>({product:{name:"Booking Engine",href:"/hotel_admin/spl.jsp"},propertySelector:{type:"fetch",hotels:"/api/hotels"},user:{label:"Profile",children:[{label:"Maintain Users",href:"https://admin-dc.dev.bookassist.com/hotel_admin/maintain_users.jsp"},{label:"Change Password",href:"https://admin-dc.dev.bookassist.com/hotel_admin/login.jsp?resetpass"},{label:"Log Out",href:"https://admin-dc.bookassist.com/hotel_admin/logout.jsp"}]},languageSelector:{label:"Language",children:[{code:"en",label:"EnGlIsH"},{code:"cs"},{code:"de"},{code:"es"},{code:"fr"},{code:"it"},{code:"pl"},{code:"pt"}]},help:{label:"Help Center",href:"https://go.bookassist.org/en/knowledge/booking-engine"}})),this.get("/menu",()=>[{id:"raq3yznphb",label:"Hotel setup"},{id:"xjcwuw5o0wl",parentId:"raq3yznphb",label:"Hotel Logo",href:"#HotelLogo"},{id:"epzy61enrwu",parentId:"raq3yznphb",label:"Hotel Mobile Colours",href:"#HotelMobileColours"},{id:"szeh0zcpjn",parentId:"raq3yznphb",label:"Deposit Invoices",href:"#Invoices"},{id:"65csve3x2l",parentId:"raq3yznphb",label:"General Hotel Policies",href:"#GeneralHotelPolicies"},{id:"5tequyqbitm",parentId:"raq3yznphb",label:"Locate your hotel",href:"#Locateyourhotel"},{id:"mk86ze75d7",parentId:"raq3yznphb",label:"Premium example",premium:{value:!0,locked:!0}},{id:"f1ec1ry0rro",label:"Rooms/Packages"},{id:"w7x9wwfq4ge",parentId:"f1ec1ry0rro",label:"Manage Rooms & Packages",href:"#ManageRoomsPackages"},{id:"njxovt6l0d",parentId:"f1ec1ry0rro",label:"Book without credit card",href:"#Bookwithoutcreditcard"},{id:"39dl1gf3e8x",parentId:"f1ec1ry0rro",label:"XMLConnector Inventory",href:"#XMLConnectorInventory"},{id:"0qwiv7k5i6md",label:"Rates/Availability"},{id:"o3qrjsnlyin",parentId:"0qwiv7k5i6md",label:"Availability",group:"Availability"},{id:"gk3gwhnfo8j",parentId:"o3qrjsnlyin",label:"Edit Availability",href:"#EditAvailability"},{id:"g95dnxr3ifb",parentId:"o3qrjsnlyin",label:"Availability Batch",href:"#AvailabilityBatch"},{id:"8lttj490hu8",parentId:"0qwiv7k5i6md",label:"Availability and Rate Details",href:"#AvailabilityandRateDetails",group:"Availability"},{id:"7y6i0dnzc8o",parentId:"0qwiv7k5i6md",label:"Edit Rates",href:"#EditRates",group:"Rates"},{id:"o7c1dx9xume",parentId:"0qwiv7k5i6md",label:"Adjust Rates Manually",group:"Rates"},{id:"an9perx1x67",parentId:"o7c1dx9xume",label:"Adjust Rates",href:"#AdjustRates"},{id:"irtojrlv0t8",parentId:"o7c1dx9xume",label:"Rates Batch",href:"#RatesBatch"},{id:"j4mctyj216",parentId:"0qwiv7k5i6md",label:"Minimum Stays",group:"Restrictions"},{id:"yus5cglsgmm",parentId:"j4mctyj216",label:"Edit Minimum Stays",href:"#EditMinimumStays"},{id:"di4smaz6oyk",parentId:"j4mctyj216",label:"Batch",href:"#Batch"},{id:"3nvl2vajzb8",parentId:"0qwiv7k5i6md",label:"Closed For Arrival",group:"Restrictions"},{id:"gs54wi7f3ov",parentId:"3nvl2vajzb8",label:"Edit Closed For Arrival",href:"#EditClosedForArrival"},{id:"o8xoquq2vhm",parentId:"3nvl2vajzb8",label:"Batch",href:"#Batch"},{id:"a3lezzgyke",parentId:"0qwiv7k5i6md",label:"Open/Close Rooms",group:"Restrictions"},{id:"yhmwk4ntycs",parentId:"a3lezzgyke",label:"Edit Open/Close Rooms",href:"#EditOpenCloseRooms"},{id:"i00jgm1jw4",parentId:"a3lezzgyke",label:"Batch",href:"#Batch"},{id:"nwvz5qdsn4",parentId:"0qwiv7k5i6md",label:"Open/Closed Rooms Report",href:"#OpenClosedRoomsReport",group:"Restrictions"},{id:"xet04pxoomi",parentId:"0qwiv7k5i6md",label:"Extra Beds"},{id:"ww3e5s1k37s",parentId:"xet04pxoomi",label:"Edit Extra Beds",href:"#EditExtraBeds",group:"Restrictions"},{id:"3kdww03xlh8",parentId:"xet04pxoomi",label:"Batch",href:"#Batch"},{id:"462vczykrt8",label:"Extras"},{id:"rk6y9sxm8km",parentId:"462vczykrt8",label:"Manage Meal Plans",href:"#ManageMealPlans",group:"Meal Plans"},{id:"wg3uwe8mh2",parentId:"462vczykrt8",label:"Meal Plans Prices",group:"Meal Plans"},{id:"g128kodkhjo",parentId:"wg3uwe8mh2",label:"Edit Meal Plans Prices",href:"#EditMealPlansPrices"},{id:"xod48otj9o",parentId:"wg3uwe8mh2",label:"Meal Plans Prices Batch",href:"#MealPlansPricesBatch"},{id:"kwmxcwr5y8s",parentId:"462vczykrt8",label:"Open/Close Add-ons",href:"#OpenCloseAddons",group:"Add-Ons"},{id:"rbk08ib5mxb",parentId:"462vczykrt8",label:"Switch Off Add-ons",href:"#SwitchOffAddons",group:"Add-Ons"},{id:"ntbts4i22sb",parentId:"462vczykrt8",label:"Dynamic Discounts",href:"#DynamicDiscounts",group:"Discounts"},{id:"736g9tauy6k",parentId:"462vczykrt8",label:"Open/Close Discounts",group:"Discounts"},{id:"2qvsnasaj1l",parentId:"736g9tauy6k",label:"Edit Open/Close Discounts",href:"#EditOpenCloseDiscounts"},{id:"nj3242z7nt",parentId:"736g9tauy6k",label:"Batch",href:"#Batch"},{id:"ocf8po5w2el",parentId:"462vczykrt8",label:"Open/Close IRS",href:"#OpenCloseIRS",group:"Upselling"},{id:"5kccvsqsuf4",label:"Reservations",href:"#Reservations"},{id:"vu9d7b45nte",parentId:"5kccvsqsuf4",label:"Manage Reservation",href:"#ManageReservation"},{id:"f437g317fjc",parentId:"5kccvsqsuf4",label:"Search Reservations",href:"#SearchReservations"},{id:"k5464kvte8l",parentId:"5kccvsqsuf4",label:"Bookings Reports",href:"#BookingsReports"},{id:"cb58wdcv38c",label:"Corporate",href:"#Corporate"},{id:"3r614o7kqby",parentId:"cb58wdcv38c",label:"Customer list",href:"#Customerlist"},{id:"3qa95mud1xf",parentId:"cb58wdcv38c",label:"Categories",href:"#Categories"},{id:"af6698sant",parentId:"cb58wdcv38c",label:"Companies",href:"#Companies"},{id:"2wbkjjcia",parentId:"cb58wdcv38c",label:"Corporate Rates",href:"#CorporateRates"},{id:"hyaxqvj6doh",parentId:"cb58wdcv38c",label:"Corp Rate Groups",href:"#CorpRateGroups"},{id:"6rocuyqud7m",parentId:"cb58wdcv38c",label:"Create Rewards",href:"#CreateRewards"},{id:"a07tcgufbqm",parentId:"cb58wdcv38c",label:"Create New Customer",href:"#CreateNewCustomer"},{id:"s0ioinudzz",parentId:"cb58wdcv38c",label:"Voucher Availability",href:"#VoucherAvailability"},{id:"emm4qyt75ga",label:"Reputation",href:"#Reputation"},{id:"ysvbfa69j6",parentId:"emm4qyt75ga",label:"Direct Customer Reviews",href:"#DirectCustomerReviews"},{id:"67e1vjgsbl7",label:"Vouchers",href:"#Vouchers"},{id:"vx6f8cd05od",parentId:"67e1vjgsbl7",label:"Create Vouchers",href:"#CreateVouchers"},{id:"9fvp9xal5qo",parentId:"67e1vjgsbl7",label:"Purchased Vouchers",href:"#PurchasedVouchers"},{id:"bhe7fnem0nt",parentId:"67e1vjgsbl7",label:"Vouchers delivery options",href:"#Vouchersdeliveryoptions"}]),this.get("/notifications",()=>({en:[{title:"Test header 1",items:[{title:"Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-01-01"},{title:"Ipsum Dolor Sem Ligula",url:"#",date:"2022-01-05"},{title:"Vestibulum Amet Risus Vehicula",url:"#",date:"2022-02-07"},{title:"Ullamcorper Parturient Malesuada Magna",url:"#",date:"2022-02-15"},{title:"Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-03-04"}]},{title:"Test header 2",items:[{title:"Vestibulum Amet Risus Vehicula",url:"#",date:"2022-01-03"},{title:"Ullamcorper Parturient Malesuada Magna",url:"#",date:"2022-02-14"},{title:"Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-03-03"},{title:"Ipsum Dolor Sem Ligula",url:"#",date:"2022-03-31"},{title:"Vestibulum Amet Risus Vehicula",url:"#",date:"2022-04-04"}]}],es:[{title:"Test header 1 ES",items:[{title:"ES Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-01-01"},{title:"ES Ipsum Dolor Sem Ligula",url:"#",date:"2022-01-05"}]},{title:"Test header 2 ES",items:[{title:"ES Ipsum Dolor Sem Ligula",url:"#",date:"2022-03-31"},{title:"ES Vestibulum Amet Risus Vehicula",url:"#",date:"2022-04-04"}]}]})),this.get("/hotels",()=>[[" NON ATTIVO - Hotel Lunetta","2071_808"],["987 Design Prague Hotel","3291_802"],["A.Liebeskind Hotel","4012_823"],["Abbey Hotel Ballyvourney","2155_2"],["ABC Arabian Suites","2001_829"],["Abito Hotel","3425_802"],["Abrial Hotel","1101_600"],["Academy Plaza Hotel","9_1"],["Actons Hotel Kinsale","1739_2"],["ADLER HOTEL","3724_802"],["Adria Hotel Prague","1465_802"],["Agroturismo Can Toni Xumeu","3033_102"],["AGUA DE MaR Hotel Boutique","2620_102"],["Aida Plaza Hotel","2677_810"],["Akademik Collegia","3976_823"],["Akcent Hotel","2017_802"],["Al Buraimi Hotel","2076_869"],["Albergo Firenze","2722_808"],["Alef Hotel","3672_809"],["Alerion Hotel","2673_600"],["Aletti Palace Hotel","1742_600"],["Alexandra Lodge","1801_401"],["Allegroitalia Elba Capo D'arco","3160_808"],["Allegroitalia Elba Golf","3161_808"],["Allegroitalia Espresso Bologna","3115_808"],["Allegroitalia Etna Pedara","3163_808"],["Allegroitalia Golden Palace","3116_808"],["Allegroitalia Nazionale Volterra","3176_808"]]),this.passthrough("https://www.bookassist.com/**"),this.passthrough("https://exceptions.hubspot.com/**"),this.passthrough("https://api.hubspot.com/**"),this.passthrough("https://forms.hubspot.com/**"),this.passthrough("/hotel_admin/json/**")}})}var rg={exports:{}},jA="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",LA=jA,zA=LA;function ng(){}function ig(){}ig.resetWarningCache=ng;var HA=function(){function e(n,i,a,o,s,u){if(u!==zA){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:ig,resetWarningCache:ng};return r.PropTypes=r,r};rg.exports=HA();var se=rg.exports,gi=ot.default.createContext(null);function UA(e){e()}var ag=UA,BA=function(t){return ag=t},kA=function(){return ag};function WA(){var e=kA(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var i=t;i;)i.callback(),i=i.next})},get:function(){for(var i=[],a=t;a;)i.push(a),a=a.next;return i},subscribe:function(i){var a=!0,o=r={callback:i,next:null,prev:r};return o.prev?o.prev.next=o:t=o,function(){!a||t===null||(a=!1,o.next?o.next.prev=o.prev:r=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}var og={notify:function(){},get:function(){return[]}};function sg(e,t){var r,n=og;function i(d){return u(),n.subscribe(d)}function a(){n.notify()}function o(){p.onStateChange&&p.onStateChange()}function s(){return Boolean(r)}function u(){r||(r=t?t.addNestedSub(o):e.subscribe(o),n=WA())}function f(){r&&(r(),r=void 0,n.clear(),n=og)}var p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:o,isSubscribed:s,trySubscribe:u,tryUnsubscribe:f,getListeners:function(){return n}};return p}var Bc=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined"?z.useLayoutEffect:z.useEffect,Zo={exports:{}},Pa={};/*
26
+ `).concat(a.stack||a)})}}return this._toMirageResponse(n)}},{key:"_toMirageResponse",value:function(r){var n=this,i;return new Promise(function(a,o){Promise.resolve(r).then(function(s){if(s instanceof gn)i=r;else{var u=n._getCodeForResponse(s);i=new gn(u,{},s)}a(i)}).catch(o)})}},{key:"_getCodeForResponse",value:function(r){var n;return this.customizedCode?n=this.customizedCode:(n=AA[this.verb],n===204&&r!==void 0&&r!==""&&(n=200)),n}},{key:"serialize",value:function(r,n){return r.data=this.serializerOrRegistry.serialize(r.data,n),r}}]),e}();function Jp(e,t){var r=function(n){xn(a,n);var i=Cn(a);function a(){var o;vt(this,a);for(var s=arguments.length,u=new Array(s),f=0;f<s;f++)u[f]=arguments[f];if(o=i.call.apply(i,[this].concat(u)),e&&n2(e,"constructor")){var p;(p=e.constructor).call.apply(p,[Kp(o)].concat(u))}return o}return a}(this);return Object.assign(r,this,t),e&&Object.assign(r.prototype,e),r}var Xo=function(){function e(t,r,n,i){var a=this;return vt(this,e),Re(t,"A model requires a schema"),Re(r,"A model requires a modelName"),this._schema=t,this.modelName=r,this.fks=i||[],this.attrs={},n=n||{},this.fks.forEach(function(o){a.attrs[o]=n[o]!==void 0?n[o]:null}),Object.keys(n).forEach(function(o){var s=n[o];a._validateAttr(o,s),a._setupAttr(o,s),a._setupRelationship(o,s)}),this}return xt(e,[{key:"save",value:function(){var r=this._schema.toInternalCollectionName(this.modelName);return this.isNew()?(this.attrs=this._schema.db[r].insert(this.attrs),this._definePlainAttribute("id")):(this._schema.isSaving[this.toString()]=!0,this._schema.db[r].update(this.attrs.id,this.attrs)),this._saveAssociations(),this._schema.isSaving[this.toString()]=!1,this}},{key:"update",value:function(r,n){var i;return r==null?this:(nr(r)==="object"?i=r:(i={})[r]=n,Object.keys(i).forEach(function(a){!this.associationKeys.has(a)&&!this.associationIdKeys.has(a)&&this._definePlainAttribute(a),this[a]=i[a]},this),this.save(),this)}},{key:"destroy",value:function(){if(this.isSaved()){this._disassociateFromDependents();var r=this._schema.toInternalCollectionName(this.modelName);this._schema.db[r].remove(this.attrs.id)}}},{key:"isNew",value:function(){var r=!1,n=this.attrs.id!==void 0&&this.attrs.id!==null;if(n){var i=this._schema.toInternalCollectionName(this.modelName),a=this._schema.db[i].find(this.attrs.id);a&&(r=!0)}return!r}},{key:"isSaved",value:function(){return!this.isNew()}},{key:"reload",value:function(){if(this.id){var r=this._schema.toInternalCollectionName(this.modelName),n=this._schema.db[r].find(this.id);Object.keys(n).filter(function(i){return i!=="id"}).forEach(function(i){this.attrs[i]=n[i]},this)}return this._tempAssociations={},this}},{key:"toJSON",value:function(){return aA({},this.attrs)}},{key:"associations",get:function(){return this._schema.associationsFor(this.modelName)}},{key:"associationFor",value:function(r){return this.associations[r]}},{key:"inverseFor",value:function(r){return this._explicitInverseFor(r)||this._implicitInverseFor(r)}},{key:"_explicitInverseFor",value:function(r){this._checkForMultipleExplicitInverses(r);var n=this._schema.associationsFor(this.modelName),i=r.opts.inverse,a=i?n[i]:null,o=a&&a.isPolymorphic,s=a&&a.modelName===r.ownerModelName,u=a&&a.opts.inverse;return u&&a.opts.inverse!==r.name&&Re(!1,"You specified an inverse of ".concat(i," for ").concat(r.name,", but it does not match ").concat(a.modelName," ").concat(a.name,"'s inverse")),o||s?a:null}},{key:"_checkForMultipleExplicitInverses",value:function(r){var n=this._schema.associationsFor(this.modelName),i=Object.keys(n).filter(function(a){var o=n[a],s=r.ownerModelName===o.modelName,u=r.name===o.opts.inverse;return s&&u});Re(i.length<=1,"The ".concat(this.modelName," model has defined multiple explicit inverse associations for the ").concat(r.ownerModelName,".").concat(r.name," association."))}},{key:"_implicitInverseFor",value:function(r){var n=this,i=this._schema.associationsFor(this.modelName),a=r.ownerModelName;return yc(i).filter(function(o){return o.modelName===a}).reduce(function(o,s){var u=s.opts.inverse,f=u===void 0,p=u===r.name,d=f||p;return d&&(Re(!o,"The ".concat(n.modelName," model has multiple possible inverse associations for the ").concat(r.ownerModelName,".").concat(r.name," association.")),o=s),o},null)}},{key:"hasInverseFor",value:function(r){return!!this.inverseFor(r)}},{key:"alreadyAssociatedWith",value:function(r,n){var i=this[n.name];if(i&&r)return i instanceof e?i.isSaved()&&r.isSaved()?i.toString()===r.toString():i===r:i.includes(r)}},{key:"associate",value:function(r,n){if(!this.alreadyAssociatedWith(r,n)){var i=n.name;n instanceof Sa?this[i].includes(r)||this[i].add(r):this[i]=r}}},{key:"disassociate",value:function(r,n){var i=n.getForeignKey();if(n instanceof Sa){var a;if(n.isPolymorphic){var o=this[i].find(function(s){var u=s.type,f=s.id;return u===r.modelName&&f===r.id});a=o&&this[i].indexOf(o)}else a=this[i].map(function(s){return s.toString()}).indexOf(r.id.toString());a>-1&&this.attrs[i].splice(a,1)}else this.attrs[i]=null}},{key:"isSaving",get:function(){return this._schema.isSaving[this.toString()]}},{key:"_setupAttr",value:function(r,n){var i=this.associationKeys.has(r)||this.associationIdKeys.has(r);i||(this.attrs[r]=n,this._definePlainAttribute(r))}},{key:"_definePlainAttribute",value:function(r){var n=Object.getOwnPropertyDescriptor(this,r);n&&n.get||(Object.prototype.hasOwnProperty.call(this.attrs,r)||(this.attrs[r]=null),Object.defineProperty(this,r,{get:function(){return this.attrs[r]},set:function(a){this.attrs[r]=a}}))}},{key:"_setupRelationship",value:function(r,n){var i=this.associationIdKeys.has(r)||this.fks.includes(r),a=this.associationKeys.has(r);i&&(n!=null&&this._validateForeignKeyExistsInDatabase(r,n),this.attrs[r]=n),a&&(this[r]=n)}},{key:"_validateAttr",value:function(r,n){if(this.associationKeys.has(r)){var i=this.associationFor(r),a=n===null;if(i instanceof Sa){var o=n instanceof Vn||n instanceof an,s=Array.isArray(n)&&n.every(function(A){return A instanceof e});Re(o||s||a,"You're trying to create a ".concat(this.modelName,' model and you passed in "').concat(n,'" under the ').concat(r," key, but that key is a HasMany relationship. You must pass in a Collection, PolymorphicCollection, array of Models, or null."))}else i instanceof Oa&&Re(n instanceof e||a,"You're trying to create a ".concat(this.modelName,' model and you passed in "').concat(n,'" under the ').concat(r," key, but that key is a BelongsTo relationship. You must pass in a Model or null."))}if(this.associationIdKeys.has(r)&&r.endsWith("Ids")){var u=Array.isArray(n),f=n===null;Re(u||f,"You're trying to create a ".concat(this.modelName,' model and you passed in "').concat(n,'" under the ').concat(r," key, but that key is a foreign key for a HasMany relationship. You must pass in an array of ids or null."))}{var p=n instanceof e||n instanceof Vn||n instanceof an,d=Array.isArray(n)&&n.length&&n.every(function(A){return A instanceof e});if(p||d){var y=n;Re(this.associationKeys.has(r),"You're trying to create a ".concat(this.modelName," model and you passed in a ").concat(y.toString()," under the ").concat(r," key, but you haven't defined that key as an association on your model."))}}}},{key:"_validateForeignKeyExistsInDatabase",value:function(r,n){var i=this;if(Array.isArray(n)){var a=this.hasManyAssociationFks[r],o;a.isPolymorphic?(o=n.map(function(d){var y=d.type,A=d.id;return i._schema.db[i._schema.toInternalCollectionName(y)].find(A)}),o=jo(o)):o=this._schema.db[this._schema.toInternalCollectionName(a.modelName)].find(n);var s=a.isPolymorphic?n.map(function(d){return"".concat(d.type,":").concat(d.id)}).join(","):n;Re(o.length===n.length,"You're instantiating a ".concat(this.modelName," that has a ").concat(r," of ").concat(s,", but some of those records don't exist in the database."))}else{var u=this.belongsToAssociationFks[r],f;u.isPolymorphic?f=this._schema.db[this._schema.toInternalCollectionName(n.type)].find(n.id):f=this._schema.db[this._schema.toInternalCollectionName(u.modelName)].find(n);var p=u.isPolymorphic?"".concat(n.type,":").concat(n.id):n;Re(f,"You're instantiating a ".concat(this.modelName," that has a ").concat(r," of ").concat(p,", but that record doesn't exist in the database."))}}},{key:"_saveAssociations",value:function(){this._saveBelongsToAssociations(),this._saveHasManyAssociations()}},{key:"_saveBelongsToAssociations",value:function(){var r=this;yc(this.belongsToAssociations).forEach(function(n){r._disassociateFromOldInverses(n),r._saveNewAssociates(n),r._associateWithNewInverses(n)})}},{key:"_saveHasManyAssociations",value:function(){var r=this;yc(this.hasManyAssociations).forEach(function(n){r._disassociateFromOldInverses(n),r._saveNewAssociates(n),r._associateWithNewInverses(n)})}},{key:"_disassociateFromOldInverses",value:function(r){r instanceof Sa?this._disassociateFromHasManyInverses(r):r instanceof Oa&&this._disassociateFromBelongsToInverse(r)}},{key:"_disassociateFromHasManyInverses",value:function(r){var n=this,i=r.getForeignKey(),a=this._tempAssociations&&this._tempAssociations[r.name],o=this.attrs[i];if(a&&o){var s;r.isPolymorphic?s=o.map(function(u){var f=u.type,p=u.id;return n._schema[n._schema.toCollectionName(f)].find(p)}):s=this._schema[this._schema.toCollectionName(r.modelName)].find(o||[]).models,s.filter(function(u){return!u.isSaving&&!a.includes(u)&&u.hasInverseFor(r)}).forEach(function(u){var f=u.inverseFor(r);u.disassociate(n,f),u.save()})}}},{key:"_disassociateFromBelongsToInverse",value:function(r){var n=r.getForeignKey(),i=this._tempAssociations&&this._tempAssociations[r.name],a=this.attrs[n];if(i!==void 0&&a){var o;if(r.isPolymorphic?o=this._schema[this._schema.toCollectionName(a.type)].find(a.id):o=this._schema[this._schema.toCollectionName(r.modelName)].find(a),o.hasInverseFor(r)){var s=o.inverseFor(r);o.disassociate(this,s),o._updateInDb(o.attrs)}}}},{key:"_disassociateFromDependents",value:function(){var r=this;this._schema.dependentAssociationsFor(this.modelName).forEach(function(n){n.disassociateAllDependentsFromTarget(r)})}},{key:"_saveNewAssociates",value:function(r){var n=r.getForeignKey(),i=this._tempAssociations&&this._tempAssociations[r.name];if(i!==void 0){if(this.__isSavingNewChildren=!0,delete this._tempAssociations[r.name],i instanceof Vn)i.models.filter(function(o){return!o.isSaving}).forEach(function(o){o.save()}),this._updateInDb(rn({},n,i.models.map(function(o){return o.id})));else if(i instanceof an)i.models.filter(function(o){return!o.isSaving}).forEach(function(o){o.save()}),this._updateInDb(rn({},n,i.models.map(function(o){return{type:o.modelName,id:o.id}})));else if(i===null)this._updateInDb(rn({},n,null));else if(this.equals(i))this._updateInDb(rn({},n,this.id));else if(!i.isSaving){i.save(),this._syncTempAssociations(i);var a;r.isPolymorphic?a={id:i.id,type:i.modelName}:a=i.id,this._updateInDb(rn({},n,a))}this.__isSavingNewChildren=!1}}},{key:"_associateWithNewInverses",value:function(r){var n=this;if(!this.__isSavingNewChildren){var i=this[r.name];i instanceof e?this._associateModelWithInverse(i,r):(i instanceof Vn||i instanceof an)&&i.models.forEach(function(a){n._associateModelWithInverse(a,r)}),delete this._tempAssociations[r.name]}}},{key:"_associateModelWithInverse",value:function(r,n){var i=this;if(r.hasInverseFor(n)){var a=r.inverseFor(n),o=a.getForeignKey(),s=this.id;if(a instanceof Oa){var u;a.isPolymorphic?u={type:this.modelName,id:s}:u=s,this._schema.db[this._schema.toInternalCollectionName(r.modelName)].update(r.id,rn({},o,u))}else{var f=this._schema.db[this._schema.toInternalCollectionName(r.modelName)],p=f.find(r.id)[a.getForeignKey()]||[],d=Object.assign([],p),y,A;a.isPolymorphic?(y={type:this.modelName,id:s},A=d.some(function(P){return P.type==i.modelName&&P.id==s})):(y=s,A=d.includes(s)),A||d.push(y),f.update(r.id,rn({},o,d))}}}},{key:"_updateInDb",value:function(r){this.attrs=this._schema.db[this._schema.toInternalCollectionName(this.modelName)].update(this.attrs.id,r)}},{key:"_syncTempAssociations",value:function(r){var n=this;Object.keys(this._tempAssociations).forEach(function(i){n._tempAssociations[i]&&n._tempAssociations[i].toString()===r.toString()&&(n._tempAssociations[i]=r)})}},{key:"toString",value:function(){var r=this.id?"(".concat(this.id,")"):"";return"model:".concat(this.modelName).concat(r)}},{key:"equals",value:function(r){return this.toString()===r.toString()}}]),e}();Xo.extend=Jp,Xo.findBelongsToAssociation=function(e){return this.prototype.belongsToAssociations[e]};var Yn=function(){function e(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};vt(this,e),this.registry=t,this.type=r,this.request=n,this.attrs=this.attrs||void 0,this.include=this.include||[],this.root=this.root||void 0,this.embed=this.embed||void 0,this.serializeIds=this.serializeIds||void 0}return xt(e,[{key:"serialize",value:function(r){return this.primaryResource=r,this.buildPayload(r)}},{key:"normalize",value:function(r){return r}},{key:"buildPayload",value:function(r,n,i,a){if(!r&&vc(n))return a;if(r){var o=this.getHashForPrimaryResource(r),s=nn(o,2),u=s[0],f=s[1],p=this.isCollection(r)?r.models:[r];return this.buildPayload(void 0,f,p,u)}else{var d=n.shift(),y=this.getHashForIncludedResource(d),A=nn(y,2),P=A[0],C=A[1],v=C.filter(function(M){return!i.map(function(L){return L.toString()}).includes(M.toString())}).concat(n),I=(this.isCollection(d)?d.models:[d]).concat(i),T=this.mergePayloads(a,P);return this.buildPayload(void 0,v,I,T)}}},{key:"getHashForPrimaryResource",value:function(r){var n=this.getHashForResource(r),i=nn(n,2),a=i[0],o=i[1],s;if(this.root){Re(!(r instanceof an),"The base Serializer class cannot serialize a top-level PolymorphicCollection when root is true, since PolymorphicCollections have no type.");var u=this.serializerFor(r.modelName),f=u.keyForResource(r);s=rn({},f,a)}else s=a;return[s,o]}},{key:"getHashForIncludedResource",value:function(r){var n,i;if(r instanceof an)n={},i=r.models;else{var a=this.serializerFor(r.modelName),o=a.getHashForResource(r),s=nn(o,2),u=s[0],f=s[1],p=a.keyForRelationship(r.modelName);n=Array.isArray(u)?rn({},p,u):rn({},p,[u]),i=f}return[n,i]}},{key:"getHashForResource",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,s,u;if(o||(u=this),o&&r.modelName&&(u=this.serializerFor(r.modelName)),this.isModel(r)?s=u._hashForModel(r,i,a):s=r.models.map(function(p){var d=u;return d||(d=n.serializerFor(p.modelName)),d._hashForModel(p,i,a)}),this.embed)return[s,[]];var f=bp(jo(Dd(u.getKeysForIncluded().map(function(p){return n.isCollection(r)?r.models.map(function(d){return d[p]}):r[p]}))),function(p){return p.toString()});return[s,f]}},{key:"mergePayloads",value:function(r,n){var i,a=Object.keys(n),o=nn(a,1),s=o[0];return r[s]?(i=r,i[s]=r[s].concat(n[s])):i=Object.assign(r,n),i}},{key:"keyForResource",value:function(r){var n=r.modelName;return this.isModel(r)?this.keyForModel(n):this.keyForCollection(n)}},{key:"keyForModel",value:function(r){return Te(r)}},{key:"keyForCollection",value:function(r){return this._container.inflector.pluralize(this.keyForModel(r))}},{key:"_hashForModel",value:function(r,n){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=this._attrsForModel(r);if(n&&r.fks.forEach(function(u){delete o[u]}),this.embed){var s=Object.assign({},a);return s[r.modelName]=s[r.modelName]||{},s[r.modelName][r.id]=!0,this.getKeysForIncluded().forEach(function(u){var f=r[u];if(f&&!vp(s,"".concat(f.modelName,".").concat(f.id))){var p=i.getHashForResource(f,!0,s,!0),d=nn(p,1),y=d[0],A=i.keyForEmbeddedRelationship(u);if(o[A]=y,i.isModel(f)){var P="".concat(Te(u),"Id");delete o[P]}}}),o}else return this._maybeAddAssociationIds(r,o)}},{key:"_attrsForModel",value:function(r){var n={};return this.attrs?n=this.attrs.reduce(function(i,a){return i[a]=r[a],i},{}):n=Object.assign(n,r.attrs),r.fks.forEach(function(i){return delete n[i]}),this._formatAttributeKeys(n)}},{key:"_maybeAddAssociationIds",value:function(r,n){var i=this,a=Object.assign({},n);return this.serializeIds==="always"?r.associationKeys.forEach(function(o){var s=r[o],u=r.associationFor(o);if(i.isCollection(s)){var f=i.keyForRelationshipIds(o);a[f]=r["".concat(i._container.inflector.singularize(o),"Ids")]}else if(i.isModel(s)&&u.isPolymorphic){var p=i.keyForPolymorphicForeignKeyType(o),d=i.keyForPolymorphicForeignKeyId(o);a[p]=r["".concat(o,"Id")].type,a[d]=r["".concat(o,"Id")].id}else if(s){var y=i.keyForForeignKey(o);a[y]=r["".concat(o,"Id")]}}):this.serializeIds==="included"&&this.getKeysForIncluded().forEach(function(o){var s=r[o],u=r.associationFor(o);if(i.isCollection(s)){var f=i.keyForRelationshipIds(o);a[f]=r["".concat(i._container.inflector.singularize(o),"Ids")]}else if(i.isModel(s)&&u.isPolymorphic){var p=i.keyForPolymorphicForeignKeyType(o),d=i.keyForPolymorphicForeignKeyId(o);a[p]=r["".concat(o,"Id")].type,a[d]=r["".concat(o,"Id")].id}else if(i.isModel(s)){var y=i.keyForForeignKey(o);a[y]=r["".concat(o,"Id")]}}),a}},{key:"keyForAttribute",value:function(r){return r}},{key:"keyForRelationship",value:function(r){return Te(this._container.inflector.pluralize(r))}},{key:"keyForEmbeddedRelationship",value:function(r){return Te(r)}},{key:"keyForRelationshipIds",value:function(r){return"".concat(this._container.inflector.singularize(Te(r)),"Ids")}},{key:"keyForForeignKey",value:function(r){return"".concat(Te(r),"Id")}},{key:"keyForPolymorphicForeignKeyId",value:function(r){return"".concat(Te(r),"Id")}},{key:"keyForPolymorphicForeignKeyType",value:function(r){return"".concat(Te(r),"Type")}},{key:"isModel",value:function(r){return r instanceof Xo}},{key:"isCollection",value:function(r){return r instanceof Vn||r instanceof an}},{key:"isModelOrCollection",value:function(r){return this.isModel(r)||this.isCollection(r)}},{key:"serializerFor",value:function(r){return this.registry.serializerFor(r)}},{key:"getKeysForIncluded",value:function(){return A1(this.include)?this.include(this.request,this.primaryResource):this.include}},{key:"schema",get:function(){return this.registry.schema}},{key:"_formatAttributeKeys",value:function(r){var n={};for(var i in r){var a=this.keyForAttribute(i);n[a]=r[i]}return n}},{key:"getCoalescedIds",value:function(){}}]),e}();Yn.prototype.include=[],Yn.prototype.root=!0,Yn.prototype.embed=!1,Yn.prototype.serializeIds="included",Yn.extend=Jp;var Xp=function(e){xn(r,e);var t=Cn(r);function r(){var n;return vt(this,r),n=t.apply(this,arguments),n.alwaysIncludeLinkageData=n.alwaysIncludeLinkageData||void 0,n}return xt(r,[{key:"keyForModel",value:function(i){return Ot(i)}},{key:"keyForCollection",value:function(i){return Ot(i)}},{key:"keyForAttribute",value:function(i){return Ot(i)}},{key:"keyForRelationship",value:function(i){return Ot(i)}},{key:"links",value:function(){}},{key:"getHashForPrimaryResource",value:function(i){this._createRequestedIncludesGraph(i);var a=this.getHashForResource(i),o={data:a},s=this.getAddToIncludesForResource(i);return[o,s]}},{key:"getHashForIncludedResource",value:function(i){var a=this.serializerFor(i.modelName),o=a.getHashForResource(i),s={included:this.isModel(i)?[o]:o},u=[];return this.hasQueryParamIncludes()||(u=this.getAddToIncludesForResource(i)),[s,u]}},{key:"getHashForResource",value:function(i){var a=this,o;return this.isModel(i)?o=this.getResourceObjectForModel(i):o=i.models.map(function(s){return a.getResourceObjectForModel(s)}),o}},{key:"getAddToIncludesForResource",value:function(i){var a;if(this.hasQueryParamIncludes())a=this.request.queryParams.include.split(",");else{var o=this.serializerFor(i.modelName);a=o.getKeysForIncluded()}return this.getAddToIncludesForResourceAndPaths(i,a)}},{key:"getAddToIncludesForResourceAndPaths",value:function(i,a){var o=this,s=[];return a.forEach(function(u){var f=u.split("."),p=o.getIncludesForResourceAndPath.apply(o,[i].concat(Vo(f)));s.push(p)}),bp(jo(Dd(s)),function(u){return u.toString()})}},{key:"getIncludesForResourceAndPath",value:function(i){for(var a=this,o=arguments.length,s=new Array(o>1?o-1:0),u=1;u<o;u++)s[u-1]=arguments[u];var f=Te(s.shift()),p=[],d=[];if(this.isModel(i)){var y=i[f];this.isModel(y)?d=[y]:this.isCollection(y)&&(d=y.models)}else i.models.forEach(function(A){var P=A[f];a.isModel(P)?d.push(P):a.isCollection(P)&&(d=d.concat(P.models))});return p=p.concat(d),s.length&&d.forEach(function(A){p=p.concat(a.getIncludesForResourceAndPath.apply(a,[A].concat(s)))}),p}},{key:"getResourceObjectForModel",value:function(i){var a=this._attrsForModel(i,!0);delete a.id;var o={type:this.typeKeyForModel(i),id:i.id,attributes:a};return this._maybeAddRelationshipsToResourceObjectForModel(o,i)}},{key:"_maybeAddRelationshipsToResourceObjectForModel",value:function(i,a){var o=this,s={};return a.associationKeys.forEach(function(u){var f=a[u],p=o.keyForRelationship(u),d={};if(o.hasLinksForRelationship(a,u)){var y=o.serializerFor(a.modelName),A=y.links(a);d.links=A[u]}if(o.alwaysIncludeLinkageData||o.shouldIncludeLinkageData(u,a)||o._relationshipIsIncludedForModel(u,a)){var P=null;o.isModel(f)?P={type:o.typeKeyForModel(f),id:f.id}:o.isCollection(f)&&(P=f.models.map(function(C){return{type:o.typeKeyForModel(C),id:C.id}})),d.data=P}vc(d)||(s[p]=d)}),vc(s)||(i.relationships=s),i}},{key:"hasLinksForRelationship",value:function(i,a){var o=this.serializerFor(i.modelName),s=o.links&&o.links(i);return s&&s[a]!=null}},{key:"_relationshipIsIncludedForModel",value:function(i,a){if(this.hasQueryParamIncludes()){var o=this.request._includesGraph,s=this._graphKeyForModel(a),u;return o.data[s]?u=o.data[s]:o.included[this._container.inflector.pluralize(a.modelName)]&&(u=o.included[this._container.inflector.pluralize(a.modelName)][s]),u&&u.relationships&&Object.prototype.hasOwnProperty.call(u.relationships,Ot(i))}else{var f=this.getKeysForIncluded();return f.includes(i)}}},{key:"_createRequestedIncludesGraph",value:function(i){var a=this,o={data:{}};if(this.isModel(i)){var s=this._graphKeyForModel(i);o.data[s]={},this._addPrimaryModelToRequestedIncludesGraph(o,i)}else this.isCollection(i)&&i.models.forEach(function(u){var f=a._graphKeyForModel(u);o.data[f]={},a._addPrimaryModelToRequestedIncludesGraph(o,u)});this.request._includesGraph=o}},{key:"_addPrimaryModelToRequestedIncludesGraph",value:function(i,a){var o=this;if(this.hasQueryParamIncludes()){var s=this._graphKeyForModel(a),u=this.getQueryParamIncludes();u.split(",").filter(function(f){return!!f.trim()}).forEach(function(f){i.data[s].relationships=i.data[s].relationships||{};var p=f.split(".").map(Ot),d=p[0],y=d,A=Te(d),P=a.associationKeys.has(A);Re(P,'You tried to include "'.concat(d,'" with ').concat(a,' but no association named "').concat(A,'" is defined on the model.'));var C=a[A],v;o.isModel(C)?v=o._graphKeyForModel(C):o.isCollection(C)?v=C.models.map(o._graphKeyForModel):v=null,i.data[s].relationships[y]=v,C&&o._addResourceToRequestedIncludesGraph(i,C,p.slice(1))})}}},{key:"_addResourceToRequestedIncludesGraph",value:function(i,a,o){var s=this;i.included=i.included||{};var u=this.isCollection(a)?a.models:[a];u.forEach(function(f){var p=s._container.inflector.pluralize(f.modelName);i.included[p]=i.included[p]||{},s._addModelToRequestedIncludesGraph(i,f,o)})}},{key:"_addModelToRequestedIncludesGraph",value:function(i,a,o){var s=this._container.inflector.pluralize(a.modelName),u=this._graphKeyForModel(a);i.included[s][u]=i.included[s][u]||{},o.length&&this._addResourceRelationshipsToRequestedIncludesGraph(i,s,u,a,o)}},{key:"_addResourceRelationshipsToRequestedIncludesGraph",value:function(i,a,o,s,u){i.included[a][o].relationships=i.included[a][o].relationships||{};var f=u[0],p=s[Te(f)],d;this.isModel(p)?d=this._graphKeyForModel(p):this.isCollection(p)&&(d=p.models.map(this._graphKeyForModel)),i.included[a][o].relationships[f]=d,p&&this._addResourceToRequestedIncludesGraph(i,p,u.slice(1))}},{key:"_graphKeyForModel",value:function(i){return"".concat(i.modelName,":").concat(i.id)}},{key:"getQueryParamIncludes",value:function(){return vp(this,"request.queryParams.include")}},{key:"hasQueryParamIncludes",value:function(){return!!this.getQueryParamIncludes()}},{key:"typeKeyForModel",value:function(i){return Ot(this._container.inflector.pluralize(i.modelName))}},{key:"getCoalescedIds",value:function(i){var a=i.queryParams&&i.queryParams["filter[id]"];return typeof a=="string"?a.split(","):a}},{key:"shouldIncludeLinkageData",value:function(i,a){return!1}}]),r}(Yn);Xp.prototype.alwaysIncludeLinkageData=!1;var Zp=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),this.schema=t,this._serializerMap=r}return xt(e,[{key:"normalize",value:function(r,n){return this.serializerFor(n).normalize(r)}},{key:"serialize",value:function(r,n){var i=this;if(this.request=n,this._isModelOrCollection(r)){var a=this.serializerFor(r.modelName);return a.serialize(r,n)}else return Array.isArray(r)&&r.some(this._isCollection)?r.reduce(function(o,s){var u=i.serializerFor(s.modelName);return u.embed?o[i._container.inflector.pluralize(s.modelName)]=u.serialize(s,n):o=Object.assign(o,u.serialize(s,n)),o},{}):r}},{key:"serializerFor",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.explicit,a=i===void 0?!1:i,o=r&&this._serializerMap&&this._serializerMap[Te(r)];return a?Re(!!o,"You passed in ".concat(r," as an explicit serializer type but that serializer doesn't exist.")):(o=o||this._serializerMap.application||Yn,Re(!o||o.prototype.embed||o.prototype.root||new o instanceof Xp,"You cannot have a serializer that sideloads (embed: false) and disables the root (root: false).")),new o(this,r,this.request)}},{key:"_isModel",value:function(r){return r instanceof Xo}},{key:"_isCollection",value:function(r){return r instanceof Vn||r instanceof an}},{key:"_isModelOrCollection",value:function(r){return this._isModel(r)||this._isCollection(r)}},{key:"registerSerializers",value:function(r){var n=this._serializerMap||{};this._serializerMap=Object.assign(n,r)}},{key:"getCoalescedIds",value:function(r,n){return this.serializerFor(n).getCoalescedIds(r)}}]),e}(),jc={},Lc={},zc={},eg=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};vt(this,e),Re(t,"A schema requires a db"),this.db=t,this._registry={},this._dependentAssociations={polymorphic:[]},this.registerModels(r),this.isSaving={}}return xt(e,[{key:"registerModels",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};KO(n,function(i,a){r.registerModel(a,n[a])})}},{key:"registerModel",value:function(r,n){var i=this,a=Te(r),o=Ot(a);n=n.extend(),this._registry[a]=this._registry[a]||{class:null,foreignKeys:[]},this._registry[a].class=n,n.prototype._schema=this,n.prototype.modelName=o,n.prototype.hasManyAssociations={},n.prototype.hasManyAssociationFks={},n.prototype.belongsToAssociations={},n.prototype.belongsToAssociationFks={},n.prototype.associationKeys=new Set,n.prototype.associationIdKeys=new Set,n.prototype.dependentAssociations=[];var s={};for(var u in n.prototype)if(n.prototype[u]instanceof wa){var f=n.prototype[u];f.name=u,f.modelName=f.modelName||this.toModelName(u),f.ownerModelName=o,f.setSchema(this);var p=f.getForeignKeyArray(),d=nn(p,2),y=d[0],A=d[1];s[y]=s[y]||[],Re(!s[y].includes(A),"Your '".concat(r,"' model definition has multiple possible inverse relationships of type '").concat(y,"'. Please use explicit inverses.")),s[y].push(A),this._addForeignKeyToRegistry(y,A),f.addMethodsToModelClass(n,u)}var P=this.toCollectionName(o);return this.db[P]||this.db.createCollection(P),this[P]={camelizedModelName:a,new:function(v){return i.new(a,v)},create:function(v){return i.create(a,v)},all:function(v){return i.all(a,v)},find:function(v){return i.find(a,v)},findBy:function(v){return i.findBy(a,v)},findOrCreateBy:function(v){return i.findOrCreateBy(a,v)},where:function(v){return i.where(a,v)},none:function(v){return i.none(a,v)},first:function(v){return i.first(a,v)}},this}},{key:"modelFor",value:function(r){return this._registry[r]}},{key:"new",value:function(r,n){return this._instantiateModel(Ot(r),n)}},{key:"create",value:function(r,n){return this.new(r,n).save()}},{key:"all",value:function(r){var n=this.collectionForType(r);return this._hydrate(n,Ot(r))}},{key:"none",value:function(r){return this._hydrate([],Ot(r))}},{key:"find",value:function(r,n){var i=this.collectionForType(r),a=i.find(n);return Array.isArray(n)&&Re(a.length===n.length,"Couldn't find all ".concat(this._container.inflector.pluralize(r)," with ids: (").concat(n.join(","),") (found ").concat(a.length," results, but was looking for ").concat(n.length,")")),this._hydrate(a,Ot(r))}},{key:"findBy",value:function(r,n){var i=this.collectionForType(r),a=i.findBy(n);return this._hydrate(a,Ot(r))}},{key:"findOrCreateBy",value:function(r,n){var i=this.collectionForType(r),a=i.findBy(n),o;return a?o=this._hydrate(a,Ot(r)):o=this.create(r,n),o}},{key:"where",value:function(r,n){var i=this.collectionForType(r),a=i.where(n);return this._hydrate(a,Ot(r))}},{key:"first",value:function(r){var n=this.collectionForType(r),i=n[0];return this._hydrate(i,Ot(r))}},{key:"modelClassFor",value:function(r){var n=this._registry[Te(r)];return Re(n,"Model not registered: ".concat(r)),n.class.prototype}},{key:"addDependentAssociation",value:function(r,n){r.isPolymorphic?this._dependentAssociations.polymorphic.push(r):(this._dependentAssociations[n]=this._dependentAssociations[n]||[],this._dependentAssociations[n].push(r))}},{key:"dependentAssociationsFor",value:function(r){var n=this._dependentAssociations[r]||[],i=this._dependentAssociations.polymorphic||[];return n.concat(i)}},{key:"associationsFor",value:function(r){var n=this.modelClassFor(r);return Object.assign({},n.belongsToAssociations,n.hasManyAssociations)}},{key:"hasModelForModelName",value:function(r){return this.modelFor(Te(r))}},{key:"collectionForType",value:function(r){var n=this.toCollectionName(r);return Re(this.db[n],"You're trying to find model(s) of type ".concat(r," but this collection doesn't exist in the database.")),this.db[n]}},{key:"toCollectionName",value:function(r){if(typeof jc[r]!="string"){var n=Ot(r),i=Te(this._container.inflector.pluralize(n));jc[r]=i}return jc[r]}},{key:"toInternalCollectionName",value:function(r){if(typeof Lc[r]!="string"){var n="_".concat(this.toCollectionName(r));Lc[r]=n}return Lc[r]}},{key:"toModelName",value:function(r){if(typeof zc[r]!="string"){var n=Ot(r),i=this._container.inflector.singularize(n);zc[r]=i}return zc[r]}},{key:"_addForeignKeyToRegistry",value:function(r,n){this._registry[r]=this._registry[r]||{class:null,foreignKeys:[]};var i=this._registry[r].foreignKeys;i.includes(n)||i.push(n)}},{key:"_instantiateModel",value:function(r,n){var i=this._modelFor(r),a=this._foreignKeysFor(r);return new i(this,r,n,a)}},{key:"_modelFor",value:function(r){return this._registry[Te(r)].class}},{key:"_foreignKeysFor",value:function(r){return this._registry[Te(r)].foreignKeys}},{key:"_hydrate",value:function(r,n){if(Array.isArray(r)){var i=r.map(function(a){return this._instantiateModel(n,a)},this);return new Vn(n,i)}else return r?this._instantiateModel(n,r):null}}]),e}(),IA={Db:Vp,Association:wa,RouteHandler:Qp,BaseRouteHandler:Jo,Serializer:Yn,SerializerRegistry:Zp,Schema:eg},xA={singularize:ph,pluralize:hh},tg=function(){function e(){vt(this,e),this.inflector=xA}return xt(e,[{key:"register",value:function(r,n){this[r]=n}},{key:"create",value:function(r){var n=IA[r];n.prototype._container=this;for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];return En(n,a)}}]),e}(),Mi=new tg;Vp.prototype._container=Mi,wa.prototype._container=Mi,Jo.prototype._container=Mi,Qp.prototype._container=Mi,Yn.prototype._container=Mi,Zp.prototype._container=Mi,eg.prototype._container=Mi;var Hc={};function EA(e){if(typeof window!="undefined")return new To(function(){this.passthroughRequest=function(r,n,i){e.shouldLog()&&console.log("Mirage: Passthrough request for ".concat(r.toUpperCase()," ").concat(i.url))},this.handledRequest=function(r,n,i){if(e.shouldLog()){console.groupCollapsed("Mirage: [".concat(i.status,"] ").concat(r.toUpperCase()," ").concat(i.url));var a=i.requestBody,o=i.responseText,s,u;try{s=JSON.parse(a)}catch{s=a}try{u=JSON.parse(o)}catch{u=o}console.groupCollapsed("Response"),console.log(u),console.groupEnd(),console.groupCollapsed("Request (data)"),console.log(s),console.groupEnd(),console.groupCollapsed("Request (raw)"),console.log(i),console.groupEnd(),console.groupEnd()}};var t=this.checkPassthrough;this.checkPassthrough=function(r){var n=e.passthroughChecks.some(function(a){return a(r)});if(n){var i=r.url.includes("?")?r.url.substr(0,r.url.indexOf("?")):r.url;this[r.method.toLowerCase()](i,this.passthrough)}return t.apply(this,arguments)},this.unhandledRequest=function(r,n){n=decodeURI(n),Re("Your app tried to ".concat(r," '").concat(n,"', but there was no route defined to handle this request. Define a route for this endpoint in your routes() config. Did you forget to define a namespace?"))}},{trackRequests:e.shouldTrackRequests()})}var Uc={coalesce:!1,timing:void 0},CA={singularize:ph,pluralize:hh},RA=["http://localhost:0/chromecheckurl","http://localhost:30820/socket.io",function(e){return/.+\.hot-update.json$/.test(e.url)}];function TA(e){if(!e||nr(e)!=="object")return!1;for(var t=Object.keys(Uc),r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];if(t.indexOf(i)>-1)return!0}return!1}function MA(e){var t=e.splice(-1),r=nn(t,1),n=r[0];TA(n)?n=Ec({},Uc,n):(e.push(n),n=Uc);for(var i=2-e.length;i-- >0;)e.push(void 0);return e.push(n),e}function FA(e){return new $A(e)}var $A=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(this,e),this._container=new tg,this.config(t),this.db=this.db||void 0,this.schema=this.schema||void 0}return xt(e,[{key:"config",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.passthroughChecks=this.passthroughChecks||[];var n=r.environment&&this.environment&&this.environment!==r.environment;Re(!n,"You cannot modify Mirage's environment once the server is created"),this.environment=r.environment||this.environment||"development",r.routes&&(Re(!r.baseConfig,"The routes option is an alias for the baseConfig option. You can't pass both options into your server definition."),r.baseConfig=r.routes),r.seeds&&(Re(!r.scenarios,"The seeds option is an alias for the scenarios.default option. You can't pass both options into your server definition."),r.scenarios={default:r.seeds}),this._config=r,this.namespace=this.namespace||r.namespace||"",this.inflector=r.inflector||CA,this._container.register("inflector",this.inflector),this.urlPrefix=this.urlPrefix||r.urlPrefix||"",this.timing=this.timing||r.timing||400,this.logging=this.logging!==void 0?this.logging:void 0,this.testConfig=this.testConfig||void 0,this.trackRequests=r.trackRequests,this._defineRouteHandlerHelpers(),this.db?this.db.registerIdentityManagers(r.identityManagers):this.db=this._container.create("Db",void 0,r.identityManagers),this.schema?(this.schema.registerModels(r.models),this.serializerOrRegistry.registerSerializers(r.serializers||{})):(this.schema=this._container.create("Schema",this.db,r.models),this.serializerOrRegistry=this._container.create("SerializerRegistry",this.schema,r.serializers));var i=this._hasModulesOfType(r,"factories"),a=r.scenarios&&Object.prototype.hasOwnProperty.call(r.scenarios,"default"),o=r.trackRequests!==void 0&&this.pretender;Re(!o,"You cannot modify Pretender's request tracking once the server is created"),this.pretender=this.pretender||r.pretender||EA(this),r.baseConfig&&this.loadConfig(r.baseConfig),this.isTest()&&(r.testConfig&&this.loadConfig(r.testConfig),typeof window!="undefined"&&(window.server=this)),this.isTest()&&i?this.loadFactories(r.factories):!this.isTest()&&a?(this.loadFactories(r.factories),r.scenarios.default(this)):this.loadFixtures();var s=typeof r.useDefaultPassthroughs!="undefined"?r.useDefaultPassthroughs:!0;s&&this._configureDefaultPassthroughs()}},{key:"isTest",value:function(){return this.environment==="test"}},{key:"shouldLog",value:function(){return typeof this.logging!="undefined"?this.logging:!this.isTest()}},{key:"shouldTrackRequests",value:function(){return Boolean(this.trackRequests)}},{key:"loadConfig",value:function(r){r.call(this),this.timing=this.isTest()?0:this.timing||0}},{key:"passthrough",value:function(){for(var r=this,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];if(typeof window!="undefined"){var o=["get","post","put","delete","patch","options","head"],s=i[i.length-1];i.length===0?i=["/**","/"]:Array.isArray(s)&&(o=i.pop()),i.forEach(function(u){typeof u=="function"?r.passthroughChecks.push(u):o.forEach(function(f){var p=r._getFullPath(u);r.pretender[f](p,r.pretender.passthrough)})})}}},{key:"loadFixtures",value:function(){for(var r=this._config.fixtures,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];if(i.length){var o=i.map(Te),s=o.filter(function(u){return!r[u]});if(s.length)throw new Error("Fixtures not found: ".concat(s.join(", ")));r=_S.apply(void 0,[r].concat(Vo(o)))}this.db.loadData(r)}},{key:"loadFactories",value:function(){var r=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=this._factoryMap||{};this._factoryMap=Ec(i,n),Object.keys(n).forEach(function(a){var o=r.schema.toCollectionName(a);r.db.createCollection(o)})}},{key:"factoryFor",value:function(r){var n=Te(r);if(this._factoryMap&&this._factoryMap[n])return this._factoryMap[n]}},{key:"build",value:function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];var o=i.filter(function(C){return C&&typeof C=="string"}),s=Rc(i,function(C){return Iu(C)}),u=Te(r);this.factorySequences=this.factorySequences||{},this.factorySequences[u]=this.factorySequences[u]+1||0;var f=this.factoryFor(r);if(f){f=f.extend({});var p=f.attrs||{};this._validateTraits(o,f,r);var d=this._mergeExtensions(p,o,s);this._mapAssociationsFromAttributes(r,p,s),this._mapAssociationsFromAttributes(r,d);var y=f.extend(d),A=new y,P=this.factorySequences[u];return A.build(P)}else return s}},{key:"buildList",value:function(r,n){Re(Up(n),"second argument has to be an integer, you passed: ".concat(nr(n)));for(var i=[],a=arguments.length,o=new Array(a>2?a-2:0),s=2;s<a;s++)o[s-2]=arguments[s];for(var u=[r].concat(o),f=0;f<n;f++)i.push(this.build.apply(this,u));return i}},{key:"create",value:function(r){var n=this;Re(this._modelOrFactoryExistsForType(r),"You called server.create('".concat(r,"') but no model or factory was found. Make sure you're passing in the singularized version of the model or factory name."));for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];var s=a.filter(function(v){return v&&typeof v=="string"}),u=Rc(a,function(v){return Iu(v)}),f=Rc(a,function(v){return v&&Array.isArray(v)}),p=this.build.apply(this,[r].concat(Vo(s),[u])),d;if(this.schema&&this.schema[this.schema.toCollectionName(r)]){var y=this.schema[this.schema.toCollectionName(r)];d=y.create(p)}else{var A,P;f?A=f:(P=this.schema?this.schema.toInternalCollectionName(r):"_".concat(this.inflector.pluralize(r)),A=this.db[P]),Re(A,"You called server.create('".concat(r,"') but no model or factory was found.")),d=A.insert(p)}var C=this.factoryFor(r);return C&&C.extractAfterCreateCallbacks({traits:s}).forEach(function(v){v(d,n)}),d}},{key:"createList",value:function(r,n){Re(this._modelOrFactoryExistsForType(r),"You called server.createList('".concat(r,"') but no model or factory was found. Make sure you're passing in the singularized version of the model or factory name.")),Re(Up(n),"second argument has to be an integer, you passed: ".concat(nr(n)));for(var i=[],a=this.schema?this.schema.toInternalCollectionName(r):"_".concat(this.inflector.pluralize(r)),o=this.db[a],s=arguments.length,u=new Array(s>2?s-2:0),f=2;f<s;f++)u[f-2]=arguments[f];for(var p=[r].concat(u,[o]),d=0;d<n;d++)i.push(this.create.apply(this,p));return i}},{key:"shutdown",value:function(){typeof window!="undefined"&&this.pretender.shutdown(),typeof window!="undefined"&&this.environment==="test"&&(window.server=void 0)}},{key:"resource",value:function(r){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.only,o=i.except,s=i.path;if(r=this.inflector.pluralize(r),s=s||"/".concat(r),a=a||[],o=o||[],a.length>0&&o.length>0)throw"cannot use both :only and :except options";var u={index:{methods:["get"],path:"".concat(s)},show:{methods:["get"],path:"".concat(s,"/:id")},create:{methods:["post"],path:"".concat(s)},update:{methods:["put","patch"],path:"".concat(s,"/:id")},delete:{methods:["del"],path:"".concat(s,"/:id")}},f=Object.keys(u),p=a.length>0&&a||o.length>0&&f.filter(function(d){return o.indexOf(d)===-1})||f;p.forEach(function(d){var y=u[d];y.methods.forEach(function(A){return s===r?n[A](y.path):n[A](y.path,r)})})}},{key:"_defineRouteHandlerHelpers",value:function(){var r=this;[["get"],["post"],["put"],["delete","del"],["patch"],["head"],["options"]].forEach(function(n){var i=nn(n,2),a=i[0],o=i[1];r[a]=function(s){for(var u=arguments.length,f=new Array(u>1?u-1:0),p=1;p<u;p++)f[p-1]=arguments[p];var d=MA(f),y=nn(d,3),A=y[0],P=y[1],C=y[2];return r._registerRouteHandler(a,s,A,P,C)},o&&(r[o]=r[a])})}},{key:"_serialize",value:function(r){return typeof r=="string"?r:JSON.stringify(r)}},{key:"_registerRouteHandler",value:function(r,n,i,a,o){var s=this,u=this._container.create("RouteHandler",{schema:this.schema,verb:r,rawHandler:i,customizedCode:a,options:o,path:n,serializerOrRegistry:this.serializerOrRegistry}),f=this._getFullPath(n),p=o.timing!==void 0?o.timing:function(){return s.timing};if(this.pretender)return this.pretender[r](f,function(d){return u.handle(d).then(function(y){var A=nn(y,3),P=A[0],C=A[1],v=A[2];return[P,C,s._serialize(v)]})},p)}},{key:"_hasModulesOfType",value:function(r,n){var i=r[n];return i?Object.keys(i).length>0:!1}},{key:"_getFullPath",value:function(r){r=r[0]==="/"?r.slice(1):r;var n="",i=this.urlPrefix?this.urlPrefix.trim():"",a="";if(this.urlPrefix&&this.namespace&&(this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]==="/"&&(a=this.namespace.substring(0,this.namespace.length-1).substring(1)),this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a=this.namespace.substring(1)),this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]==="/"&&(a=this.namespace.substring(0,this.namespace.length-1)),this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a=this.namespace)),this.namespace&&!this.urlPrefix){if(this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]==="/"&&(a=this.namespace.substring(0,this.namespace.length-1)),this.namespace[0]==="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a=this.namespace),this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]==="/"){var o=this.namespace.substring(0,this.namespace.length-1);a="/".concat(o)}this.namespace[0]!=="/"&&this.namespace[this.namespace.length-1]!=="/"&&(a="/".concat(this.namespace))}return this.namespace||(a=""),/^https?:\/\//.test(r)?n+=r:(i.length&&(n+=i[i.length-1]==="/"?i:"".concat(i,"/")),n+=a,n[n.length-1]!=="/"&&(n+="/"),n+=r,/^https?:\/\//.test(n)||(n="/".concat(n),n=n.replace(/\/+/g,"/"))),n}},{key:"_configureDefaultPassthroughs",value:function(){var r=this;RA.forEach(function(n){r.passthrough(n)})}},{key:"_typeIsPluralForModel",value:function(r){if(typeof Hc[r]!="boolean"){var n=this._modelOrFactoryExistsForTypeOrCollectionName(r),i=r===this.inflector.pluralize(r),a=this.inflector.singularize(r)===this.inflector.pluralize(r),o=i&&!a&&n;Hc[r]=o}return Hc[r]}},{key:"_modelOrFactoryExistsForType",value:function(r){var n=this.schema&&this.schema.modelFor(Te(r)),i=this.db[this.schema.toInternalCollectionName(r)];return(n||i)&&!this._typeIsPluralForModel(r)}},{key:"_modelOrFactoryExistsForTypeOrCollectionName",value:function(r){var n=this.schema&&this.schema.modelFor(Te(r)),i=this.db[this.schema.toInternalCollectionName(r)];return n||i}},{key:"_validateTraits",value:function(r,n,i){r.forEach(function(a){if(!n.isTrait(a))throw new Error("'".concat(a,"' trait is not registered in '").concat(i,"' factory"))})}},{key:"_mergeExtensions",value:function(r,n,i){var a=n.map(function(o){return r[o].extension});return a.push(i||{}),a.reduce(function(o,s){return Ec(o,s)},{})}},{key:"_mapAssociationsFromAttributes",value:function(r,n){var i=this,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(n||{}).filter(function(o){return yA(n[o])}).forEach(function(o){var s=i.schema.modelClassFor(r),u=s.associationFor(o);Re(u&&u instanceof Oa,"You're using the `association` factory helper on the '".concat(o,"' attribute of your ").concat(r," factory, but that attribute is not a `belongsTo` association."));var f=u&&u instanceof Oa&&u.modelName===r;Re(!f,"You're using the association() helper on your ".concat(r," factory for ").concat(o,", which is a belongsTo self-referential relationship. You can't do this as it will lead to infinite recursion. You can move the helper inside of a trait and use it selectively."));var p=u&&u.opts&&u.opts.polymorphic;Re(!p,"You're using the association() helper on your ".concat(r," factory for ").concat(o,", which is a polymorphic relationship. This is not currently supported."));var d=n[o],y="".concat(Te(o),"Id");a[o]||(n[y]=i.create.apply(i,[u.modelName].concat(Vo(d.traitsAndOverrides))).id),delete n[o]})}}]),e}(),NA=Yn.extend({serializeIds:"always",normalizeIds:!0,keyForModel:function(t){return Gn(t)},keyForAttribute:function(t){return Gn(t)},keyForRelationship:function(t){return this._container.inflector.pluralize(Gn(t))},keyForEmbeddedRelationship:function(t){return Gn(t)},keyForRelationshipIds:function(t){return"".concat(Gn(this._container.inflector.singularize(t)),"_ids")},keyForForeignKey:function(t){return"".concat(Gn(t),"_id")},keyForPolymorphicForeignKeyId:function(t){return"".concat(Gn(t),"_id")},keyForPolymorphicForeignKeyType:function(t){return"".concat(Gn(t),"_type")},normalize:function(t){var r=this,n=Object.keys(t)[0],i=t[n],a=Te(n),o=this.schema.modelClassFor(a),s=o.belongsToAssociations,u=o.hasManyAssociations,f=Object.keys(s),p=Object.keys(u),d={data:{type:this._container.inflector.pluralize(n),attributes:{}}};i.id&&(d.data.id=i.id);var y={};return Object.keys(i).forEach(function(A){if(A!=="id")if(r.normalizeIds)if(f.includes(A)){var P=s[A],C=P.modelName;y[Ot(A)]={data:{type:C,id:i[A]}}}else if(p.includes(A)){var v=u[A],I=v.modelName,T=i[A].map(function(M){return{type:I,id:M}});y[Ot(A)]={data:T}}else d.data.attributes[Ot(A)]=i[A];else d.data.attributes[Ot(A)]=i[A]}),Object.keys(y).length&&(d.data.relationships=y),d},getCoalescedIds:function(t){return t.queryParams&&t.queryParams.ids}});NA.extend({serializeIds:"always",keyForModel:function(t){return Te(t)},keyForAttribute:function(t){return Te(t)},keyForRelationship:function(t){return Te(this._container.inflector.pluralize(t))},keyForEmbeddedRelationship:function(t){return Te(t)},keyForRelationshipIds:function(t){return Te(this._container.inflector.pluralize(t))},keyForForeignKey:function(t){return Te(this._container.inflector.singularize(t))},getCoalescedIds:function(t){return t.queryParams&&t.queryParams.ids}});function DA(){return FA({routes(){this.namespace="api",this.get("/titlebar",()=>({product:{name:"Booking Engine",href:"/hotel_admin/spl.jsp"},propertySelector:{type:"fetch",hotels:"/api/hotels"},user:{label:"Profile",children:[{label:"Maintain Users",href:"https://admin-dc.dev.bookassist.com/hotel_admin/maintain_users.jsp"},{label:"Change Password",href:"https://admin-dc.dev.bookassist.com/hotel_admin/login.jsp?resetpass"},{label:"Log Out",href:"https://admin-dc.bookassist.com/hotel_admin/logout.jsp"}]},languageSelector:{label:"Language",children:[{code:"en",label:"EnGlIsH"},{code:"cs"},{code:"de"},{code:"es"},{code:"fr"},{code:"it"},{code:"pl"},{code:"pt"}]},help:{label:"Help Center",href:"https://go.bookassist.org/en/knowledge/booking-engine"}})),this.get("/menu",()=>[{id:"raq3yznphb",label:"Hotel setup"},{id:"xjcwuw5o0wl",parentId:"raq3yznphb",label:"Hotel Logo",href:"#HotelLogo"},{id:"epzy61enrwu",parentId:"raq3yznphb",label:"Hotel Mobile Colours",href:"#HotelMobileColours"},{id:"szeh0zcpjn",parentId:"raq3yznphb",label:"Deposit Invoices",href:"#Invoices"},{id:"65csve3x2l",parentId:"raq3yznphb",label:"General Hotel Policies",href:"#GeneralHotelPolicies"},{id:"5tequyqbitm",parentId:"raq3yznphb",label:"Locate your hotel",href:"#Locateyourhotel"},{id:"mk86ze75d7",parentId:"raq3yznphb",label:"Premium example",premium:{value:!0,locked:!0}},{id:"f1ec1ry0rro",label:"Rooms/Packages"},{id:"w7x9wwfq4ge",parentId:"f1ec1ry0rro",label:"Manage Rooms & Packages",href:"#ManageRoomsPackages"},{id:"njxovt6l0d",parentId:"f1ec1ry0rro",label:"Book without credit card",href:"#Bookwithoutcreditcard"},{id:"39dl1gf3e8x",parentId:"f1ec1ry0rro",label:"XMLConnector Inventory",href:"#XMLConnectorInventory"},{id:"0qwiv7k5i6md",label:"Rates/Availability"},{id:"o3qrjsnlyin",parentId:"0qwiv7k5i6md",label:"Availability",group:"Availability"},{id:"gk3gwhnfo8j",parentId:"o3qrjsnlyin",label:"Edit Availability",href:"#EditAvailability"},{id:"g95dnxr3ifb",parentId:"o3qrjsnlyin",label:"Availability Batch",href:"#AvailabilityBatch"},{id:"8lttj490hu8",parentId:"0qwiv7k5i6md",label:"Availability and Rate Details",href:"#AvailabilityandRateDetails",group:"Availability"},{id:"7y6i0dnzc8o",parentId:"0qwiv7k5i6md",label:"Edit Rates",href:"#EditRates",group:"Rates"},{id:"o7c1dx9xume",parentId:"0qwiv7k5i6md",label:"Adjust Rates Manually",group:"Rates"},{id:"an9perx1x67",parentId:"o7c1dx9xume",label:"Adjust Rates",href:"#AdjustRates"},{id:"irtojrlv0t8",parentId:"o7c1dx9xume",label:"Rates Batch",href:"#RatesBatch"},{id:"j4mctyj216",parentId:"0qwiv7k5i6md",label:"Minimum Stays",group:"Restrictions"},{id:"yus5cglsgmm",parentId:"j4mctyj216",label:"Edit Minimum Stays",href:"#EditMinimumStays"},{id:"di4smaz6oyk",parentId:"j4mctyj216",label:"Batch",href:"#Batch"},{id:"3nvl2vajzb8",parentId:"0qwiv7k5i6md",label:"Closed For Arrival",group:"Restrictions"},{id:"gs54wi7f3ov",parentId:"3nvl2vajzb8",label:"Edit Closed For Arrival",href:"#EditClosedForArrival"},{id:"o8xoquq2vhm",parentId:"3nvl2vajzb8",label:"Batch",href:"#Batch"},{id:"a3lezzgyke",parentId:"0qwiv7k5i6md",label:"Open/Close Rooms",group:"Restrictions"},{id:"yhmwk4ntycs",parentId:"a3lezzgyke",label:"Edit Open/Close Rooms",href:"#EditOpenCloseRooms"},{id:"i00jgm1jw4",parentId:"a3lezzgyke",label:"Batch",href:"#Batch"},{id:"nwvz5qdsn4",parentId:"0qwiv7k5i6md",label:"Open/Closed Rooms Report",href:"#OpenClosedRoomsReport",group:"Restrictions"},{id:"xet04pxoomi",parentId:"0qwiv7k5i6md",label:"Extra Beds"},{id:"ww3e5s1k37s",parentId:"xet04pxoomi",label:"Edit Extra Beds",href:"#EditExtraBeds",group:"Restrictions"},{id:"3kdww03xlh8",parentId:"xet04pxoomi",label:"Batch",href:"#Batch"},{id:"462vczykrt8",label:"Extras"},{id:"rk6y9sxm8km",parentId:"462vczykrt8",label:"Manage Meal Plans",href:"#ManageMealPlans",group:"Meal Plans"},{id:"wg3uwe8mh2",parentId:"462vczykrt8",label:"Meal Plans Prices",group:"Meal Plans"},{id:"g128kodkhjo",parentId:"wg3uwe8mh2",label:"Edit Meal Plans Prices",href:"#EditMealPlansPrices"},{id:"xod48otj9o",parentId:"wg3uwe8mh2",label:"Meal Plans Prices Batch",href:"#MealPlansPricesBatch"},{id:"kwmxcwr5y8s",parentId:"462vczykrt8",label:"Open/Close Add-ons",href:"#OpenCloseAddons",group:"Add-Ons"},{id:"rbk08ib5mxb",parentId:"462vczykrt8",label:"Switch Off Add-ons",href:"#SwitchOffAddons",group:"Add-Ons"},{id:"ntbts4i22sb",parentId:"462vczykrt8",label:"Dynamic Discounts",href:"#DynamicDiscounts",group:"Discounts"},{id:"736g9tauy6k",parentId:"462vczykrt8",label:"Open/Close Discounts",group:"Discounts"},{id:"2qvsnasaj1l",parentId:"736g9tauy6k",label:"Edit Open/Close Discounts",href:"#EditOpenCloseDiscounts"},{id:"nj3242z7nt",parentId:"736g9tauy6k",label:"Batch",href:"#Batch"},{id:"ocf8po5w2el",parentId:"462vczykrt8",label:"Open/Close IRS",href:"#OpenCloseIRS",group:"Upselling"},{id:"5kccvsqsuf4",label:"Reservations",href:"#Reservations"},{id:"vu9d7b45nte",parentId:"5kccvsqsuf4",label:"Manage Reservation",href:"#ManageReservation"},{id:"f437g317fjc",parentId:"5kccvsqsuf4",label:"Search Reservations",href:"#SearchReservations"},{id:"k5464kvte8l",parentId:"5kccvsqsuf4",label:"Bookings Reports",href:"#BookingsReports"},{id:"cb58wdcv38c",label:"Corporate",href:"#Corporate"},{id:"3r614o7kqby",parentId:"cb58wdcv38c",label:"Customer list",href:"#Customerlist"},{id:"3qa95mud1xf",parentId:"cb58wdcv38c",label:"Categories",href:"#Categories"},{id:"af6698sant",parentId:"cb58wdcv38c",label:"Companies",href:"#Companies"},{id:"2wbkjjcia",parentId:"cb58wdcv38c",label:"Corporate Rates",href:"#CorporateRates"},{id:"hyaxqvj6doh",parentId:"cb58wdcv38c",label:"Corp Rate Groups",href:"#CorpRateGroups"},{id:"6rocuyqud7m",parentId:"cb58wdcv38c",label:"Create Rewards",href:"#CreateRewards"},{id:"a07tcgufbqm",parentId:"cb58wdcv38c",label:"Create New Customer",href:"#CreateNewCustomer"},{id:"s0ioinudzz",parentId:"cb58wdcv38c",label:"Voucher Availability",href:"#VoucherAvailability"},{id:"emm4qyt75ga",label:"Reputation",href:"#Reputation"},{id:"ysvbfa69j6",parentId:"emm4qyt75ga",label:"Direct Customer Reviews",href:"#DirectCustomerReviews"},{id:"67e1vjgsbl7",label:"Vouchers",href:"#Vouchers"},{id:"vx6f8cd05od",parentId:"67e1vjgsbl7",label:"Create Vouchers",href:"#CreateVouchers"},{id:"9fvp9xal5qo",parentId:"67e1vjgsbl7",label:"Purchased Vouchers",href:"#PurchasedVouchers"},{id:"bhe7fnem0nt",parentId:"67e1vjgsbl7",label:"Vouchers delivery options",href:"#Vouchersdeliveryoptions"}]),this.get("/notifications",()=>({en:[{title:"Test header 1",items:[{title:"Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-01-01"},{title:"Ipsum Dolor Sem Ligula",url:"#",date:"2022-01-05"},{title:"Vestibulum Amet Risus Vehicula",url:"#",date:"2022-02-07"},{title:"Ullamcorper Parturient Malesuada Magna",url:"#",date:"2022-02-15"},{title:"Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-03-04"}]},{title:"Test header 2",items:[{title:"Vestibulum Amet Risus Vehicula",url:"#",date:"2022-01-03"},{title:"Ullamcorper Parturient Malesuada Magna",url:"#",date:"2022-02-14"},{title:"Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-03-03"},{title:"Ipsum Dolor Sem Ligula",url:"#",date:"2022-03-31"},{title:"Vestibulum Amet Risus Vehicula",url:"#",date:"2022-04-04"}]}],es:[{title:"Test header 1 ES",items:[{title:"ES Sollicitudin Vulputate Nibh Adipiscing",url:"#",date:"2022-01-01"},{title:"ES Ipsum Dolor Sem Ligula",url:"#",date:"2022-01-05"}]},{title:"Test header 2 ES",items:[{title:"ES Ipsum Dolor Sem Ligula",url:"#",date:"2022-03-31"},{title:"ES Vestibulum Amet Risus Vehicula",url:"#",date:"2022-04-04"}]}]})),this.get("/hotels",()=>[[" NON ATTIVO - Hotel Lunetta","2071_808"],["987 Design Prague Hotel","3291_802"],["A.Liebeskind Hotel","4012_823"],["Abbey Hotel Ballyvourney","2155_2"],["ABC Arabian Suites","2001_829"],["Abito Hotel","3425_802"],["Abrial Hotel","1101_600"],["Academy Plaza Hotel","9_1"],["Actons Hotel Kinsale","1739_2"],["ADLER HOTEL","3724_802"],["Adria Hotel Prague","1465_802"],["Agroturismo Can Toni Xumeu","3033_102"],["AGUA DE MaR Hotel Boutique","2620_102"],["Aida Plaza Hotel","2677_810"],["Akademik Collegia","3976_823"],["Akcent Hotel","2017_802"],["Al Buraimi Hotel","2076_869"],["Albergo Firenze","2722_808"],["Alef Hotel","3672_809"],["Alerion Hotel","2673_600"],["Aletti Palace Hotel","1742_600"],["Alexandra Lodge","1801_401"],["Allegroitalia Elba Capo D'arco","3160_808"],["Allegroitalia Elba Golf","3161_808"],["Allegroitalia Espresso Bologna","3115_808"],["Allegroitalia Etna Pedara","3163_808"],["Allegroitalia Golden Palace","3116_808"],["Allegroitalia Nazionale Volterra","3176_808"]]),this.passthrough("https://www.bookassist.com/**"),this.passthrough("https://exceptions.hubspot.com/**"),this.passthrough("https://api.hubspot.com/**"),this.passthrough("https://forms.hubspot.com/**"),this.passthrough("/hotel_admin/json/title_bar.jsp")}})}var rg={exports:{}},jA="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",LA=jA,zA=LA;function ng(){}function ig(){}ig.resetWarningCache=ng;var HA=function(){function e(n,i,a,o,s,u){if(u!==zA){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:ig,resetWarningCache:ng};return r.PropTypes=r,r};rg.exports=HA();var se=rg.exports,gi=ot.default.createContext(null);function UA(e){e()}var ag=UA,BA=function(t){return ag=t},kA=function(){return ag};function WA(){var e=kA(),t=null,r=null;return{clear:function(){t=null,r=null},notify:function(){e(function(){for(var i=t;i;)i.callback(),i=i.next})},get:function(){for(var i=[],a=t;a;)i.push(a),a=a.next;return i},subscribe:function(i){var a=!0,o=r={callback:i,next:null,prev:r};return o.prev?o.prev.next=o:t=o,function(){!a||t===null||(a=!1,o.next?o.next.prev=o.prev:r=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}var og={notify:function(){},get:function(){return[]}};function sg(e,t){var r,n=og;function i(d){return u(),n.subscribe(d)}function a(){n.notify()}function o(){p.onStateChange&&p.onStateChange()}function s(){return Boolean(r)}function u(){r||(r=t?t.addNestedSub(o):e.subscribe(o),n=WA())}function f(){r&&(r(),r=void 0,n.clear(),n=og)}var p={addNestedSub:i,notifyNestedSubs:a,handleChangeWrapper:o,isSubscribed:s,trySubscribe:u,tryUnsubscribe:f,getListeners:function(){return n}};return p}var Bc=typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement!="undefined"?z.useLayoutEffect:z.useEffect,Zo={exports:{}},Pa={};/*
27
27
  object-assign
28
28
  (c) Sindre Sorhus
29
29
  @license MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ba-js-common-header",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "vite build",