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S,EACX,EACA,EAAI,UAAY,EAAI,WAAa,WAAW,EAuC9C,EAAI,QAAW,EAAQ,SAAW,EAAK,SAAS,QAC5C,EAKF,EAAI,KAAK,GAJT,YAAW,WACT,EAAI,KAAK,EACX,GAAG,EAAQ,OAAS,EAAK,SAAS,MAItC,CAEA,MAAO,CACL,IAAK,EACL,MAAO,EAAI,MACX,KAAM,EACN,GAAI,EACJ,IAAK,EACL,MAAO,EAEX,EAKA,EAAK,GAAK,EAKV,EAAK,MAAQ,EAKb,EAAK,WAAa,EAKlB,EAAK,SAAW,CACd,OAAQ,MACR,QAAS,IACT,MAAO,EACP,OAAO,EACP,UAAW,SACX,MAAO,WACP,MAAO,QACP,OAAQ,OACR,QAAS,CACP,mBAAoB,mBAIF,iBAAb,QAAoD,iBAApB,OAAc,QACrD,OAAO,QAAU,EACQ,mBAAZ,QAA0B,OAAO,IAC9C,QAAO,SAAS,GACd,OAAO,CACT,IACO,SACP,OAAO,KAAO,EAEjB,CApcA","file":"/npm/xdr@0.5.3/lib/ajax.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/xdr@0.5.3/lib/ajax.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n",";(function() {\n  'use strict';\n\n  /**\n   *  Creates a DOM element.\n   *\n   *  @param tag The tag name for the element.\n   *  @param attrs Attributes to assign to the element.\n   *  @param text Text to append as a child node.\n   *\n   *  @return The created DOM element.\n   */\n  var createElement = function(tag, attrs, text) {\n    var el = document.createElement(tag);\n    for(var z in attrs) {\n      el.setAttribute(z, attrs[z]);\n    }\n    if(text) el.appendChild(document.createTextNode(text));\n    return el;\n  }\n\n  /**\n   *  Detect Internet Explorer version as we cannot feature detect\n   *  using ('XDomainRequest' in window) as IE10 retains the\n   *  obsolete XDomainRequest object.\n   */\n  var ie = (function () {\n    var version = 0, browser = false, map, jscript;\n    map = {\n      '5.5': 5.5,\n      '5.6': 6,\n      '5.7': 7,\n      '5.8': 8,\n      '9': 9,\n      '10': 10\n    };\n    jscript = new Function('/*@cc_on return @_jscript_version; @*/')();\n    if (jscript !== undefined) {\n      browser = true;\n      version = map[jscript];\n    }\n    return {version: version, browser: browser};\n  }());\n\n  /**\n   *  Parse response headers into an object.\n   *\n   *  @param headers The response headers as a string.\n   *\n   *  @return An object encapsulating the response headers.\n   */\n  var parse = function(headers) {\n    var output = {}, i, p, k, v;\n    headers = headers || '';\n    headers = headers.replace('\\r', '');\n    headers = headers.split('\\n');\n    for(i = 0;i < headers.length;i++) {\n      p = headers[i].indexOf(':');\n      k = headers[i].substr(0, p);\n      v = headers[i].substr(p + 1);\n      if(k && v) {\n        k = k.replace(/^\\s+/, '').replace(/\\s+$/, '');\n        v = v.replace(/^\\s+/, '').replace(/\\s+$/, '');\n        output[k.toLowerCase()] = v;\n      }\n    }\n    return output;\n  }\n\n  /**\n   *  Accepts the URL and query string parameters\n   *  and returns a new URL.\n   *\n   *  @param url The original URL.\n   *  @param params The query string parameters.\n   *\n   *  @return The original or updated URL.\n   */\n  var qs = function(url, params) {\n    if(!params || !(typeof(params) == 'object')) return url;\n    var u = new String(url);\n    var q = [];\n    for(var z in params) {\n      q.push(encodeURIComponent(z) + '=' + encodeURIComponent(params[z]));\n    }\n    var qs = q.join('&');\n    u += (u.indexOf('?') == -1) ? '?' : '&';\n    u += qs;\n    return u;\n  }\n\n  /**\n   *  Type converters.\n   */\n  var converters = {\n    text: {\n      mime: 'text/plain',\n      encode: function(data){return data;},\n      decode: function(data){return data;}\n    },\n    json: {\n      mime: 'application/json',\n      encode: function(data) {\n        return JSON.stringify(data);\n      },\n      decode: function(data) {\n        return JSON.parse(data);\n      }\n    }\n  }\n\n  /**\n   *  Converts response text into a response format.\n   *\n   *  @param text The response text.\n   *  @param type The expected response type identifer.\n   */\n  var convert = function(text, type) {\n    var data = text;\n    if(converters[type]) {\n      var decoder = converters[type].decode;\n      data = decoder(data);\n    }\n    return data;\n  }\n\n  /**\n   *  Constant indicating whether CORS is used or\n   *  whether the XDomainRequest object is used instead.\n   */\n  var cors = !('XDomainRequest' in window)\n    || ie.browser && ie.version == 10;\n\n  /**\n   *  Retrieve the object used to make the request.\n   */\n  var xhr = function() {\n    if(!cors) {\n      return new XDomainRequest();\n    }else if(window.XMLHttpRequest) {\n      return new XMLHttpRequest();\n    }\n    return null;\n  }\n\n  /**\n   *  Injects custom error information into a response object.\n   *\n   *  When a server responds with a packet if the packet contains\n   *  an *error* object and the object contains a status number\n   *  then that overrides any pre-determined response status.\n   *\n   *  If the error object contains a message field then the response\n   *  Error instance is overwritten to use the server message.\n   *\n   *  @param response The response object about to be returned to the caller.\n   *  @param options The request options.\n   */\n  var error = function(response, options) {\n    var packet = response.data;\n    // override response status code\n    if(typeof(packet[options.status]) == 'number') {\n      response.status = packet[options.status];\n    }\n    if(typeof(packet[options.error]) == 'object') {\n      var status = '' + response.status;\n      if(!/^2/.test(status)) {\n        if(packet[options.error].message) {\n          response.error = new Error('' + packet[options.error].message);\n        }\n      }\n    }\n  }\n\n  /**\n   *  JSONP implementation.\n   *\n   *  @param url The URL to make the request to.\n   *  @param options The configuration options.\n   */\n  var jsonp = function(url, options) {\n    this.url = url;\n    this.options = options;\n  }\n\n  jsonp.counter = -1;\n\n  jsonp.prototype.send = function(message) {\n    var self = this;\n    var cb = '__jsonp__' + (++jsonp.counter);\n    this.url += (this.url.indexOf('?') == -1) ? '?' : '&';\n    this.url += encodeURIComponent(this.options.jsonp)\n      + '=' + encodeURIComponent(cb);\n    var elem = createElement('script',{src: this.url});\n    window[cb] = function (packet) {\n      if(typeof(self.options.callback) == 'function') {\n        var res = {status: 200, xhr: self, headers: null, error: null};\n        res.data = packet;\n        error(res, self.options);\n        self.options.callback(res);\n      }\n    }\n\n    var head = document.getElementsByTagName('head')[0]\n      || document.documentElement;\n    var done = false;\n    var cleanup = function() {\n      window[cb] = null;\n      // NOTE: empty try/catch due to a bug in IE8\n      // SEE: http://stackoverflow.com/questions/1073414/ \\\n      // SEE:   deleting-a-window-property-in-ie\n      try {\n        delete window[cb];\n      }catch(e){}\n      if(head && elem.parentNode) {\n        head.removeChild(elem);\n      }\n    }\n\n    // load handlers for all browsers\n    elem.onload = elem.onreadystatechange = function() {\n      if(!done\n         && (!this.readyState\n           || this.readyState === 'loaded'\n           || this.readyState === 'complete')) {\n        done = true;\n        // handle memory leak in IE\n        elem.onload = elem.onreadystatechange = null;\n        cleanup();\n      }\n    };\n    // perform the request\n    head.insertBefore(elem, head.firstChild);\n  }\n\n  /**\n   *  Declared for compatibility with XMLHttpRequest.\n   */\n  jsonp.prototype.abort = function(){};\n\n  /**\n   *  Performs an ajax request.\n   *\n   *  @param options.method The HTTP method.\n   *  @param options.url The URL to connect to.\n   *  @param options.headers An object containing HTTP headers.\n   *  @param options.timeout A timeout for the request in milliseconds.\n   *  @param options.delay A delay before invoking send() in milliseconds.\n   *  @param options.data Data to send with the request.\n   *  @param options.credentials Authentication credentials.\n   *  @param options.callback A callback for responses.\n   *  @param options.error The name of a property of the response object that \n   *  contains error information, default is `error`.\n   *  @param options.status The name of a property of the response object that \n   *  contains a status code, default is `code`.\n   *  @param options.mime A MIME type passed to overrideMimeType().\n   *  @param options.type The expected data type, one of `json`, `jsonp` \n   *  or `text`.\n   *  @param options.async Whether the request is asynchronous.\n   *  @param options.params Query string parameters to append to the URL.\n   *  @param options.fields Properties to apply to the XMLHttpRequest.\n   *  @param options.parameter Send the data as the named query string\n   *  parameter.\n   *  @param jsonp The name of the callback query string variable for jsonp\n   *  requests, default is 'callback'.\n   */\n  var ajax = function(options, callback) {\n    var req, z, jsp = false, data;\n    // no options or no json capability (IE7 etc.)\n    if(!(typeof(options) == 'object') || !('JSON' in window)) {\n      return false;\n    }\n\n    var type = options.type || 'text';\n    // mutate type for jsonp\n    if(type == 'jsonp') {\n      jsp = true;\n      type = 'json';\n      options.jsonp = options.jsonp || ajax.defaults.jsonp;\n    }\n\n    // unsupported content type\n    if(!(type in converters)) {\n      return false;\n    }\n\n    // unsupported browser version\n    if(!jsp && ((ie.browser && ie.version < 8)\n      || (!('XMLHttpRequest' in window) && !('XDomainRequest' in window)))) {\n      return false;\n    }\n\n    if(typeof(callback) == 'function') {\n      options.callback = callback;\n    }\n\n    // TODO: copy data so as not to affect the source data\n    if(options.data) {\n      var encoder = converters[type].encode;\n      data = encoder(options.data);\n    }\n\n    // setup custom error field\n    options.error = options.error || ajax.defaults.error;\n    options.status = options.status || ajax.defaults.status;\n\n    // send the data as a query string parameter\n    if(data && (jsp || (typeof(options.parameter) == 'string'))) {\n      options.params = options.params || {};\n      options.params[options.parameter || ajax.defaults.parameter] = data;\n    }\n\n    var url = qs(options.url || '', options.params);\n    var method = options.method || ajax.defaults.method;\n    var headers = options.headers || {};\n    var async = (typeof(options.async) == 'boolean') ? options.async\n       : ajax.defaults.async;\n    options.credentials = options.credentials || {};\n\n    /**\n     *  Generic response handler for invoking the\n     *  callback functions.\n     */\n    var response = function(response) {\n      if(typeof(options.callback) == 'function') {\n        error(response, options);\n        options.callback(response);\n      }\n    }\n\n    // execute as jsonp\n    if(jsp) {\n      req = new jsonp(url, options);\n      req.send(data);\n      url = req.url;\n    // execute as ajax\n    }else{\n      req = xhr();\n      if(!cors) {\n        req.open(method, url);\n        req.onload = function() {\n          var res = {status: this.status || 200,\n            xhr: this, headers: null, error: null};\n          res.data = convert(this.responseText, type);\n          response(res);\n        }\n        req.onerror = function() {\n          var res = {status: this.status || 500,\n            xhr: this, headers: null, error: null};\n          res.error = new Error('XDomainRequest error');\n          response(res);\n        }\n        req.ontimeout = req.onprogress = function(){};\n      }else{\n        // apply custom fields, eg: withCredentials\n        if(options.fields) {\n          for(z in options.fields) {\n            req[z] = options.fields[z];\n          }\n        }\n\n        req.open(method, url, async,\n          options.credentials.username, options.credentials.password);\n\n        if(options.mime && (typeof(req.overrideMimeType) == 'function')) {\n          req.overrideMimeType(options.mime);\n        }\n\n        // set default headers\n        for(z in ajax.defaults.headers) {\n          req.setRequestHeader(z, ajax.defaults.headers[z]);\n        }\n\n        // apply custom request headers\n        for(z in headers) {\n          req.setRequestHeader(z, headers[z]);\n        }\n\n        req.onreadystatechange = function() {\n          if(this.readyState == 4) {\n            var status = '' + (this.status || 0);\n            var res = {status: this.status, xhr: this, error: null};\n            if(!/^2/.test(status)) {\n              res.error = new Error('XMLHttpRequest error ' + status);\n            }\n            res.headers = parse(this.getAllResponseHeaders());\n            res.data = convert(this.responseText, type);\n            response(res);\n          }\n        }\n      }\n      req.timeout = (options.timeout || ajax.defaults.timeout);\n      if(!cors) {\n        setTimeout(function(){\n          req.send(data);\n        }, options.delay || ajax.defaults.delay);\n      }else{\n        req.send(data);\n      }\n    }\n\n    return {\n      xhr: req,\n      abort: req.abort,\n      cors: cors,\n      ie: ie,\n      url: url,\n      jsonp: jsp\n    }\n  }\n\n  /**\n   *  Expose IE browser information.\n   */\n  ajax.ie = ie;\n\n  /**\n   *  Expose the jsonp implementation.\n   */\n  ajax.jsonp = jsonp;\n\n  /**\n   *  Expose type converters.\n   */\n  ajax.converters = converters;\n\n  /**\n   *  Default options.\n   */\n  ajax.defaults = {\n    method: 'GET',\n    timeout: 10000,\n    delay: 0,\n    async: true,\n    parameter: 'packet',\n    jsonp: 'callback',\n    error: 'error',\n    status: 'code',\n    headers: {\n      'X-Requested-With': 'XMLHttpRequest'\n    }\n  }\n\n  if(typeof(module) === 'object' && typeof(module.exports) === 'object') {\n    module.exports = ajax;\n  }else if(typeof(define) == 'function' && define.amd) {\n    define(function(require) {\n      return ajax;\n    });\n  }else if(window) {\n    window.ajax = ajax;\n  }\n})();\n"]}