forked from radiosilence/xr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xr.js
1 lines (1 loc) · 3.79 KB
/
xr.js
1
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["xr.js"]=t():e["xr.js"]=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return{status:e.status,response:e.response,data:t,xhr:e}}function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];for(var o in n)if({}.hasOwnProperty.call(n,o)){var a=n[o];if("object"===("undefined"==typeof a?"undefined":f(a)))for(var s in a)({}).hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e}function s(e){T=a({},T,e)}function u(e,t){return(e&&e.promise?e.promise:T.promise||h.promise)(t)}function i(e){var t=e.url,n=e.subPath;return t&&-1===n.indexOf("://")||(t=n,n=void 0),(n||e.params)&&(t=t.split("?")[0]),n&&(t.indexOf("/")===t.length-1&&(t=t.substr(0,t.length-1)),0===n.indexOf("/")&&(n=n.substr(1)),t=t+"/"+n),e.params&&(t=t+"?"+(0,p["default"])(e.params)),t}function d(e){return u(e,function(t,n){var r=a({},h,T,e),s=r.xmlHttpRequest();s.withCredentials=r.withCredentials,r.abort&&e.abort(function(){n(o(s)),s.abort()}),s.open(r.method,i(r),!0),s.addEventListener(m.LOAD,function(){if(s.status>=200&&s.status<300){var e=null;s.responseText&&(e=r.raw===!0?s.responseText:r.load(s.responseText)),t(o(s,e))}else n(o(s))}),s.addEventListener(m.ABORT,function(){return n(o(s))}),s.addEventListener(m.ERROR,function(){return n(o(s))}),s.addEventListener(m.TIMEOUT,function(){return n(o(s))});for(var u in r.headers)({}).hasOwnProperty.call(r.headers,u)&&s.setRequestHeader(u,r.headers[u]);for(var d in r.events)({}).hasOwnProperty.call(r.events,d)&&s.addEventListener(d,r.events[d].bind(null,s),!1);var c="object"!==f(r.data)||r.raw?r.data:r.dump(r.data);void 0!==c?s.send(c):s.send()})}Object.defineProperty(t,"__esModule",{value:!0});var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=n(2),p=r(c),l={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",OPTIONS:"OPTIONS"},m={READY_STATE_CHANGE:"readystatechange",LOAD_START:"loadstart",PROGRESS:"progress",ABORT:"abort",ERROR:"error",LOAD:"load",TIMEOUT:"timeout",LOAD_END:"loadend"},h={method:l.GET,data:void 0,headers:{Accept:"application/json","Content-Type":"application/json"},dump:JSON.stringify,load:JSON.parse,xmlHttpRequest:function(){return new XMLHttpRequest},promise:function(e){return new Promise(e)},withCredentials:!1},T={};d.assign=a,d.encode=p["default"],d.configure=s,d.Methods=l,d.Events=m,d.defaults=h,d.get=function(e,t,n){return d(a({subPath:e,method:l.GET,params:t},n))},d.put=function(e,t,n){return d(a({subPath:e,method:l.PUT,data:t},n))},d.post=function(e,t,n){return d(a({subPath:e,method:l.POST,data:t},n))},d.patch=function(e,t,n){return d(a({subPath:e,method:l.PATCH,data:t},n))},d.del=function(e,t){return d(a({subPath:e,method:l.DELETE},t))},d.options=function(e,t){return d(a({subPath:e,method:l.OPTIONS},t))},t["default"]=d},function(e,t){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,r,o){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(o){var a=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return a+encodeURIComponent(n(e))}).join(t):a+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}}])});