/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/neojax@2.1.7/dist/neojax.umd.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/* neojax version 2.1.7 Copyright (c) Keimeno 2020
   licensed under Apache-2.0 http://www.apache.org/licenses/LICENSE-2.0 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).neojax=t()}(this,(function(){"use strict";var e=function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};function t(e,t,n,r){return new(n||(n=Promise))((function(s,o){function u(e){try{a(r.next(e))}catch(e){o(e)}}function i(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){e.done?s(e.value):new n((function(t){t(e.value)})).then(u,i)}a((r=r.apply(e,t||[])).next())}))}function n(e,t){var n,r,s,o,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(s=2&o[0]?r.return:o[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;switch(r=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,r=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(!(s=(s=u.trys).length>0&&s[s.length-1])&&(6===o[0]||2===o[0])){u=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){u.label=o[1];break}if(6===o[0]&&u.label<s[1]){u.label=s[1],s=o;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(o);break}s[2]&&u.ops.pop(),u.trys.pop();continue}o=t.call(e,u)}catch(e){o=[6,e],r=0}finally{n=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}}self.fetch||(self.fetch=function(e,t){return t=t||{},new Promise((function(n,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return{ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(JSON.parse(s.responseText))},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var c in s.open(t.method||"get",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){o.push(t=t.toLowerCase()),u.push([t,n]),i[t]=i[t]?i[t]+","+n:n})),n(a())},s.onerror=r,s.withCredentials="include"==t.credentials,t.headers)s.setRequestHeader(c,t.headers[c]);s.send(t.body||null)}))});var r=function(){function r(){}return r.sendRequest=function(s,o,u,i,a){return t(this,void 0,Promise,(function(){var t,c,f,l,p,h;return n(this,(function(n){switch(n.label){case 0:return t=r.retrieveUrl(i.baseUrl||"",(a||{}).baseUrl||"",s),c=r.retrieveHeaders(i.headers||{},(a||{}).headers||{}),(f={method:o,headers:e({},c)}).body=JSON.stringify(u),[4,fetch(t,f)];case 1:return l=n.sent(),p=r.parseHeadersToNeojaxHeaders(l.headers),h={status:l.status,headers:p,url:l.url,success:l.ok,message:l.statusText},[4,r.retrieveData(l)];case 2:return[2,(h.data=n.sent(),h)]}}))}))},r.parseHeadersToNeojaxHeaders=function(e){var t={};try{e.forEach((function(e,n){t[n]=e}))}catch(e){return{}}return t},r.retrieveData=function(e){return t(this,void 0,Promise,(function(){return n(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,e.json()];case 1:return[2,t.sent()];case 2:t.sent(),t.label=3;case 3:return t.trys.push([3,5,,6]),[4,e.text()];case 4:return[2,t.sent()];case 5:return t.sent(),[2,""];case 6:return[3,7];case 7:return[2]}}))}))},r.retrieveUrl=function(e,t,n){return t?t+n:e+n},r.retrieveHeaders=function(t,n){return e(e({},t),n)},r}();return new(function(){function s(t){this._options={},this._defaultHeaders={"Content-Type":"application/json; charset=utf-8"};var n={};t&&(this._options=t,n=t.headers||{}),this._options.headers=e(e({},this._defaultHeaders),n)}return s.prototype.create=function(e){return new s(e)},s.prototype.manageRequest=function(e,s,o,u){return void 0===o&&(o=null),t(this,void 0,Promise,(function(){var i=this;return n(this,(function(a){return[2,new Promise((function(a,c){return t(i,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,r.sendRequest(s,e,o,this._options,u)];case 1:return(t=n.sent()).success?a(t):c({response:t,message:t.message}),[2]}}))}))}))]}))}))},s.prototype.get=function(e,t){return this.manageRequest("GET",e,null,t)},s.prototype.post=function(e,t,n){return this.manageRequest("POST",e,t,n)},s.prototype.put=function(e,t,n){return this.manageRequest("PUT",e,t,n)},s.prototype.delete=function(e,t,n){return this.manageRequest("DELETE",e,t,n)},Object.defineProperty(s.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"defaultHeaders",{get:function(){return this._defaultHeaders},enumerable:!0,configurable:!0}),s}())}));
