├── .babelrc ├── .editorconfig ├── .env ├── .eslintrc.js ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── bower.json ├── build ├── elitejax.js ├── elitejax.js.map ├── elitejax.min.js └── elitejax.min.js.map ├── eliteJAX.png ├── index.html ├── package.json ├── src └── index.es6 ├── webpack.config.js └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"] 3 | } 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # General settings for whole project 4 | [*] 5 | indent_style = tab 6 | indent_size = 2 7 | 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | 13 | # Format markdown files 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # production/development 2 | NODE_ENV=development 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es6": true, 6 | "node": true 7 | }, 8 | "extends": "eslint:recommended", 9 | "parser": "babel-eslint", 10 | "parserOptions": { 11 | "sourceType": "module" 12 | }, 13 | "rules": { 14 | "accessor-pairs": 2, 15 | "arrow-spacing": [2, { "before": true, "after": true }], 16 | "block-spacing": [2, "always"], 17 | 18 | "camelcase": [2, { "properties": "never" }], 19 | "comma-dangle": [2, "never"], 20 | "comma-spacing": [2, { "before": false, "after": true }], 21 | "comma-style": [2, "last"], 22 | "constructor-super": 2, 23 | "curly": [2, "multi-line"], 24 | "dot-location": [2, "property"], 25 | "eol-last": 2, 26 | "eqeqeq": [2, "allow-null"], 27 | "handle-callback-err": [2, "^(err|error)$" ], 28 | 29 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 30 | "keyword-spacing": [2, { "before": true, "after": true }], 31 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 32 | "new-parens": 2, 33 | "no-array-constructor": 2, 34 | "no-caller": 2, 35 | "no-class-assign": 2, 36 | "no-cond-assign": 2, 37 | "no-const-assign": 2, 38 | "no-constant-condition": [2, { "checkLoops": false }], 39 | "no-console": 0, 40 | "no-control-regex": 2, 41 | "no-debugger": 2, 42 | "no-delete-var": 2, 43 | "no-dupe-args": 2, 44 | "no-dupe-class-members": 2, 45 | "no-dupe-keys": 2, 46 | "no-duplicate-case": 2, 47 | "no-duplicate-imports": 2, 48 | "no-empty-character-class": 2, 49 | "no-empty-pattern": 2, 50 | "no-eval": 2, 51 | "no-ex-assign": 2, 52 | "no-extend-native": 2, 53 | "no-extra-bind": 2, 54 | "no-extra-boolean-cast": 2, 55 | "no-extra-parens": [2, "functions"], 56 | "no-fallthrough": 2, 57 | "no-floating-decimal": 2, 58 | "no-func-assign": 2, 59 | "no-implied-eval": 2, 60 | "no-inner-declarations": [2, "functions"], 61 | "no-invalid-regexp": 2, 62 | "no-irregular-whitespace": 2, 63 | "no-iterator": 2, 64 | "no-label-var": 2, 65 | "no-labels": [2, { "allowLoop": false, "allowSwitch": false }], 66 | "no-lone-blocks": 2, 67 | "no-mixed-spaces-and-tabs": 2, 68 | "no-multi-spaces": 2, 69 | "no-multi-str": 2, 70 | "no-multiple-empty-lines": [2, { "max": 1 }], 71 | "no-native-reassign": 2, 72 | "no-negated-in-lhs": 2, 73 | "no-new": 2, 74 | "no-new-func": 2, 75 | "no-new-object": 2, 76 | "no-new-require": 2, 77 | "no-new-symbol": 2, 78 | "no-new-wrappers": 2, 79 | "no-obj-calls": 2, 80 | "no-octal": 2, 81 | "no-octal-escape": 2, 82 | "no-path-concat": 2, 83 | "no-proto": 2, 84 | "no-redeclare": 2, 85 | "no-regex-spaces": 2, 86 | "no-return-assign": [2, "except-parens"], 87 | "no-self-assign": 2, 88 | "no-self-compare": 2, 89 | "no-sequences": 2, 90 | "no-shadow-restricted-names": 2, 91 | "no-spaced-func": 2, 92 | "no-sparse-arrays": 2, 93 | "no-this-before-super": 2, 94 | "no-throw-literal": 2, 95 | "no-trailing-spaces": 2, 96 | "no-undef": 2, 97 | "no-undef-init": 2, 98 | "no-unexpected-multiline": 2, 99 | "no-unmodified-loop-condition": 2, 100 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 101 | "no-unreachable": 2, 102 | "no-unsafe-finally": 2, 103 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 104 | "no-useless-call": 2, 105 | "no-useless-computed-key": 2, 106 | "no-useless-constructor": 2, 107 | "no-useless-escape": 2, 108 | "no-useless-rename": 2, 109 | "no-whitespace-before-property": 2, 110 | "no-with": 2, 111 | "object-property-newline": [2, { "allowMultiplePropertiesPerLine": true }], 112 | "one-var": [2, { "initialized": "never" }], 113 | "operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }], 114 | "padded-blocks": [2, "never"], 115 | "quotes": [2, "single", { "avoidEscape": true, "allowTemplateLiterals": true }], 116 | "rest-spread-spacing": [2, "never"], 117 | "semi": ["error", "always"], 118 | "semi-spacing": [2, { "before": false, "after": true }], 119 | "space-before-blocks": [2, "always"], 120 | "space-in-parens": [2, "never"], 121 | "space-infix-ops": 2, 122 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 123 | "spaced-comment": [2, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 124 | "template-curly-spacing": [2, "never"], 125 | "unicode-bom": [2, "never"], 126 | "use-isnan": 2, 127 | "valid-typeof": 2, 128 | "wrap-iife": [2, "any"], 129 | "yield-star-spacing": [2, "both"], 130 | "yoda": [2, "never"] 131 | } 132 | }; 133 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | # ignore my trash file 40 | .trash.js 41 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # not ready yet 2 | language: node_js 3 | node_js: 4 | - "6" 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Code Wolf 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # elitejax 2 | 3 | [![Build Status](https://travis-ci.org/ghostffcode/elitejax.svg?branch=master)](https://travis-ci.org/ghostffcode/elitejax) [![Bower version](https://badge.fury.io/bo/elitejax.svg)](https://badge.fury.io/bo/elitejax) 4 | 5 | Simplifying Ajax Requests Using HTML attributes 6 | 7 | ### **Introduction** 8 | --- 9 | Elitejax is a standalone javascript library that makes AJAX requests a lot more easier without you writing a single line of javascript. 10 | 11 | All you have to do is add data-elitejax="true" attribute to your form tag and you are good to go 12 | 13 | ### **Installation** 14 | --- 15 | You can install this library by cloning this git and reference the javascript files from the build directory, using npm: 16 | ``` 17 | npm install elitejax --save 18 | ``` 19 | or using bower: 20 | ``` 21 | bower install elitejax 22 | ``` 23 | 24 | ### Usage Without javascript 25 | If your request returns data as JSON, you can add to the DOM from that object without javascript using the `data-post` and `data-postTo` attributes in your form element. 26 | 27 | The `data-post` attribute is used to specify what part of the data returned you want to use. 28 | `data-postTo` is the DOM selector of where to post the resulting value. 29 | 30 | ```html 31 | 32 |
33 |
34 | Enter name:
35 | Category:
36 | 37 |
38 | 39 | ``` 40 | The above will place the result in the div element with .result class. 41 | 42 | ### Exclude form field 43 | ___ 44 | To exclude a form field in your form from your AJAX request, you can add data-elitejax-x attribute to that field, like: 45 | ```html 46 | 47 | 48 | ``` 49 | 50 | ### Adding custom configurations 51 | --- 52 | Due to elitejax's flexibility, you can add custom configuration for each form in your webpage. First specify a name for your form and then use it with ej.configure, like so: 53 | 54 | ```html 55 |
56 | ..... 57 | 58 |
59 | 60 | 61 | 64 | ``` 65 | 66 | The configuration object argument for the configure method takes 4 parameters: 67 | 68 | * async **default: true** : You can set this to true or false 69 | 70 | * cType **default: "application/json"** : This is the content type header. 71 | 72 | * resType **default: "json"** : This is the response type of the AJAX query, you can use jsonp for cross domain requests. 73 | 74 | * callback **default: function** : The default callback logs the data to the console. You can specify your callback function for when the request completes successfully 75 | 76 | ### Making Custom AJAX requests 77 | --- 78 | You can use the elitejax ajaxIt method to send a custom AJAX request: 79 | ```javascript 80 | elitejax.ajaxIt(url, method, data[, requestName]); 81 | ``` 82 | * url **(string)** : the API Endpoint or url the request is to be made to. 83 | * method **(string)** : can be get/post/delete/put request type. 84 | * data **(object)** : data you want to send to the url 85 | * requestName - optional **(string)** : The name you want to give to your AJAX request. You need to set this if you want to use custom configuration (the elitejax configure method) with your AJAX request. 86 | 87 | So, we can customize the spotify API call to run on page load instead of depending on user interaction like so: 88 | ```html 89 | 90 | 99 | ``` 100 | 101 | ## **License** 102 | Elitejax is Licensed under the [MIT License](../master/LICENSE) 103 | 104 | ## **Contributing** 105 | Please do! Send a pull request after your modifications. 106 | 107 | Sharing is caring.... make sure to let your peers know. 108 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "elitejax", 3 | "description": "Simplifying Ajax Requests Using HTML attributes", 4 | "main": "./build/elitejax.js", 5 | "authors": [ 6 | "Chimeremeze Ukah " 7 | ], 8 | "license": "MIT", 9 | "keywords": [ 10 | "simple", 11 | "ajax", 12 | "elite", 13 | "ajax", 14 | "elitejax", 15 | "ajax" 16 | ], 17 | "homepage": "https://github.com/ghostffcode/elitejax", 18 | "ignore": [ 19 | "**/.*", 20 | "node_modules", 21 | "bower_components", 22 | "test", 23 | "tests" 24 | ], 25 | "version": "1.0.1" 26 | } 27 | -------------------------------------------------------------------------------- /build/elitejax.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | /******/ 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | /******/ 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | /******/ 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | /******/ 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | /******/ 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | /******/ 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | /******/ 29 | /******/ 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | /******/ 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | /******/ 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | /******/ 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ function(module, exports, __webpack_require__) { 46 | 47 | 'use strict'; 48 | 49 | Object.defineProperty(exports, "__esModule", { 50 | value: true 51 | }); 52 | 53 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 54 | 55 | var _axios = __webpack_require__(1); 56 | 57 | var _axios2 = _interopRequireDefault(_axios); 58 | 59 | var _querystring = __webpack_require__(27); 60 | 61 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 62 | 63 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 64 | 65 | var Elitejax = function () { 66 | // get config via object for elitejax constructor 67 | function Elitejax(document) { 68 | _classCallCheck(this, Elitejax); 69 | 70 | this.config = {}; 71 | this.document = document; 72 | this.ajaxForm(this.getEl()); 73 | } 74 | 75 | // function to add configurations to selected forms 76 | 77 | 78 | _createClass(Elitejax, [{ 79 | key: 'configure', 80 | value: function configure(name) { 81 | var config = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 82 | 83 | // set default configuration 84 | var defaultConfig = { 85 | async: true, 86 | cType: 'application/json', 87 | resType: 'json', 88 | callback: function callback(data) { 89 | console.log(data); 90 | } 91 | }; 92 | 93 | for (var prop in defaultConfig) { 94 | if (config[prop] === undefined) { 95 | config[prop] = defaultConfig[prop]; 96 | } 97 | } 98 | 99 | this.config[name] = config; 100 | return this.config[name]; 101 | } 102 | 103 | // gets elements that has been marked for elitejax 104 | 105 | }, { 106 | key: 'getEl', 107 | value: function getEl() { 108 | var res = []; 109 | var elem = this.document.querySelectorAll('form'); 110 | Array.from(elem).forEach(function (form) { 111 | if (form.getAttribute('data-elitejax') === 'true') { 112 | var postTo = form.getAttribute('data-postTo'); 113 | res.push({ form: form, postTo: postTo }); 114 | } 115 | }); 116 | return res; 117 | } 118 | 119 | // gets value from form elements 120 | 121 | }, { 122 | key: 'formData', 123 | value: function formData(inputs) { 124 | var res = {}; 125 | var num = inputs.length; 126 | for (var i = 0; i < num; i++) { 127 | var valid = this.validInput(inputs[i]); 128 | if (valid[0]) { 129 | res[valid[1]] = valid[2]; 130 | } 131 | } 132 | return res; 133 | } 134 | }, { 135 | key: 'resolve', 136 | value: function resolve(path, data) { 137 | return path.split(/[.\[]+/).reduce(function (prev, curr) { 138 | curr = curr.replace(/[\]]+/, ''); 139 | return prev ? prev[curr] : undefined; 140 | }, data); 141 | } 142 | 143 | // validate user inputs according to input types 144 | 145 | }, { 146 | key: 'validInput', 147 | value: function validInput(inputEl) { 148 | var val = [true, '', '']; 149 | var name = inputEl.name.toLowerCase(); 150 | var value = inputEl.value; 151 | var ex = inputEl.getAttribute('data-elitejax-x'); 152 | if (name !== '' && value !== '' && name !== 'submit' && value !== 'submit' && ex === null) { 153 | val[1] = name; 154 | val[2] = value; 155 | } else { 156 | val[0] = false; 157 | } 158 | return val; 159 | } 160 | 161 | // convert object to url parameter 162 | 163 | }, { 164 | key: 'params', 165 | value: function params() { 166 | var obj = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; 167 | var resType = arguments.length <= 1 || arguments[1] === undefined ? '' : arguments[1]; 168 | var cbName = arguments.length <= 2 || arguments[2] === undefined ? '' : arguments[2]; 169 | 170 | var str = ''; 171 | str = resType === 'jsonp' ? '?callback=' + cbName + '&' : str; 172 | str += '' + (0, _querystring.stringify)(obj); 173 | return str; 174 | } 175 | }, { 176 | key: 'ajaxForm', 177 | value: function ajaxForm(forms) { 178 | var _this = this; 179 | 180 | forms.forEach(function (form, index) { 181 | form['form'].addEventListener('submit', function (e) { 182 | e.preventDefault(); 183 | var name = e.target.getAttribute('name'); 184 | var url = e.target.getAttribute('action'); 185 | var method = e.target.getAttribute('method'); 186 | var post = e.target.getAttribute('data-post'); 187 | var data = _this.formData(e.target.elements); 188 | // make ajax request 189 | _this.ajaxIt(url, method, data, post, form['postTo'], name); 190 | }); 191 | }); 192 | } 193 | }, { 194 | key: 'ajaxIt', 195 | value: function ajaxIt(url, method, data) { 196 | var post = arguments.length <= 3 || arguments[3] === undefined ? '' : arguments[3]; 197 | 198 | var _this2 = this; 199 | 200 | var postTo = arguments.length <= 4 || arguments[4] === undefined ? null : arguments[4]; 201 | var name = arguments.length <= 5 || arguments[5] === undefined ? null : arguments[5]; 202 | 203 | method = method.toUpperCase(); 204 | if (this.config[name] === undefined || this.config[name] === null) { 205 | this.configure(name); 206 | } 207 | // destructure configuration for given form 208 | var _config$name = this.config[name]; 209 | var resType = _config$name.resType; 210 | var callback = _config$name.callback; 211 | 212 | if (resType === 'jsonp') { 213 | var script = this.document.createElement('script'); 214 | script.type = 'text/javascript'; 215 | var cbName = 'ej_' + Date.now(); 216 | self.callback[cbName] = callback; 217 | script.src = url + this.params(data, resType, 'self.callback.' + cbName); 218 | this.document.getElementsByTagName('head')[0].appendChild(script); 219 | } else { 220 | var req = void 0; 221 | if (method === 'GET' || method === 'DELETE' || method === 'HEAD' && resType !== 'jsonp') { 222 | req = _axios2.default.get(url, { params: data }); 223 | } else { 224 | req = _axios2.default.post(url, data); 225 | } 226 | req.then(function (response) { 227 | // console.log(response); 228 | if (postTo !== null) { 229 | Array.from(_this2.document.querySelectorAll(postTo)).forEach(function (output) { 230 | output.innerHTML = _this2.resolve(post, response.data); 231 | }); 232 | } else { 233 | callback(response); 234 | } 235 | }).catch(function (err) { 236 | console.log(err); 237 | }); 238 | } 239 | } 240 | }]); 241 | 242 | return Elitejax; 243 | }(); 244 | 245 | var elitejax = function elitejax() { 246 | var ej = new Elitejax(document); 247 | self.callback = {}; 248 | return ej; 249 | }; 250 | 251 | window['elitejax'] = elitejax(); 252 | 253 | exports.default = elitejax; 254 | 255 | /***/ }, 256 | /* 1 */ 257 | /***/ function(module, exports, __webpack_require__) { 258 | 259 | module.exports = __webpack_require__(2); 260 | 261 | /***/ }, 262 | /* 2 */ 263 | /***/ function(module, exports, __webpack_require__) { 264 | 265 | 'use strict'; 266 | 267 | var utils = __webpack_require__(3); 268 | var bind = __webpack_require__(4); 269 | var Axios = __webpack_require__(5); 270 | 271 | /** 272 | * Create an instance of Axios 273 | * 274 | * @param {Object} defaultConfig The default config for the instance 275 | * @return {Axios} A new instance of Axios 276 | */ 277 | function createInstance(defaultConfig) { 278 | var context = new Axios(defaultConfig); 279 | var instance = bind(Axios.prototype.request, context); 280 | 281 | // Copy axios.prototype to instance 282 | utils.extend(instance, Axios.prototype, context); 283 | 284 | // Copy context to instance 285 | utils.extend(instance, context); 286 | 287 | return instance; 288 | } 289 | 290 | // Create the default instance to be exported 291 | var axios = createInstance(); 292 | 293 | // Expose Axios class to allow class inheritance 294 | axios.Axios = Axios; 295 | 296 | // Factory for creating new instances 297 | axios.create = function create(defaultConfig) { 298 | return createInstance(defaultConfig); 299 | }; 300 | 301 | // Expose Cancel & CancelToken 302 | axios.Cancel = __webpack_require__(24); 303 | axios.CancelToken = __webpack_require__(25); 304 | axios.isCancel = __webpack_require__(21); 305 | 306 | // Expose all/spread 307 | axios.all = function all(promises) { 308 | return Promise.all(promises); 309 | }; 310 | axios.spread = __webpack_require__(26); 311 | 312 | module.exports = axios; 313 | 314 | // Allow use of default import syntax in TypeScript 315 | module.exports.default = axios; 316 | 317 | 318 | /***/ }, 319 | /* 3 */ 320 | /***/ function(module, exports, __webpack_require__) { 321 | 322 | 'use strict'; 323 | 324 | var bind = __webpack_require__(4); 325 | 326 | /*global toString:true*/ 327 | 328 | // utils is a library of generic helper functions non-specific to axios 329 | 330 | var toString = Object.prototype.toString; 331 | 332 | /** 333 | * Determine if a value is an Array 334 | * 335 | * @param {Object} val The value to test 336 | * @returns {boolean} True if value is an Array, otherwise false 337 | */ 338 | function isArray(val) { 339 | return toString.call(val) === '[object Array]'; 340 | } 341 | 342 | /** 343 | * Determine if a value is an ArrayBuffer 344 | * 345 | * @param {Object} val The value to test 346 | * @returns {boolean} True if value is an ArrayBuffer, otherwise false 347 | */ 348 | function isArrayBuffer(val) { 349 | return toString.call(val) === '[object ArrayBuffer]'; 350 | } 351 | 352 | /** 353 | * Determine if a value is a FormData 354 | * 355 | * @param {Object} val The value to test 356 | * @returns {boolean} True if value is an FormData, otherwise false 357 | */ 358 | function isFormData(val) { 359 | return (typeof FormData !== 'undefined') && (val instanceof FormData); 360 | } 361 | 362 | /** 363 | * Determine if a value is a view on an ArrayBuffer 364 | * 365 | * @param {Object} val The value to test 366 | * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 367 | */ 368 | function isArrayBufferView(val) { 369 | var result; 370 | if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 371 | result = ArrayBuffer.isView(val); 372 | } else { 373 | result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 374 | } 375 | return result; 376 | } 377 | 378 | /** 379 | * Determine if a value is a String 380 | * 381 | * @param {Object} val The value to test 382 | * @returns {boolean} True if value is a String, otherwise false 383 | */ 384 | function isString(val) { 385 | return typeof val === 'string'; 386 | } 387 | 388 | /** 389 | * Determine if a value is a Number 390 | * 391 | * @param {Object} val The value to test 392 | * @returns {boolean} True if value is a Number, otherwise false 393 | */ 394 | function isNumber(val) { 395 | return typeof val === 'number'; 396 | } 397 | 398 | /** 399 | * Determine if a value is undefined 400 | * 401 | * @param {Object} val The value to test 402 | * @returns {boolean} True if the value is undefined, otherwise false 403 | */ 404 | function isUndefined(val) { 405 | return typeof val === 'undefined'; 406 | } 407 | 408 | /** 409 | * Determine if a value is an Object 410 | * 411 | * @param {Object} val The value to test 412 | * @returns {boolean} True if value is an Object, otherwise false 413 | */ 414 | function isObject(val) { 415 | return val !== null && typeof val === 'object'; 416 | } 417 | 418 | /** 419 | * Determine if a value is a Date 420 | * 421 | * @param {Object} val The value to test 422 | * @returns {boolean} True if value is a Date, otherwise false 423 | */ 424 | function isDate(val) { 425 | return toString.call(val) === '[object Date]'; 426 | } 427 | 428 | /** 429 | * Determine if a value is a File 430 | * 431 | * @param {Object} val The value to test 432 | * @returns {boolean} True if value is a File, otherwise false 433 | */ 434 | function isFile(val) { 435 | return toString.call(val) === '[object File]'; 436 | } 437 | 438 | /** 439 | * Determine if a value is a Blob 440 | * 441 | * @param {Object} val The value to test 442 | * @returns {boolean} True if value is a Blob, otherwise false 443 | */ 444 | function isBlob(val) { 445 | return toString.call(val) === '[object Blob]'; 446 | } 447 | 448 | /** 449 | * Determine if a value is a Function 450 | * 451 | * @param {Object} val The value to test 452 | * @returns {boolean} True if value is a Function, otherwise false 453 | */ 454 | function isFunction(val) { 455 | return toString.call(val) === '[object Function]'; 456 | } 457 | 458 | /** 459 | * Determine if a value is a Stream 460 | * 461 | * @param {Object} val The value to test 462 | * @returns {boolean} True if value is a Stream, otherwise false 463 | */ 464 | function isStream(val) { 465 | return isObject(val) && isFunction(val.pipe); 466 | } 467 | 468 | /** 469 | * Determine if a value is a URLSearchParams object 470 | * 471 | * @param {Object} val The value to test 472 | * @returns {boolean} True if value is a URLSearchParams object, otherwise false 473 | */ 474 | function isURLSearchParams(val) { 475 | return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 476 | } 477 | 478 | /** 479 | * Trim excess whitespace off the beginning and end of a string 480 | * 481 | * @param {String} str The String to trim 482 | * @returns {String} The String freed of excess whitespace 483 | */ 484 | function trim(str) { 485 | return str.replace(/^\s*/, '').replace(/\s*$/, ''); 486 | } 487 | 488 | /** 489 | * Determine if we're running in a standard browser environment 490 | * 491 | * This allows axios to run in a web worker, and react-native. 492 | * Both environments support XMLHttpRequest, but not fully standard globals. 493 | * 494 | * web workers: 495 | * typeof window -> undefined 496 | * typeof document -> undefined 497 | * 498 | * react-native: 499 | * typeof document.createElement -> undefined 500 | */ 501 | function isStandardBrowserEnv() { 502 | return ( 503 | typeof window !== 'undefined' && 504 | typeof document !== 'undefined' && 505 | typeof document.createElement === 'function' 506 | ); 507 | } 508 | 509 | /** 510 | * Iterate over an Array or an Object invoking a function for each item. 511 | * 512 | * If `obj` is an Array callback will be called passing 513 | * the value, index, and complete array for each item. 514 | * 515 | * If 'obj' is an Object callback will be called passing 516 | * the value, key, and complete object for each property. 517 | * 518 | * @param {Object|Array} obj The object to iterate 519 | * @param {Function} fn The callback to invoke for each item 520 | */ 521 | function forEach(obj, fn) { 522 | // Don't bother if no value provided 523 | if (obj === null || typeof obj === 'undefined') { 524 | return; 525 | } 526 | 527 | // Force an array if not already something iterable 528 | if (typeof obj !== 'object' && !isArray(obj)) { 529 | /*eslint no-param-reassign:0*/ 530 | obj = [obj]; 531 | } 532 | 533 | if (isArray(obj)) { 534 | // Iterate over array values 535 | for (var i = 0, l = obj.length; i < l; i++) { 536 | fn.call(null, obj[i], i, obj); 537 | } 538 | } else { 539 | // Iterate over object keys 540 | for (var key in obj) { 541 | if (Object.prototype.hasOwnProperty.call(obj, key)) { 542 | fn.call(null, obj[key], key, obj); 543 | } 544 | } 545 | } 546 | } 547 | 548 | /** 549 | * Accepts varargs expecting each argument to be an object, then 550 | * immutably merges the properties of each object and returns result. 551 | * 552 | * When multiple objects contain the same key the later object in 553 | * the arguments list will take precedence. 554 | * 555 | * Example: 556 | * 557 | * ```js 558 | * var result = merge({foo: 123}, {foo: 456}); 559 | * console.log(result.foo); // outputs 456 560 | * ``` 561 | * 562 | * @param {Object} obj1 Object to merge 563 | * @returns {Object} Result of all merge properties 564 | */ 565 | function merge(/* obj1, obj2, obj3, ... */) { 566 | var result = {}; 567 | function assignValue(val, key) { 568 | if (typeof result[key] === 'object' && typeof val === 'object') { 569 | result[key] = merge(result[key], val); 570 | } else { 571 | result[key] = val; 572 | } 573 | } 574 | 575 | for (var i = 0, l = arguments.length; i < l; i++) { 576 | forEach(arguments[i], assignValue); 577 | } 578 | return result; 579 | } 580 | 581 | /** 582 | * Extends object a by mutably adding to it the properties of object b. 583 | * 584 | * @param {Object} a The object to be extended 585 | * @param {Object} b The object to copy properties from 586 | * @param {Object} thisArg The object to bind function to 587 | * @return {Object} The resulting value of object a 588 | */ 589 | function extend(a, b, thisArg) { 590 | forEach(b, function assignValue(val, key) { 591 | if (thisArg && typeof val === 'function') { 592 | a[key] = bind(val, thisArg); 593 | } else { 594 | a[key] = val; 595 | } 596 | }); 597 | return a; 598 | } 599 | 600 | module.exports = { 601 | isArray: isArray, 602 | isArrayBuffer: isArrayBuffer, 603 | isFormData: isFormData, 604 | isArrayBufferView: isArrayBufferView, 605 | isString: isString, 606 | isNumber: isNumber, 607 | isObject: isObject, 608 | isUndefined: isUndefined, 609 | isDate: isDate, 610 | isFile: isFile, 611 | isBlob: isBlob, 612 | isFunction: isFunction, 613 | isStream: isStream, 614 | isURLSearchParams: isURLSearchParams, 615 | isStandardBrowserEnv: isStandardBrowserEnv, 616 | forEach: forEach, 617 | merge: merge, 618 | extend: extend, 619 | trim: trim 620 | }; 621 | 622 | 623 | /***/ }, 624 | /* 4 */ 625 | /***/ function(module, exports) { 626 | 627 | 'use strict'; 628 | 629 | module.exports = function bind(fn, thisArg) { 630 | return function wrap() { 631 | var args = new Array(arguments.length); 632 | for (var i = 0; i < args.length; i++) { 633 | args[i] = arguments[i]; 634 | } 635 | return fn.apply(thisArg, args); 636 | }; 637 | }; 638 | 639 | 640 | /***/ }, 641 | /* 5 */ 642 | /***/ function(module, exports, __webpack_require__) { 643 | 644 | 'use strict'; 645 | 646 | var defaults = __webpack_require__(6); 647 | var utils = __webpack_require__(3); 648 | var InterceptorManager = __webpack_require__(18); 649 | var dispatchRequest = __webpack_require__(19); 650 | var isAbsoluteURL = __webpack_require__(22); 651 | var combineURLs = __webpack_require__(23); 652 | 653 | /** 654 | * Create a new instance of Axios 655 | * 656 | * @param {Object} defaultConfig The default config for the instance 657 | */ 658 | function Axios(defaultConfig) { 659 | this.defaults = utils.merge(defaults, defaultConfig); 660 | this.interceptors = { 661 | request: new InterceptorManager(), 662 | response: new InterceptorManager() 663 | }; 664 | } 665 | 666 | /** 667 | * Dispatch a request 668 | * 669 | * @param {Object} config The config specific for this request (merged with this.defaults) 670 | */ 671 | Axios.prototype.request = function request(config) { 672 | /*eslint no-param-reassign:0*/ 673 | // Allow for axios('example/url'[, config]) a la fetch API 674 | if (typeof config === 'string') { 675 | config = utils.merge({ 676 | url: arguments[0] 677 | }, arguments[1]); 678 | } 679 | 680 | config = utils.merge(defaults, this.defaults, { method: 'get' }, config); 681 | 682 | // Support baseURL config 683 | if (config.baseURL && !isAbsoluteURL(config.url)) { 684 | config.url = combineURLs(config.baseURL, config.url); 685 | } 686 | 687 | // Hook up interceptors middleware 688 | var chain = [dispatchRequest, undefined]; 689 | var promise = Promise.resolve(config); 690 | 691 | this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 692 | chain.unshift(interceptor.fulfilled, interceptor.rejected); 693 | }); 694 | 695 | this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 696 | chain.push(interceptor.fulfilled, interceptor.rejected); 697 | }); 698 | 699 | while (chain.length) { 700 | promise = promise.then(chain.shift(), chain.shift()); 701 | } 702 | 703 | return promise; 704 | }; 705 | 706 | // Provide aliases for supported request methods 707 | utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 708 | /*eslint func-names:0*/ 709 | Axios.prototype[method] = function(url, config) { 710 | return this.request(utils.merge(config || {}, { 711 | method: method, 712 | url: url 713 | })); 714 | }; 715 | }); 716 | 717 | utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 718 | /*eslint func-names:0*/ 719 | Axios.prototype[method] = function(url, data, config) { 720 | return this.request(utils.merge(config || {}, { 721 | method: method, 722 | url: url, 723 | data: data 724 | })); 725 | }; 726 | }); 727 | 728 | module.exports = Axios; 729 | 730 | 731 | /***/ }, 732 | /* 6 */ 733 | /***/ function(module, exports, __webpack_require__) { 734 | 735 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; 736 | 737 | var utils = __webpack_require__(3); 738 | var normalizeHeaderName = __webpack_require__(8); 739 | 740 | var PROTECTION_PREFIX = /^\)\]\}',?\n/; 741 | var DEFAULT_CONTENT_TYPE = { 742 | 'Content-Type': 'application/x-www-form-urlencoded' 743 | }; 744 | 745 | function setContentTypeIfUnset(headers, value) { 746 | if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 747 | headers['Content-Type'] = value; 748 | } 749 | } 750 | 751 | function getDefaultAdapter() { 752 | var adapter; 753 | if (typeof XMLHttpRequest !== 'undefined') { 754 | // For browsers use XHR adapter 755 | adapter = __webpack_require__(9); 756 | } else if (typeof process !== 'undefined') { 757 | // For node use HTTP adapter 758 | adapter = __webpack_require__(9); 759 | } 760 | return adapter; 761 | } 762 | 763 | module.exports = { 764 | adapter: getDefaultAdapter(), 765 | 766 | transformRequest: [function transformRequest(data, headers) { 767 | normalizeHeaderName(headers, 'Content-Type'); 768 | if (utils.isFormData(data) || 769 | utils.isArrayBuffer(data) || 770 | utils.isStream(data) || 771 | utils.isFile(data) || 772 | utils.isBlob(data) 773 | ) { 774 | return data; 775 | } 776 | if (utils.isArrayBufferView(data)) { 777 | return data.buffer; 778 | } 779 | if (utils.isURLSearchParams(data)) { 780 | setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 781 | return data.toString(); 782 | } 783 | if (utils.isObject(data)) { 784 | setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 785 | return JSON.stringify(data); 786 | } 787 | return data; 788 | }], 789 | 790 | transformResponse: [function transformResponse(data) { 791 | /*eslint no-param-reassign:0*/ 792 | if (typeof data === 'string') { 793 | data = data.replace(PROTECTION_PREFIX, ''); 794 | try { 795 | data = JSON.parse(data); 796 | } catch (e) { /* Ignore */ } 797 | } 798 | return data; 799 | }], 800 | 801 | headers: { 802 | common: { 803 | 'Accept': 'application/json, text/plain, */*' 804 | }, 805 | patch: utils.merge(DEFAULT_CONTENT_TYPE), 806 | post: utils.merge(DEFAULT_CONTENT_TYPE), 807 | put: utils.merge(DEFAULT_CONTENT_TYPE) 808 | }, 809 | 810 | timeout: 0, 811 | 812 | xsrfCookieName: 'XSRF-TOKEN', 813 | xsrfHeaderName: 'X-XSRF-TOKEN', 814 | 815 | maxContentLength: -1, 816 | 817 | validateStatus: function validateStatus(status) { 818 | return status >= 200 && status < 300; 819 | } 820 | }; 821 | 822 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) 823 | 824 | /***/ }, 825 | /* 7 */ 826 | /***/ function(module, exports) { 827 | 828 | // shim for using process in browser 829 | var process = module.exports = {}; 830 | 831 | // cached from whatever global is present so that test runners that stub it 832 | // don't break things. But we need to wrap it in a try catch in case it is 833 | // wrapped in strict mode code which doesn't define any globals. It's inside a 834 | // function because try/catches deoptimize in certain engines. 835 | 836 | var cachedSetTimeout; 837 | var cachedClearTimeout; 838 | 839 | function defaultSetTimout() { 840 | throw new Error('setTimeout has not been defined'); 841 | } 842 | function defaultClearTimeout () { 843 | throw new Error('clearTimeout has not been defined'); 844 | } 845 | (function () { 846 | try { 847 | if (typeof setTimeout === 'function') { 848 | cachedSetTimeout = setTimeout; 849 | } else { 850 | cachedSetTimeout = defaultSetTimout; 851 | } 852 | } catch (e) { 853 | cachedSetTimeout = defaultSetTimout; 854 | } 855 | try { 856 | if (typeof clearTimeout === 'function') { 857 | cachedClearTimeout = clearTimeout; 858 | } else { 859 | cachedClearTimeout = defaultClearTimeout; 860 | } 861 | } catch (e) { 862 | cachedClearTimeout = defaultClearTimeout; 863 | } 864 | } ()) 865 | function runTimeout(fun) { 866 | if (cachedSetTimeout === setTimeout) { 867 | //normal enviroments in sane situations 868 | return setTimeout(fun, 0); 869 | } 870 | // if setTimeout wasn't available but was latter defined 871 | if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 872 | cachedSetTimeout = setTimeout; 873 | return setTimeout(fun, 0); 874 | } 875 | try { 876 | // when when somebody has screwed with setTimeout but no I.E. maddness 877 | return cachedSetTimeout(fun, 0); 878 | } catch(e){ 879 | try { 880 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 881 | return cachedSetTimeout.call(null, fun, 0); 882 | } catch(e){ 883 | // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 884 | return cachedSetTimeout.call(this, fun, 0); 885 | } 886 | } 887 | 888 | 889 | } 890 | function runClearTimeout(marker) { 891 | if (cachedClearTimeout === clearTimeout) { 892 | //normal enviroments in sane situations 893 | return clearTimeout(marker); 894 | } 895 | // if clearTimeout wasn't available but was latter defined 896 | if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 897 | cachedClearTimeout = clearTimeout; 898 | return clearTimeout(marker); 899 | } 900 | try { 901 | // when when somebody has screwed with setTimeout but no I.E. maddness 902 | return cachedClearTimeout(marker); 903 | } catch (e){ 904 | try { 905 | // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 906 | return cachedClearTimeout.call(null, marker); 907 | } catch (e){ 908 | // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 909 | // Some versions of I.E. have different rules for clearTimeout vs setTimeout 910 | return cachedClearTimeout.call(this, marker); 911 | } 912 | } 913 | 914 | 915 | 916 | } 917 | var queue = []; 918 | var draining = false; 919 | var currentQueue; 920 | var queueIndex = -1; 921 | 922 | function cleanUpNextTick() { 923 | if (!draining || !currentQueue) { 924 | return; 925 | } 926 | draining = false; 927 | if (currentQueue.length) { 928 | queue = currentQueue.concat(queue); 929 | } else { 930 | queueIndex = -1; 931 | } 932 | if (queue.length) { 933 | drainQueue(); 934 | } 935 | } 936 | 937 | function drainQueue() { 938 | if (draining) { 939 | return; 940 | } 941 | var timeout = runTimeout(cleanUpNextTick); 942 | draining = true; 943 | 944 | var len = queue.length; 945 | while(len) { 946 | currentQueue = queue; 947 | queue = []; 948 | while (++queueIndex < len) { 949 | if (currentQueue) { 950 | currentQueue[queueIndex].run(); 951 | } 952 | } 953 | queueIndex = -1; 954 | len = queue.length; 955 | } 956 | currentQueue = null; 957 | draining = false; 958 | runClearTimeout(timeout); 959 | } 960 | 961 | process.nextTick = function (fun) { 962 | var args = new Array(arguments.length - 1); 963 | if (arguments.length > 1) { 964 | for (var i = 1; i < arguments.length; i++) { 965 | args[i - 1] = arguments[i]; 966 | } 967 | } 968 | queue.push(new Item(fun, args)); 969 | if (queue.length === 1 && !draining) { 970 | runTimeout(drainQueue); 971 | } 972 | }; 973 | 974 | // v8 likes predictible objects 975 | function Item(fun, array) { 976 | this.fun = fun; 977 | this.array = array; 978 | } 979 | Item.prototype.run = function () { 980 | this.fun.apply(null, this.array); 981 | }; 982 | process.title = 'browser'; 983 | process.browser = true; 984 | process.env = {}; 985 | process.argv = []; 986 | process.version = ''; // empty string to avoid regexp issues 987 | process.versions = {}; 988 | 989 | function noop() {} 990 | 991 | process.on = noop; 992 | process.addListener = noop; 993 | process.once = noop; 994 | process.off = noop; 995 | process.removeListener = noop; 996 | process.removeAllListeners = noop; 997 | process.emit = noop; 998 | 999 | process.binding = function (name) { 1000 | throw new Error('process.binding is not supported'); 1001 | }; 1002 | 1003 | process.cwd = function () { return '/' }; 1004 | process.chdir = function (dir) { 1005 | throw new Error('process.chdir is not supported'); 1006 | }; 1007 | process.umask = function() { return 0; }; 1008 | 1009 | 1010 | /***/ }, 1011 | /* 8 */ 1012 | /***/ function(module, exports, __webpack_require__) { 1013 | 1014 | 'use strict'; 1015 | 1016 | var utils = __webpack_require__(3); 1017 | 1018 | module.exports = function normalizeHeaderName(headers, normalizedName) { 1019 | utils.forEach(headers, function processHeader(value, name) { 1020 | if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 1021 | headers[normalizedName] = value; 1022 | delete headers[name]; 1023 | } 1024 | }); 1025 | }; 1026 | 1027 | 1028 | /***/ }, 1029 | /* 9 */ 1030 | /***/ function(module, exports, __webpack_require__) { 1031 | 1032 | /* WEBPACK VAR INJECTION */(function(process) {'use strict'; 1033 | 1034 | var utils = __webpack_require__(3); 1035 | var settle = __webpack_require__(10); 1036 | var buildURL = __webpack_require__(13); 1037 | var parseHeaders = __webpack_require__(14); 1038 | var isURLSameOrigin = __webpack_require__(15); 1039 | var createError = __webpack_require__(11); 1040 | var btoa = (typeof window !== 'undefined' && window.btoa) || __webpack_require__(16); 1041 | 1042 | module.exports = function xhrAdapter(config) { 1043 | return new Promise(function dispatchXhrRequest(resolve, reject) { 1044 | var requestData = config.data; 1045 | var requestHeaders = config.headers; 1046 | 1047 | if (utils.isFormData(requestData)) { 1048 | delete requestHeaders['Content-Type']; // Let the browser set it 1049 | } 1050 | 1051 | var request = new XMLHttpRequest(); 1052 | var loadEvent = 'onreadystatechange'; 1053 | var xDomain = false; 1054 | 1055 | // For IE 8/9 CORS support 1056 | // Only supports POST and GET calls and doesn't returns the response headers. 1057 | // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest. 1058 | if (process.env.NODE_ENV !== 'test' && 1059 | typeof window !== 'undefined' && 1060 | window.XDomainRequest && !('withCredentials' in request) && 1061 | !isURLSameOrigin(config.url)) { 1062 | request = new window.XDomainRequest(); 1063 | loadEvent = 'onload'; 1064 | xDomain = true; 1065 | request.onprogress = function handleProgress() {}; 1066 | request.ontimeout = function handleTimeout() {}; 1067 | } 1068 | 1069 | // HTTP basic authentication 1070 | if (config.auth) { 1071 | var username = config.auth.username || ''; 1072 | var password = config.auth.password || ''; 1073 | requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 1074 | } 1075 | 1076 | request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); 1077 | 1078 | // Set the request timeout in MS 1079 | request.timeout = config.timeout; 1080 | 1081 | // Listen for ready state 1082 | request[loadEvent] = function handleLoad() { 1083 | if (!request || (request.readyState !== 4 && !xDomain)) { 1084 | return; 1085 | } 1086 | 1087 | // The request errored out and we didn't get a response, this will be 1088 | // handled by onerror instead 1089 | // With one exception: request that using file: protocol, most browsers 1090 | // will return status as 0 even though it's a successful request 1091 | if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 1092 | return; 1093 | } 1094 | 1095 | // Prepare the response 1096 | var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 1097 | var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 1098 | var response = { 1099 | data: responseData, 1100 | // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201) 1101 | status: request.status === 1223 ? 204 : request.status, 1102 | statusText: request.status === 1223 ? 'No Content' : request.statusText, 1103 | headers: responseHeaders, 1104 | config: config, 1105 | request: request 1106 | }; 1107 | 1108 | settle(resolve, reject, response); 1109 | 1110 | // Clean up request 1111 | request = null; 1112 | }; 1113 | 1114 | // Handle low level network errors 1115 | request.onerror = function handleError() { 1116 | // Real errors are hidden from us by the browser 1117 | // onerror should only fire if it's a network error 1118 | reject(createError('Network Error', config)); 1119 | 1120 | // Clean up request 1121 | request = null; 1122 | }; 1123 | 1124 | // Handle timeout 1125 | request.ontimeout = function handleTimeout() { 1126 | reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED')); 1127 | 1128 | // Clean up request 1129 | request = null; 1130 | }; 1131 | 1132 | // Add xsrf header 1133 | // This is only done if running in a standard browser environment. 1134 | // Specifically not if we're in a web worker, or react-native. 1135 | if (utils.isStandardBrowserEnv()) { 1136 | var cookies = __webpack_require__(17); 1137 | 1138 | // Add xsrf header 1139 | var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? 1140 | cookies.read(config.xsrfCookieName) : 1141 | undefined; 1142 | 1143 | if (xsrfValue) { 1144 | requestHeaders[config.xsrfHeaderName] = xsrfValue; 1145 | } 1146 | } 1147 | 1148 | // Add headers to the request 1149 | if ('setRequestHeader' in request) { 1150 | utils.forEach(requestHeaders, function setRequestHeader(val, key) { 1151 | if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 1152 | // Remove Content-Type if data is undefined 1153 | delete requestHeaders[key]; 1154 | } else { 1155 | // Otherwise add header to the request 1156 | request.setRequestHeader(key, val); 1157 | } 1158 | }); 1159 | } 1160 | 1161 | // Add withCredentials to request if needed 1162 | if (config.withCredentials) { 1163 | request.withCredentials = true; 1164 | } 1165 | 1166 | // Add responseType to request if needed 1167 | if (config.responseType) { 1168 | try { 1169 | request.responseType = config.responseType; 1170 | } catch (e) { 1171 | if (request.responseType !== 'json') { 1172 | throw e; 1173 | } 1174 | } 1175 | } 1176 | 1177 | // Handle progress if needed 1178 | if (typeof config.onDownloadProgress === 'function') { 1179 | request.addEventListener('progress', config.onDownloadProgress); 1180 | } 1181 | 1182 | // Not all browsers support upload events 1183 | if (typeof config.onUploadProgress === 'function' && request.upload) { 1184 | request.upload.addEventListener('progress', config.onUploadProgress); 1185 | } 1186 | 1187 | if (config.cancelToken) { 1188 | // Handle cancellation 1189 | config.cancelToken.promise.then(function onCanceled(cancel) { 1190 | if (!request) { 1191 | return; 1192 | } 1193 | 1194 | request.abort(); 1195 | reject(cancel); 1196 | // Clean up request 1197 | request = null; 1198 | }); 1199 | } 1200 | 1201 | if (requestData === undefined) { 1202 | requestData = null; 1203 | } 1204 | 1205 | // Send the request 1206 | request.send(requestData); 1207 | }); 1208 | }; 1209 | 1210 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) 1211 | 1212 | /***/ }, 1213 | /* 10 */ 1214 | /***/ function(module, exports, __webpack_require__) { 1215 | 1216 | 'use strict'; 1217 | 1218 | var createError = __webpack_require__(11); 1219 | 1220 | /** 1221 | * Resolve or reject a Promise based on response status. 1222 | * 1223 | * @param {Function} resolve A function that resolves the promise. 1224 | * @param {Function} reject A function that rejects the promise. 1225 | * @param {object} response The response. 1226 | */ 1227 | module.exports = function settle(resolve, reject, response) { 1228 | var validateStatus = response.config.validateStatus; 1229 | // Note: status is not exposed by XDomainRequest 1230 | if (!response.status || !validateStatus || validateStatus(response.status)) { 1231 | resolve(response); 1232 | } else { 1233 | reject(createError( 1234 | 'Request failed with status code ' + response.status, 1235 | response.config, 1236 | null, 1237 | response 1238 | )); 1239 | } 1240 | }; 1241 | 1242 | 1243 | /***/ }, 1244 | /* 11 */ 1245 | /***/ function(module, exports, __webpack_require__) { 1246 | 1247 | 'use strict'; 1248 | 1249 | var enhanceError = __webpack_require__(12); 1250 | 1251 | /** 1252 | * Create an Error with the specified message, config, error code, and response. 1253 | * 1254 | * @param {string} message The error message. 1255 | * @param {Object} config The config. 1256 | * @param {string} [code] The error code (for example, 'ECONNABORTED'). 1257 | @ @param {Object} [response] The response. 1258 | * @returns {Error} The created error. 1259 | */ 1260 | module.exports = function createError(message, config, code, response) { 1261 | var error = new Error(message); 1262 | return enhanceError(error, config, code, response); 1263 | }; 1264 | 1265 | 1266 | /***/ }, 1267 | /* 12 */ 1268 | /***/ function(module, exports) { 1269 | 1270 | 'use strict'; 1271 | 1272 | /** 1273 | * Update an Error with the specified config, error code, and response. 1274 | * 1275 | * @param {Error} error The error to update. 1276 | * @param {Object} config The config. 1277 | * @param {string} [code] The error code (for example, 'ECONNABORTED'). 1278 | @ @param {Object} [response] The response. 1279 | * @returns {Error} The error. 1280 | */ 1281 | module.exports = function enhanceError(error, config, code, response) { 1282 | error.config = config; 1283 | if (code) { 1284 | error.code = code; 1285 | } 1286 | error.response = response; 1287 | return error; 1288 | }; 1289 | 1290 | 1291 | /***/ }, 1292 | /* 13 */ 1293 | /***/ function(module, exports, __webpack_require__) { 1294 | 1295 | 'use strict'; 1296 | 1297 | var utils = __webpack_require__(3); 1298 | 1299 | function encode(val) { 1300 | return encodeURIComponent(val). 1301 | replace(/%40/gi, '@'). 1302 | replace(/%3A/gi, ':'). 1303 | replace(/%24/g, '$'). 1304 | replace(/%2C/gi, ','). 1305 | replace(/%20/g, '+'). 1306 | replace(/%5B/gi, '['). 1307 | replace(/%5D/gi, ']'); 1308 | } 1309 | 1310 | /** 1311 | * Build a URL by appending params to the end 1312 | * 1313 | * @param {string} url The base of the url (e.g., http://www.google.com) 1314 | * @param {object} [params] The params to be appended 1315 | * @returns {string} The formatted url 1316 | */ 1317 | module.exports = function buildURL(url, params, paramsSerializer) { 1318 | /*eslint no-param-reassign:0*/ 1319 | if (!params) { 1320 | return url; 1321 | } 1322 | 1323 | var serializedParams; 1324 | if (paramsSerializer) { 1325 | serializedParams = paramsSerializer(params); 1326 | } else if (utils.isURLSearchParams(params)) { 1327 | serializedParams = params.toString(); 1328 | } else { 1329 | var parts = []; 1330 | 1331 | utils.forEach(params, function serialize(val, key) { 1332 | if (val === null || typeof val === 'undefined') { 1333 | return; 1334 | } 1335 | 1336 | if (utils.isArray(val)) { 1337 | key = key + '[]'; 1338 | } 1339 | 1340 | if (!utils.isArray(val)) { 1341 | val = [val]; 1342 | } 1343 | 1344 | utils.forEach(val, function parseValue(v) { 1345 | if (utils.isDate(v)) { 1346 | v = v.toISOString(); 1347 | } else if (utils.isObject(v)) { 1348 | v = JSON.stringify(v); 1349 | } 1350 | parts.push(encode(key) + '=' + encode(v)); 1351 | }); 1352 | }); 1353 | 1354 | serializedParams = parts.join('&'); 1355 | } 1356 | 1357 | if (serializedParams) { 1358 | url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 1359 | } 1360 | 1361 | return url; 1362 | }; 1363 | 1364 | 1365 | /***/ }, 1366 | /* 14 */ 1367 | /***/ function(module, exports, __webpack_require__) { 1368 | 1369 | 'use strict'; 1370 | 1371 | var utils = __webpack_require__(3); 1372 | 1373 | /** 1374 | * Parse headers into an object 1375 | * 1376 | * ``` 1377 | * Date: Wed, 27 Aug 2014 08:58:49 GMT 1378 | * Content-Type: application/json 1379 | * Connection: keep-alive 1380 | * Transfer-Encoding: chunked 1381 | * ``` 1382 | * 1383 | * @param {String} headers Headers needing to be parsed 1384 | * @returns {Object} Headers parsed into an object 1385 | */ 1386 | module.exports = function parseHeaders(headers) { 1387 | var parsed = {}; 1388 | var key; 1389 | var val; 1390 | var i; 1391 | 1392 | if (!headers) { return parsed; } 1393 | 1394 | utils.forEach(headers.split('\n'), function parser(line) { 1395 | i = line.indexOf(':'); 1396 | key = utils.trim(line.substr(0, i)).toLowerCase(); 1397 | val = utils.trim(line.substr(i + 1)); 1398 | 1399 | if (key) { 1400 | parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 1401 | } 1402 | }); 1403 | 1404 | return parsed; 1405 | }; 1406 | 1407 | 1408 | /***/ }, 1409 | /* 15 */ 1410 | /***/ function(module, exports, __webpack_require__) { 1411 | 1412 | 'use strict'; 1413 | 1414 | var utils = __webpack_require__(3); 1415 | 1416 | module.exports = ( 1417 | utils.isStandardBrowserEnv() ? 1418 | 1419 | // Standard browser envs have full support of the APIs needed to test 1420 | // whether the request URL is of the same origin as current location. 1421 | (function standardBrowserEnv() { 1422 | var msie = /(msie|trident)/i.test(navigator.userAgent); 1423 | var urlParsingNode = document.createElement('a'); 1424 | var originURL; 1425 | 1426 | /** 1427 | * Parse a URL to discover it's components 1428 | * 1429 | * @param {String} url The URL to be parsed 1430 | * @returns {Object} 1431 | */ 1432 | function resolveURL(url) { 1433 | var href = url; 1434 | 1435 | if (msie) { 1436 | // IE needs attribute set twice to normalize properties 1437 | urlParsingNode.setAttribute('href', href); 1438 | href = urlParsingNode.href; 1439 | } 1440 | 1441 | urlParsingNode.setAttribute('href', href); 1442 | 1443 | // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 1444 | return { 1445 | href: urlParsingNode.href, 1446 | protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 1447 | host: urlParsingNode.host, 1448 | search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 1449 | hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 1450 | hostname: urlParsingNode.hostname, 1451 | port: urlParsingNode.port, 1452 | pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 1453 | urlParsingNode.pathname : 1454 | '/' + urlParsingNode.pathname 1455 | }; 1456 | } 1457 | 1458 | originURL = resolveURL(window.location.href); 1459 | 1460 | /** 1461 | * Determine if a URL shares the same origin as the current location 1462 | * 1463 | * @param {String} requestURL The URL to test 1464 | * @returns {boolean} True if URL shares the same origin, otherwise false 1465 | */ 1466 | return function isURLSameOrigin(requestURL) { 1467 | var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 1468 | return (parsed.protocol === originURL.protocol && 1469 | parsed.host === originURL.host); 1470 | }; 1471 | })() : 1472 | 1473 | // Non standard browser envs (web workers, react-native) lack needed support. 1474 | (function nonStandardBrowserEnv() { 1475 | return function isURLSameOrigin() { 1476 | return true; 1477 | }; 1478 | })() 1479 | ); 1480 | 1481 | 1482 | /***/ }, 1483 | /* 16 */ 1484 | /***/ function(module, exports) { 1485 | 1486 | 'use strict'; 1487 | 1488 | // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js 1489 | 1490 | var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 1491 | 1492 | function E() { 1493 | this.message = 'String contains an invalid character'; 1494 | } 1495 | E.prototype = new Error; 1496 | E.prototype.code = 5; 1497 | E.prototype.name = 'InvalidCharacterError'; 1498 | 1499 | function btoa(input) { 1500 | var str = String(input); 1501 | var output = ''; 1502 | for ( 1503 | // initialize result and counter 1504 | var block, charCode, idx = 0, map = chars; 1505 | // if the next str index does not exist: 1506 | // change the mapping table to "=" 1507 | // check if d has no fractional digits 1508 | str.charAt(idx | 0) || (map = '=', idx % 1); 1509 | // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 1510 | output += map.charAt(63 & block >> 8 - idx % 1 * 8) 1511 | ) { 1512 | charCode = str.charCodeAt(idx += 3 / 4); 1513 | if (charCode > 0xFF) { 1514 | throw new E(); 1515 | } 1516 | block = block << 8 | charCode; 1517 | } 1518 | return output; 1519 | } 1520 | 1521 | module.exports = btoa; 1522 | 1523 | 1524 | /***/ }, 1525 | /* 17 */ 1526 | /***/ function(module, exports, __webpack_require__) { 1527 | 1528 | 'use strict'; 1529 | 1530 | var utils = __webpack_require__(3); 1531 | 1532 | module.exports = ( 1533 | utils.isStandardBrowserEnv() ? 1534 | 1535 | // Standard browser envs support document.cookie 1536 | (function standardBrowserEnv() { 1537 | return { 1538 | write: function write(name, value, expires, path, domain, secure) { 1539 | var cookie = []; 1540 | cookie.push(name + '=' + encodeURIComponent(value)); 1541 | 1542 | if (utils.isNumber(expires)) { 1543 | cookie.push('expires=' + new Date(expires).toGMTString()); 1544 | } 1545 | 1546 | if (utils.isString(path)) { 1547 | cookie.push('path=' + path); 1548 | } 1549 | 1550 | if (utils.isString(domain)) { 1551 | cookie.push('domain=' + domain); 1552 | } 1553 | 1554 | if (secure === true) { 1555 | cookie.push('secure'); 1556 | } 1557 | 1558 | document.cookie = cookie.join('; '); 1559 | }, 1560 | 1561 | read: function read(name) { 1562 | var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 1563 | return (match ? decodeURIComponent(match[3]) : null); 1564 | }, 1565 | 1566 | remove: function remove(name) { 1567 | this.write(name, '', Date.now() - 86400000); 1568 | } 1569 | }; 1570 | })() : 1571 | 1572 | // Non standard browser env (web workers, react-native) lack needed support. 1573 | (function nonStandardBrowserEnv() { 1574 | return { 1575 | write: function write() {}, 1576 | read: function read() { return null; }, 1577 | remove: function remove() {} 1578 | }; 1579 | })() 1580 | ); 1581 | 1582 | 1583 | /***/ }, 1584 | /* 18 */ 1585 | /***/ function(module, exports, __webpack_require__) { 1586 | 1587 | 'use strict'; 1588 | 1589 | var utils = __webpack_require__(3); 1590 | 1591 | function InterceptorManager() { 1592 | this.handlers = []; 1593 | } 1594 | 1595 | /** 1596 | * Add a new interceptor to the stack 1597 | * 1598 | * @param {Function} fulfilled The function to handle `then` for a `Promise` 1599 | * @param {Function} rejected The function to handle `reject` for a `Promise` 1600 | * 1601 | * @return {Number} An ID used to remove interceptor later 1602 | */ 1603 | InterceptorManager.prototype.use = function use(fulfilled, rejected) { 1604 | this.handlers.push({ 1605 | fulfilled: fulfilled, 1606 | rejected: rejected 1607 | }); 1608 | return this.handlers.length - 1; 1609 | }; 1610 | 1611 | /** 1612 | * Remove an interceptor from the stack 1613 | * 1614 | * @param {Number} id The ID that was returned by `use` 1615 | */ 1616 | InterceptorManager.prototype.eject = function eject(id) { 1617 | if (this.handlers[id]) { 1618 | this.handlers[id] = null; 1619 | } 1620 | }; 1621 | 1622 | /** 1623 | * Iterate over all the registered interceptors 1624 | * 1625 | * This method is particularly useful for skipping over any 1626 | * interceptors that may have become `null` calling `eject`. 1627 | * 1628 | * @param {Function} fn The function to call for each interceptor 1629 | */ 1630 | InterceptorManager.prototype.forEach = function forEach(fn) { 1631 | utils.forEach(this.handlers, function forEachHandler(h) { 1632 | if (h !== null) { 1633 | fn(h); 1634 | } 1635 | }); 1636 | }; 1637 | 1638 | module.exports = InterceptorManager; 1639 | 1640 | 1641 | /***/ }, 1642 | /* 19 */ 1643 | /***/ function(module, exports, __webpack_require__) { 1644 | 1645 | 'use strict'; 1646 | 1647 | var utils = __webpack_require__(3); 1648 | var transformData = __webpack_require__(20); 1649 | var isCancel = __webpack_require__(21); 1650 | var defaults = __webpack_require__(6); 1651 | 1652 | /** 1653 | * Throws a `Cancel` if cancellation has been requested. 1654 | */ 1655 | function throwIfCancellationRequested(config) { 1656 | if (config.cancelToken) { 1657 | config.cancelToken.throwIfRequested(); 1658 | } 1659 | } 1660 | 1661 | /** 1662 | * Dispatch a request to the server using the configured adapter. 1663 | * 1664 | * @param {object} config The config that is to be used for the request 1665 | * @returns {Promise} The Promise to be fulfilled 1666 | */ 1667 | module.exports = function dispatchRequest(config) { 1668 | throwIfCancellationRequested(config); 1669 | 1670 | // Ensure headers exist 1671 | config.headers = config.headers || {}; 1672 | 1673 | // Transform request data 1674 | config.data = transformData( 1675 | config.data, 1676 | config.headers, 1677 | config.transformRequest 1678 | ); 1679 | 1680 | // Flatten headers 1681 | config.headers = utils.merge( 1682 | config.headers.common || {}, 1683 | config.headers[config.method] || {}, 1684 | config.headers || {} 1685 | ); 1686 | 1687 | utils.forEach( 1688 | ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 1689 | function cleanHeaderConfig(method) { 1690 | delete config.headers[method]; 1691 | } 1692 | ); 1693 | 1694 | var adapter = config.adapter || defaults.adapter; 1695 | 1696 | return adapter(config).then(function onAdapterResolution(response) { 1697 | throwIfCancellationRequested(config); 1698 | 1699 | // Transform response data 1700 | response.data = transformData( 1701 | response.data, 1702 | response.headers, 1703 | config.transformResponse 1704 | ); 1705 | 1706 | return response; 1707 | }, function onAdapterRejection(reason) { 1708 | if (!isCancel(reason)) { 1709 | throwIfCancellationRequested(config); 1710 | 1711 | // Transform response data 1712 | if (reason && reason.response) { 1713 | reason.response.data = transformData( 1714 | reason.response.data, 1715 | reason.response.headers, 1716 | config.transformResponse 1717 | ); 1718 | } 1719 | } 1720 | 1721 | return Promise.reject(reason); 1722 | }); 1723 | }; 1724 | 1725 | 1726 | /***/ }, 1727 | /* 20 */ 1728 | /***/ function(module, exports, __webpack_require__) { 1729 | 1730 | 'use strict'; 1731 | 1732 | var utils = __webpack_require__(3); 1733 | 1734 | /** 1735 | * Transform the data for a request or a response 1736 | * 1737 | * @param {Object|String} data The data to be transformed 1738 | * @param {Array} headers The headers for the request or response 1739 | * @param {Array|Function} fns A single function or Array of functions 1740 | * @returns {*} The resulting transformed data 1741 | */ 1742 | module.exports = function transformData(data, headers, fns) { 1743 | /*eslint no-param-reassign:0*/ 1744 | utils.forEach(fns, function transform(fn) { 1745 | data = fn(data, headers); 1746 | }); 1747 | 1748 | return data; 1749 | }; 1750 | 1751 | 1752 | /***/ }, 1753 | /* 21 */ 1754 | /***/ function(module, exports) { 1755 | 1756 | 'use strict'; 1757 | 1758 | module.exports = function isCancel(value) { 1759 | return !!(value && value.__CANCEL__); 1760 | }; 1761 | 1762 | 1763 | /***/ }, 1764 | /* 22 */ 1765 | /***/ function(module, exports) { 1766 | 1767 | 'use strict'; 1768 | 1769 | /** 1770 | * Determines whether the specified URL is absolute 1771 | * 1772 | * @param {string} url The URL to test 1773 | * @returns {boolean} True if the specified URL is absolute, otherwise false 1774 | */ 1775 | module.exports = function isAbsoluteURL(url) { 1776 | // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). 1777 | // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 1778 | // by any combination of letters, digits, plus, period, or hyphen. 1779 | return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 1780 | }; 1781 | 1782 | 1783 | /***/ }, 1784 | /* 23 */ 1785 | /***/ function(module, exports) { 1786 | 1787 | 'use strict'; 1788 | 1789 | /** 1790 | * Creates a new URL by combining the specified URLs 1791 | * 1792 | * @param {string} baseURL The base URL 1793 | * @param {string} relativeURL The relative URL 1794 | * @returns {string} The combined URL 1795 | */ 1796 | module.exports = function combineURLs(baseURL, relativeURL) { 1797 | return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, ''); 1798 | }; 1799 | 1800 | 1801 | /***/ }, 1802 | /* 24 */ 1803 | /***/ function(module, exports) { 1804 | 1805 | 'use strict'; 1806 | 1807 | /** 1808 | * A `Cancel` is an object that is thrown when an operation is canceled. 1809 | * 1810 | * @class 1811 | * @param {string=} message The message. 1812 | */ 1813 | function Cancel(message) { 1814 | this.message = message; 1815 | } 1816 | 1817 | Cancel.prototype.toString = function toString() { 1818 | return 'Cancel' + (this.message ? ': ' + this.message : ''); 1819 | }; 1820 | 1821 | Cancel.prototype.__CANCEL__ = true; 1822 | 1823 | module.exports = Cancel; 1824 | 1825 | 1826 | /***/ }, 1827 | /* 25 */ 1828 | /***/ function(module, exports, __webpack_require__) { 1829 | 1830 | 'use strict'; 1831 | 1832 | var Cancel = __webpack_require__(24); 1833 | 1834 | /** 1835 | * A `CancelToken` is an object that can be used to request cancellation of an operation. 1836 | * 1837 | * @class 1838 | * @param {Function} executor The executor function. 1839 | */ 1840 | function CancelToken(executor) { 1841 | if (typeof executor !== 'function') { 1842 | throw new TypeError('executor must be a function.'); 1843 | } 1844 | 1845 | var resolvePromise; 1846 | this.promise = new Promise(function promiseExecutor(resolve) { 1847 | resolvePromise = resolve; 1848 | }); 1849 | 1850 | var token = this; 1851 | executor(function cancel(message) { 1852 | if (token.reason) { 1853 | // Cancellation has already been requested 1854 | return; 1855 | } 1856 | 1857 | token.reason = new Cancel(message); 1858 | resolvePromise(token.reason); 1859 | }); 1860 | } 1861 | 1862 | /** 1863 | * Throws a `Cancel` if cancellation has been requested. 1864 | */ 1865 | CancelToken.prototype.throwIfRequested = function throwIfRequested() { 1866 | if (this.reason) { 1867 | throw this.reason; 1868 | } 1869 | }; 1870 | 1871 | /** 1872 | * Returns an object that contains a new `CancelToken` and a function that, when called, 1873 | * cancels the `CancelToken`. 1874 | */ 1875 | CancelToken.source = function source() { 1876 | var cancel; 1877 | var token = new CancelToken(function executor(c) { 1878 | cancel = c; 1879 | }); 1880 | return { 1881 | token: token, 1882 | cancel: cancel 1883 | }; 1884 | }; 1885 | 1886 | module.exports = CancelToken; 1887 | 1888 | 1889 | /***/ }, 1890 | /* 26 */ 1891 | /***/ function(module, exports) { 1892 | 1893 | 'use strict'; 1894 | 1895 | /** 1896 | * Syntactic sugar for invoking a function and expanding an array for arguments. 1897 | * 1898 | * Common use case would be to use `Function.prototype.apply`. 1899 | * 1900 | * ```js 1901 | * function f(x, y, z) {} 1902 | * var args = [1, 2, 3]; 1903 | * f.apply(null, args); 1904 | * ``` 1905 | * 1906 | * With `spread` this example can be re-written. 1907 | * 1908 | * ```js 1909 | * spread(function(x, y, z) {})([1, 2, 3]); 1910 | * ``` 1911 | * 1912 | * @param {Function} callback 1913 | * @returns {Function} 1914 | */ 1915 | module.exports = function spread(callback) { 1916 | return function wrap(arr) { 1917 | return callback.apply(null, arr); 1918 | }; 1919 | }; 1920 | 1921 | 1922 | /***/ }, 1923 | /* 27 */ 1924 | /***/ function(module, exports, __webpack_require__) { 1925 | 1926 | 'use strict'; 1927 | 1928 | exports.decode = exports.parse = __webpack_require__(28); 1929 | exports.encode = exports.stringify = __webpack_require__(29); 1930 | 1931 | 1932 | /***/ }, 1933 | /* 28 */ 1934 | /***/ function(module, exports) { 1935 | 1936 | // Copyright Joyent, Inc. and other Node contributors. 1937 | // 1938 | // Permission is hereby granted, free of charge, to any person obtaining a 1939 | // copy of this software and associated documentation files (the 1940 | // "Software"), to deal in the Software without restriction, including 1941 | // without limitation the rights to use, copy, modify, merge, publish, 1942 | // distribute, sublicense, and/or sell copies of the Software, and to permit 1943 | // persons to whom the Software is furnished to do so, subject to the 1944 | // following conditions: 1945 | // 1946 | // The above copyright notice and this permission notice shall be included 1947 | // in all copies or substantial portions of the Software. 1948 | // 1949 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1950 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1951 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 1952 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 1953 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 1954 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 1955 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 1956 | 1957 | 'use strict'; 1958 | 1959 | // If obj.hasOwnProperty has been overridden, then calling 1960 | // obj.hasOwnProperty(prop) will break. 1961 | // See: https://github.com/joyent/node/issues/1707 1962 | function hasOwnProperty(obj, prop) { 1963 | return Object.prototype.hasOwnProperty.call(obj, prop); 1964 | } 1965 | 1966 | module.exports = function(qs, sep, eq, options) { 1967 | sep = sep || '&'; 1968 | eq = eq || '='; 1969 | var obj = {}; 1970 | 1971 | if (typeof qs !== 'string' || qs.length === 0) { 1972 | return obj; 1973 | } 1974 | 1975 | var regexp = /\+/g; 1976 | qs = qs.split(sep); 1977 | 1978 | var maxKeys = 1000; 1979 | if (options && typeof options.maxKeys === 'number') { 1980 | maxKeys = options.maxKeys; 1981 | } 1982 | 1983 | var len = qs.length; 1984 | // maxKeys <= 0 means that we should not limit keys count 1985 | if (maxKeys > 0 && len > maxKeys) { 1986 | len = maxKeys; 1987 | } 1988 | 1989 | for (var i = 0; i < len; ++i) { 1990 | var x = qs[i].replace(regexp, '%20'), 1991 | idx = x.indexOf(eq), 1992 | kstr, vstr, k, v; 1993 | 1994 | if (idx >= 0) { 1995 | kstr = x.substr(0, idx); 1996 | vstr = x.substr(idx + 1); 1997 | } else { 1998 | kstr = x; 1999 | vstr = ''; 2000 | } 2001 | 2002 | k = decodeURIComponent(kstr); 2003 | v = decodeURIComponent(vstr); 2004 | 2005 | if (!hasOwnProperty(obj, k)) { 2006 | obj[k] = v; 2007 | } else if (Array.isArray(obj[k])) { 2008 | obj[k].push(v); 2009 | } else { 2010 | obj[k] = [obj[k], v]; 2011 | } 2012 | } 2013 | 2014 | return obj; 2015 | }; 2016 | 2017 | 2018 | /***/ }, 2019 | /* 29 */ 2020 | /***/ function(module, exports) { 2021 | 2022 | // Copyright Joyent, Inc. and other Node contributors. 2023 | // 2024 | // Permission is hereby granted, free of charge, to any person obtaining a 2025 | // copy of this software and associated documentation files (the 2026 | // "Software"), to deal in the Software without restriction, including 2027 | // without limitation the rights to use, copy, modify, merge, publish, 2028 | // distribute, sublicense, and/or sell copies of the Software, and to permit 2029 | // persons to whom the Software is furnished to do so, subject to the 2030 | // following conditions: 2031 | // 2032 | // The above copyright notice and this permission notice shall be included 2033 | // in all copies or substantial portions of the Software. 2034 | // 2035 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 2036 | // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2037 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 2038 | // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 2039 | // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 2040 | // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 2041 | // USE OR OTHER DEALINGS IN THE SOFTWARE. 2042 | 2043 | 'use strict'; 2044 | 2045 | var stringifyPrimitive = function(v) { 2046 | switch (typeof v) { 2047 | case 'string': 2048 | return v; 2049 | 2050 | case 'boolean': 2051 | return v ? 'true' : 'false'; 2052 | 2053 | case 'number': 2054 | return isFinite(v) ? v : ''; 2055 | 2056 | default: 2057 | return ''; 2058 | } 2059 | }; 2060 | 2061 | module.exports = function(obj, sep, eq, name) { 2062 | sep = sep || '&'; 2063 | eq = eq || '='; 2064 | if (obj === null) { 2065 | obj = undefined; 2066 | } 2067 | 2068 | if (typeof obj === 'object') { 2069 | return Object.keys(obj).map(function(k) { 2070 | var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; 2071 | if (Array.isArray(obj[k])) { 2072 | return obj[k].map(function(v) { 2073 | return ks + encodeURIComponent(stringifyPrimitive(v)); 2074 | }).join(sep); 2075 | } else { 2076 | return ks + encodeURIComponent(stringifyPrimitive(obj[k])); 2077 | } 2078 | }).join(sep); 2079 | 2080 | } 2081 | 2082 | if (!name) return ''; 2083 | return encodeURIComponent(stringifyPrimitive(name)) + eq + 2084 | encodeURIComponent(stringifyPrimitive(obj)); 2085 | }; 2086 | 2087 | 2088 | /***/ } 2089 | /******/ ]); 2090 | //# sourceMappingURL=elitejax.js.map -------------------------------------------------------------------------------- /build/elitejax.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///webpack/bootstrap 6db2f095859e55f508cb","webpack:///./src/index.es6","webpack:///./~/axios/index.js","webpack:///./~/axios/lib/axios.js","webpack:///./~/axios/lib/utils.js","webpack:///./~/axios/lib/helpers/bind.js","webpack:///./~/axios/lib/core/Axios.js","webpack:///./~/axios/lib/defaults.js","webpack:///./~/process/browser.js","webpack:///./~/axios/lib/helpers/normalizeHeaderName.js","webpack:///./~/axios/lib/adapters/xhr.js","webpack:///./~/axios/lib/core/settle.js","webpack:///./~/axios/lib/core/createError.js","webpack:///./~/axios/lib/core/enhanceError.js","webpack:///./~/axios/lib/helpers/buildURL.js","webpack:///./~/axios/lib/helpers/parseHeaders.js","webpack:///./~/axios/lib/helpers/isURLSameOrigin.js","webpack:///./~/axios/lib/helpers/btoa.js","webpack:///./~/axios/lib/helpers/cookies.js","webpack:///./~/axios/lib/core/InterceptorManager.js","webpack:///./~/axios/lib/core/dispatchRequest.js","webpack:///./~/axios/lib/core/transformData.js","webpack:///./~/axios/lib/cancel/isCancel.js","webpack:///./~/axios/lib/helpers/isAbsoluteURL.js","webpack:///./~/axios/lib/helpers/combineURLs.js","webpack:///./~/axios/lib/cancel/Cancel.js","webpack:///./~/axios/lib/cancel/CancelToken.js","webpack:///./~/axios/lib/helpers/spread.js","webpack:///./~/querystring/index.js","webpack:///./~/querystring/decode.js","webpack:///./~/querystring/encode.js"],"names":["Elitejax","document","config","ajaxForm","getEl","name","defaultConfig","async","cType","resType","callback","data","console","log","prop","undefined","res","elem","querySelectorAll","Array","from","forEach","form","getAttribute","postTo","push","inputs","num","length","i","valid","validInput","path","split","reduce","prev","curr","replace","inputEl","val","toLowerCase","value","ex","obj","cbName","str","forms","index","addEventListener","e","preventDefault","target","url","method","post","formData","elements","ajaxIt","toUpperCase","configure","script","createElement","type","Date","now","self","src","params","getElementsByTagName","appendChild","req","get","then","response","output","innerHTML","resolve","catch","err","elitejax","ej","window"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;;;;;;;;AAEA;;;;AACA;;;;;;KAEMA,Q;AACJ;AACA,qBAAYC,QAAZ,EAAsB;AAAA;;AACpB,UAAKC,MAAL,GAAc,EAAd;AACA,UAAKD,QAAL,GAAgBA,QAAhB;AACA,UAAKE,QAAL,CAAc,KAAKC,KAAL,EAAd;AACD;;AAED;;;;;+BACWC,I,EAAmB;AAAA,WAAbH,MAAa,yDAAJ,EAAI;;AAC5B;AACA,WAAMI,gBAAgB;AACpBC,gBAAO,IADa;AAEpBC,gBAAO,kBAFa;AAGpBC,kBAAS,MAHW;AAIpBC,mBAAU,kBAAUC,IAAV,EAAgB;AACxBC,mBAAQC,GAAR,CAAYF,IAAZ;AACD;AANmB,QAAtB;;AASA,YAAK,IAAIG,IAAT,IAAiBR,aAAjB,EAAgC;AAC9B,aAAIJ,OAAOY,IAAP,MAAiBC,SAArB,EAAgC;AAC9Bb,kBAAOY,IAAP,IAAeR,cAAcQ,IAAd,CAAf;AACD;AACF;;AAED,YAAKZ,MAAL,CAAYG,IAAZ,IAAoBH,MAApB;AACA,cAAO,KAAKA,MAAL,CAAYG,IAAZ,CAAP;AACD;;AAED;;;;6BACS;AACP,WAAIW,MAAM,EAAV;AACA,WAAMC,OAAO,KAAKhB,QAAL,CAAciB,gBAAd,CAA+B,MAA/B,CAAb;AACAC,aAAMC,IAAN,CAAWH,IAAX,EAAiBI,OAAjB,CAAyB,UAACC,IAAD,EAAU;AACjC,aAAIA,KAAKC,YAAL,CAAkB,eAAlB,MAAuC,MAA3C,EAAmD;AACjD,eAAMC,SAASF,KAAKC,YAAL,CAAkB,aAAlB,CAAf;AACAP,eAAIS,IAAJ,CAAS,EAACH,UAAD,EAAOE,cAAP,EAAT;AACD;AACF,QALD;AAMA,cAAOR,GAAP;AACD;;AAED;;;;8BACUU,M,EAAQ;AAChB,WAAMV,MAAM,EAAZ;AACA,WAAMW,MAAMD,OAAOE,MAAnB;AACA,YAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIF,GAApB,EAAyBE,GAAzB,EAA8B;AAC5B,aAAMC,QAAQ,KAAKC,UAAL,CAAgBL,OAAOG,CAAP,CAAhB,CAAd;AACA,aAAIC,MAAM,CAAN,CAAJ,EAAc;AACZd,eAAIc,MAAM,CAAN,CAAJ,IAAgBA,MAAM,CAAN,CAAhB;AACD;AACF;AACD,cAAOd,GAAP;AACD;;;6BAEQgB,I,EAAMrB,I,EAAM;AACnB,cAAOqB,KAAKC,KAAL,CAAW,QAAX,EAAqBC,MAArB,CAA4B,UAASC,IAAT,EAAeC,IAAf,EAAqB;AACpDA,gBAAOA,KAAKC,OAAL,CAAa,OAAb,EAAsB,EAAtB,CAAP;AACA,gBAAOF,OAAOA,KAAKC,IAAL,CAAP,GAAoBrB,SAA3B;AACH,QAHM,EAGJJ,IAHI,CAAP;AAID;;AAED;;;;gCACY2B,O,EAAS;AACnB,WAAMC,MAAM,CAAC,IAAD,EAAO,EAAP,EAAW,EAAX,CAAZ;AACA,WAAMlC,OAAOiC,QAAQjC,IAAR,CAAamC,WAAb,EAAb;AACA,WAAMC,QAAQH,QAAQG,KAAtB;AACA,WAAMC,KAAKJ,QAAQf,YAAR,CAAqB,iBAArB,CAAX;AACA,WAAIlB,SAAS,EAAT,IAAeoC,UAAU,EAAzB,IAA+BpC,SAAS,QAAxC,IAAoDoC,UAAU,QAA9D,IAA0EC,OAAO,IAArF,EAA2F;AACzFH,aAAI,CAAJ,IAASlC,IAAT;AACAkC,aAAI,CAAJ,IAASE,KAAT;AACD,QAHD,MAGO;AACLF,aAAI,CAAJ,IAAS,KAAT;AACD;AACD,cAAOA,GAAP;AACD;;AAED;;;;8BAC6C;AAAA,WAArCI,GAAqC,yDAA/B,EAA+B;AAAA,WAA3BlC,OAA2B,yDAAjB,EAAiB;AAAA,WAAbmC,MAAa,yDAAJ,EAAI;;AAC3C,WAAIC,MAAM,EAAV;AACAA,aAAOpC,YAAY,OAAb,kBAAqCmC,MAArC,SAAiDC,GAAvD;AACAA,mBAAU,4BAAUF,GAAV,CAAV;AACA,cAAOE,GAAP;AACD;;;8BAESC,K,EAAO;AAAA;;AACfA,aAAMzB,OAAN,CAAc,UAACC,IAAD,EAAOyB,KAAP,EAAiB;AAC7BzB,cAAK,MAAL,EAAa0B,gBAAb,CAA8B,QAA9B,EAAwC,UAACC,CAAD,EAAO;AAC7CA,aAAEC,cAAF;AACA,eAAI7C,OAAO4C,EAAEE,MAAF,CAAS5B,YAAT,CAAsB,MAAtB,CAAX;AACA,eAAI6B,MAAMH,EAAEE,MAAF,CAAS5B,YAAT,CAAsB,QAAtB,CAAV;AACA,eAAI8B,SAASJ,EAAEE,MAAF,CAAS5B,YAAT,CAAsB,QAAtB,CAAb;AACA,eAAI+B,OAAOL,EAAEE,MAAF,CAAS5B,YAAT,CAAsB,WAAtB,CAAX;AACA,eAAIZ,OAAO,MAAK4C,QAAL,CAAcN,EAAEE,MAAF,CAASK,QAAvB,CAAX;AACA;AACA,iBAAKC,MAAL,CAAYL,GAAZ,EAAiBC,MAAjB,EAAyB1C,IAAzB,EAA+B2C,IAA/B,EAAqChC,KAAK,QAAL,CAArC,EAAqDjB,IAArD;AACD,UATD;AAUD,QAXD;AAYD;;;4BAEO+C,G,EAAKC,M,EAAQ1C,I,EAA6C;AAAA,WAAvC2C,IAAuC,yDAAhC,EAAgC;;AAAA;;AAAA,WAA5B9B,MAA4B,yDAAnB,IAAmB;AAAA,WAAbnB,IAAa,yDAAN,IAAM;;AAChEgD,gBAASA,OAAOK,WAAP,EAAT;AACA,WAAI,KAAKxD,MAAL,CAAYG,IAAZ,MAAsBU,SAAtB,IAAmC,KAAKb,MAAL,CAAYG,IAAZ,MAAsB,IAA7D,EAAmE;AACjE,cAAKsD,SAAL,CAAetD,IAAf;AACD;AACD;AALgE,0BAMpC,KAAKH,MAAL,CAAYG,IAAZ,CANoC;AAAA,WAM1DI,OAN0D,gBAM1DA,OAN0D;AAAA,WAMjDC,QANiD,gBAMjDA,QANiD;;AAOhE,WAAID,YAAY,OAAhB,EAAyB;AACvB,aAAMmD,SAAS,KAAK3D,QAAL,CAAc4D,aAAd,CAA4B,QAA5B,CAAf;AACAD,gBAAOE,IAAP,GAAc,iBAAd;AACA,aAAMlB,iBAAemB,KAAKC,GAAL,EAArB;AACAC,cAAKvD,QAAL,CAAckC,MAAd,IAAwBlC,QAAxB;AACAkD,gBAAOM,GAAP,GAAad,MAAM,KAAKe,MAAL,CAAYxD,IAAZ,EAAkBF,OAAlB,qBAA4CmC,MAA5C,CAAnB;AACA,cAAK3C,QAAL,CAAcmE,oBAAd,CAAmC,MAAnC,EAA2C,CAA3C,EAA8CC,WAA9C,CAA0DT,MAA1D;AACD,QAPD,MAOO;AACL,aAAIU,YAAJ;AACA,aAAIjB,WAAW,KAAX,IAAoBA,WAAW,QAA/B,IAA2CA,WAAW,MAAX,IAAqB5C,YAAY,OAAhF,EAAyF;AACvF6D,iBAAM,gBAAMC,GAAN,CAAUnB,GAAV,EAAe,EAACe,QAAQxD,IAAT,EAAf,CAAN;AACD,UAFD,MAEO;AACL2D,iBAAM,gBAAMhB,IAAN,CAAWF,GAAX,EAAgBzC,IAAhB,CAAN;AACD;AACD2D,aAAIE,IAAJ,CAAS,UAACC,QAAD,EAAc;AACrB;AACA,eAAIjD,WAAW,IAAf,EAAqB;AACnBL,mBAAMC,IAAN,CAAW,OAAKnB,QAAL,CAAciB,gBAAd,CAA+BM,MAA/B,CAAX,EAAmDH,OAAnD,CAA2D,UAACqD,MAAD,EAAY;AACrEA,sBAAOC,SAAP,GAAmB,OAAKC,OAAL,CAAatB,IAAb,EAAmBmB,SAAS9D,IAA5B,CAAnB;AACD,cAFD;AAGD,YAJD,MAIO;AACLD,sBAAS+D,QAAT;AACD;AACF,UATD,EASGI,KATH,CASS,UAACC,GAAD,EAAS;AAChBlE,mBAAQC,GAAR,CAAYiE,GAAZ;AACD,UAXD;AAYD;AACF;;;;;;AAIH,KAAIC,WAAW,SAAXA,QAAW,GAAM;AACnB,OAAIC,KAAK,IAAIhF,QAAJ,CAAaC,QAAb,CAAT;AACAgE,QAAKvD,QAAL,GAAgB,EAAhB;AACA,UAAOsE,EAAP;AACD,EAJD;;AAMAC,QAAO,UAAP,IAAqBF,UAArB;;mBAEeA,Q;;;;;;ACxJf,yC;;;;;;ACAA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,aAAY,MAAM;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;AClDA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,SAAS,GAAG,SAAS;AAC5C,4BAA2B;AAC3B;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1SA;;AAEA;AACA;AACA;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA,kDAAiD,gBAAgB;;AAEjE;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA;AACA,MAAK;AACL;AACA,EAAC;;AAED;;;;;;;ACpFA;;AAEA;AACA;;AAEA,iCAAgC;AAChC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE;AACxE;AACA;AACA;AACA,wDAAuD;AACvD;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,QAAO,YAAY;AACnB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,IAAG;;AAEH;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;;;;;;ACrFA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA,MAAK;AACL;AACA;AACA,EAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;ACnLtC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACXA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,6CAA4C;AAC5C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;;;;;;;AChLA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxBA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;;;;;;;AChBA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AClBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;ACnEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,eAAe;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACpCA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACnEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACnCA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,yCAAwC;AACxC,QAAO;;AAEP;AACA,2DAA0D,wBAAwB;AAClF;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,iCAAgC;AAChC,8BAA6B,aAAa,EAAE;AAC5C;AACA;AACA,IAAG;AACH;;;;;;;ACpDA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;;;;;;ACnDA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAA+B;AAC/B,wCAAuC;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAG;AACH;;;;;;;AC9EA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,MAAM;AACjB,YAAW,eAAe;AAC1B,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACnBA;;AAEA;AACA;AACA;;;;;;;ACJA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;;;;;;ACXA;;AAEA;AACA;AACA;AACA;AACA,YAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;AClBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxDA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,YAAW,SAAS;AACpB,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1BA;;AAEA;AACA;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,SAAS;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;;AAEA;AACA;;;;;;;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP;AACA;AACA,MAAK;;AAEL;;AAEA;AACA;AACA;AACA","file":"elitejax.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 6db2f095859e55f508cb\n **/","'use strict';\n\nimport axios from 'axios';\nimport { stringify } from 'querystring';\n\nclass Elitejax {\n // get config via object for elitejax constructor\n constructor(document) {\n this.config = {};\n this.document = document;\n this.ajaxForm(this.getEl());\n }\n\n // function to add configurations to selected forms\n configure (name, config = {}) {\n // set default configuration\n const defaultConfig = {\n async: true,\n cType: 'application/json',\n resType: 'json',\n callback: function (data) {\n console.log(data);\n }\n };\n\n for (let prop in defaultConfig) {\n if (config[prop] === undefined) {\n config[prop] = defaultConfig[prop];\n }\n }\n\n this.config[name] = config;\n return this.config[name];\n }\n\n // gets elements that has been marked for elitejax\n getEl () {\n let res = [];\n const elem = this.document.querySelectorAll('form');\n Array.from(elem).forEach((form) => {\n if (form.getAttribute('data-elitejax') === 'true') {\n const postTo = form.getAttribute('data-postTo');\n res.push({form, postTo});\n }\n });\n return res;\n }\n\n // gets value from form elements\n formData (inputs) {\n const res = {};\n const num = inputs.length;\n for (let i = 0; i < num; i++) {\n const valid = this.validInput(inputs[i]);\n if (valid[0]) {\n res[valid[1]] = valid[2];\n }\n }\n return res;\n }\n\n resolve (path, data) {\n return path.split(/[.\\[]+/).reduce(function(prev, curr) {\n curr = curr.replace(/[\\]]+/, '');\n return prev ? prev[curr] : undefined;\n }, data);\n }\n\n // validate user inputs according to input types\n validInput (inputEl) {\n const val = [true, '', ''];\n const name = inputEl.name.toLowerCase();\n const value = inputEl.value;\n const ex = inputEl.getAttribute('data-elitejax-x');\n if (name !== '' && value !== '' && name !== 'submit' && value !== 'submit' && ex === null) {\n val[1] = name;\n val[2] = value;\n } else {\n val[0] = false;\n }\n return val;\n }\n\n // convert object to url parameter\n params (obj = {}, resType = '', cbName = '') {\n var str = '';\n str = (resType === 'jsonp') ? `?callback=${cbName}&` : str;\n str += `${stringify(obj)}`;\n return str;\n }\n\n ajaxForm (forms) {\n forms.forEach((form, index) => {\n form['form'].addEventListener('submit', (e) => {\n e.preventDefault();\n let name = e.target.getAttribute('name');\n let url = e.target.getAttribute('action');\n let method = e.target.getAttribute('method');\n let post = e.target.getAttribute('data-post');\n let data = this.formData(e.target.elements);\n // make ajax request\n this.ajaxIt(url, method, data, post, form['postTo'], name);\n });\n });\n }\n\n ajaxIt (url, method, data, post = '', postTo = null, name = null) {\n method = method.toUpperCase();\n if (this.config[name] === undefined || this.config[name] === null) {\n this.configure(name);\n }\n // destructure configuration for given form\n var { resType, callback } = this.config[name];\n if (resType === 'jsonp') {\n const script = this.document.createElement('script');\n script.type = 'text/javascript';\n const cbName = `ej_${Date.now()}`;\n self.callback[cbName] = callback;\n script.src = url + this.params(data, resType, `self.callback.${cbName}`);\n this.document.getElementsByTagName('head')[0].appendChild(script);\n } else {\n let req;\n if (method === 'GET' || method === 'DELETE' || method === 'HEAD' && resType !== 'jsonp') {\n req = axios.get(url, {params: data});\n } else {\n req = axios.post(url, data);\n }\n req.then((response) => {\n // console.log(response);\n if (postTo !== null) {\n Array.from(this.document.querySelectorAll(postTo)).forEach((output) => {\n output.innerHTML = this.resolve(post, response.data);\n });\n } else {\n callback(response);\n }\n }).catch((err) => {\n console.log(err);\n });\n }\n }\n\n}\n\nlet elitejax = () => {\n let ej = new Elitejax(document);\n self.callback = {};\n return ej;\n};\n\nwindow['elitejax'] = elitejax();\n\nexport default elitejax;\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.es6\n **/","module.exports = require('./lib/axios');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/index.js\n ** module id = 1\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance();\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(defaultConfig) {\n return createInstance(defaultConfig);\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/axios.js\n ** module id = 2\n ** module chunks = 0\n **/","'use strict';\n\nvar bind = require('./helpers/bind');\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return (typeof FormData !== 'undefined') && (val instanceof FormData);\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Determine if a value is a Function\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nfunction isFunction(val) {\n return toString.call(val) === '[object Function]';\n}\n\n/**\n * Determine if a value is a Stream\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nfunction isStream(val) {\n return isObject(val) && isFunction(val.pipe);\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nfunction isURLSearchParams(val) {\n return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * typeof document.createElement -> undefined\n */\nfunction isStandardBrowserEnv() {\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof document.createElement === 'function'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object' && !isArray(obj)) {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n * @return {Object} The resulting value of object a\n */\nfunction extend(a, b, thisArg) {\n forEach(b, function assignValue(val, key) {\n if (thisArg && typeof val === 'function') {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n });\n return a;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isFunction: isFunction,\n isStream: isStream,\n isURLSearchParams: isURLSearchParams,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n extend: extend,\n trim: trim\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/utils.js\n ** module id = 3\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/bind.js\n ** module id = 4\n ** module chunks = 0\n **/","'use strict';\n\nvar defaults = require('./../defaults');\nvar utils = require('./../utils');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar isAbsoluteURL = require('./../helpers/isAbsoluteURL');\nvar combineURLs = require('./../helpers/combineURLs');\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n */\nfunction Axios(defaultConfig) {\n this.defaults = utils.merge(defaults, defaultConfig);\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = utils.merge({\n url: arguments[0]\n }, arguments[1]);\n }\n\n config = utils.merge(defaults, this.defaults, { method: 'get' }, config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/Axios.js\n ** module id = 5\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./utils');\nvar normalizeHeaderName = require('./helpers/normalizeHeaderName');\n\nvar PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nfunction setContentTypeIfUnset(headers, value) {\n if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = value;\n }\n}\n\nfunction getDefaultAdapter() {\n var adapter;\n if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('./adapters/xhr');\n } else if (typeof process !== 'undefined') {\n // For node use HTTP adapter\n adapter = require('./adapters/http');\n }\n return adapter;\n}\n\nmodule.exports = {\n adapter: getDefaultAdapter(),\n\n transformRequest: [function transformRequest(data, headers) {\n normalizeHeaderName(headers, 'Content-Type');\n if (utils.isFormData(data) ||\n utils.isArrayBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');\n return data.toString();\n }\n if (utils.isObject(data)) {\n setContentTypeIfUnset(headers, 'application/json;charset=utf-8');\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n data = data.replace(PROTECTION_PREFIX, '');\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n },\n patch: utils.merge(DEFAULT_CONTENT_TYPE),\n post: utils.merge(DEFAULT_CONTENT_TYPE),\n put: utils.merge(DEFAULT_CONTENT_TYPE)\n },\n\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/defaults.js\n ** module id = 6\n ** module chunks = 0\n **/","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 7\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/normalizeHeaderName.js\n ** module id = 8\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar buildURL = require('./../helpers/buildURL');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\nvar btoa = (typeof window !== 'undefined' && window.btoa) || require('./../helpers/btoa');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n var loadEvent = 'onreadystatechange';\n var xDomain = false;\n\n // For IE 8/9 CORS support\n // Only supports POST and GET calls and doesn't returns the response headers.\n // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.\n if (process.env.NODE_ENV !== 'test' &&\n typeof window !== 'undefined' &&\n window.XDomainRequest && !('withCredentials' in request) &&\n !isURLSameOrigin(config.url)) {\n request = new window.XDomainRequest();\n loadEvent = 'onload';\n xDomain = true;\n request.onprogress = function handleProgress() {};\n request.ontimeout = function handleTimeout() {};\n }\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request[loadEvent] = function handleLoad() {\n if (!request || (request.readyState !== 4 && !xDomain)) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;\n var response = {\n data: responseData,\n // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)\n status: request.status === 1223 ? 204 : request.status,\n statusText: request.status === 1223 ? 'No Content' : request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n if (request.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (requestData === undefined) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/adapters/xhr.js\n ** module id = 9\n ** module chunks = 0\n **/","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n // Note: status is not exposed by XDomainRequest\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response\n ));\n }\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/settle.js\n ** module id = 10\n ** module chunks = 0\n **/","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n @ @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, response);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/createError.js\n ** module id = 11\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n @ @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n error.response = response;\n return error;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/enhanceError.js\n ** module id = 12\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n }\n\n if (!utils.isArray(val)) {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/buildURL.js\n ** module id = 13\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/parseHeaders.js\n ** module id = 14\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/isURLSameOrigin.js\n ** module id = 15\n ** module chunks = 0\n **/","'use strict';\n\n// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction E() {\n this.message = 'String contains an invalid character';\n}\nE.prototype = new Error;\nE.prototype.code = 5;\nE.prototype.name = 'InvalidCharacterError';\n\nfunction btoa(input) {\n var str = String(input);\n var output = '';\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars;\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new E();\n }\n block = block << 8 | charCode;\n }\n return output;\n}\n\nmodule.exports = btoa;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/btoa.js\n ** module id = 16\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/cookies.js\n ** module id = 17\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/InterceptorManager.js\n ** module id = 18\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData(\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData(\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/dispatchRequest.js\n ** module id = 19\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/transformData.js\n ** module id = 20\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/cancel/isCancel.js\n ** module id = 21\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/isAbsoluteURL.js\n ** module id = 22\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '');\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/combineURLs.js\n ** module id = 23\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/cancel/Cancel.js\n ** module id = 24\n ** module chunks = 0\n **/","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/cancel/CancelToken.js\n ** module id = 25\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/spread.js\n ** module id = 26\n ** module chunks = 0\n **/","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystring/index.js\n ** module id = 27\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nmodule.exports = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystring/decode.js\n ** module id = 28\n ** module chunks = 0\n **/","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nmodule.exports = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) return '';\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/querystring/encode.js\n ** module id = 29\n ** module chunks = 0\n **/"],"sourceRoot":""} -------------------------------------------------------------------------------- /build/elitejax.min.js: -------------------------------------------------------------------------------- 1 | !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){"use strict";function r(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(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=200&&e<300}}}).call(t,n(7))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?h=d.concat(h):v=-1,h.length&&u())}function u(){if(!m){var e=o(a);m=!0;for(var t=h.length;t;){for(d=h,h=[];++v1)for(var n=1;n>8-u%1*8)){if(r=i.charCodeAt(u+=.75),r>255)throw new n;t=t<<8|r}return a}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(3);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,a){var u=[];u.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),r.isString(o)&&u.push("path="+o),r.isString(i)&&u.push("domain="+i),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(3);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(3),i=n(20),a=n(21),u=n(6);e.exports=function(e){r(e),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||u.adapter;return t(e).then(function(t){return r(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(r(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(3);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(24);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},function(e,t,n){"use strict";t.decode=t.parse=n(28),t.encode=t.stringify=n(29)},function(e,t){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,r,o){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var a=/\+/g;e=e.split(t);var u=1e3;o&&"number"==typeof o.maxKeys&&(u=o.maxKeys);var s=e.length;u>0&&s>u&&(s=u);for(var c=0;c=0?(f=h.substr(0,m),l=h.substr(m+1)):(f=h,l=""),p=decodeURIComponent(f),d=decodeURIComponent(l),n(i,p)?Array.isArray(i[p])?i[p].push(d):i[p]=[i[p],d]:i[p]=d}return i}},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 i=encodeURIComponent(n(o))+r;return Array.isArray(e[o])?e[o].map(function(e){return i+encodeURIComponent(n(e))}).join(t):i+encodeURIComponent(n(e[o]))}).join(t):o?encodeURIComponent(n(o))+r+encodeURIComponent(n(e)):""}}]); 2 | //# sourceMappingURL=elitejax.min.js.map -------------------------------------------------------------------------------- /eliteJAX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ghostffcode/elitejax/bebbfa3939d140d4702a5c965cd62345197a7069/eliteJAX.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Elitejax Trial 6 | 7 | 8 |
9 |
10 | Enter name:
11 | Enter name:
12 | 18 | 19 |
20 | 21 |
22 | 23 | 24 |
25 | 26 |
27 | 28 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "elitejax", 3 | "version": "2.0.3", 4 | "description": "Simplifying Ajax Requests Using HTML attributes", 5 | "main": "./build/elitejax.min.js", 6 | "source": "./src/index", 7 | "scripts": { 8 | "start": "webpack-dev-server --inline --hot", 9 | "build": "webpack && NODE_ENV='production' webpack", 10 | "lint": "eslint . --ext .es6 --ignore-path .gitignore --cache || true" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/ghostffcode/elitejax.git" 15 | }, 16 | "keywords": [ 17 | "ajax", 18 | "elitejax", 19 | "elite", 20 | "ajax" 21 | ], 22 | "author": "Chimeremeze Ukah ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/ghostffcode/elitejax/issues" 26 | }, 27 | "homepage": "https://github.com/ghostffcode/elitejax#readme", 28 | "devDependencies": { 29 | "axios": "^0.15.1", 30 | "babel-core": "^6.14.0", 31 | "babel-eslint": "^6.1.2", 32 | "babel-loader": "^6.2.5", 33 | "babel-preset-es2015": "^6.14.0", 34 | "dotenv": "^2.0.0", 35 | "eslint": "^3.4.0", 36 | "eslint-loader": "^1.5.0", 37 | "jsonp": "^0.2.0", 38 | "webpack": "^1.13.2", 39 | "webpack-dev-server": "^1.15.1" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/index.es6: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | import axios from 'axios'; 4 | import { stringify } from 'querystring'; 5 | 6 | class Elitejax { 7 | // get config via object for elitejax constructor 8 | constructor(document) { 9 | this.config = {}; 10 | this.document = document; 11 | this.ajaxForm(this.getEl()); 12 | } 13 | 14 | // function to add configurations to selected forms 15 | configure (name, config = {}) { 16 | // set default configuration 17 | const defaultConfig = { 18 | async: true, 19 | cType: 'application/json', 20 | resType: 'json', 21 | callback: function (data) { 22 | console.log(data); 23 | } 24 | }; 25 | 26 | for (let prop in defaultConfig) { 27 | if (config[prop] === undefined) { 28 | config[prop] = defaultConfig[prop]; 29 | } 30 | } 31 | 32 | this.config[name] = config; 33 | return this.config[name]; 34 | } 35 | 36 | // gets elements that has been marked for elitejax 37 | getEl () { 38 | let res = []; 39 | const elem = this.document.querySelectorAll('form'); 40 | Array.from(elem).forEach((form) => { 41 | if (form.getAttribute('data-elitejax') === 'true') { 42 | const postTo = form.getAttribute('data-postTo'); 43 | res.push({form, postTo}); 44 | } 45 | }); 46 | return res; 47 | } 48 | 49 | // gets value from form elements 50 | formData (inputs) { 51 | const res = {}; 52 | const num = inputs.length; 53 | for (let i = 0; i < num; i++) { 54 | const valid = this.validInput(inputs[i]); 55 | if (valid[0]) { 56 | res[valid[1]] = valid[2]; 57 | } 58 | } 59 | return res; 60 | } 61 | 62 | resolve (path, data) { 63 | return path.split(/[.\[]+/).reduce(function(prev, curr) { 64 | curr = curr.replace(/[\]]+/, ''); 65 | return prev ? prev[curr] : undefined; 66 | }, data); 67 | } 68 | 69 | // validate user inputs according to input types 70 | validInput (inputEl) { 71 | const val = [true, '', '']; 72 | const name = inputEl.name.toLowerCase(); 73 | const value = inputEl.value; 74 | const ex = inputEl.getAttribute('data-elitejax-x'); 75 | if (name !== '' && value !== '' && name !== 'submit' && value !== 'submit' && ex === null) { 76 | val[1] = name; 77 | val[2] = value; 78 | } else { 79 | val[0] = false; 80 | } 81 | return val; 82 | } 83 | 84 | // convert object to url parameter 85 | params (obj = {}, resType = '', cbName = '') { 86 | var str = ''; 87 | str = (resType === 'jsonp') ? `?callback=${cbName}&` : str; 88 | str += `${stringify(obj)}`; 89 | return str; 90 | } 91 | 92 | ajaxForm (forms) { 93 | forms.forEach((form, index) => { 94 | form['form'].addEventListener('submit', (e) => { 95 | e.preventDefault(); 96 | let name = e.target.getAttribute('name'); 97 | let url = e.target.getAttribute('action'); 98 | let method = e.target.getAttribute('method'); 99 | let post = e.target.getAttribute('data-post'); 100 | let data = this.formData(e.target.elements); 101 | // make ajax request 102 | this.ajaxIt(url, method, data, post, form['postTo'], name); 103 | }); 104 | }); 105 | } 106 | 107 | ajaxIt (url, method, data, post = '', postTo = null, name = null) { 108 | method = method.toUpperCase(); 109 | if (this.config[name] === undefined || this.config[name] === null) { 110 | this.configure(name); 111 | } 112 | // destructure configuration for given form 113 | var { resType, callback } = this.config[name]; 114 | if (resType === 'jsonp') { 115 | const script = this.document.createElement('script'); 116 | script.type = 'text/javascript'; 117 | const cbName = `ej_${Date.now()}`; 118 | self.callback[cbName] = callback; 119 | script.src = url + this.params(data, resType, `self.callback.${cbName}`); 120 | this.document.getElementsByTagName('head')[0].appendChild(script); 121 | } else { 122 | let req; 123 | if (method === 'GET' || method === 'DELETE' || method === 'HEAD' && resType !== 'jsonp') { 124 | req = axios.get(url, {params: data}); 125 | } else { 126 | req = axios.post(url, data); 127 | } 128 | req.then((response) => { 129 | // console.log(response); 130 | if (postTo !== null) { 131 | Array.from(this.document.querySelectorAll(postTo)).forEach((output) => { 132 | output.innerHTML = this.resolve(post, response.data); 133 | }); 134 | } else { 135 | callback(response); 136 | } 137 | }).catch((err) => { 138 | console.log(err); 139 | }); 140 | } 141 | } 142 | 143 | } 144 | 145 | let elitejax = () => { 146 | let ej = new Elitejax(document); 147 | self.callback = {}; 148 | return ej; 149 | }; 150 | 151 | window['elitejax'] = elitejax(); 152 | 153 | export default elitejax; 154 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('webpack'); 2 | const PROD = process.env.NODE_ENV === 'production'; 3 | 4 | 5 | module.exports = { 6 | entry: __dirname + "/src/index.es6", 7 | devtool: "source-map", 8 | output: { 9 | path: __dirname + "/build/", 10 | filename: PROD ? "elitejax.min.js" : "elitejax.js" 11 | }, 12 | module: { 13 | preLoaders: [ 14 | { test: /\.es6?$/, exclude: /node_modules/, loader: 'eslint-loader', include: __dirname + '/' } 15 | ], 16 | loaders: [ 17 | { test: /\.es6$/, exclude: /node_modules/, loader: "babel" } 18 | ] 19 | }, 20 | resolve: { 21 | extensions: ['', '.js', '.es6'] 22 | }, 23 | plugins: PROD ? [ 24 | new webpack.optimize.UglifyJsPlugin({ 25 | compress: { warnings: false } 26 | }) 27 | ] : [] 28 | } 29 | --------------------------------------------------------------------------------