doipjs/dist/doip.js

8 lines
148 KiB
JavaScript
Raw Normal View History

2021-04-30 04:30:50 -06:00
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.doip = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2021-01-07 08:26:31 -07:00
(function (global){(function (){
2022-02-25 13:42:23 -07:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).doip=e()}}((function(){return function e(t,r,i){function o(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(n)return n(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};t[a][0].call(c.exports,(function(e){return o(t[a][1][e]||e)}),c,c.exports,e,t,r,i)}return r[a].exports}for(var n="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,r){(function(i){(function(){!function(e){"object"==typeof r&&void 0!==t?t.exports=e():("undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:this).doip=e()}((function(){return function t(r,i,o){function n(s,u){if(!i[s]){if(!r[s]){var l="function"==typeof e&&e;if(!u&&l)return l(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=i[s]={exports:{}};r[s][0].call(d.exports,(function(e){return n(r[s][1][e]||e)}),d,d.exports,t,r,i,o)}return i[s].exports}for(var a="function"==typeof e&&e,s=0;s<o.length;s++)n(o[s]);return n}({1:[function(e,t,r){"use strict";const i=e("./core");class o extends Error{constructor(e,...t){let r;super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,o),this.name="StatusError",this.message=e.statusMessage,this.statusCode=e.status,this.res=e,this.json=e.json.bind(e),this.text=e.text.bind(e),this.arrayBuffer=e.arrayBuffer.bind(e),Object.defineProperty(this,"responseBody",{get:()=>(r||(r=this.arrayBuffer()),r)}),this.headers={};for(const[t,r]of e.headers.entries())this.headers[t.toLowerCase()]=r}}t.exports=i(((e,t,r,i,n)=>async(a,s,u={})=>{a=n+(a||"");let l=new URL(a);if(i||(i={}),l.username&&(i.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error("Unknown protocol, "+l.protocol);if(s)if(s instanceof ArrayBuffer||ArrayBuffer.isView(s)||"string"==typeof s);else{if("object"!=typeof s)throw new Error("Unknown body type.");s=JSON.stringify(s),i["Content-Type"]="application/json"}u=new Headers({...i||{},...u});const c=await fetch(l,{method:t,headers:u,body:s});if(c.statusCode=c.status,!e.has(c.status))throw new o(c);return"json"===r?c.json():"buffer"===r?c.arrayBuffer():"string"===r?c.text():c}))},{"./core":2}],2:[function(e,t,r){"use strict";const i=new Set(["json","buffer","string"]);t.exports=e=>(...t)=>{const r=new Set;let o,n,a,s="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(o)throw new Error(`Can't set method to ${e}, already set to ${o}.`);o=e}else if(e.startsWith("http:")||e.startsWith("https:"))s=e;else{if(!i.has(e))throw new Error("Unknown encoding, "+e);n=e}else if("number"==typeof e)r.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>r.add(e)));else{if(a)throw new Error("Cannot set headers twice.");a=e}}})),o||(o="GET"),0===r.size&&r.add(200),e(r,o,n,a,s)}},{}],3:[function(e,t,r){(function(e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var t="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},i="undefined"!=typeof window&&void 0!==window.document,o="object"===("undefined"==typeof self?"undefined":t(self))&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name,n=void 0!==e&&null!=e.versions&&null!=e.versions.node;r.isBrowser=i,r.isWebWorker=o,r.isNode=n,r.isJsDom=function(){return"undefined"!=typeof window&&"nodejs"===window.name||navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")}}).call(this)}).call(this,e("_process"))},{_process:9}],4:[functio
2021-01-07 08:26:31 -07:00
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
2022-02-25 13:42:23 -07:00
},{}]},{},[1])(1)
2020-10-24 06:38:10 -06:00
});