'use strict';(function(){window.Reci||(window.Reci={});window.Reci.Class||(window.Reci.Class={});window.Reci.Class.Fetch||(window.Reci.Class.Fetch=function(g){function l(b,d){return fetch(b,d).catch(function(a){if(a instanceof DOMException&&(20===a.code||"AbortError"===a.name))throw{type:"cancel",by:"fetch",reason:d&&d.signal?d.signal.reason:a.message};throw{type:"fail",by:"fetch",reason:a};}).then(function(a){const c={res:a},e=a.headers.get("Content-Type");return e.match(/application\/json/i)?a.json().then(function(h){c.json= h;return c}):e.match(/text\/html/i)?a.text().then(function(h){c.text=h;return c}):c}).then(function(a){if(!1===a.res.ok)throw a.type="fail",a.by="fetch",a.reason="response not ok",a;return a})}g=g?g:{};const m=["GET","HEAD","OPTIONS"],f={},k={legacy_ajax_headers:!0};for(let b in k)"undefined"!==typeof g[b]&&(k[b]=g[b]);this.send=function(b,d,a){const c=String(b);b="undefined"===typeof d?{}:d;a="undefined"===typeof a?{}:a;"undefined"===typeof b.method&&(b.method="GET");if(a.use_cache&&-1===m.indexOf(b.method))return Promise.reject(new TypeError("can't cache method: "+ b.method));if(a.use_cache&&"undefined"!==typeof b.body)return Promise.reject(new TypeError("can't cache body"));"undefined"===typeof b.headers&&(b.headers=new Headers);k.legacy_ajax_headers&&b.headers.append("X-Requested-With","XMLHttpRequest");if(a.use_cache){const e=JSON.stringify(b);f[c]||(f[c]={});f[c][e]||(f[c][e]=l(c,b).catch(function(h){f[c][e]=!1;throw h;}));return f[c][e]}return l(c,b)}})})();