@mountainpass/waychaser 5.0.12 → 5.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/waychaser.es.js +51 -15
- package/dist/waychaser.es.min.js +1 -15
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/waychaser.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
14
|
***************************************************************************** */
|
|
15
|
-
/* global Reflect, Promise */
|
|
15
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
16
16
|
|
|
17
17
|
var extendStatics = function(d, b) {
|
|
18
18
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -63,12 +63,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function __generator(thisArg, body) {
|
|
66
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
67
|
-
return g =
|
|
66
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
67
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
68
68
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
69
69
|
function step(op) {
|
|
70
70
|
if (f) throw new TypeError("Generator is already executing.");
|
|
71
|
-
while (_) try {
|
|
71
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
72
72
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
73
73
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
74
74
|
switch (op[0]) {
|
|
@@ -127,7 +127,12 @@ function __spreadArray(to, from, pack) {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
133
|
+
var e = new Error(message);
|
|
134
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
135
|
+
};
|
|
131
136
|
|
|
132
137
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
133
138
|
|
|
@@ -330,8 +335,7 @@ var qsStringify = function queryStringify (obj, prefix) {
|
|
|
330
335
|
};
|
|
331
336
|
|
|
332
337
|
/* eslint-env browser */
|
|
333
|
-
|
|
334
|
-
var browser = typeof self == 'object' ? self.FormData : window.FormData;
|
|
338
|
+
var browser = typeof self === 'object' ? self.FormData : window.FormData;
|
|
335
339
|
|
|
336
340
|
// negotiated (https://www.npmjs.com/package/negotiated) doesn't working in IE 11 due to missing regex polyfill stuff
|
|
337
341
|
/**
|
|
@@ -660,7 +664,7 @@ function get (obj, pointer) {
|
|
|
660
664
|
for (var p = 1; p < len;) {
|
|
661
665
|
obj = obj[untilde(pointer[p++])];
|
|
662
666
|
if (len === p) return obj
|
|
663
|
-
if (typeof obj !== 'object') return undefined
|
|
667
|
+
if (typeof obj !== 'object' || obj === null) return undefined
|
|
664
668
|
}
|
|
665
669
|
}
|
|
666
670
|
|
|
@@ -1311,6 +1315,21 @@ function needsQuotes( value ) {
|
|
|
1311
1315
|
!TOKEN_PATTERN.test( value )
|
|
1312
1316
|
}
|
|
1313
1317
|
|
|
1318
|
+
/**
|
|
1319
|
+
* Shallow compares two objects to check if their properties match.
|
|
1320
|
+
* @param {object} object1 First object to compare.
|
|
1321
|
+
* @param {object} object2 Second object to compare.
|
|
1322
|
+
* @returns {boolean} Do the objects have matching properties.
|
|
1323
|
+
*/
|
|
1324
|
+
function shallowCompareObjects( object1, object2 ) {
|
|
1325
|
+
return (
|
|
1326
|
+
Object.keys( object1 ).length === Object.keys( object2 ).length &&
|
|
1327
|
+
Object.keys( object1 ).every(
|
|
1328
|
+
( key ) => key in object2 && object1[ key ] === object2[ key ]
|
|
1329
|
+
)
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1314
1333
|
class Link {
|
|
1315
1334
|
|
|
1316
1335
|
/**
|
|
@@ -1341,7 +1360,7 @@ class Link {
|
|
|
1341
1360
|
var type = value.toLowerCase();
|
|
1342
1361
|
|
|
1343
1362
|
for( var i = 0; i < this.refs.length; i++ ) {
|
|
1344
|
-
if( this.refs[ i ].rel.toLowerCase() === type ) {
|
|
1363
|
+
if( typeof this.refs[ i ].rel === 'string' && this.refs[ i ].rel.toLowerCase() === type ) {
|
|
1345
1364
|
links.push( this.refs[ i ] );
|
|
1346
1365
|
}
|
|
1347
1366
|
}
|
|
@@ -1359,11 +1378,12 @@ class Link {
|
|
|
1359
1378
|
get( attr, value ) {
|
|
1360
1379
|
|
|
1361
1380
|
attr = attr.toLowerCase();
|
|
1381
|
+
value = value.toLowerCase();
|
|
1362
1382
|
|
|
1363
1383
|
var links = [];
|
|
1364
1384
|
|
|
1365
1385
|
for( var i = 0; i < this.refs.length; i++ ) {
|
|
1366
|
-
if( this.refs[ i ][ attr ] === value ) {
|
|
1386
|
+
if( typeof this.refs[ i ][ attr ] === 'string' && this.refs[ i ][ attr ].toLowerCase() === value ) {
|
|
1367
1387
|
links.push( this.refs[ i ] );
|
|
1368
1388
|
}
|
|
1369
1389
|
}
|
|
@@ -1372,17 +1392,32 @@ class Link {
|
|
|
1372
1392
|
|
|
1373
1393
|
}
|
|
1374
1394
|
|
|
1395
|
+
/** Sets a reference. */
|
|
1375
1396
|
set( link ) {
|
|
1376
1397
|
this.refs.push( link );
|
|
1377
1398
|
return this
|
|
1378
1399
|
}
|
|
1379
1400
|
|
|
1401
|
+
/**
|
|
1402
|
+
* Sets a reference if a reference with similar properties isn’t already set.
|
|
1403
|
+
*/
|
|
1404
|
+
setUnique( link ) {
|
|
1405
|
+
|
|
1406
|
+
if( !this.refs.some(( ref ) => shallowCompareObjects( ref, link )) ) {
|
|
1407
|
+
this.refs.push( link );
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
return this
|
|
1411
|
+
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1380
1414
|
has( attr, value ) {
|
|
1381
1415
|
|
|
1382
1416
|
attr = attr.toLowerCase();
|
|
1417
|
+
value = value.toLowerCase();
|
|
1383
1418
|
|
|
1384
1419
|
for( var i = 0; i < this.refs.length; i++ ) {
|
|
1385
|
-
if( this.refs[ i ][ attr ] === value ) {
|
|
1420
|
+
if( typeof this.refs[ i ][ attr ] === 'string' && this.refs[ i ][ attr ].toLowerCase() === value ) {
|
|
1386
1421
|
return true
|
|
1387
1422
|
}
|
|
1388
1423
|
}
|
|
@@ -1444,7 +1479,8 @@ class Link {
|
|
|
1444
1479
|
continue
|
|
1445
1480
|
}
|
|
1446
1481
|
var end = value.indexOf( '=', offset );
|
|
1447
|
-
if( end === -1 )
|
|
1482
|
+
if( end === -1 ) end = value.indexOf( ';', offset );
|
|
1483
|
+
if( end === -1 ) end = value.length;
|
|
1448
1484
|
var attr = trim( value.slice( offset, end ) ).toLowerCase();
|
|
1449
1485
|
var attrValue = '';
|
|
1450
1486
|
offset = end + 1;
|
|
@@ -1570,7 +1606,7 @@ Link.expandRelations = function( ref ) {
|
|
|
1570
1606
|
* @return {Object}
|
|
1571
1607
|
*/
|
|
1572
1608
|
Link.parseExtendedValue = function( value ) {
|
|
1573
|
-
var parts = /([^']+)?(?:'([^']
|
|
1609
|
+
var parts = /([^']+)?(?:'([^']*)')?(.+)/.exec( value );
|
|
1574
1610
|
return {
|
|
1575
1611
|
language: parts[2].toLowerCase(),
|
|
1576
1612
|
encoding: Link.isCompatibleEncoding( parts[1] ) ?
|
|
@@ -1588,7 +1624,7 @@ Link.parseExtendedValue = function( value ) {
|
|
|
1588
1624
|
*/
|
|
1589
1625
|
Link.formatExtendedAttribute = function( attr, data ) {
|
|
1590
1626
|
|
|
1591
|
-
var encoding = ( data.encoding ||
|
|
1627
|
+
var encoding = ( data.encoding || 'utf-8' ).toUpperCase();
|
|
1592
1628
|
var language = data.language || 'en';
|
|
1593
1629
|
|
|
1594
1630
|
var encodedValue = '';
|
package/dist/waychaser.es.min.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
/*! *****************************************************************************
|
|
2
|
-
Copyright (c) Microsoft Corporation.
|
|
3
|
-
|
|
4
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
-
purpose with or without fee is hereby granted.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */
|
|
15
|
-
var e=function(r,t){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(r,t)};function r(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var t=function(){return(t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function n(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}function o(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,s)}l((n=n.apply(e,r||[])).next())}))}function i(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(e,a)}catch(e){i=[6,e],n=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function a(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),a=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function l(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c={};!function(e){var r=/[!'()]/g,t={"":",","+":",","#":",","?":"&"},n=/[$-\/?[-^{|}]/g,o=/\{([#&+.\/;?]?)((?:[-\w%.]+(\*|:\d+)?,?)+)\}/g,i=RegExp(o.source+"|.[^{]*?","g");function a(e){return encodeURIComponent(e).replace(r,escape)}function s(e){return null!=e}function l(e,r,t){return(e=e.map(r).filter(s)).length&&e.join(t)}function u(e,r){return e.replace(o,(function(e,n,o){var i=t[n]||n,s=";"==i||"&"==i,u=n&&","==i?encodeURI:a,c=l(o.split(","),(function(e){var t=e.split(/[*:]/),n=t[0],o=r[n];if(null!=o){if("object"==typeof o){if(t=n!=e,Array.isArray(o)?o=l(o,u,t?s?i+n+"=":i:","):(o=l(Object.keys(o),(function(e){return u(e)+(t?"=":",")+u(o[e])}),t&&(s||"/"==i)?i:","),t&&(s=0)),!o)return}else o=u(t[1]?o.slice(0,t[1]):o);return s?n+(o||"&"==i?"="+o:o):o}}),i);return c||""===c?"+"!=n?n+c:c:""}))}e.expand=u,e.Template=function(e){var r=this,o=0,a={},s="",l="^"+e.replace(i,(function(e,r,n){if(!n)return p(e);var i=t[r]||r,l=";"==i||"&"==i,u=n.split(",").map((function(e){var r=e.split(/[*:]/),t=r[0],n=(a[t]||"(")+".*?)";return o++,r[1]&&(n="((?:%..|.){1,"+r[1]+"})",a[t]="(\\"+o),s+="t=($["+o+"]||'').split('"+i+"').map(decodeURIComponent);",s+='o["'+t+'"]=t.length>1?t:t[0];',l?p(t)+"(?:="+n+")?":"&"==i?p(t+"=")+n:n})).join(p(i));return"+"!=r?p(r)+u:u}))+"$",c=RegExp(l),f=Function("$","var t,o={};"+s+"return o");function p(e){return e.replace(n,"\\$&")}r.template=e,r.match=function(e){var r=c.exec(e);return r&&f(r)},r.expand=u.bind(r,e)}}(u.URI||(u.URI={}));const f=function(){const e="undefined"==typeof window?c.URI||global.URI:window.URI||c.URI;return e.parameters=function(e){return new f.Template(e).match(e)},e}();var p=Object.prototype.hasOwnProperty,d=function e(r,t){var n=[];for(var o in r)if(p.call(r,o)){var i,a=r[o],s=encodeURIComponent(o);i="object"==typeof a?e(a,t?t+"["+s+"]":s):(t?t+"["+s+"]":s)+"="+encodeURIComponent(a),n.push(i)}return n.join("&")},h="object"==typeof self?self.FormData:window.FormData;function y(e,r,t){if(e){return function(e){return e.split(",").map((function(e){var r,t,n=e.split(";"),o=n.shift(),i=null==o?void 0:o.split("/"),s={type:o,parentType:null==i?void 0:i[0],subType:null==i?void 0:i[1],q:1};try{for(var l=a(n),u=l.next();!u.done;u=l.next()){var c=u.value,f=c.split("=");"q"===c[0]&&(s[f[0]]=Number.parseFloat(f[1]))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(r)throw r.error}}return s})).sort((function(e,r){return e.q>r.q?-1:e.q<r.q||"*"===e.parentType&&"*"!==r.parentType?1:"*"!==e.parentType&&"*"===r.parentType?-1:"*"===e.subType&&"*"!==r.subType?1:"*"!==e.subType&&"*"===r.subType?-1:0})).map((function(e){return{type:e.type||""}})).filter((function(e){return""!==e.type}))}(e).find((e=>r.includes(e.type))).type}return t}var v=w;function b(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function m(e){return e}function w(e,r){const t=(r=r||{}).delimiter||".",n=r.maxDepth,o=r.transformKey||m,i={};return function e(a,s,l){l=l||1,Object.keys(a).forEach((function(u){const c=a[u],f=r.safe&&Array.isArray(c),p=Object.prototype.toString.call(c),d=b(c),h="[object Object]"===p||"[object Array]"===p,y=s?s+t+o(u):o(u);if(!f&&!d&&h&&Object.keys(c).length&&(!r.maxDepth||l<n))return e(c,y,l+1);i[y]=c}))}(e),i}w.flatten=w,w.unflatten=function e(r,t){const n=(t=t||{}).delimiter||".",o=t.overwrite||!1,i=t.transformKey||m,a={};if(b(r)||"[object Object]"!==Object.prototype.toString.call(r))return r;function s(e){const r=Number(e);return isNaN(r)||-1!==e.indexOf(".")||t.object?e:r}return r=Object.keys(r).reduce((function(e,o){const i=Object.prototype.toString.call(r[o]);return!("[object Object]"===i||"[object Array]"===i)||function(e){const r=Object.prototype.toString.call(e),t="[object Array]"===r,n="[object Object]"===r;if(!e)return!0;if(t)return!e.length;if(n)return!Object.keys(e).length}(r[o])?(e[o]=r[o],e):function(e,r,t){return Object.keys(t).reduce((function(r,o){return r[e+n+o]=t[o],r}),r)}(o,e,w(r[o],t))}),{}),Object.keys(r).forEach((function(l){const u=l.split(n).map(i);let c=s(u.shift()),f=s(u[0]),p=a;for(;void 0!==f;){if("__proto__"===c)return;const e=Object.prototype.toString.call(p[c]),r="[object Object]"===e||"[object Array]"===e;if(!o&&!r&&void 0!==p[c])return;(o&&!r||!o&&null==p[c])&&(p[c]="number"!=typeof f||t.object?{}:[]),p=p[c],u.length>0&&(c=s(u.shift()),f=s(u[0]))}p[c]=e(r[l],t)})),a};var g={},O=/~/,x=/~[01]/g;function j(e){switch(e){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+e)}function k(e){return O.test(e)?e.replace(x,j):e}function A(e){if("string"==typeof e){if(""===(e=e.split("/"))[0])return e;throw new Error("Invalid JSON pointer.")}if(Array.isArray(e)){for(const r of e)if("string"!=typeof r&&"number"!=typeof r)throw new Error("Invalid JSON pointer. Must be of type string or number.");return e}throw new Error("Invalid JSON pointer.")}function E(e,r){if("object"!=typeof e)throw new Error("Invalid input object.");var t=(r=A(r)).length;if(1===t)return e;for(var n=1;n<t;){if(e=e[k(r[n++])],t===n)return e;if("object"!=typeof e)return}}function I(e,r,t){if("object"!=typeof e)throw new Error("Invalid input object.");if(0===(r=A(r)).length)throw new Error("Invalid JSON pointer for set.");return function(e,r,t){for(var n,o,i=1,a=r.length;i<a;){if("constructor"===r[i]||"prototype"===r[i]||"__proto__"===r[i])return e;if(n=k(r[i++]),o=a>i,void 0===e[n]&&(Array.isArray(e)&&"-"===n&&(n=e.length),o&&(""!==r[i]&&r[i]<1/0||"-"===r[i]?e[n]=[]:e[n]={})),!o)break;e=e[n]}var s=e[n];return void 0===t?delete e[n]:e[n]=t,s}(e,r,t)}g.get=E,g.set=I,g.compile=function(e){var r=A(e);return{get:function(e){return E(e,r)},set:function(e,t){return I(e,r,t)}}};var R={};Object.defineProperty(R,"__esModule",{value:!0});var P=R.ProblemDocument=void 0;P=R.ProblemDocument=class{constructor(e){Object.assign(this,e)}};var S=function(e){var r=e.rel,t=e.uri,o=e.method,i=e.parameters,a=e.accept,s=e.anchor,l=n(e,["rel","uri","method","parameters","accept","anchor"]);this.rel=r,this.uri=t,this.method=o,this.parameters=i||{},this.accept=a,this.anchor=s,Object.assign(this,l)},C=function(e){function t(r,t,n,o){var i=e.call(this,r)||this;return i.response=t,i.defaultOptions=n,i.uri.includes("{this.")&&(i.uri=f.expand(i.uri,o)),i}return r(t,e),t.prototype.invokeAsFragment=function(e,r){if(this.uri.startsWith("#/")){var t=this.expandUrl(e).toString(),n=this.response.fullContent&&g.get(this.response.fullContent,t.slice(1));if(void 0===n)return;if(r){var o=r(n);if(se(o))return new le({defaultOptions:this.defaultOptions,baseResponse:this.response.response,content:o.content,fullContent:this.response.fullContent,anchor:t,parentOperations:this.response.allOperations,parameters:e});throw new ue({problem:o.problem,response:new le({defaultOptions:this.defaultOptions,baseResponse:this.response.response,content:n,fullContent:this.response.fullContent,parameters:e})})}return new le({defaultOptions:this.defaultOptions,baseResponse:this.response.response,content:n,fullContent:this.response.fullContent,anchor:t,parentOperations:this.response.allOperations,parameters:e})}},t.prototype.invokeAll=function(e){return o(this,void 0,void 0,(function(){var r;return i(this,(function(t){return this.uri.startsWith("#/")&&this.response instanceof le?(r=this.doInvokeAll((null==e?void 0:e.parameters)||{}),[2,Promise.all(r)]):[2,Promise.all([this.invoke(e)])]}))}))},t.prototype.doInvokeAll=function(e,r){var t=this,n=this.response,o=new f.Template(this.uri),i=Object.assign(f.parameters(this.uri),e),a=o.expand(i).replace(/%7B/g,"{").replace(/%7D/g,"}"),u=f.parameters(a),c=Object.keys(u);if(0!==c.length){var p=u[c[0]],d=a.slice(1,a.indexOf(p)-1),h=""===d?n.content:g.get(n.content,d);if(h)return(Array.isArray(h)?l([],s(Array.from({length:h.length}).keys()),!1):Object.keys(h)).flatMap((function(n){var o,i=Object.assign({},e,((o={})[c[0]]=n,o));return t.doInvokeAll(i,r)}));throw new ue({response:this.response,problem:new P({type:"https://waychaser.io/fragment-uri-error",title:"The fragment URI does not match the content structure",uri:d,content:n.content,parameters:e})})}return[this.invokeAsFragment(e,r)]},t.prototype.invoke=function(e){return o(this,void 0,void 0,(function(){var r,t,n,o,s,l,u,c,f,p,v,b,m,w,g,O,x,j;return i(this,(function(i){if(this.uri.startsWith("#/"))return[2,this.invokeAsFragment(null==e?void 0:e.parameters)];if(r=this.parameters||{},t=Object.assign({},this.defaultOptions.parameters,null==e?void 0:e.parameters),n=this.url(t),o={},Array.isArray(r))try{for(s=a(r),l=s.next();!l.done;l=s.next())f=l.value,o[f]=null==t?void 0:t[f]}catch(e){g={error:e}}finally{try{l&&!l.done&&(O=s.return)&&O.call(s)}finally{if(g)throw g.error}}else try{for(u=a(Object.keys(r)),c=u.next();!c.done;c=u.next())f=c.value,o[f]=null==t?void 0:t[f]}catch(e){x={error:e}}finally{try{c&&!c.done&&(j=u.return)&&j.call(u)}finally{if(x)throw x.error}}if(p=void 0,v={},(b=Object.assign({},e)).method=this.method,0!==Object.keys(this.parameters).length&&(k=this.method||"GET",!["GET","DELETE","TRACE","OPTIONS","HEAD"].includes(k))){switch(m=y(this.accept,["application/x-www-form-urlencoded","application/json","multipart/form-data"],"application/x-www-form-urlencoded")){case"application/x-www-form-urlencoded":p=d(o);break;case"application/json":p=JSON.stringify(o);break;case"multipart/form-data":for(w in p=new h,o)p.append(w,o[w])}"multipart/form-data"!==m&&(v={"content-type":m}),b.body=p,b.headers=Object.assign(v,null==e?void 0:e.headers)}return[2,fe(n.toString(),this.defaultOptions,b)];var k}))}))},t.prototype.url=function(e){var r=this.expandUrl(e);return new URL(r,this.response.url)},t.prototype.expandUrl=function(e){return f.expand(this.uri,v(e||{}))},t}(S),_=function(e){function t(r){return e.apply(this,l([],s(r||[]),!1))||this}return r(t,e),t.create=function(){return Object.create(t.prototype)},t.prototype.find=function(e,r){var t=Array.prototype.find.bind(this);return t("string"==typeof e?T({rel:e}):"object"==typeof e?T(e):e,r)},t.prototype.filter=function(e,r){if("string"==typeof e)return this.filter({rel:e},r);if("object"==typeof e)return this.filter(T(e),r);var n=Array.prototype.filter.bind(this)(e);return Object.setPrototypeOf(n,t.prototype),n},t.prototype.invoke=function(e,r){var t=this.find(e);return t?t.invoke(r):void 0},t.prototype.invokeAll=function(e,r){var t=this.filter(e);return Promise.all(t.map((function(e){return e.invokeAll(r)}))).then((function(e){return e.flat()}))},t}(Array);function T(e){return function(r){for(var t in e)if(e[t]!==r[t])return!1;return!0}}function U(e){var r,t,n,o,i=[],s=/{\[(\d+)..(\d+)]}/,l=e.uri.toString(),u=l.match(s);if(u)for(var c=Number.parseInt(u[1]);c<=Number.parseInt(u[2]);++c){var f=U(new S(Object.assign(e,{uri:l.replace(s,c.toFixed(0))})));try{for(var p=(r=void 0,a(f)),d=p.next();!d.done;d=p.next()){var h=d.value;i.push(h)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(t=p.return)&&t.call(p)}finally{if(r)throw r.error}}}else{var y=e.anchor,v=null==y?void 0:y.match(s);if(y&&v)for(c=Number.parseInt(v[1]);c<=Number.parseInt(v[2]);++c){f=U(new S(Object.assign(e,{anchor:y.replace(s,c.toFixed(0))})));try{for(var b=(n=void 0,a(f)),m=b.next();!m.done;m=b.next()){var w=m.value;i.push(w)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}else i.push(e)}return i}const q="application/hal+json",N="application/vnd.siren+json";function F(e,r){const t=e.split(/:(.+)/);if(t.length>1){const[n,o]=t;return r[n]?f.expand(r[n],{rel:o}):e}return e}function H(e,r,t){const{href:n,templated:o,...i}=r;return new S({rel:F(e,t),uri:n,...i})}var D=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,L=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,$=/\s|\uFEFF|\xA0/,B=/\r?\n[\x20\x09]+/g,J=/[;,"]/,W=/[;,"]|\s/,G=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/,M=1,Q=2,K=4;function V(e){return e.replace(L,"")}function z(e){return $.test(e)}function Z(e,r){for(;z(e[r]);)r++;return r}function X(e){return W.test(e)||!G.test(e)}class Y{constructor(e){this.refs=[],e&&this.parse(e)}rel(e){for(var r=[],t=e.toLowerCase(),n=0;n<this.refs.length;n++)this.refs[n].rel.toLowerCase()===t&&r.push(this.refs[n]);return r}get(e,r){e=e.toLowerCase();for(var t=[],n=0;n<this.refs.length;n++)this.refs[n][e]===r&&t.push(this.refs[n]);return t}set(e){return this.refs.push(e),this}has(e,r){e=e.toLowerCase();for(var t=0;t<this.refs.length;t++)if(this.refs[t][e]===r)return!0;return!1}parse(e,r){e=V(e=(r=r||0)?e.slice(r):e).replace(B,"");for(var t=M,n=e.length,o=(r=0,null);r<n;)if(t===M){if(z(e[r])){r++;continue}if("<"!==e[r])throw new Error('Unexpected character "'+e[r]+'" at offset '+r);if(null!=o&&(null!=o.rel?this.refs.push(...Y.expandRelations(o)):this.refs.push(o)),-1===(s=e.indexOf(">",r)))throw new Error("Expected end of URI delimiter at offset "+r);o={uri:e.slice(r+1,s)},r=s,t=Q,r++}else if(t===Q){if(z(e[r])){r++;continue}if(";"===e[r])t=K,r++;else{if(","!==e[r])throw new Error('Unexpected character "'+e[r]+'" at offset '+r);t=M,r++}}else{if(t!==K)throw new Error('Unknown parser state "'+t+'"');if(";"===e[r]||z(e[r])){r++;continue}if(-1===(s=e.indexOf("=",r)))throw new Error("Expected attribute delimiter at offset "+r);var i=V(e.slice(r,s)).toLowerCase(),a="";if('"'===e[r=Z(e,r=s+1)])for(r++;r<n;){if('"'===e[r]){r++;break}"\\"===e[r]&&r++,a+=e[r],r++}else{for(var s=r+1;!J.test(e[s])&&s<n;)s++;a=e.slice(r,s),r=s}switch(o[i]&&Y.isSingleOccurenceAttr(i)||("*"===i[i.length-1]?o[i]=Y.parseExtendedValue(a):(a="type"===i?a.toLowerCase():a,null!=o[i]?Array.isArray(o[i])?o[i].push(a):o[i]=[o[i],a]:o[i]=a)),e[r]){case",":t=M;break;case";":t=K}r++}return null!=o&&(null!=o.rel?this.refs.push(...Y.expandRelations(o)):this.refs.push(o)),o=null,this}toString(){for(var e=[],r="",t=null,n=0;n<this.refs.length;n++)t=this.refs[n],r=Object.keys(this.refs[n]).reduce((function(e,r){return"uri"===r?e:e+"; "+Y.formatAttribute(r,t[r])}),"<"+t.uri+">"),e.push(r);return e.join(", ")}}Y.isCompatibleEncoding=function(e){return D.test(e)},Y.parse=function(e,r){return(new Y).parse(e,r)},Y.isSingleOccurenceAttr=function(e){return"rel"===e||"type"===e||"media"===e||"title"===e||"title*"===e},Y.isTokenAttr=function(e){return"rel"===e||"type"===e||"anchor"===e},Y.escapeQuotes=function(e){return e.replace(/"/g,'\\"')},Y.expandRelations=function(e){return e.rel.split(" ").map((function(r){var t=Object.assign({},e);return t.rel=r,t}))},Y.parseExtendedValue=function(e){var r=/([^']+)?(?:'([^']+)')?(.+)/.exec(e);return{language:r[2].toLowerCase(),encoding:Y.isCompatibleEncoding(r[1])?null:r[1].toLowerCase(),value:Y.isCompatibleEncoding(r[1])?decodeURIComponent(r[3]):r[3]}},Y.formatExtendedAttribute=function(e,r){var t=(r.encoding||"utf-8").toUpperCase();return e+"="+t+"'"+(r.language||"en")+"'"+(Buffer.isBuffer(r.value)&&Y.isCompatibleEncoding(t)?r.value.toString(t):Buffer.isBuffer(r.value)?r.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(r.value))},Y.formatAttribute=function(e,r){return Array.isArray(r)?r.map((r=>Y.formatAttribute(e,r))).join("; "):"*"===e[e.length-1]||"string"!=typeof r?Y.formatExtendedAttribute(e,r):(Y.isTokenAttr(e)?r=X(r)?'"'+Y.escapeQuotes(r)+'"':Y.escapeQuotes(r):X(r)&&(r='"'+(r=(r=encodeURIComponent(r)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),e+"="+r)};var ee,re,te=Y;function ne(e){return e?te.parse(e).refs.map((function(e){var r=e.rel,o=e.uri,i=e.method,a=e["accept*"],s=e["params*"],l=n(e,["rel","uri","method","accept*","params*"]),u=(null==s?void 0:s.value)?JSON.parse(null==s?void 0:s.value):void 0;return new S(t({rel:r,uri:o,method:i,parameters:u,accept:null==a?void 0:a.value},l))})):[]}function oe(e){var r,o,i=e.name,s=e.href,l=e.fields,u=e.type,c=n(e,["name","href","fields","type"]),f={};if(l)try{for(var p=a(l),d=p.next();!d.done;d=p.next()){f[d.value.name]={}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}return t({rel:i,uri:s,accept:u,parameters:l&&f},c)}function ie(e,r){var o=r.href;r.rel;var i=n(r,["href","rel"]);return new S(t({rel:e,uri:o},i))}function ae(e,r){var o=e.handlers,i=e.defaultHandlers,a=e.headers,u=e.contentParser,c=n(e,["handlers","defaultHandlers","headers","contentParser"]),f=r||{},p=f.handlers,d=f.defaultHandlers,h=f.headers,y=f.contentParser,v=n(f,["handlers","defaultHandlers","headers","contentParser"]),b=ce(l(l([],s(p||o||[]),!1),s(d||i||[]),!1)),m=y?function(e){return y(e,u)}:u;return t(t(t({},c),v),{defaultHandlers:b,handlers:[],headers:t(t({},a),h),contentParser:m})}function se(e){return e.success}var le=function(){function e(e){var r,t,n,o,i,s,l=e.handlers,u=e.defaultOptions,c=e.baseResponse,p=e.content,d=e.fullContent,h=e.anchor,y=e.parentOperations,b=e.parameters;this.response=c,this.anchor=h,this.parameters=b||{},this.fullContent=d||p,this.content=p,this.operations=_.create();var m=v({this:p});if(y&&h&&u){this.allOperations=y;try{for(var w=a(this.allOperations[h]||[]),g=w.next();!g.done;g=w.next()){var O=g.value;this.operations.push(new C(O,this,u,m))}}catch(e){r={error:e}}finally{try{g&&!g.done&&(t=w.return)&&t.call(w)}finally{if(r)throw r.error}}for(var x in this.allOperations)if(""!==x){var j=new f.Template(x),k=j.match(this.anchor);if(j.expand(k)===this.anchor){var A=Object.assign({},u,{parameters:Object.assign(k,u.parameters)});try{for(var E=(n=void 0,a(this.allOperations[x])),I=E.next();!I.done;I=E.next()){O=I.value;this.operations.push(new C(O,this,A,m))}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}}}else if(c&&l&&u){this.allOperations=function(e){var r,t,n,o,i,s,l,u,c=e.handlers,f=e.baseResponse,p=e.content,d=[],h=!1;try{for(var y=a(c),v=y.next();!v.done;v=y.next()){var b=v.value.handler(f,p,(function(){h=!0}));if(b)try{for(var m=(n=void 0,a(b)),w=m.next();!w.done;w=m.next()){var g=w.value;d.push(g)}}catch(e){n={error:e}}finally{try{w&&!w.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}if(h)break}}catch(e){r={error:e}}finally{try{v&&!v.done&&(t=y.return)&&t.call(y)}finally{if(r)throw r.error}}var O={};try{for(var x=a(d),j=x.next();!j.done;j=x.next()){var k=U(g=j.value);try{for(var A=(l=void 0,a(k)),E=A.next();!E.done;E=A.next()){var I=E.value,R=I.anchor||"";O[R]||(O[R]=[]),O[R].push(I)}}catch(e){l={error:e}}finally{try{E&&!E.done&&(u=A.return)&&u.call(A)}finally{if(l)throw l.error}}}}catch(e){i={error:e}}finally{try{j&&!j.done&&(s=x.return)&&s.call(x)}finally{if(i)throw i.error}}return O}({baseResponse:c,content:p,handlers:l}),this.operations=_.create();try{for(var R=a(this.allOperations[""]||[]),P=R.next();!P.done;P=R.next()){O=P.value;var S=new C(O,this,u,m);this.operations.push(S)}}catch(e){i={error:e}}finally{try{P&&!P.done&&(s=R.return)&&s.call(R)}finally{if(i)throw i.error}}}}return e.create=function(r,t,n,o){if(t instanceof P)throw new ue({response:new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:t,parameters:o.parameters}),problem:t});if(o.validator){var i=o.validator(t);if(se(i))return new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:i.content,parameters:o.parameters});throw new ue({response:new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:t,parameters:o.parameters}),problem:i.problem})}return new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:t,parameters:o.parameters})},Object.defineProperty(e.prototype,"ops",{get:function(){return this.operations},enumerable:!1,configurable:!0}),e.prototype.invoke=function(e,r){return this.operations.invoke(e,r)},e.prototype.invokeAll=function(e,r){return this.operations.invokeAll(e,r)},Object.defineProperty(e.prototype,"body",{get:function(){throw new Error("Not Implemented. Use `.content` instead")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodyUsed",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headers",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.headers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ok",{get:function(){return!!this.response&&this.response.ok},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"redirected",{get:function(){return!!this.response&&this.response.redirected},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.url},enumerable:!1,configurable:!0}),e.prototype.arrayBuffer=function(){throw new Error("Not Implemented. Use `.content` instead")},e.prototype.blob=function(){throw new Error("Not Implemented. Use `.content` instead")},e.prototype.clone=function(){throw new Error("Not Implemented")},e.prototype.formData=function(){throw new Error("Not Implemented. Use `.content` instead")},e.prototype.text=function(){throw new Error("Not Implemented. Use `.content` instead")},e}(),ue=function(e){function t(r){var t=this.constructor,n=r.response,o=r.problem,i=e.call(this,o.detail)||this,a=t.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(i,a):i.__proto__=a,i.problem=o,i.response=n,i}return r(t,e),t}(Error);function ce(e){return e.sort((function(e,r){return(r.q||1)-(e.q||1)}))}function fe(e,r,n){var u;return o(this,void 0,void 0,(function(){var o,c,f,p,d,h,y,v,b,m,w,g,O,x,j,k,A,E,I,R,S,C,_,T,U;return i(this,(function(i){switch(i.label){case 0:if(o=ae(r,n),c=o.defaultHandlers,!o.fetch)throw new Error("No global fetch and fetch not provided in options");f=function(e){var r,t,n,o,i=[];try{for(var s=a(e),l=s.next();!l.done;l=s.next()){var u=l.value;try{for(var c=(n=void 0,a(u.mediaRanges)),f=c.next();!f.done;f=c.next()){var p=f.value;"object"==typeof p?u.q?i.push({type:p.mediaType,q:u.q*(p.q||1)}):i.push({type:p.mediaType,q:p.q||1}):u.q?i.push({type:p,q:u.q}):i.push({type:p,q:1})}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}var d=i.sort((function(e,r){return e.q-r.q})),h=new Set;return d.filter((function(e){var r=e.type;return!h.has(r)&&h.add(r)}))}(c),p=f.map((function(e){return 1===e.q?e.type:"".concat(e.type,";q=").concat(e.q)})),d=(null===(u=null==n?void 0:n.headers)||void 0===u?void 0:u.accept)?[n.headers.accept]:[],h=l(l([],s(d),!1),s(p),!1).join(","),y=t(t({},o),{headers:t(t({},o.headers),{accept:h})}),v=!1;try{for(b=a(y.preInterceptors||[]),m=b.next();!m.done&&((0,m.value)(e,y,(function(){return v=!0})),!v);m=b.next());}catch(e){R={error:e}}finally{try{m&&!m.done&&(S=b.return)&&S.call(b)}finally{if(R)throw R.error}}return[4,o.fetch(e.toString(),y)];case 1:w=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,o.contentParser(w)];case 3:g=i.sent(),k=le.create(w,g,r,o),v=!1;try{for(O=a(y.postInterceptors),x=O.next();!x.done&&((0,x.value)(k,(function(){return v=!0})),!v);x=O.next());}catch(e){C={error:e}}finally{try{x&&!x.done&&(_=O.return)&&_.call(O)}finally{if(C)throw C.error}}return[2,k];case 4:j=i.sent(),k=new le({handlers:o.defaultHandlers,defaultOptions:r,baseResponse:w,content:j,parameters:o.parameters}),A=new ue(j instanceof P?{response:k,problem:j}:{response:k,problem:new P({type:"https://waychaser.io/unexected-error",title:"An unexpected error occurred",error:j})}),v=!1;try{for(E=a(y.postErrorInterceptors),I=E.next();!I.done&&((0,I.value)(A,(function(){return v=!0})),!v);I=E.next());}catch(e){T={error:e}}finally{try{I&&!I.done&&(U=E.return)&&U.call(E)}finally{if(T)throw T.error}}throw A;case 5:return[2]}}))}))}var pe={fetch:"undefined"!=typeof window?null===(ee=window.fetch)||void 0===ee?void 0:ee.bind(window):null===(re="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0)||void 0===re?void 0:re.fetch,handlers:[],defaultHandlers:ce([{handler:function(e){var r=null==e?void 0:e.headers.get("location");return r?[new S({rel:"related",uri:r})]:[]},mediaRanges:["*/*"],q:.4},{handler:function(e,r,t){return l(l([],s(ne(e.headers.get("link"))),!1),s(ne(e.headers.get("link-template"))),!1)},mediaRanges:["*/*"],q:.5},{handler:function(e,r){var t,n,o,i,s,l,u,c=[],f=null===(u=e.headers.get("content-type"))||void 0===u?void 0:u.split(";");if((null==f?void 0:f[0])===q&&r&&"object"==typeof r&&"_links"in r){var p=r,d={};if(p._links.curies)if(Array.isArray(p._links.curies))try{for(var h=a(p._links.curies),y=h.next();!y.done;y=h.next()){var v=y.value;d[v.name]=v.href}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}else d[p._links.curies.name]=p._links.curies.href;try{for(var b=a(Object.keys(p._links).filter((function(e){return"curies"!==e}))),m=b.next();!m.done;m=b.next()){var w=m.value;if(Array.isArray(p._links[w]))try{for(var g=(s=void 0,a(p._links[w])),O=g.next();!O.done;O=g.next()){var x=O.value;c.push(H(w,x,d))}}catch(e){s={error:e}}finally{try{O&&!O.done&&(l=g.return)&&l.call(g)}finally{if(s)throw s.error}}else c.push(H(w,p._links[w],d))}}catch(e){o={error:e}}finally{try{m&&!m.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}}return c},mediaRanges:[q],q:.5},{handler:function(e,r){var t,n=null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";");return(null==n?void 0:n[0])===N?l(l([],s(function(e){var r,t,n,o,i=[];if(e&&"object"==typeof e&&"links"in e){var s=e;if(s.links)try{for(var l=a(s.links),u=l.next();!u.done;u=l.next()){var c=u.value;try{for(var f=(n=void 0,a(c.rel)),p=f.next();!p.done;p=f.next()){var d=ie(p.value,c);i.push(d)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(r)throw r.error}}}return i}(r)),!1),s(function(e){var r,t,n=[];if(e&&"object"==typeof e&&"actions"in e){var o=e;if(o.actions)try{for(var i=a(o.actions),s=i.next();!s.done;s=i.next()){var l=oe(s.value);n.push(l)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}}return n}(r)),!1):[]},mediaRanges:[N],q:.5}]),preInterceptors:[],postInterceptors:[],postErrorInterceptors:[],contentParser:function(e){return o(void 0,void 0,void 0,(function(){var r,t,n,o,a;return i(this,(function(i){switch(i.label){case 0:return e.headers.get("content-length")&&"0"!==e.headers.get("content-length")?[4,e.text()]:[3,2];case 1:if(r=i.sent(),null==(t=null===(a=null===(o=e.headers.get("content-type"))||void 0===o?void 0:o.split(";"))||void 0===a?void 0:a[0])?void 0:t.endsWith("json")){if(n=function(e,r){try{return JSON.parse(e)}catch(t){throw new P({type:"https://waychaser.io/invalid-json",title:"JSON response could not be parsed",detail:"The response document with content type '".concat(r,"' could not be parsed as json"),content:e,error:t})}}(r,t),"application/problem+json"===t)throw Object.assign(new P(n),n);return[2,n]}i.label=2;case 2:return[2]}}))}))}};function de(e,r){var t=ae(r,e),n=function(e,r){return fe(e,t,r)};return n.currentDefaults=t,n.defaults=function(e){return de(e,t)},n}var he=Object.assign((function(e,r){return fe(e,pe,r)}),{currentDefaults:pe,defaults:function(e){return de(e,pe)}});export{ue as WayChaserProblem,le as WayChaserResponse,fe as _waychaser,se as isValidationSuccess,ce as sortHandlers,he as waychaser};
|
|
1
|
+
var e=function(r,t){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(r,t)};function r(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var t=function(){return(t=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function n(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}function o(e,r,t,n){return new(t||(t=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,s)}l((n=n.apply(e,r||[])).next())}))}function i(e,r){var t,n,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(i=0)),i;)try{if(t=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=r.call(e,i)}catch(e){s=[6,e],n=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function a(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),a=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function l(e,r,t){if(t||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c={};!function(e){var r=/[!'()]/g,t={"":",","+":",","#":",","?":"&"},n=/[$-\/?[-^{|}]/g,o=/\{([#&+.\/;?]?)((?:[-\w%.]+(\*|:\d+)?,?)+)\}/g,i=RegExp(o.source+"|.[^{]*?","g");function a(e){return encodeURIComponent(e).replace(r,escape)}function s(e){return null!=e}function l(e,r,t){return(e=e.map(r).filter(s)).length&&e.join(t)}function u(e,r){return e.replace(o,(function(e,n,o){var i=t[n]||n,s=";"==i||"&"==i,u=n&&","==i?encodeURI:a,c=l(o.split(","),(function(e){var t=e.split(/[*:]/),n=t[0],o=r[n];if(null!=o){if("object"==typeof o){if(t=n!=e,Array.isArray(o)?o=l(o,u,t?s?i+n+"=":i:","):(o=l(Object.keys(o),(function(e){return u(e)+(t?"=":",")+u(o[e])}),t&&(s||"/"==i)?i:","),t&&(s=0)),!o)return}else o=u(t[1]?o.slice(0,t[1]):o);return s?n+(o||"&"==i?"="+o:o):o}}),i);return c||""===c?"+"!=n?n+c:c:""}))}e.expand=u,e.Template=function(e){var r=this,o=0,a={},s="",l="^"+e.replace(i,(function(e,r,n){if(!n)return p(e);var i=t[r]||r,l=";"==i||"&"==i,u=n.split(",").map((function(e){var r=e.split(/[*:]/),t=r[0],n=(a[t]||"(")+".*?)";return o++,r[1]&&(n="((?:%..|.){1,"+r[1]+"})",a[t]="(\\"+o),s+="t=($["+o+"]||'').split('"+i+"').map(decodeURIComponent);",s+='o["'+t+'"]=t.length>1?t:t[0];',l?p(t)+"(?:="+n+")?":"&"==i?p(t+"=")+n:n})).join(p(i));return"+"!=r?p(r)+u:u}))+"$",c=RegExp(l),f=Function("$","var t,o={};"+s+"return o");function p(e){return e.replace(n,"\\$&")}r.template=e,r.match=function(e){var r=c.exec(e);return r&&f(r)},r.expand=u.bind(r,e)}}(u.URI||(u.URI={}));const f=function(){const e="undefined"==typeof window?c.URI||global.URI:window.URI||c.URI;return e.parameters=function(e){return new f.Template(e).match(e)},e}();var p=Object.prototype.hasOwnProperty,d=function e(r,t){var n=[];for(var o in r)if(p.call(r,o)){var i,a=r[o],s=encodeURIComponent(o);i="object"==typeof a?e(a,t?t+"["+s+"]":s):(t?t+"["+s+"]":s)+"="+encodeURIComponent(a),n.push(i)}return n.join("&")},h="object"==typeof self?self.FormData:window.FormData;function y(e,r,t){if(e){return function(e){return e.split(",").map((function(e){var r,t,n=e.split(";"),o=n.shift(),i=null==o?void 0:o.split("/"),s={type:o,parentType:null==i?void 0:i[0],subType:null==i?void 0:i[1],q:1};try{for(var l=a(n),u=l.next();!u.done;u=l.next()){var c=u.value,f=c.split("=");"q"===c[0]&&(s[f[0]]=Number.parseFloat(f[1]))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(r)throw r.error}}return s})).sort((function(e,r){return e.q>r.q?-1:e.q<r.q||"*"===e.parentType&&"*"!==r.parentType?1:"*"!==e.parentType&&"*"===r.parentType?-1:"*"===e.subType&&"*"!==r.subType?1:"*"!==e.subType&&"*"===r.subType?-1:0})).map((function(e){return{type:e.type||""}})).filter((function(e){return""!==e.type}))}(e).find((e=>r.includes(e.type))).type}return t}var v=w;function b(e){return e&&e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function m(e){return e}function w(e,r){const t=(r=r||{}).delimiter||".",n=r.maxDepth,o=r.transformKey||m,i={};return function e(a,s,l){l=l||1,Object.keys(a).forEach((function(u){const c=a[u],f=r.safe&&Array.isArray(c),p=Object.prototype.toString.call(c),d=b(c),h="[object Object]"===p||"[object Array]"===p,y=s?s+t+o(u):o(u);if(!f&&!d&&h&&Object.keys(c).length&&(!r.maxDepth||l<n))return e(c,y,l+1);i[y]=c}))}(e),i}w.flatten=w,w.unflatten=function e(r,t){const n=(t=t||{}).delimiter||".",o=t.overwrite||!1,i=t.transformKey||m,a={};if(b(r)||"[object Object]"!==Object.prototype.toString.call(r))return r;function s(e){const r=Number(e);return isNaN(r)||-1!==e.indexOf(".")||t.object?e:r}return r=Object.keys(r).reduce((function(e,o){const i=Object.prototype.toString.call(r[o]);return!("[object Object]"===i||"[object Array]"===i)||function(e){const r=Object.prototype.toString.call(e),t="[object Array]"===r,n="[object Object]"===r;if(!e)return!0;if(t)return!e.length;if(n)return!Object.keys(e).length}(r[o])?(e[o]=r[o],e):function(e,r,t){return Object.keys(t).reduce((function(r,o){return r[e+n+o]=t[o],r}),r)}(o,e,w(r[o],t))}),{}),Object.keys(r).forEach((function(l){const u=l.split(n).map(i);let c=s(u.shift()),f=s(u[0]),p=a;for(;void 0!==f;){if("__proto__"===c)return;const e=Object.prototype.toString.call(p[c]),r="[object Object]"===e||"[object Array]"===e;if(!o&&!r&&void 0!==p[c])return;(o&&!r||!o&&null==p[c])&&(p[c]="number"!=typeof f||t.object?{}:[]),p=p[c],u.length>0&&(c=s(u.shift()),f=s(u[0]))}p[c]=e(r[l],t)})),a};var g={},O=/~/,j=/~[01]/g;function x(e){switch(e){case"~1":return"/";case"~0":return"~"}throw new Error("Invalid tilde escape: "+e)}function k(e){return O.test(e)?e.replace(j,x):e}function A(e){if("string"==typeof e){if(""===(e=e.split("/"))[0])return e;throw new Error("Invalid JSON pointer.")}if(Array.isArray(e)){for(const r of e)if("string"!=typeof r&&"number"!=typeof r)throw new Error("Invalid JSON pointer. Must be of type string or number.");return e}throw new Error("Invalid JSON pointer.")}function E(e,r){if("object"!=typeof e)throw new Error("Invalid input object.");var t=(r=A(r)).length;if(1===t)return e;for(var n=1;n<t;){if(e=e[k(r[n++])],t===n)return e;if("object"!=typeof e||null===e)return}}function I(e,r,t){if("object"!=typeof e)throw new Error("Invalid input object.");if(0===(r=A(r)).length)throw new Error("Invalid JSON pointer for set.");return function(e,r,t){for(var n,o,i=1,a=r.length;i<a;){if("constructor"===r[i]||"prototype"===r[i]||"__proto__"===r[i])return e;if(n=k(r[i++]),o=a>i,void 0===e[n]&&(Array.isArray(e)&&"-"===n&&(n=e.length),o&&(""!==r[i]&&r[i]<1/0||"-"===r[i]?e[n]=[]:e[n]={})),!o)break;e=e[n]}var s=e[n];return void 0===t?delete e[n]:e[n]=t,s}(e,r,t)}g.get=E,g.set=I,g.compile=function(e){var r=A(e);return{get:function(e){return E(e,r)},set:function(e,t){return I(e,r,t)}}};var R={};Object.defineProperty(R,"__esModule",{value:!0});var C=R.ProblemDocument=void 0;C=R.ProblemDocument=class{constructor(e){Object.assign(this,e)}};var S=function(e){var r=e.rel,t=e.uri,o=e.method,i=e.parameters,a=e.accept,s=e.anchor,l=n(e,["rel","uri","method","parameters","accept","anchor"]);this.rel=r,this.uri=t,this.method=o,this.parameters=i||{},this.accept=a,this.anchor=s,Object.assign(this,l)},P=function(e){function t(r,t,n,o){var i=e.call(this,r)||this;return i.response=t,i.defaultOptions=n,i.uri.includes("{this.")&&(i.uri=f.expand(i.uri,o)),i}return r(t,e),t.prototype.invokeAsFragment=function(e,r){if(this.uri.startsWith("#/")){var t=this.expandUrl(e).toString(),n=this.response.fullContent&&g.get(this.response.fullContent,t.slice(1));if(void 0===n)return;if(r){var o=r(n);if(se(o))return new le({defaultOptions:this.defaultOptions,baseResponse:this.response.response,content:o.content,fullContent:this.response.fullContent,anchor:t,parentOperations:this.response.allOperations,parameters:e});throw new ue({problem:o.problem,response:new le({defaultOptions:this.defaultOptions,baseResponse:this.response.response,content:n,fullContent:this.response.fullContent,parameters:e})})}return new le({defaultOptions:this.defaultOptions,baseResponse:this.response.response,content:n,fullContent:this.response.fullContent,anchor:t,parentOperations:this.response.allOperations,parameters:e})}},t.prototype.invokeAll=function(e){return o(this,void 0,void 0,(function(){var r;return i(this,(function(t){return this.uri.startsWith("#/")&&this.response instanceof le?(r=this.doInvokeAll((null==e?void 0:e.parameters)||{}),[2,Promise.all(r)]):[2,Promise.all([this.invoke(e)])]}))}))},t.prototype.doInvokeAll=function(e,r){var t=this,n=this.response,o=new f.Template(this.uri),i=Object.assign(f.parameters(this.uri),e),a=o.expand(i).replace(/%7B/g,"{").replace(/%7D/g,"}"),u=f.parameters(a),c=Object.keys(u);if(0!==c.length){var p=u[c[0]],d=a.slice(1,a.indexOf(p)-1),h=""===d?n.content:g.get(n.content,d);if(h)return(Array.isArray(h)?l([],s(Array.from({length:h.length}).keys()),!1):Object.keys(h)).flatMap((function(n){var o,i=Object.assign({},e,((o={})[c[0]]=n,o));return t.doInvokeAll(i,r)}));throw new ue({response:this.response,problem:new C({type:"https://waychaser.io/fragment-uri-error",title:"The fragment URI does not match the content structure",uri:d,content:n.content,parameters:e})})}return[this.invokeAsFragment(e,r)]},t.prototype.invoke=function(e){return o(this,void 0,void 0,(function(){var r,t,n,o,s,l,u,c,f,p,v,b,m,w,g,O,j,x;return i(this,(function(i){if(this.uri.startsWith("#/"))return[2,this.invokeAsFragment(null==e?void 0:e.parameters)];if(r=this.parameters||{},t=Object.assign({},this.defaultOptions.parameters,null==e?void 0:e.parameters),n=this.url(t),o={},Array.isArray(r))try{for(s=a(r),l=s.next();!l.done;l=s.next())f=l.value,o[f]=null==t?void 0:t[f]}catch(e){g={error:e}}finally{try{l&&!l.done&&(O=s.return)&&O.call(s)}finally{if(g)throw g.error}}else try{for(u=a(Object.keys(r)),c=u.next();!c.done;c=u.next())f=c.value,o[f]=null==t?void 0:t[f]}catch(e){j={error:e}}finally{try{c&&!c.done&&(x=u.return)&&x.call(u)}finally{if(j)throw j.error}}if(p=void 0,v={},(b=Object.assign({},e)).method=this.method,0!==Object.keys(this.parameters).length&&(k=this.method||"GET",!["GET","DELETE","TRACE","OPTIONS","HEAD"].includes(k))){switch(m=y(this.accept,["application/x-www-form-urlencoded","application/json","multipart/form-data"],"application/x-www-form-urlencoded")){case"application/x-www-form-urlencoded":p=d(o);break;case"application/json":p=JSON.stringify(o);break;case"multipart/form-data":for(w in p=new h,o)p.append(w,o[w])}"multipart/form-data"!==m&&(v={"content-type":m}),b.body=p,b.headers=Object.assign(v,null==e?void 0:e.headers)}return[2,fe(n.toString(),this.defaultOptions,b)];var k}))}))},t.prototype.url=function(e){var r=this.expandUrl(e);return new URL(r,this.response.url)},t.prototype.expandUrl=function(e){return f.expand(this.uri,v(e||{}))},t}(S),_=function(e){function t(r){return e.apply(this,l([],s(r||[]),!1))||this}return r(t,e),t.create=function(){return Object.create(t.prototype)},t.prototype.find=function(e,r){var t=Array.prototype.find.bind(this);return t("string"==typeof e?T({rel:e}):"object"==typeof e?T(e):e,r)},t.prototype.filter=function(e,r){if("string"==typeof e)return this.filter({rel:e},r);if("object"==typeof e)return this.filter(T(e),r);var n=Array.prototype.filter.bind(this)(e);return Object.setPrototypeOf(n,t.prototype),n},t.prototype.invoke=function(e,r){var t=this.find(e);return t?t.invoke(r):void 0},t.prototype.invokeAll=function(e,r){var t=this.filter(e);return Promise.all(t.map((function(e){return e.invokeAll(r)}))).then((function(e){return e.flat()}))},t}(Array);function T(e){return function(r){for(var t in e)if(e[t]!==r[t])return!1;return!0}}function U(e){var r,t,n,o,i=[],s=/{\[(\d+)..(\d+)]}/,l=e.uri.toString(),u=l.match(s);if(u)for(var c=Number.parseInt(u[1]);c<=Number.parseInt(u[2]);++c){var f=U(new S(Object.assign(e,{uri:l.replace(s,c.toFixed(0))})));try{for(var p=(r=void 0,a(f)),d=p.next();!d.done;d=p.next()){var h=d.value;i.push(h)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(t=p.return)&&t.call(p)}finally{if(r)throw r.error}}}else{var y=e.anchor,v=null==y?void 0:y.match(s);if(y&&v)for(c=Number.parseInt(v[1]);c<=Number.parseInt(v[2]);++c){f=U(new S(Object.assign(e,{anchor:y.replace(s,c.toFixed(0))})));try{for(var b=(n=void 0,a(f)),m=b.next();!m.done;m=b.next()){var w=m.value;i.push(w)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}}else i.push(e)}return i}const q="application/hal+json",N="application/vnd.siren+json";function F(e,r){const t=e.split(/:(.+)/);if(t.length>1){const[n,o]=t;return r[n]?f.expand(r[n],{rel:o}):e}return e}function L(e,r,t){const{href:n,templated:o,...i}=r;return new S({rel:F(e,t),uri:n,...i})}var H=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,D=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,$=/\s|\uFEFF|\xA0/,B=/\r?\n[\x20\x09]+/g,J=/[;,"]/,W=/[;,"]|\s/,G=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/,M=1,Q=2,K=4;function V(e){return e.replace(D,"")}function z(e){return $.test(e)}function Z(e,r){for(;z(e[r]);)r++;return r}function X(e){return W.test(e)||!G.test(e)}class Y{constructor(e){this.refs=[],e&&this.parse(e)}rel(e){for(var r=[],t=e.toLowerCase(),n=0;n<this.refs.length;n++)"string"==typeof this.refs[n].rel&&this.refs[n].rel.toLowerCase()===t&&r.push(this.refs[n]);return r}get(e,r){e=e.toLowerCase(),r=r.toLowerCase();for(var t=[],n=0;n<this.refs.length;n++)"string"==typeof this.refs[n][e]&&this.refs[n][e].toLowerCase()===r&&t.push(this.refs[n]);return t}set(e){return this.refs.push(e),this}setUnique(e){return this.refs.some((r=>{return t=r,n=e,Object.keys(t).length===Object.keys(n).length&&Object.keys(t).every((e=>e in n&&t[e]===n[e]));var t,n}))||this.refs.push(e),this}has(e,r){e=e.toLowerCase(),r=r.toLowerCase();for(var t=0;t<this.refs.length;t++)if("string"==typeof this.refs[t][e]&&this.refs[t][e].toLowerCase()===r)return!0;return!1}parse(e,r){e=V(e=(r=r||0)?e.slice(r):e).replace(B,"");for(var t=M,n=e.length,o=(r=0,null);r<n;)if(t===M){if(z(e[r])){r++;continue}if("<"!==e[r])throw new Error('Unexpected character "'+e[r]+'" at offset '+r);if(null!=o&&(null!=o.rel?this.refs.push(...Y.expandRelations(o)):this.refs.push(o)),-1===(s=e.indexOf(">",r)))throw new Error("Expected end of URI delimiter at offset "+r);o={uri:e.slice(r+1,s)},r=s,t=Q,r++}else if(t===Q){if(z(e[r])){r++;continue}if(";"===e[r])t=K,r++;else{if(","!==e[r])throw new Error('Unexpected character "'+e[r]+'" at offset '+r);t=M,r++}}else{if(t!==K)throw new Error('Unknown parser state "'+t+'"');if(";"===e[r]||z(e[r])){r++;continue}-1===(s=e.indexOf("=",r))&&(s=e.indexOf(";",r)),-1===s&&(s=e.length);var i=V(e.slice(r,s)).toLowerCase(),a="";if('"'===e[r=Z(e,r=s+1)])for(r++;r<n;){if('"'===e[r]){r++;break}"\\"===e[r]&&r++,a+=e[r],r++}else{for(var s=r+1;!J.test(e[s])&&s<n;)s++;a=e.slice(r,s),r=s}switch(o[i]&&Y.isSingleOccurenceAttr(i)||("*"===i[i.length-1]?o[i]=Y.parseExtendedValue(a):(a="type"===i?a.toLowerCase():a,null!=o[i]?Array.isArray(o[i])?o[i].push(a):o[i]=[o[i],a]:o[i]=a)),e[r]){case",":t=M;break;case";":t=K}r++}return null!=o&&(null!=o.rel?this.refs.push(...Y.expandRelations(o)):this.refs.push(o)),o=null,this}toString(){for(var e=[],r="",t=null,n=0;n<this.refs.length;n++)t=this.refs[n],r=Object.keys(this.refs[n]).reduce((function(e,r){return"uri"===r?e:e+"; "+Y.formatAttribute(r,t[r])}),"<"+t.uri+">"),e.push(r);return e.join(", ")}}Y.isCompatibleEncoding=function(e){return H.test(e)},Y.parse=function(e,r){return(new Y).parse(e,r)},Y.isSingleOccurenceAttr=function(e){return"rel"===e||"type"===e||"media"===e||"title"===e||"title*"===e},Y.isTokenAttr=function(e){return"rel"===e||"type"===e||"anchor"===e},Y.escapeQuotes=function(e){return e.replace(/"/g,'\\"')},Y.expandRelations=function(e){return e.rel.split(" ").map((function(r){var t=Object.assign({},e);return t.rel=r,t}))},Y.parseExtendedValue=function(e){var r=/([^']+)?(?:'([^']*)')?(.+)/.exec(e);return{language:r[2].toLowerCase(),encoding:Y.isCompatibleEncoding(r[1])?null:r[1].toLowerCase(),value:Y.isCompatibleEncoding(r[1])?decodeURIComponent(r[3]):r[3]}},Y.formatExtendedAttribute=function(e,r){var t=(r.encoding||"utf-8").toUpperCase();return e+"="+t+"'"+(r.language||"en")+"'"+(Buffer.isBuffer(r.value)&&Y.isCompatibleEncoding(t)?r.value.toString(t):Buffer.isBuffer(r.value)?r.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(r.value))},Y.formatAttribute=function(e,r){return Array.isArray(r)?r.map((r=>Y.formatAttribute(e,r))).join("; "):"*"===e[e.length-1]||"string"!=typeof r?Y.formatExtendedAttribute(e,r):(Y.isTokenAttr(e)?r=X(r)?'"'+Y.escapeQuotes(r)+'"':Y.escapeQuotes(r):X(r)&&(r='"'+(r=(r=encodeURIComponent(r)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),e+"="+r)};var ee,re,te=Y;function ne(e){return e?te.parse(e).refs.map((function(e){var r=e.rel,o=e.uri,i=e.method,a=e["accept*"],s=e["params*"],l=n(e,["rel","uri","method","accept*","params*"]),u=(null==s?void 0:s.value)?JSON.parse(null==s?void 0:s.value):void 0;return new S(t({rel:r,uri:o,method:i,parameters:u,accept:null==a?void 0:a.value},l))})):[]}function oe(e){var r,o,i=e.name,s=e.href,l=e.fields,u=e.type,c=n(e,["name","href","fields","type"]),f={};if(l)try{for(var p=a(l),d=p.next();!d.done;d=p.next()){f[d.value.name]={}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}return t({rel:i,uri:s,accept:u,parameters:l&&f},c)}function ie(e,r){var o=r.href;r.rel;var i=n(r,["href","rel"]);return new S(t({rel:e,uri:o},i))}function ae(e,r){var o=e.handlers,i=e.defaultHandlers,a=e.headers,u=e.contentParser,c=n(e,["handlers","defaultHandlers","headers","contentParser"]),f=r||{},p=f.handlers,d=f.defaultHandlers,h=f.headers,y=f.contentParser,v=n(f,["handlers","defaultHandlers","headers","contentParser"]),b=ce(l(l([],s(p||o||[]),!1),s(d||i||[]),!1)),m=y?function(e){return y(e,u)}:u;return t(t(t({},c),v),{defaultHandlers:b,handlers:[],headers:t(t({},a),h),contentParser:m})}function se(e){return e.success}var le=function(){function e(e){var r,t,n,o,i,s,l=e.handlers,u=e.defaultOptions,c=e.baseResponse,p=e.content,d=e.fullContent,h=e.anchor,y=e.parentOperations,b=e.parameters;this.response=c,this.anchor=h,this.parameters=b||{},this.fullContent=d||p,this.content=p,this.operations=_.create();var m=v({this:p});if(y&&h&&u){this.allOperations=y;try{for(var w=a(this.allOperations[h]||[]),g=w.next();!g.done;g=w.next()){var O=g.value;this.operations.push(new P(O,this,u,m))}}catch(e){r={error:e}}finally{try{g&&!g.done&&(t=w.return)&&t.call(w)}finally{if(r)throw r.error}}for(var j in this.allOperations)if(""!==j){var x=new f.Template(j),k=x.match(this.anchor);if(x.expand(k)===this.anchor){var A=Object.assign({},u,{parameters:Object.assign(k,u.parameters)});try{for(var E=(n=void 0,a(this.allOperations[j])),I=E.next();!I.done;I=E.next()){O=I.value;this.operations.push(new P(O,this,A,m))}}catch(e){n={error:e}}finally{try{I&&!I.done&&(o=E.return)&&o.call(E)}finally{if(n)throw n.error}}}}}else if(c&&l&&u){this.allOperations=function(e){var r,t,n,o,i,s,l,u,c=e.handlers,f=e.baseResponse,p=e.content,d=[],h=!1;try{for(var y=a(c),v=y.next();!v.done;v=y.next()){var b=v.value.handler(f,p,(function(){h=!0}));if(b)try{for(var m=(n=void 0,a(b)),w=m.next();!w.done;w=m.next()){var g=w.value;d.push(g)}}catch(e){n={error:e}}finally{try{w&&!w.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}if(h)break}}catch(e){r={error:e}}finally{try{v&&!v.done&&(t=y.return)&&t.call(y)}finally{if(r)throw r.error}}var O={};try{for(var j=a(d),x=j.next();!x.done;x=j.next()){var k=U(g=x.value);try{for(var A=(l=void 0,a(k)),E=A.next();!E.done;E=A.next()){var I=E.value,R=I.anchor||"";O[R]||(O[R]=[]),O[R].push(I)}}catch(e){l={error:e}}finally{try{E&&!E.done&&(u=A.return)&&u.call(A)}finally{if(l)throw l.error}}}}catch(e){i={error:e}}finally{try{x&&!x.done&&(s=j.return)&&s.call(j)}finally{if(i)throw i.error}}return O}({baseResponse:c,content:p,handlers:l}),this.operations=_.create();try{for(var R=a(this.allOperations[""]||[]),C=R.next();!C.done;C=R.next()){O=C.value;var S=new P(O,this,u,m);this.operations.push(S)}}catch(e){i={error:e}}finally{try{C&&!C.done&&(s=R.return)&&s.call(R)}finally{if(i)throw i.error}}}}return e.create=function(r,t,n,o){if(t instanceof C)throw new ue({response:new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:t,parameters:o.parameters}),problem:t});if(o.validator){var i=o.validator(t);if(se(i))return new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:i.content,parameters:o.parameters});throw new ue({response:new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:t,parameters:o.parameters}),problem:i.problem})}return new e({handlers:o.defaultHandlers,defaultOptions:n,baseResponse:r,content:t,parameters:o.parameters})},Object.defineProperty(e.prototype,"ops",{get:function(){return this.operations},enumerable:!1,configurable:!0}),e.prototype.invoke=function(e,r){return this.operations.invoke(e,r)},e.prototype.invokeAll=function(e,r){return this.operations.invokeAll(e,r)},Object.defineProperty(e.prototype,"body",{get:function(){throw new Error("Not Implemented. Use `.content` instead")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodyUsed",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headers",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.headers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ok",{get:function(){return!!this.response&&this.response.ok},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"redirected",{get:function(){return!!this.response&&this.response.redirected},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.status},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statusText",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.statusText},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){var e;return null===(e=this.response)||void 0===e?void 0:e.url},enumerable:!1,configurable:!0}),e.prototype.arrayBuffer=function(){throw new Error("Not Implemented. Use `.content` instead")},e.prototype.blob=function(){throw new Error("Not Implemented. Use `.content` instead")},e.prototype.clone=function(){throw new Error("Not Implemented")},e.prototype.formData=function(){throw new Error("Not Implemented. Use `.content` instead")},e.prototype.text=function(){throw new Error("Not Implemented. Use `.content` instead")},e}(),ue=function(e){function t(r){var t=this.constructor,n=r.response,o=r.problem,i=e.call(this,o.detail)||this,a=t.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(i,a):i.__proto__=a,i.problem=o,i.response=n,i}return r(t,e),t}(Error);function ce(e){return e.sort((function(e,r){return(r.q||1)-(e.q||1)}))}function fe(e,r,n){var u;return o(this,void 0,void 0,(function(){var o,c,f,p,d,h,y,v,b,m,w,g,O,j,x,k,A,E,I,R,S,P,_,T,U;return i(this,(function(i){switch(i.label){case 0:if(o=ae(r,n),c=o.defaultHandlers,!o.fetch)throw new Error("No global fetch and fetch not provided in options");f=function(e){var r,t,n,o,i=[];try{for(var s=a(e),l=s.next();!l.done;l=s.next()){var u=l.value;try{for(var c=(n=void 0,a(u.mediaRanges)),f=c.next();!f.done;f=c.next()){var p=f.value;"object"==typeof p?u.q?i.push({type:p.mediaType,q:u.q*(p.q||1)}):i.push({type:p.mediaType,q:p.q||1}):u.q?i.push({type:p,q:u.q}):i.push({type:p,q:1})}}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}var d=i.sort((function(e,r){return e.q-r.q})),h=new Set;return d.filter((function(e){var r=e.type;return!h.has(r)&&h.add(r)}))}(c),p=f.map((function(e){return 1===e.q?e.type:"".concat(e.type,";q=").concat(e.q)})),d=(null===(u=null==n?void 0:n.headers)||void 0===u?void 0:u.accept)?[n.headers.accept]:[],h=l(l([],s(d),!1),s(p),!1).join(","),y=t(t({},o),{headers:t(t({},o.headers),{accept:h})}),v=!1;try{for(b=a(y.preInterceptors||[]),m=b.next();!m.done&&((0,m.value)(e,y,(function(){return v=!0})),!v);m=b.next());}catch(e){R={error:e}}finally{try{m&&!m.done&&(S=b.return)&&S.call(b)}finally{if(R)throw R.error}}return[4,o.fetch(e.toString(),y)];case 1:w=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,o.contentParser(w)];case 3:g=i.sent(),k=le.create(w,g,r,o),v=!1;try{for(O=a(y.postInterceptors),j=O.next();!j.done&&((0,j.value)(k,(function(){return v=!0})),!v);j=O.next());}catch(e){P={error:e}}finally{try{j&&!j.done&&(_=O.return)&&_.call(O)}finally{if(P)throw P.error}}return[2,k];case 4:x=i.sent(),k=new le({handlers:o.defaultHandlers,defaultOptions:r,baseResponse:w,content:x,parameters:o.parameters}),A=new ue(x instanceof C?{response:k,problem:x}:{response:k,problem:new C({type:"https://waychaser.io/unexected-error",title:"An unexpected error occurred",error:x})}),v=!1;try{for(E=a(y.postErrorInterceptors),I=E.next();!I.done&&((0,I.value)(A,(function(){return v=!0})),!v);I=E.next());}catch(e){T={error:e}}finally{try{I&&!I.done&&(U=E.return)&&U.call(E)}finally{if(T)throw T.error}}throw A;case 5:return[2]}}))}))}var pe={fetch:"undefined"!=typeof window?null===(ee=window.fetch)||void 0===ee?void 0:ee.bind(window):null===(re="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0)||void 0===re?void 0:re.fetch,handlers:[],defaultHandlers:ce([{handler:function(e){var r=null==e?void 0:e.headers.get("location");return r?[new S({rel:"related",uri:r})]:[]},mediaRanges:["*/*"],q:.4},{handler:function(e,r,t){return l(l([],s(ne(e.headers.get("link"))),!1),s(ne(e.headers.get("link-template"))),!1)},mediaRanges:["*/*"],q:.5},{handler:function(e,r){var t,n,o,i,s,l,u,c=[],f=null===(u=e.headers.get("content-type"))||void 0===u?void 0:u.split(";");if((null==f?void 0:f[0])===q&&r&&"object"==typeof r&&"_links"in r){var p=r,d={};if(p._links.curies)if(Array.isArray(p._links.curies))try{for(var h=a(p._links.curies),y=h.next();!y.done;y=h.next()){var v=y.value;d[v.name]=v.href}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}else d[p._links.curies.name]=p._links.curies.href;try{for(var b=a(Object.keys(p._links).filter((function(e){return"curies"!==e}))),m=b.next();!m.done;m=b.next()){var w=m.value;if(Array.isArray(p._links[w]))try{for(var g=(s=void 0,a(p._links[w])),O=g.next();!O.done;O=g.next()){var j=O.value;c.push(L(w,j,d))}}catch(e){s={error:e}}finally{try{O&&!O.done&&(l=g.return)&&l.call(g)}finally{if(s)throw s.error}}else c.push(L(w,p._links[w],d))}}catch(e){o={error:e}}finally{try{m&&!m.done&&(i=b.return)&&i.call(b)}finally{if(o)throw o.error}}}return c},mediaRanges:[q],q:.5},{handler:function(e,r){var t,n=null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";");return(null==n?void 0:n[0])===N?l(l([],s(function(e){var r,t,n,o,i=[];if(e&&"object"==typeof e&&"links"in e){var s=e;if(s.links)try{for(var l=a(s.links),u=l.next();!u.done;u=l.next()){var c=u.value;try{for(var f=(n=void 0,a(c.rel)),p=f.next();!p.done;p=f.next()){var d=ie(p.value,c);i.push(d)}}catch(e){n={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(r)throw r.error}}}return i}(r)),!1),s(function(e){var r,t,n=[];if(e&&"object"==typeof e&&"actions"in e){var o=e;if(o.actions)try{for(var i=a(o.actions),s=i.next();!s.done;s=i.next()){var l=oe(s.value);n.push(l)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}}return n}(r)),!1):[]},mediaRanges:[N],q:.5}]),preInterceptors:[],postInterceptors:[],postErrorInterceptors:[],contentParser:function(e){return o(void 0,void 0,void 0,(function(){var r,t,n,o,a;return i(this,(function(i){switch(i.label){case 0:return e.headers.get("content-length")&&"0"!==e.headers.get("content-length")?[4,e.text()]:[3,2];case 1:if(r=i.sent(),null==(t=null===(a=null===(o=e.headers.get("content-type"))||void 0===o?void 0:o.split(";"))||void 0===a?void 0:a[0])?void 0:t.endsWith("json")){if(n=function(e,r){try{return JSON.parse(e)}catch(t){throw new C({type:"https://waychaser.io/invalid-json",title:"JSON response could not be parsed",detail:"The response document with content type '".concat(r,"' could not be parsed as json"),content:e,error:t})}}(r,t),"application/problem+json"===t)throw Object.assign(new C(n),n);return[2,n]}i.label=2;case 2:return[2]}}))}))}};function de(e,r){var t=ae(r,e),n=function(e,r){return fe(e,t,r)};return n.currentDefaults=t,n.defaults=function(e){return de(e,t)},n}var he=Object.assign((function(e,r){return fe(e,pe,r)}),{currentDefaults:pe,defaults:function(e){return de(e,pe)}});export{ue as WayChaserProblem,le as WayChaserResponse,fe as _waychaser,se as isValidationSuccess,ce as sortHandlers,he as waychaser};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mountainpass/waychaser",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.14",
|
|
4
4
|
"description": "Client library for HATEOAS level 3 RESTful APIs that provide hypermedia controls",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"depcheck": "^1.2.0",
|
|
177
177
|
"dirty-chai": "^2.0.1",
|
|
178
178
|
"dry-aged-deps": "^2.6.0",
|
|
179
|
-
"eslint": "^8",
|
|
179
|
+
"eslint": "^8.18.0",
|
|
180
180
|
"eslint-config-prettier": "^8.5.0",
|
|
181
181
|
"eslint-import-resolver-node": "^0.3.6",
|
|
182
182
|
"eslint-import-resolver-typescript": "^2.7.1",
|