Skip to content

Instantly share code, notes, and snippets.

@jmdisuanco
Last active April 11, 2017 12:47
Show Gist options
  • Select an option

  • Save jmdisuanco/f58db40de9afee13dc37a1e6e5a2e459 to your computer and use it in GitHub Desktop.

Select an option

Save jmdisuanco/f58db40de9afee13dc37a1e6e5a2e459 to your computer and use it in GitHub Desktop.
Feathers Client and Client-Authentication for feathers-authentication@1.x
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.client=e()}}(function(){var define,module,exports;return function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(e){var r=t[s][1][e];return o(r||e)},f,f.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,r){(function(n){function o(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(e){var t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff),t){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var o=0,i=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(i=o))}),e.splice(i,0,n)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?r.storage.removeItem("debug"):r.storage.debug=e}catch(e){}}function u(){var e;try{e=r.storage.debug}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}r=t.exports=e("./debug"),r.log=s,r.formatArgs=i,r.save=a,r.load=u,r.useColors=o,r.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},r.enable(u())}).call(this,e("_process"))},{"./debug":2,_process:64}],2:[function(e,t,r){function n(e){var t,n=0;for(t in e)n=(n<<5)-n+e.charCodeAt(t),n|=0;return r.colors[Math.abs(n)%r.colors.length]}function o(e){function t(){if(t.enabled){var e=t,n=+new Date,o=n-(c||n);e.diff=o,e.prev=c,e.curr=n,c=n;for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];i[0]=r.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var a=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(t,n){if("%%"===t)return t;a++;var o=r.formatters[n];if("function"==typeof o){var s=i[a];t=o.call(e,s),i.splice(a,1),a--}return t}),r.formatArgs.call(e,i);(t.log||r.log||console.log.bind(console)).apply(e,i)}}return t.namespace=e,t.enabled=r.enabled(e),t.useColors=r.useColors(),t.color=n(e),"function"==typeof r.init&&r.init(t),t}function i(e){r.save(e),r.names=[],r.skips=[];for(var t=(e||"").split(/[\s,]+/),n=t.length,o=0;o<n;o++)t[o]&&(e=t[o].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function s(){r.enable("")}function a(e){var t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}r=t.exports=o.debug=o.default=o,r.coerce=u,r.disable=s,r.enable=i,r.enabled=a,r.humanize=e("ms"),r.names=[],r.skips=[],r.formatters={};var c},{ms:45}],3:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("./populate-header"),i=n(o),s=e("./populate-access-token"),a=n(s),u=e("./populate-entity"),c=n(u),f={populateHeader:i.default,populateAccessToken:a.default,populateEntity:c.default};r.default=f,t.exports=r.default},{"./populate-access-token":4,"./populate-entity":5,"./populate-header":6}],4:[function(e,t,r){"use strict";function n(){return function(e){var t=e.app;return"before"!==e.type?Promise.reject(new Error("The 'populateAccessToken' hook should only be used as a 'before' hook.")):(Object.assign(e.params,{accessToken:t.get("accessToken")}),Promise.resolve(e))}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n,t.exports=r.default},{}],5:[function(e,t,r){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.service)throw new Error("You need to pass 'options.service' to the populateEntity() hook.");if(!e.field)throw new Error("You need to pass 'options.field' to the populateEntity() hook.");if(!e.entity)throw new Error("You need to pass 'options.entity' to the populateEntity() hook.");return function(t){var r=t.app;return"after"!==t.type?Promise.reject(new Error("The 'populateEntity' hook should only be used as an 'after' hook.")):r.passport.verifyJWT(t.result.accessToken).then(function(t){var n=t[e.field];return n?r.service(e.service).get(n):Promise.reject(new Error("Access token payload is missing the '"+e.field+"' field."))}).then(function(n){return t.result[e.entity]=n,r.set(e.entity,n),Promise.resolve(t)})}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n,t.exports=r.default},{}],6:[function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.header)throw new Error("You need to pass 'options.header' to the populateHeader() hook.");return function(t){return"before"!==t.type?Promise.reject(new Error("The 'populateHeader' hook should only be used as a 'before' hook.")):(t.params.accessToken&&(t.params.headers=Object.assign({},n({},e.header,e.prefix?e.prefix+" "+t.params.accessToken:t.params.accessToken),t.params.headers)),Promise.resolve(t))}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=o,t.exports=r.default},{}],7:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},c,e);return function(){var e=this;e.passport=new u.default(e,t),e.authenticate=e.passport.authenticate.bind(e.passport),e.logout=e.passport.logout.bind(e.passport),e.mixins.push(function(e){if("function"!=typeof e.before||"function"!=typeof e.after)throw new Error("It looks like feathers-hooks isn't configured. It is required before running feathers-authentication.");e.before(s.default.populateAccessToken(t))}),e.rest&&e.mixins.push(function(e){e.before(s.default.populateHeader(t))})}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;var i=e("./hooks/index"),s=n(i),a=e("./passport"),u=n(a),c={header:"Authorization",cookie:"feathers-jwt",storageKey:"feathers-jwt",jwtStrategy:"jwt",path:"/authentication",entity:"user",service:"users",timeout:5e3};o.defaults=c,t.exports=r.default},{"./hooks/index":3,"./passport":8}],8:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=e("feathers-errors"),a=n(s),u=e("jwt-decode"),c=n(u),f=e("debug"),l=n(f),p=e("./utils"),h=(0,l.default)("feathers-authentication-client"),d=function(){function e(t,r){if(o(this,e),t.passport)throw new Error("You have already registered authentication on this client app instance. You only need to do it once.");Object.assign(this,{options:r,app:t,payloadIsValid:p.payloadIsValid,getCookie:p.getCookie,clearCookie:p.clearCookie,storage:t.get("storage")||this.getStorage(r.storage)}),this.setJWT=this.setJWT.bind(this),t.set("storage",this.storage),this.getJWT().then(this.setJWT),this.setupSocketListeners()}return i(e,[{key:"setupSocketListeners",value:function(){var e=this,t=this.app,r=t.io||t.primus,n=t.io?"emit":"send",o=t.io?"reconnect":"reconnected";if(r){r.on(o,function(){if(h("Socket reconnected"),r.authenticated){var o={strategy:e.options.jwtStrategy,accessToken:t.get("accessToken")};e.authenticateSocket(o,r,n).then(e.setJWT).catch(function(e){h("Error re-authenticating after socket reconnect",e),r.authenticated=!1,t.emit("reauthentication-error",e)})}});var i=function(){r.io.engine.on("upgrade",function(){if(h("Socket upgrading"),r.authenticated){var o={strategy:e.options.jwtStrategy,accessToken:t.get("accessToken")};e.authenticateSocket(o,r,n).then(e.setJWT).catch(function(e){h("Error re-authenticating after socket upgrade",e),r.authenticated=!1,t.emit("reauthentication-error",e)})}})};r.io&&r.io.engine?i():r.on("connect",i)}}},{key:"connected",value:function(){var e=this,t=this.app;if(t.rest)return Promise.resolve();var r=t.io||t.primus;return r?t.io&&r.connected||t.primus&&3===r.readyState?(h("Socket already connected"),Promise.resolve(r)):new Promise(function(n,o){var i=t.primus?"open":"connect",s=t.io?"disconnect":"end",a=setTimeout(function(){h("Socket connection timed out"),o(new Error("Socket connection timed out"))},e.options.timeout);h("Waiting for socket connection");var u=function(){h("Socket disconnected before it could connect"),r.authenticated=!1};r.once(s,u),r.once(i,function(){h("Socket connected"),h("Removing "+s+" listener"),r.removeListener(s,u),clearTimeout(a),n(r)})}):Promise.reject(new Error("It looks like your client connection has not been configured."))}},{key:"authenticate",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this.app,n=Promise.resolve(t);return t.strategy||(t.accessToken?t.strategy=this.options.jwtStrategy:n=this.getJWT().then(function(t){return t?{strategy:e.options.jwtStrategy,accessToken:t}:Promise.reject(new a.default.NotAuthenticated("Could not find stored JWT and no authentication strategy was given"))})),n.then(function(t){return e.connected(r).then(function(n){if(r.rest)return r.service(e.options.path).create(t).then(e.setJWT);var o=r.io?"emit":"send";return e.authenticateSocket(t,n,o).then(e.setJWT)})}).then(function(e){return r.emit("authenticated",e),e})}},{key:"authenticateSocket",value:function(e,t,r){var n=this;return new Promise(function(o,i){var s=setTimeout(function(){h("authenticateSocket timed out"),i(new Error("Authentication timed out"))},n.options.timeout);h("Attempting to authenticate socket"),t[r]("authenticate",e,function(e,r){if(e)return i(e);clearTimeout(s),t.authenticated=!0,h("Socket authenticated!"),o(r)})})}},{key:"logoutSocket",value:function(e,t){var r=this;return new Promise(function(n,o){var i=setTimeout(function(){h("logoutSocket timed out"),o(new Error("Logout timed out"))},r.options.timeout);e[t]("logout",function(t){if(clearTimeout(i),e.authenticated=!1,t)return o(t);n()})})}},{key:"logout",value:function(){var e=this,t=this.app;return t.set("accessToken",null),this.clearCookie(this.options.cookie),Promise.resolve(t.get("storage").removeItem(this.options.storageKey)).then(function(){if(t.io||t.primus){var r=t.io?"emit":"send",n=t.io?t.io:t.primus;return e.logoutSocket(n,r)}}).then(function(e){return t.emit("logout",e),e})}},{key:"setJWT",value:function(e){var t=e&&e.accessToken?e.accessToken:e;return t&&(this.app.set("accessToken",t),this.app.get("storage").setItem(this.options.storageKey,t)),Promise.resolve(e)}},{key:"getJWT",value:function(){var e=this,t=this.app;return new Promise(function(r){var n=t.get("accessToken");return n?r(n):Promise.resolve(e.storage.getItem(e.options.storageKey)).then(function(t){var n=t||e.getCookie(e.options.cookie);return n&&"null"!==n&&!e.payloadIsValid((0,c.default)(n))&&(n=void 0),r(n)})})}},{key:"verifyJWT",value:function(e){if("string"!=typeof e)return Promise.reject(new Error("Token provided to verifyJWT is missing or not a string"));try{var t=(0,c.default)(e);return this.payloadIsValid(t)?Promise.resolve(t):Promise.reject(new Error("Invalid token: expired"))}catch(e){return Promise.reject(new Error("Cannot decode malformed token."))}}},{key:"getStorage",value:function(e){return e||new p.Storage}}]),e}();r.default=d,t.exports=r.default},{"./utils":9,debug:1,"feathers-errors":14,"jwt-decode":44}],9:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return e&&(!e.exp||1e3*e.exp>(new Date).getTime())}function i(e){if("undefined"!=typeof document){var t="; "+document.cookie,r=t.split("; "+e+"=");if(2===r.length)return r.pop().split(";").shift()}return null}function s(e){return"undefined"!=typeof document&&(document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;"),null}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();r.payloadIsValid=o,r.getCookie=i,r.clearCookie=s;r.Storage=function(){function e(){n(this,e),this.store={}}return a(e,[{key:"getItem",value:function(e){return this.store[e]}},{key:"setItem",value:function(e,t){return this.store[e]=t}},{key:"removeItem",value:function(e){return delete this.store[e],this}}]),e}()},{}],10:[function(e,t,r){"use strict";function n(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function o(e,t){return f[e](t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;var i=r.noop=function(){},s=function(e){var t=e[e.length-1];return"function"==typeof t?t:i},a=function(e,t){return"object"===n(e[t])?e[t]:{}},u=function(e){return function(t){var r=t[0],o=t[1],i=s(t),u=a(t,2);if("function"==typeof r)throw new Error("First parameter for '"+e+"' can not be a function");if("object"!==(void 0===o?"undefined":n(o)))throw new Error("No data provided for '"+e+"'");if(t.length>4)throw new Error("Too many arguments for '"+e+"' service method");return[r,o,u,i]}},c=function(e){return function(t){var r=t[0],n=a(t,1),o=s(t);if(t.length>3)throw new Error("Too many arguments for '"+e+"' service method");if("function"==typeof r)throw new Error("First parameter for '"+e+"' can not be a function");return[r,n,o]}},f=r.converters={find:function(e){var t=s(e),r=a(e,0);if(e.length>2)throw new Error("Too many arguments for 'find' service method");return[r,t]},create:function(e){var t=e[0],r=a(e,1),o=s(e);if("object"!==(void 0===t?"undefined":n(t)))throw new Error("First parameter for 'create' must be an object");if(e.length>3)throw new Error("Too many arguments for 'create' service method");return[t,r,o]},update:u("update"),patch:u("patch"),get:c("get"),remove:c("remove")}},{}],11:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("./arguments"),i=n(o),s=e("./utils"),a=e("./hooks"),u=n(a);r.default={_:s._,getArguments:i.default,stripSlashes:s.stripSlashes,hooks:u.default,matcher:s.matcher,sorter:s.sorter,select:s.select,makeUrl:s.makeUrl,each:s.each,some:s.some,every:s.every,keys:s.keys,values:s.values,isMatch:s.isMatch,isEmpty:s.isEmpty,isObject:s.isObject,extend:s.extend,omit:s.omit,pick:s.pick,merge:s.merge},t.exports=r.default},{"./arguments":10,"./hooks":12,"./utils":13}],12:[function(e,t,r){"use strict";function n(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function o(e){return{id:e[0],params:e[1],callback:e[2]}}function i(e){return{id:e[0],data:e[1],params:e[2],callback:e[3]}}function s(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=p[e](r);return o.method=e,o.type=t,"function"==typeof n?o.app=n:f(o,n),o}function a(e){var t=[];return void 0!==e.id&&t.push(e.id),e.data&&t.push(e.data),t.push(e.params||{}),t.push(e.callback),t}function u(e){return"find"===e.method?[e.params,e.callback]:"get"===e.method||"remove"===e.method?[e.id,e.params,e.callback]:"update"===e.method||"patch"===e.method?[e.id,e.data,e.params,e.callback]:"create"===e.method?[e.data,e.params,e.callback]:a(e)}function c(e){var t={};return Array.isArray(e)?t={all:e}:"object"!==(void 0===e?"undefined":n(e))?t={all:[e]}:(0,l.each)(e,function(e,r){t[r]=Array.isArray(e)?e:[e]}),t}var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};Object.defineProperty(r,"__esModule",{value:!0});var l=e("./utils"),p={find:function(e){return{params:e[0],callback:e[1]}},create:function(e){return{data:e[0],params:e[1],callback:e[2]}},get:o,remove:o,update:i,patch:i};r.default={hookObject:s,hook:s,converters:p,defaultMakeArguments:a,makeArguments:u,convertHookData:c},t.exports=r.default},{"./utils":13}],13:[function(e,t,r){(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e){return e.replace(/^(\/*)|(\/*)$/g,"")}function s(e,t){e&&"function"==typeof e.forEach?e.forEach(t):h(e)&&Object.keys(e).forEach(function(r){return t(e[r],r)})}function a(e,t){return Object.keys(e).map(function(t){return[e[t],t]}).some(function(e){return t.apply(void 0,o(e))})}function u(e,t){return Object.keys(e).map(function(t){return[e[t],t]}).every(function(e){return t.apply(void 0,o(e))})}function c(e){return Object.keys(e)}function f(e){return O.keys(e).map(function(t){return e[t]})}function l(e,t){return O.keys(t).every(function(r){return e[r]===t[r]})}function p(e){return 0===O.keys(e).length}function h(e){return"object"===(void 0===e?"undefined":n(e))&&!Array.isArray(e)&&null!==e}function d(){return k.apply(void 0,arguments)}function y(e){for(var t=O.extend({},e),r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.forEach(function(e){return delete t[e]}),t}function v(e){for(var t={},r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.forEach(function(r){t[r]=e[r]}),t}function m(e,r){return h(e)&&h(r)&&Object.keys(r).forEach(function(n){h(r[n])?(e[n]||k(e,t({},n,{})),m(e[n],r[n])):k(e,t({},n,r[n]))}),e}function b(e){for(var t=e&&e.query&&e.query.$select,r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];Array.isArray(t)&&n.length&&t.push.apply(t,n);var s=function(e){return Array.isArray(t)?O.pick.apply(O,[e].concat(o(t))):e};return function(e){return Array.isArray(e)?e.map(s):s(e)}}function g(e){var t=O.omit(e,"$limit","$skip","$sort","$select");return function(e){return!(!t.$or||!O.some(t.$or,function(t){return g(t)(e)}))||O.every(t,function(r,o){return null!==r&&"object"===(void 0===r?"undefined":n(r))?O.every(r,function(t,r){if(j[r]){return j[r](o,t)(e)}return!1}):void 0!==e[o]&&e[o]===t[o]})}}function _(e){return function(t,r){var n=0;return s(e,function(e,o){e=parseInt(e,10),t[o]<r[o]&&(n-=1*e),t[o]>r[o]&&(n+=1*e)}),n}}function w(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n="function"==typeof r.get?r.get.bind(r):function(){},o=n("env")||e.env.NODE_ENV,s=n("host")||e.env.HOST_NAME||"localhost",a="development"===o||"test"===o||void 0===o?"http":"https",u=n("port")||e.env.PORT||3030,c="development"===o||"test"===o||void 0===o?":"+u:"";return t=t||"",a+"://"+s+c+"/"+i(t)}var k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};Object.defineProperty(r,"__esModule",{value:!0}),r.stripSlashes=i,r.each=s,r.some=a,r.every=u,r.keys=c,r.values=f,r.isMatch=l,r.isEmpty=p,r.isObject=h,r.extend=d,r.omit=y,r.pick=v,r.merge=m,r.select=b,r.matcher=g,r.sorter=_,r.makeUrl=w;var O=r._={each:s,some:a,every:u,keys:c,values:f,isMatch:l,isEmpty:p,isObject:h,extend:d,omit:y,pick:v,merge:m},j=r.specialFilters={$in:function(e,t){return function(r){return-1!==t.indexOf(r[e])}},$nin:function(e,t){return function(r){return-1===t.indexOf(r[e])}},$lt:function(e,t){return function(r){return r[e]<t}},$lte:function(e,t){return function(r){return r[e]<=t}},$gt:function(e,t){return function(r){return r[e]>t}},$gte:function(e,t){return function(r){return r[e]>=t}},$ne:function(e,t){return function(r){return r[e]!==t}}}}).call(this,e("_process"))},{_process:64}],14:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){if(!e)return e;var t=T[e.name],r=t?new t(e.message,e.data):new Error(e.message||e);return"object"===(void 0===e?"undefined":u(e))&&a(r,e),r}Object.defineProperty(r,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),f=e("debug")("feathers-errors"),l=function(e){function t(e,r,i,s,c){n(this,t),e=e||"Error";var l=void 0,p=void 0,h=void 0;e instanceof Error?(p=e.message||"Error",e.errors&&(l=e.errors)):"object"===(void 0===e?"undefined":u(e))?(p=e.message||"Error",c=e):p=e,c&&(h=a({},c),h.errors&&(l=h.errors,delete h.errors));var d=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,p));return d.type="FeathersError",d.name=r,d.message=p,d.code=i,d.className=s,d.data=h,d.errors=l||{},f(d.name+"("+d.code+"): "+d.message),d}return i(t,e),c(t,[{key:"toJSON",value:function(){return{name:this.name,message:this.message,code:this.code,className:this.className,data:this.data,errors:this.errors}}}]),t}(function(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error)),p=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"BadRequest",400,"bad-request",r))}return i(t,e),t}(l),h=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"NotAuthenticated",401,"not-authenticated",r))}return i(t,e),t}(l),d=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"PaymentError",402,"payment-error",r))}return i(t,e),t}(l),y=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"Forbidden",403,"forbidden",r))}return i(t,e),t}(l),v=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"NotFound",404,"not-found",r))}return i(t,e),t}(l),m=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"MethodNotAllowed",405,"method-not-allowed",r))}return i(t,e),t}(l),b=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"NotAcceptable",406,"not-acceptable",r))}return i(t,e),t}(l),g=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"Timeout",408,"timeout",r))}return i(t,e),t}(l),_=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"Conflict",409,"conflict",r))}return i(t,e),t}(l),w=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"LengthRequired",411,"length-required",r))}return i(t,e),t}(l),k=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"Unprocessable",422,"unprocessable",r))}return i(t,e),t}(l),O=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"TooManyRequests",429,"too-many-requests",r))}return i(t,e),t}(l),j=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"GeneralError",500,"general-error",r))}return i(t,e),t}(l),E=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"NotImplemented",501,"not-implemented",r))}return i(t,e),t}(l),x=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"BadGateway",502,"bad-gateway",r))}return i(t,e),t}(l),P=function(e){function t(e,r){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,"Unavailable",503,"unavailable",r))}return i(t,e),t}(l),T={FeathersError:l,BadRequest:p,NotAuthenticated:h,PaymentError:d,Forbidden:y,NotFound:v,MethodNotAllowed:m,NotAcceptable:b,Timeout:g,Conflict:_,LengthRequired:w,Unprocessable:k,TooManyRequests:O,GeneralError:j,NotImplemented:E,BadGateway:x,Unavailable:P,400:p,401:h,402:d,403:y,404:v,405:m,406:b,408:g,409:_,411:w,422:k,429:O,500:j,501:E,502:x,503:P};r.default=a({convert:s,types:T,errors:T},T),t.exports=r.default},{debug:1}],15:[function(e,t,r){"use strict";function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var r=!0,n=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var a=i.value,u=(0,f.getByDot)(e,a);if(void 0!==u){if("string"!=typeof u&&null!==u)throw new l.BadRequest("Expected string data. (lowercase "+a+")");(0,f.setByDot)(e,a,u?u.toLowerCase():u)}}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}},o=function(){return!0};return"function"==typeof t[t.length-1]&&(o=t.pop(),console.error("DEPRECATED Predicate func will be removed next version. (lowerCase)")),function(e){var t="before"===e.type?e.data:e.result,r=function(r){return t&&r&&("find"===e.method||Array.isArray(t)?(t.data||t).forEach(n):n(t)),e},i=o(e);return i&&"function"==typeof i.then?i.then(r):r(i)}}function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var r=!0,n=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var a=i.value;void 0!==(0,f.getByDot)(e,a)&&(0,f.setByDot)(e,a,void 0,!0)}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}},o=function(){return!0};return"function"==typeof t[t.length-1]&&(o=t.pop(),console.error("DEPRECATED Predicate func will be removed next version. (removeQuery)")),function(e){if("after"===e.type){var t=e.params.provider||"server";throw new l.GeneralError("Provider '"+t+"' cannot remove query params on after hook. (removeQuery)")}var r=e.params.query,i=function(t){return r&&t&&n(r),e},s=o(e);return s&&"function"==typeof s.then?s.then(i):i(s)}}function i(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var r={};return t.forEach(function(t){var n=(0,f.getByDot)(e,t);void 0!==n&&(0,f.setByDot)(r,t,n)}),r},o=function(){return!0};return"function"==typeof t[t.length-1]&&(o=t.pop(),console.error("DEPRECATED Predicate func will be removed next version. (pluckQuery)")),function(e){if("after"===e.type)throw new l.GeneralError("Provider '"+e.params.provider+"' can not pluck query params on after hook. (pluckQuery)");var t=e.params.query,r=function(r){return t&&r&&(e.params.query=n(t)),e},i=o(e);return i&&"function"==typeof i.then?i.then(r):r(i)}}function s(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var r=!0,n=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done);r=!0){var a=i.value;void 0!==(0,f.getByDot)(e,a)&&(0,f.setByDot)(e,a,void 0,!0)}}catch(e){n=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(n)throw o}}},o=function(e){return!!e.params.provider};return"function"==typeof t[t.length-1]&&(o=t.pop()),function(e){var t="before"===e.type?e.data:e.result,r=function(r){return t&&r&&(Array.isArray(t)?t.forEach(n):(n(t),t.data&&(Array.isArray(t.data)?t.data.forEach(n):n(t.data)))),e},i=o(e);return i&&"function"==typeof i.then?i.then(r):r(i)}}function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var r={};return t.forEach(function(t){var n=(0,f.getByDot)(e,t);void 0!==n&&(0,f.setByDot)(r,t,n)}),r},o=function(e){return!!e.params.provider};return"function"==typeof t[t.length-1]&&(o=t.pop(),console.error("DEPRECATED Predicate func will be removed next version. (pluck)")),function(e){var t=function(t){if(t){var r=(0,f.getItems)(e);r&&(Array.isArray(r)?(0,f.replaceItems)(e,r.map(n)):(0,f.replaceItems)(e,n(r)))}return e},r=o(e);return r&&"function"==typeof r.then?r.then(t):t(r)}}function u(e){if(!e)return function(e){throw new l.MethodNotAllowed("Calling '"+e.method+"' not allowed. (disable)")};if("function"==typeof e)return function(t){var r=e(t),n=function(e){if(!e)throw new l.MethodNotAllowed("Calling '"+t.method+"' not allowed. (disable)")};if(r&&"function"==typeof r.then)return r.then(n);n(r)};for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var o=[e].concat(r);return function(t){var r=t.params.provider;if("external"===e&&r||-1!==o.indexOf(r))throw new l.MethodNotAllowed("Provider '"+t.params.provider+"' can not call '"+t.method+"'. (disable)'")}}function c(e,t){if(t=Object.assign({},t),console.error("Calling populate(target, options) is now DEPRECATED and will be removed in the future. Refer to docs.feathersjs.com for more information. (legacyPopulate)"),!t.service)throw new Error("You need to provide a service. (populate)");var r=t.field||e;return function(n){function o(o){if(!o[r])return Promise.resolve(o);var i=o[r];"function"==typeof o.toObject?o=o.toObject(t):"function"==typeof o.toJSON&&(o=o.toJSON(t));var s=Object.assign({},n.params,{query:void 0});return(Array.isArray(i)?Promise.all(i.map(function(e){return n.app.service(t.service).get(e,s)})):n.app.service(t.service).get(i,s)).then(function(t){return t&&(o[e]=t),o})}if("after"!==n.type)throw new l.GeneralError("Can not populate on before hook. (populate)");var i="find"===n.method&&n.result.data,s=i?n.result.data:n.result;return Array.isArray(s)?Promise.all(s.map(o)).then(function(e){return i?n.result.data=e:n.result=e,n}):o(n.result).then(function(e){return n.result=e,n})}}Object.defineProperty(r,"__esModule",{value:!0}),r.lowerCase=n,r.removeQuery=o,r.pluckQuery=i,r.remove=s,r.pluck=a,r.disable=u,r.legacyPopulate=c;var f=e("./utils"),l=e("feathers-errors").errors},{"./utils":17,"feathers-errors":14}],16:[function(e,t,r){(function(t){"use strict";function n(e,t,r){
return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function i(e,t,r,n,o){return Array.isArray(r)?Promise.all(r.map(function(r){return s(e,t,r,n,o+1)})):s(e,t,r,n,o+1)}function s(e,r,n,i,s){var c={},f=t.hrtime();return n._include=[],Promise.all(i.map(function(o){var i=t.hrtime();return a(e,r,n,o,s).then(function(t){var r=o.nameAs||o.service;return c[r]=u(e,i,s),t})})).then(function(t){return!1!==e.profile&&(c.total=u(e,f,s),n._elapsed=c),Object.assign.apply(Object,[n].concat(o(t)))})}function a(e,t,r,o,s){if(!o.service||!o.parentField||!o.childField)throw new l.default.BadRequest("Child schema is missing a required property. (populate)");if(o.permissions&&!e.checkPermissions(t,o.service,o.permissions,s))throw new l.default.BadRequest("Permissions for "+o.service+" do not allow include. (populate)");var a=o.nameAs||o.service;r._include.push(a);var u=Promise.resolve().then(function(){return o.select?o.select(t,r,s):{}}).then(function(e){var i=(0,p.getByDot)(r,o.parentField);if(void 0===i)throw new l.default.BadRequest("ParentField "+o.parentField+" for "+a+" depth "+s+" is undefined. (populate)");var u=Object.assign({},o.query,n({},o.childField,Array.isArray(i)?{$in:i}:i),e),c=t.app.service(o.service);if(!c)throw new l.default.BadRequest("Service "+o.service+" is not configured. (populate)");return c.find({query:u,_populate:"skip"})}).then(function(e){return e=e.data||e,1!==e.length||o.asArray||(e=e[0]),e});return o.include&&(u=u.then(function(r){return i(e,t,r,o.include,s)})),u.then(function(e){return n({},a,e)})}function u(e,r,n){if(!0===e.profile){var o=t.hrtime(r);return 1e9*o[0]+o[1]}if(!1!==e.profile)return n}Object.defineProperty(r,"__esModule",{value:!0}),r.populate=void 0;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f=e("feathers-errors"),l=function(e){return e&&e.__esModule?e:{default:e}}(f),p=e("./utils"),h=e("./bundled");r.populate=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"string"==typeof e?h.legacyPopulate.apply(void 0,[e].concat(r)):function(t){var r={schema:{},checkPermissions:function(){return!0},profile:!1};return"skip"===t.params._populate?t:Promise.resolve().then(function(){var n=(0,p.getItems)(t),o=Object.assign({},r,e),s=o.schema,a=o.checkPermissions,u="function"==typeof s?s(t,o):s,f=u.permissions||null;if("function"!=typeof a)throw new l.default.BadRequest("Permissions param is not a function. (populate)");if(f&&!a(t,t.path,f,0))throw new l.default.BadRequest("Permissions do not allow this populate. (populate)");if("object"!==(void 0===u?"undefined":c(u)))throw new l.default.BadRequest("Schema does not resolve to an object. (populate)");return u.include&&Object.keys(u.include).length?i(o,t,n,u.include,0):n}).then(function(e){return(0,p.replaceItems)(t,e),t})}}}).call(this,e("_process"))},{"./bundled":15,"./utils":17,_process:64,"feathers-errors":14}],17:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.getByDot=function(e,t){return-1===t.indexOf(".")?e[t]:t.split(".").reduce(function(e,t){return"object"===(void 0===e?"undefined":n(e))?e[t]:void 0},e)},r.setByDot=function(e,t,r,o){if(-1===t.indexOf("."))return e[t]=r,void(void 0===r&&o&&delete e[t]);var i=t.split("."),s=i.length-1;return i.reduce(function(e,t,i){return i!==s?(e.hasOwnProperty(t)&&"object"===n(e[t])||(e[t]={}),e[t]):(e[t]=r,void 0===r&&o&&delete e[t],e)},e)},r.checkContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"anonymous";if(t&&e.type!==t)throw new Error("The '"+n+"' hook can only be used as a '"+t+"' hook.");if(r){var o=Array.isArray(r)?r:[r];if(o.length>0&&-1===o.indexOf(e.method)){var i=JSON.stringify(o);throw new Error("The '"+n+"' hook can only be used on the '"+i+"' service method(s).")}}},r.getItems=function(e){var t="before"===e.type?e.data:e.result;return t&&"find"===e.method?t.data||t:t},r.replaceItems=function(e,t){"before"===e.type?e.data=t:"find"===e.method&&e.result&&e.result.data?Array.isArray(t)?(e.result.data=t,e.result.total=t.length):(e.result.data=[t],e.result.total=1):e.result=t}},{}],18:[function(e,t,r){"use strict";function n(e){return"object"===(void 0===e?"undefined":u(e))&&"string"==typeof e.method&&"string"==typeof e.type}function o(e,t){var r=this,o=t,i=function(e){if(e){if(!n(e))throw new Error(o.type+" hook for '"+o.method+"' method returned invalid hook object");o=e}return o},s=Promise.resolve(o);return e.forEach(function(e){var t=e.bind(r);s=2===t.length?s.then(function(e){return new Promise(function(r,n){t(e,function(e,t){return e?n(e):r(t)})})}):s.then(t),s=s.then(i)}),s.catch(function(e){throw e.hook=o,e})}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["before","after","error"];Object.defineProperty(e,"__hooks",{value:{}}),t.forEach(function(t){e.__hooks[t]={}})}function s(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=e.__hooks[r][n]||[],s=t.__hooks[r][n]||[];return o?s.concat(i):i.concat(s)}function a(e){for(var t={hooks:function(t){var r=this;return(0,c.each)(t,function(t,n){if(!r.__hooks[n])throw new Error("'"+n+"' is not a valid hook type");var o=c.hooks.convertHookData(t);(0,c.each)(o,function(t,r){if("all"!==r&&-1===e.indexOf(r))throw new Error("'"+r+"' is not a valid hook method")}),e.forEach(function(e){if(o[e]||o.all){var t=r.__hooks[n][e]||(r.__hooks[n][e]=[]);o.all&&t.push.apply(t,o.all),o[e]&&t.push.apply(t,o[e])}})}),this}},r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return Object.assign.apply(Object,[t].concat(n))}Object.defineProperty(r,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r.isHookObject=n,r.processHooks=o,r.addHookTypes=i,r.getHooks=s,r.baseMixin=a;var c=e("feathers-commons")},{"feathers-commons":11}],19:[function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function o(e){return void 0!==e&&"function"==typeof e.then}function i(e){var t=this,r=t.methods,i={before:e.before,after:e.after},s=(0,p.baseMixin)(r,{before:function(e){return this.hooks({before:e})},after:function(e){return this.hooks({after:e})}});(0,p.addHookTypes)(e),r.forEach(function(r){"function"==typeof e[r]&&(s[r]=function(){var e=this,i=this,s=this._super.bind(this),a={app:t,service:i,get path(){return Object.keys(t.services).find(function(e){return t.services[e]===i})}},u=c.hooks.hookObject(r,"before",arguments,a),f={before:(0,p.getHooks)(t,this,"before",r),after:(0,p.getHooks)(t,this,"after",r,!0),error:(0,p.getHooks)(t,this,"error",r,!0)};return p.processHooks.call(this,f.before,u).then(function(e){return void 0!==e.result?Promise.resolve(e):new Promise(function(t,r){var i=c.hooks.makeArguments(e),a=function(n,o){n?r(n):(e.result=o,t(e))};i.splice(i.length-1,1,a);var u=s.apply(void 0,n(i));o(u)&&u.then(function(e){return a(null,e)},a)})}).then(function(e){return Object.assign({},e,{type:"after"})}).then(p.processHooks.bind(this,f.after)).then(function(e){return e.result}).catch(function(t){var r=Object.assign({},t.hook||u,{type:"error",original:t.hook,error:t});return p.processHooks.call(e,f.error,r).then(function(e){return Promise.reject(e.error)})})})}),e.mixin(s),i.before&&e.before(i.before),i.after&&e.after(i.after)}function s(){return function(){var e=this;(0,p.addHookTypes)(e),u.default.mixin((0,p.baseMixin)(e.methods),e),this.mixins.unshift(i)}}Object.defineProperty(r,"__esModule",{value:!0});var a=e("uberproto"),u=function(e){return e&&e.__esModule?e:{default:e}}(a),c=e("feathers-commons"),f=e("feathers-hooks-common/lib/populate"),l=e("feathers-hooks-common/lib/bundled"),p=e("./commons");s.removeQuery=l.removeQuery,s.pluckQuery=l.pluckQuery,s.lowerCase=l.lowerCase,s.remove=l.remove,s.pluck=l.pluck,s.disable=l.disable,s.populate=f.populate,s.removeField=l.removeField,r.default=s,t.exports=r.default},{"./commons":18,"feathers-commons":11,"feathers-hooks-common/lib/bundled":15,"feathers-hooks-common/lib/populate":16,uberproto:53}],20:[function(e,t,r){t.exports=e("./lib/client/index")},{"./lib/client/index":24}],21:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./base"),c=function(e){return e&&e.__esModule?e:{default:e}}(u),f=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"request",value:function(e){var t={url:e.url,method:e.method,data:e.body,headers:s({Accept:"application/json"},this.options.headers,e.headers)};return this.connection.request(t).then(function(e){return e.data}).catch(function(e){var t=e.response||e;throw t instanceof Error?t:t.data||t})}}]),t}(c.default);r.default=f,t.exports=r.default},{"./base":22}],22:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){throw(0,f.convert)(e)}Object.defineProperty(r,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("qs"),u=function(e){return e&&e.__esModule?e:{default:e}}(a),c=e("feathers-commons"),f=e("feathers-errors"),l=function(){function e(t){n(this,e),this.name=(0,c.stripSlashes)(t.name),this.options=t.options,this.connection=t.connection,this.base=t.base+"/"+this.name}return s(e,[{key:"makeUrl",value:function(e,t){e=e||{};var r=this.base;if(void 0!==t&&null!==t&&(r+="/"+t),0!==Object.keys(e).length){r+="?"+u.default.stringify(e)}return r}},{key:"find",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.request({url:this.makeUrl(e.query),method:"GET",headers:i({},e.headers)}).catch(o)}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?Promise.reject(new Error("id for 'get' can not be undefined")):this.request({url:this.makeUrl(t.query,e),method:"GET",headers:i({},t.headers)}).catch(o)}},{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.request({url:this.makeUrl(t.query),body:e,method:"POST",headers:i({"Content-Type":"application/json"},t.headers)}).catch(o)}},{key:"update",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return void 0===e?Promise.reject(new Error("id for 'update' can not be undefined, only 'null' when updating multiple entries")):this.request({url:this.makeUrl(r.query,e),body:t,method:"PUT",headers:i({"Content-Type":"application/json"},r.headers)}).catch(o)}},{key:"patch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return void 0===e?Promise.reject(new Error("id for 'patch' can not be undefined, only 'null' when updating multiple entries")):this.request({url:this.makeUrl(r.query,e),body:t,method:"PATCH",headers:i({"Content-Type":"application/json"},r.headers)}).catch(o)}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return void 0===e?Promise.reject(new Error("id for 'remove' can not be undefined, only 'null' when removing multiple entries")):this.request({url:this.makeUrl(t.query,e),method:"DELETE",headers:i({},t.headers)}).catch(o)}}]),e}();r.default=l,t.exports=r.default},{"feathers-commons":11,"feathers-errors":14,qs:47}],23:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./base"),c=function(e){return e&&e.__esModule?e:{default:e}}(u),f=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"request",value:function(e){var t=s({},e);return t.headers=s({Accept:"application/json"},this.options.headers,t.headers),e.body&&(t.body=JSON.stringify(e.body)),(0,this.connection)(e.url,t).then(this.checkStatus).then(function(e){return 204===e.status?null:e.json()})}},{key:"checkStatus",value:function(e){return e.ok?e:e.json().then(function(t){throw t.response=e,t})}}]),t}(c.default);r.default=f,t.exports=r.default},{"./base":22}],24:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t={};return Object.keys(d).forEach(function(r){var n=d[r];t[r]=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t)throw new Error(r+" has to be provided to feathers-rest");var i=function(r){return new n({base:e,name:r,connection:t,options:o})},s=function(){if("function"==typeof this.defaultService)throw new Error("Only one default client provider can be configured");this.rest=t,this.defaultService=i};return s.Service=n,s.service=i,s}}),t};var o=e("./jquery"),i=n(o),s=e("./superagent"),a=n(s),u=e("./request"),c=n(u),f=e("./fetch"),l=n(f),p=e("./axios"),h=n(p),d={jquery:i.default,superagent:a.default,request:c.default,fetch:l.default,axios:h.default};t.exports=r.default},{"./axios":21,"./fetch":23,"./jquery":25,"./request":26,"./superagent":27}],25:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./base"),c=function(e){return e&&e.__esModule?e:{default:e}}(u),f=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"request",value:function(e){var t=this,r=s({dataType:e.type||"json"},{headers:this.options.headers||{}},e);return e.body&&(r.data=JSON.stringify(e.body),r.contentType="application/json"),delete r.type,delete r.body,new Promise(function(e,n){t.connection.ajax(r).then(e,function(e){var t=e.responseText;try{t=JSON.parse(t)}catch(r){t=new Error(e.responseText)}t.xhr=t.response=e,n(t)})})}}]),t}(c.default);r.default=f,t.exports=r.default},{"./base":22}],26:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e("./base"),c=function(e){return e&&e.__esModule?e:{default:e}}(u),f=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),a(t,[{key:"request",value:function(e){var t=this;return new Promise(function(r,n){t.connection(s({json:!0},e),function(e,t,o){return e?n(e):!e&&t.statusCode>=400?"string"==typeof o?n(new Error(o)):(o.response=t,n(s(new Error(o.message),o))):void r(o)})})}}]),t}(c.default);r.default=f,t.exports=r.default},{"./base":22}],27:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./base"),u=function(e){return e&&e.__esModule?e:{default:e}}(a),c=function(e){function t(){return n(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),s(t,[{key:"request",value:function(e){var t=this.connection(e.method,e.url).set(this.options.headers||{}).set("Accept","application/json").set(e.headers||{}).type(e.type||"json");return new Promise(function(r,n){t.set(e.headers),e.body&&t.send(e.body),t.end(function(e,t){if(e){try{var o=e.response;e=JSON.parse(e.response.text),e.response=o}catch(e){}return n(e)}r(t&&t.body)})})}}]),t}(u.default);r.default=c,t.exports=r.default},{"./base":22}],28:[function(e,t,r){t.exports=e("./lib/client")},{"./lib/client":29}],29:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=e("./utils"),s=e("feathers-errors"),a=e("debug")("feathers-socket-commons:client"),u=["addListener","emit","listenerCount","listeners","on","once","prependListener","prependOnceListener","removeAllListeners","removeListener"],c=["eventNames","getMaxListeners","setMaxListeners"],f=function(e){c.forEach(function(t){e[t]=function(){var e;if("function"!=typeof this.connection[t])throw new Error("Can not call '"+t+"' on the client service connection.");return(e=this.connection)[t].apply(e,arguments)}}),u.forEach(function(t){e[t]=function(e){var r;if("function"!=typeof this.connection[t])throw new Error("Can not call '"+t+"' on the client service connection.");var n=this.path+" "+e;a("Calling emitter method "+t+" with namespaced event '"+n+"'");for(var o=arguments.length,i=Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];var u=(r=this.connection)[t].apply(r,[n].concat(i));return u===this.connection?this:u}})},l=function(){function e(t){n(this,e),this.events=i.events,this.path=t.name,this.connection=t.connection,this.method=t.method,this.timeout=t.timeout||5e3,f(this)}return o(e,[{key:"send",value:function(e){for(var t=this,r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];var i=null;return"function"==typeof n[n.length-1]&&(i=n.pop()),new Promise(function(r,o){var u,c=t.path+"::"+e,f=setTimeout(function(){return o(new Error("Timeout of "+t.timeout+"ms exceeded calling "+c))},t.timeout);n.unshift(c),n.push(function(e,t){return e=(0,s.convert)(e),clearTimeout(f),i&&i(e,t),e?o(e):r(t)}),a("Sending socket."+t.method,n),(u=t.connection)[t.method].apply(u,n)})}},{key:"find",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.send("find",e.query||{})}},{key:"get",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.send("get",e,t.query||{})}},{key:"create",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.send("create",e,t.query||{})}},{key:"update",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.send("update",e,t,r.query||{})}},{key:"patch",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.send("patch",e,t,r.query||{})}},{key:"remove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.send("remove",e,t.query||{})}},{key:"off",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if("function"==typeof this.connection.off){var o;return(o=this.connection).off.apply(o,[this.path+" "+e].concat(r))}return 0===r.length?this.removeAllListeners(e):this.removeListener.apply(this,[e].concat(r))}}]),e}();r.default=l,t.exports=r.default},{"./utils":30,debug:1,"feathers-errors":14}],30:[function(e,t,r){(function(t){"use strict";function n(e){return a.hooks.convertHookData(e)}function o(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),o=2;o<r;o++)n[o-2]=arguments[o];return new Promise(function(r,o){e.apply(t,n.concat(function(e,t){if(e)return o(e);r(t)}))})}function i(e){var r={};return Object.getOwnPropertyNames(e).forEach(function(t){return r[t]=e[t]}),"production"===t.env.NODE_ENV&&delete r.stack,delete r.hook,r}function s(e){var t=[];return 2===e.length&&Array.isArray(e[0])?(t=e[0],t.push(e[1]),t):e}Object.defineProperty(r,"__esModule",{value:!0}),r.events=r.eventMappings=void 0,r.convertFilterData=n,r.promisify=o,r.normalizeError=i,r.normalizeArgs=s;var a=e("feathers-commons"),u=r.eventMappings={create:"created",update:"updated",patch:"patched",remove:"removed"};r.events=Object.keys(u).map(function(e){return u[e]})}).call(this,e("_process"))},{_process:64,"feathers-commons":11}],31:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{"./lib/client":32,dup:28}],32:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};r.default=function(e,t){if(!e)throw new Error("Socket.io connection needs to be provided");var r=function(r){var o=n({},t,{name:r,connection:e,method:"emit"});return new i.default(o)},o=function(){if("function"==typeof this.defaultService)throw new Error("Only one default client provider can be configured");this.io=e,this.defaultService=r};return o.Service=i.default,o.service=r,o};var o=e("feathers-socket-commons/client"),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.exports=r.default},{"feathers-socket-commons/client":28}],33:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{"./lib/client/index":36,dup:20}],34:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("debug"),i=n(o),s=e("feathers-commons"),a=e("uberproto"),u=n(a),c=e("./mixins/index"),f=n(c),l=(0,i.default)("feathers:application"),p=["find","get","create","update","patch","remove"],h=u.default.extend({create:null});r.default={init:function(){Object.assign(this,{methods:p,mixins:(0,f.default)(),services:{},providers:[],_setup:!1})},service:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e=(0,s.stripSlashes)(e),!t){var o=this.services[e];return void 0===o&&"function"==typeof this.defaultService?this.service(e,this.defaultService(e),n):o}var i=h.extend(t);return l("Registering new service at `"+e+"`"),this.mixins.forEach(function(e){return e.call(r,i)}),"function"==typeof i._setup&&i._setup(this,e),this.providers.forEach(function(t){return t.call(r,e,i,n)}),this._isSetup&&"function"==typeof i.setup&&(l("Setting up service for `"+e+"`"),i.setup(this,e)),this.services[e]=i},use:function(e){var t=void 0,r=Array.from(arguments).slice(1).reduce(function(e,r){if("function"==typeof r)e[t?"after":"before"].push(r);else{if(t)throw new Error("invalid arg passed to app.use");t=r}return e},{before:[],after:[]}),n=function(e){return e.some(function(e){return t&&"function"==typeof t[e]})};return n(["handle","set"])||!n(this.methods.concat("setup"))?this._super.apply(this,arguments):(this.service(e,t,{middleware:r}),this)},setup:function(){var e=this;return Object.keys(this.services).forEach(function(t){var r=e.services[t];l("Setting up service for `"+t+"`"),"function"==typeof r.setup&&r.setup(e,t)}),this._isSetup=!0,this},configure:function(e){return e.call(this),this},listen:function(){var e=this._super.apply(this,arguments);return this.setup(e),l("Feathers application listening"),e}},t.exports=r.default},{"./mixins/index":39,debug:1,"feathers-commons":11,uberproto:53}],35:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var e={settings:{},get:function(e){return this.settings[e]},set:function(e,t){return this.settings[e]=t,this},disable:function(e){return this.settings[e]=!1,this},disabled:function(e){return!this.settings[e]},enable:function(e){return this.settings[e]=!0,this},enabled:function(e){return!!this.settings[e]},use:function(){throw new Error("Middleware functions can not be used in the Feathers client")},listen:function(){return{}}};return i.default.mixin(n.EventEmitter.prototype,e),e};var n=e("events"),o=e("uberproto"),i=function(e){return e&&e.__esModule?e:{default:e}}(o);t.exports=r.default},{events:63,uberproto:53}],36:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(){return(0,s.default)(u.default.apply(void 0,arguments))}Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;var i=e("../feathers"),s=n(i),a=e("./express"),u=n(a);o.version="2.0.1",t.exports=r.default},{"../feathers":37,"./express":35}],37:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return s.default.mixin(u.default,e),e.init(),e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;var i=e("uberproto"),s=n(i),a=e("./application"),u=n(a);t.exports=r.default},{"./application":34,uberproto:53}],38:[function(e,t,r){"use strict";function n(e){return e.charAt(0).toUpperCase()+e.substring(1)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=this,r="function"==typeof e.on&&"function"==typeof e.emit,o=e._rubberDuck=i.default.emitter(e);"function"!=typeof e.mixin||r||e.mixin(s.EventEmitter.prototype),e._serviceEvents=Array.isArray(e.events)?e.events.slice():[],o.on("error",function(t){e.emit("serviceError",t[0])}),Object.keys(c).forEach(function(r){var i=c[r],s=-1!==e._serviceEvents.indexOf(i);if("function"==typeof e[r]&&!s){var a="after"+n(r);e._serviceEvents.push(i),o.punch(r,-1),o.on(a,function(n,o){n[0]?e.emit("serviceError",n[0]):function(){var s=u(r,"after",o),a=Array.isArray(n[1])?n[1]:[n[1]];s.app=t,a.forEach(function(t){return e.emit(i,t,s)})}()})}})};var o=e("rubberduck"),i=function(e){return e&&e.__esModule?e:{default:e}}(o),s=e("events"),a=e("feathers-commons"),u=a.hooks.hookObject,c={create:"created",update:"updated",remove:"removed",patch:"patched"};t.exports=r.default},{events:63,"feathers-commons":11,rubberduck:51}],39:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(){var t=[e("./promise"),e("./event"),e("./normalizer")];return t.push=function(){var e=[this.length-1,0].concat(Array.from(arguments));return this.splice.apply(this,e),this.length},t},t.exports=r.default},{"./event":38,"./normalizer":40,"./promise":41}],40:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=this;"function"==typeof e.mixin&&function(){var r={};t.methods.forEach(function(t){"function"==typeof e[t]&&(r[t]=function(){return this._super.apply(this,(0,n.getArguments)(t,arguments))})}),e.mixin(r)}()};var n=e("feathers-commons");t.exports=r.default},{"feathers-commons":11}],41:[function(e,t,r){"use strict";function n(e){return void 0!==e&&"function"==typeof e.then}function o(){var e=this._super.apply(this,arguments),t=arguments[arguments.length-1];return"function"==typeof t&&n(e)&&e.then(function(e){return t(null,e)},function(e){return t(e)}),e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(e){var t=this;"function"==typeof e.mixin&&function(){var r={};t.methods.forEach(function(t){"function"==typeof e[t]&&(r[t]=o)}),e.mixin(r)}()},t.exports=r.default},{}],42:[function(e,t,r){function n(e){this.message=e}function o(e){
var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,s=0,a=0,u="";o=t.charAt(a++);~o&&(r=s%4?64*r+o:o,s++%4)?u+=String.fromCharCode(255&r>>(-2*s&6)):0)o=i.indexOf(o);return u}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.name="InvalidCharacterError",t.exports="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||o},{}],43:[function(e,t,r){function n(e){return decodeURIComponent(o(e).replace(/(.)/g,function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}var o=e("./atob");t.exports=function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return n(t)}catch(e){return o(t)}}},{"./atob":42}],44:[function(e,t,r){"use strict";function n(e){this.message=e}var o=e("./base64_url_decode");n.prototype=new Error,n.prototype.name="InvalidTokenError",t.exports=function(e,t){if("string"!=typeof e)throw new n("Invalid token specified");t=t||{};var r=!0===t.header?0:1;try{return JSON.parse(o(e.split(".")[r]))}catch(e){throw new n("Invalid token specified: "+e.message)}},t.exports.InvalidTokenError=n},{"./base64_url_decode":43}],45:[function(e,t,r){function n(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*l;case"days":case"day":case"d":return r*f;case"hours":case"hour":case"hrs":case"hr":case"h":return r*c;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function o(e){return e>=f?Math.round(e/f)+"d":e>=c?Math.round(e/c)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return s(e,f,"day")||s(e,c,"hour")||s(e,u,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var a=1e3,u=60*a,c=60*u,f=24*c,l=365.25*f;t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return n(e);if("number"===r&&!1===isNaN(e))return t.long?i(e):o(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],46:[function(e,t,r){"use strict";var n=String.prototype.replace;t.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,/%20/g,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},{}],47:[function(e,t,r){"use strict";var n=e("./stringify"),o=e("./parse"),i=e("./formats");t.exports={formats:i,parse:o,stringify:n}},{"./formats":46,"./parse":48,"./stringify":49}],48:[function(e,t,r){"use strict";var n=e("./utils"),o=Object.prototype.hasOwnProperty,i={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},s=function(e,t){for(var r={},n=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),i=0;i<n.length;++i){var s,a,u=n[i],c=-1===u.indexOf("]=")?u.indexOf("="):u.indexOf("]=")+1;-1===c?(s=t.decoder(u),a=t.strictNullHandling?null:""):(s=t.decoder(u.slice(0,c)),a=t.decoder(u.slice(c+1))),o.call(r,s)?r[s]=[].concat(r[s]).concat(a):r[s]=a}return r},a=function(e,t,r){if(!e.length)return t;var n,o=e.shift();if("[]"===o)n=[],n=n.concat(a(e,t,r));else{n=r.plainObjects?Object.create(null):{};var i="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,s=parseInt(i,10);!isNaN(s)&&o!==i&&String(s)===i&&s>=0&&r.parseArrays&&s<=r.arrayLimit?(n=[],n[s]=a(e,t,r)):n[i]=a(e,t,r)}return n},u=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=i.exec(n),c=u?n.slice(0,u.index):n,f=[];if(c){if(!r.plainObjects&&o.call(Object.prototype,c)&&!r.allowPrototypes)return;f.push(c)}for(var l=0;null!==(u=s.exec(n))&&l<r.depth;){if(l+=1,!r.plainObjects&&o.call(Object.prototype,u[1].slice(1,-1))&&!r.allowPrototypes)return;f.push(u[1])}return u&&f.push("["+n.slice(u.index)+"]"),a(f,t,r)}};t.exports=function(e,t){var r=t||{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:i.delimiter,r.depth="number"==typeof r.depth?r.depth:i.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:i.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:i.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:i.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:i.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:i.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:i.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:i.strictNullHandling,""===e||null===e||void 0===e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?s(e,r):e,a=r.plainObjects?Object.create(null):{},c=Object.keys(o),f=0;f<c.length;++f){var l=c[f],p=u(l,o[l],r);a=n.merge(a,p,r)}return n.compact(a)}},{"./utils":50}],49:[function(e,t,r){"use strict";var n=e("./utils"),o=e("./formats"),i={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},s=Date.prototype.toISOString,a={delimiter:"&",encode:!0,encoder:n.encode,encodeValuesOnly:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},u=function e(t,r,o,i,s,a,u,c,f,l,p,h){var d=t;if("function"==typeof u)d=u(r,d);else if(d instanceof Date)d=l(d);else if(null===d){if(i)return a&&!h?a(r):r;d=""}if("string"==typeof d||"number"==typeof d||"boolean"==typeof d||n.isBuffer(d)){if(a){return[p(h?r:a(r))+"="+p(a(d))]}return[p(r)+"="+p(String(d))]}var y=[];if(void 0===d)return y;var v;if(Array.isArray(u))v=u;else{var m=Object.keys(d);v=c?m.sort(c):m}for(var b=0;b<v.length;++b){var g=v[b];s&&null===d[g]||(y=Array.isArray(d)?y.concat(e(d[g],o(r,g),o,i,s,a,u,c,f,l,p,h)):y.concat(e(d[g],r+(f?"."+g:"["+g+"]"),o,i,s,a,u,c,f,l,p,h)))}return y};t.exports=function(e,t){var r=e,n=t||{};if(null!==n.encoder&&void 0!==n.encoder&&"function"!=typeof n.encoder)throw new TypeError("Encoder has to be a function.");var s=void 0===n.delimiter?a.delimiter:n.delimiter,c="boolean"==typeof n.strictNullHandling?n.strictNullHandling:a.strictNullHandling,f="boolean"==typeof n.skipNulls?n.skipNulls:a.skipNulls,l="boolean"==typeof n.encode?n.encode:a.encode,p="function"==typeof n.encoder?n.encoder:a.encoder,h="function"==typeof n.sort?n.sort:null,d=void 0!==n.allowDots&&n.allowDots,y="function"==typeof n.serializeDate?n.serializeDate:a.serializeDate,v="boolean"==typeof n.encodeValuesOnly?n.encodeValuesOnly:a.encodeValuesOnly;if(void 0===n.format)n.format=o.default;else if(!Object.prototype.hasOwnProperty.call(o.formatters,n.format))throw new TypeError("Unknown format option provided.");var m,b,g=o.formatters[n.format];"function"==typeof n.filter?(b=n.filter,r=b("",r)):Array.isArray(n.filter)&&(b=n.filter,m=b);var _=[];if("object"!=typeof r||null===r)return"";var w;w=n.arrayFormat in i?n.arrayFormat:"indices"in n?n.indices?"indices":"repeat":"indices";var k=i[w];m||(m=Object.keys(r)),h&&m.sort(h);for(var O=0;O<m.length;++O){var j=m[O];f&&null===r[j]||(_=_.concat(u(r[j],j,k,c,f,l?p:null,b,h,d,y,g,v)))}return _.join(s)}},{"./formats":46,"./utils":50}],50:[function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}();r.arrayToObject=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},r.merge=function(e,t,o){if(!t)return e;if("object"!=typeof t){if(Array.isArray(e))e.push(t);else{if("object"!=typeof e)return[e,t];(o.plainObjects||o.allowPrototypes||!n.call(Object.prototype,t))&&(e[t]=!0)}return e}if("object"!=typeof e)return[e].concat(t);var i=e;return Array.isArray(e)&&!Array.isArray(t)&&(i=r.arrayToObject(e,o)),Array.isArray(e)&&Array.isArray(t)?(t.forEach(function(t,i){n.call(e,i)?e[i]&&"object"==typeof e[i]?e[i]=r.merge(e[i],t,o):e.push(t):e[i]=t}),e):Object.keys(t).reduce(function(e,n){var i=t[n];return Object.prototype.hasOwnProperty.call(e,n)?e[n]=r.merge(e[n],i,o):e[n]=i,e},i)},r.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},r.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",n=0;n<t.length;++n){var i=t.charCodeAt(n);45===i||46===i||95===i||126===i||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?r+=t.charAt(n):i<128?r+=o[i]:i<2048?r+=o[192|i>>6]+o[128|63&i]:i<55296||i>=57344?r+=o[224|i>>12]+o[128|i>>6&63]+o[128|63&i]:(n+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(n)),r+=o[240|i>>18]+o[128|i>>12&63]+o[128|i>>6&63]+o[128|63&i])}return r},r.compact=function(e,t){if("object"!=typeof e||null===e)return e;var n=t||[],o=n.indexOf(e);if(-1!==o)return n[o];if(n.push(e),Array.isArray(e)){for(var i=[],s=0;s<e.length;++s)e[s]&&"object"==typeof e[s]?i.push(r.compact(e[s],n)):void 0!==e[s]&&i.push(e[s]);return i}return Object.keys(e).forEach(function(t){e[t]=r.compact(e[t],n)}),e},r.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},r.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},{}],51:[function(require,module,exports){var events=require("events"),utils=require("./utils"),wrap=exports.wrap={fn:function(emitter,fn,strict,name,scope){var wrapped=function(){var e;utils.emitEvents(emitter,"before",name,[arguments,this,name]);try{e=fn.apply(scope||this,arguments)}catch(e){throw utils.emitEvents(emitter,"error",name,[e,arguments,this,name]),e}return utils.emitEvents(emitter,"after",name,[e,arguments,this,name]),e};return strict&&eval("wrapped = "+utils.addArgs(wrapped.toString(),fn.length)),wrapped},async:function(emitter,fn,position,strict,name,scope){var wrapped=function(){var e=-1==position?arguments.length-1:position||0,t=arguments[e],r=this,n=arguments,o=function(){try{t.apply(r,arguments)}catch(e){throw utils.emitEvents(emitter,"error",name,[e,n,r,name]),e}var e=arguments[0]instanceof Error?"error":"after";utils.emitEvents(emitter,e,name,[arguments,n,r,name])};utils.emitEvents(emitter,"before",name,[n,this,name]),n[e]=o;try{return fn.apply(scope||this,n)}catch(e){throw utils.emitEvents(emitter,"error",name,[e,n,r,name]),e}};return strict&&eval("wrapped = "+utils.addArgs(wrapped.toString(),fn.length)),wrapped}},Emitter=exports.Emitter=function(e){this.obj=e};Emitter.prototype=Object.create(events.EventEmitter.prototype),Emitter.prototype.punch=function(e,t,r){if(Array.isArray(e)){var n=this;e.forEach(function(e){n.punch(e,t,r)})}else{var o=this.obj[e];"function"==typeof o&&(this.obj[e]=t||0===t?wrap.async(this,o,t,r,e):wrap.fn(this,o,r,e))}return this},exports.emitter=function(e){return new Emitter(e)}},{"./utils":52,events:63}],52:[function(e,t,r){r.toBase26=function(e){for(var t="",r="abcdefghijklmnopqrstuvwxyz";e>25;){var n=e%26;t=r.charAt(n)+t,e=Math.floor(e/26)-1}return t=r.charAt(e)+t},r.makeFakeArgs=function(e){for(var t=[],n=0;n<e;n++)t.push(r.toBase26(n));return t.join(",")},r.addArgs=function(e,t){return e.replace(/function\s*\(\)/,"function("+r.makeFakeArgs(t)+")")},r.emitEvents=function(e,t,r,n){var o=r?r.replace(/^\w/,function(e){return e.toUpperCase()}):null;e.emit.apply(e,[t].concat(n)),o&&e.emit.apply(e,[t+o].concat(n))}},{}],53:[function(e,t,r){!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof r?t.exports=n():e.Proto=n()}(this,function(){function e(e,t,r,n){return function(){var o=this._super;this._super="function"==typeof t?t:e[r];var i=n.apply(this,arguments);return this._super=o,i}}function t(t,r){var n,o=r||this,i=/\b_super\b/,s=Object.getPrototypeOf(o)||o.prototype;for(var a in t)n=o[a],("function"==typeof t[a]&&"function"==typeof s[a]||"function"==typeof n&&"function"==typeof t[a])&&i.test(t[a])?o[a]=e(s,n,a,t[a]):o[a]=t[a];return o}function r(t,r){var n=r||this,o=/\b_super\b/,i=Object.getPrototypeOf(n)||n.prototype,s={},a=t,u=function(e){s[e]||(s[e]=Object.getOwnPropertyDescriptor(a,e))};do{Object.getOwnPropertyNames(a).forEach(u)}while((a=Object.getPrototypeOf(a))&&Object.getPrototypeOf(a));return Object.keys(s).forEach(function(t){var r=s[t];"function"==typeof r.value&&o.test(r.value)&&(r.value=e(i,n[t],t,r.value)),Object.defineProperty(n,t,r)}),n}return{create:function(){var e=Object.create(this),t="string"==typeof e.__init?e.__init:"init";return"function"==typeof e[t]&&e[t].apply(e,arguments),e},mixin:"function"==typeof Object.defineProperty?r:t,extend:function(e,t){return this.mixin(e,Object.create(t||this))},proxy:function(e){var t=this[e],r=Array.prototype.slice.call(arguments,1);return r.unshift(this),t.bind.apply(t,r)}}})},{}],54:[function(e,t,r){t.exports.feathers=e("feathers/client"),t.exports.rest=e("feathers-rest/client"),t.exports.socketio=e("feathers-socketio/client"),t.exports.superagent=e("superagent"),t.exports.hooks=e("feathers-hooks"),t.exports.auth=e("feathers-authentication-client")},{"feathers-authentication-client":7,"feathers-hooks":19,"feathers-rest/client":20,"feathers-socketio/client":31,"feathers/client":33,superagent:56}],55:[function(e,t,r){function n(e){if(e)return o(e)}function o(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}void 0!==t&&(t.exports=n),n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n,o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return this},n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r){r=r.slice(0);for(var n=0,o=r.length;n<o;++n)r[n].apply(this,t)}return this},n.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],56:[function(e,t,r){function n(){}function o(e){if(!y(e))return e;var t=[];for(var r in e)i(t,r,e[r]);return t.join("&")}function i(e,t,r){if(null!=r)if(Array.isArray(r))r.forEach(function(r){i(e,t,r)});else if(y(r))for(var n in r)i(e,t+"["+n+"]",r[n]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));else null===r&&e.push(encodeURIComponent(t))}function s(e){for(var t,r,n={},o=e.split("&"),i=0,s=o.length;i<s;++i)t=o[i],r=t.indexOf("="),-1==r?n[decodeURIComponent(t)]="":n[decodeURIComponent(t.slice(0,r))]=decodeURIComponent(t.slice(r+1));return n}function a(e){var t,r,n,o,i=e.split(/\r?\n/),s={};i.pop();for(var a=0,u=i.length;a<u;++a)r=i[a],t=r.indexOf(":"),n=r.slice(0,t).toLowerCase(),o=_(r.slice(t+1)),s[n]=o;return s}function u(e){return/[\/+]json\b/.test(e)}function c(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.header=this.headers=a(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function f(e,t){var r=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",function(){var e=null,t=null;try{t=new c(r)}catch(t){return e=new Error("Parser is unable to parse the response"),e.parse=!0,e.original=t,r.xhr?(e.rawResponse=void 0===r.xhr.responseType?r.xhr.responseText:r.xhr.response,e.status=r.xhr.status?r.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),r.callback(e)}r.emit("response",t);var n;try{r._isResponseOK(t)||(n=new Error(t.statusText||"Unsuccessful HTTP response"),n.original=e,n.response=t,n.status=t.status)}catch(e){n=e}n?r.callback(n,t):r.callback(null,t)})}function l(e,t,r){var n=g("DELETE",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var h=e("component-emitter"),d=e("./request-base"),y=e("./is-object"),v=e("./is-function"),m=e("./response-base"),b=e("./should-retry"),g=r=t.exports=function(e,t){return"function"==typeof t?new r.Request("GET",e).end(t):1==arguments.length?new r.Request("GET",e):new r.Request(e,t)};r.Request=f,g.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only verison of superagent could not find XHR")};var _="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=o,g.parseString=s,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},m(c.prototype),c.prototype._parseBody=function(e){var t=g.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&u(this.type)&&(t=g.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null)},c.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,n="cannot "+t+" "+r+" ("+this.status+")",o=new Error(n);return o.status=this.status,o.method=t,o.url=r,o},g.Response=c,h(f.prototype),d(f.prototype),f.prototype.type=function(e){return this.set("Content-Type",g.types[e]||e),this},f.prototype.accept=function(e){return this.set("Accept",g.types[e]||e),this},f.prototype.auth=function(e,t,r){switch("object"==typeof t&&null!==t&&(r=t),r||(r={type:"function"==typeof btoa?"basic":"auto"}),r.type){case"basic":this.set("Authorization","Basic "+btoa(e+":"+t));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer "+e)}return this},f.prototype.query=function(e){return"string"!=typeof e&&(e=o(e)),e&&this._query.push(e),this},f.prototype.attach=function(e,t,r){if(t){if(this._data)throw Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},f.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},f.prototype.callback=function(e,t){if(this._maxRetries&&this._retries++<this._maxRetries&&b(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},f.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},f.prototype.buffer=f.prototype.ca=f.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},f.prototype.pipe=f.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},f.prototype._appendQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+e),this._sort){var t=this.url.indexOf("?");if(t>=0){var r=this.url.substring(t+1).split("&");v(this._sort)?r.sort(this._sort):r.sort(),this.url=this.url.substring(0,t)+"?"+r.join("&")}}},f.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},f.prototype.end=function(e){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||n,this._appendQueryString(),this._end()},f.prototype._end=function(){var e=this,t=this.xhr=g.getXHR(),r=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4==r){var n;try{n=t.status}catch(e){n=0}if(!n){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var n=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.onprogress=n.bind(null,"download"),t.upload&&(t.upload.onprogress=n.bind(null,"upload"))}catch(e){}try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof r&&!this._isHost(r)){var o=this._header["content-type"],i=this._serializer||g.serialize[o?o.split(";")[0]:""];!i&&u(o)&&(i=g.serialize["application/json"]),i&&(r=i(r))}for(var s in this.header)null!=this.header[s]&&this.header.hasOwnProperty(s)&&t.setRequestHeader(s,this.header[s]);return this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0!==r?r:null),this},g.get=function(e,t,r){var n=g("GET",e);return"function"==typeof t&&(r=t,t=null),t&&n.query(t),r&&n.end(r),n},g.head=function(e,t,r){var n=g("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},g.options=function(e,t,r){var n=g("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},g.del=l,g.delete=l,g.patch=function(e,t,r){var n=g("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},g.post=function(e,t,r){var n=g("POST",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n},g.put=function(e,t,r){var n=g("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&n.send(t),r&&n.end(r),n}},{"./is-function":57,"./is-object":58,"./request-base":59,"./response-base":60,"./should-retry":61,"component-emitter":55}],57:[function(e,t,r){function n(e){return"[object Function]"===(o(e)?Object.prototype.toString.call(e):"")}var o=e("./is-object");t.exports=n},{"./is-object":58}],58:[function(e,t,r){function n(e){return null!==e&&"object"==typeof e}t.exports=n},{}],59:[function(e,t,r){function n(e){if(e)return o(e)}function o(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var i=e("./is-object");t.exports=n,n.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},n.prototype.parse=function(e){return this._parser=e,this},n.prototype.responseType=function(e){return this._responseType=e,this},n.prototype.serialize=function(e){return this._serializer=e,this},n.prototype.timeout=function(e){if(!e||"object"!=typeof e)return this._timeout=e,this._responseTimeout=0,this;for(var t in e)switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;default:console.warn("Unknown timeout option",t)}return this},n.prototype.retry=function(e){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this},n.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},n.prototype.then=function(e,t){if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(e,t){r.end(function(r,n){r?t(r):e(n)})})}return this._fullfilledPromise.then(e,t)},n.prototype.catch=function(e){return this.then(void 0,e)},n.prototype.use=function(e){return e(this),this},n.prototype.ok=function(e){if("function"!=typeof e)throw Error("Callback required");return this._okCallback=e,this},n.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},n.prototype.get=function(e){return this._header[e.toLowerCase()]},n.prototype.getHeader=n.prototype.get,n.prototype.set=function(e,t){if(i(e)){for(var r in e)this.set(r,e[r]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},n.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},n.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),i(e)){for(var r in e)this.field(r,e[r]);return this}if(Array.isArray(t)){for(var n in t)this.field(e,t[n]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=""+t),this._getFormData().append(e,t),this},n.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},n.prototype.withCredentials=function(e){return void 0==e&&(e=!0),this._withCredentials=e,this},n.prototype.redirects=function(e){return this._maxRedirects=e,this},n.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},n.prototype.send=function(e){var t=i(e),r=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&i(this._data))for(var n in e)this._data[n]=e[n];else"string"==typeof e?(r||this.type("form"),r=this._header["content-type"],this._data="application/x-www-form-urlencoded"==r?this._data?this._data+"&"+e:e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(r||this.type("json"),this)},n.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},n.prototype._timeoutError=function(e,t,r){if(!this._aborted){var n=new Error(e+t+"ms exceeded");n.timeout=t,n.code="ECONNABORTED",n.errno=r,this.timedout=!0,this.abort(),this.callback(n)}},n.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")},this._responseTimeout))}},{"./is-object":58}],60:[function(e,t,r){function n(e){if(e)return o(e)}function o(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}var i=e("./utils");t.exports=n,n.prototype.get=function(e){return this.header[e.toLowerCase()]},n.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=i.type(t);var r=i.params(t);for(var n in r)this[n]=r[n];this.links={};try{e.link&&(this.links=i.parseLinks(e.link))}catch(e){}},n.prototype._setStatusProperties=function(e){var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.redirect=3==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.forbidden=403==e,this.notFound=404==e}},{"./utils":62}],61:[function(e,t,r){var n=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];t.exports=function(e,t){return!!(e&&e.code&&~n.indexOf(e.code))||(!!(t&&t.status&&t.status>=500)||(!!(e&&"timeout"in e&&"ECONNABORTED"==e.code)||!!(e&&"crossDomain"in e)))}},{}],62:[function(e,t,r){r.type=function(e){return e.split(/ *; */).shift()},r.params=function(e){return e.split(/ *; */).reduce(function(e,t){var r=t.split(/ *= */),n=r.shift(),o=r.shift();return n&&o&&(e[n]=o),e},{})},r.parseLinks=function(e){return e.split(/ *, */).reduce(function(e,t){var r=t.split(/ *; */),n=r[0].slice(1,-1);return e[r[1].split(/ *= */)[1].slice(1,-1)]=n,e},{})},r.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&delete e.cookie,e}},{}],63:[function(e,t,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(e){return"function"==typeof e}function i(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,r,n,i,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(r=this._events[e],a(r))return!1;if(o(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(s(r))for(i=Array.prototype.slice.call(arguments,1),c=r.slice(),n=c.length,u=0;u<n;u++)c[u].apply(this,i);return!0},n.prototype.addListener=function(e,t){var r;if(!o(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,o(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!o(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},n.prototype.removeListener=function(e,t){var r,n,i,a
;if(!o(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],i=r.length,n=-1,r===t||o(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(a=i;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){n=a;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],o(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?o(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(o(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],64:[function(e,t,r){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function s(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){v&&d&&(v=!1,d.length?y=d.concat(y):m=-1,y.length&&u())}function u(){if(!v){var e=i(a);v=!0;for(var t=y.length;t;){for(d=y,y=[];++m<t;)d&&d[m].run();m=-1,t=y.length}d=null,v=!1,s(e)}}function c(e,t){this.fun=e,this.array=t}function f(){}var l,p,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(e){p=o}}();var d,y=[],v=!1,m=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.push(new c(e,t)),1!==y.length||v||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}]},{},[54])(54)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment