@glodon-aiot/agent-cli-sdk 3.0.9 → 3.0.10-beta.1
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/cdn/agent-cli-sdk.js +34022 -0
- package/cdn/agent-cli-sdk.umd.cjs +145 -0
- package/cdn/src/AgentPlugin.d.ts +17 -0
- package/cdn/src/AgentSession.d.ts +9 -0
- package/cdn/src/BotClient.d.ts +48 -0
- package/cdn/src/Config.d.ts +32 -0
- package/cdn/src/DialogSession.d.ts +22 -0
- package/cdn/src/EventBus.d.ts +23 -0
- package/cdn/src/Logger.d.ts +12 -0
- package/cdn/src/PayloadTypes.d.ts +84 -0
- package/cdn/src/Session.d.ts +209 -0
- package/cdn/src/api/fetchEventSource/fetch.d.ts +44 -0
- package/cdn/src/api/fetchEventSource/index.d.ts +1 -0
- package/cdn/src/api/fetchEventSource/parse.d.ts +36 -0
- package/cdn/src/api/index.d.ts +2 -0
- package/cdn/src/index.d.ts +5 -0
- package/cdn/src/utils.d.ts +4 -0
- package/dist/es/AgentPlugin.mjs +20 -0
- package/dist/es/AgentSession.mjs +246 -0
- package/dist/es/BotClient.mjs +236 -0
- package/dist/es/Config.mjs +34 -0
- package/dist/es/DialogSession.mjs +274 -0
- package/dist/es/EventBus.mjs +64 -0
- package/dist/es/Logger.mjs +31 -0
- package/dist/es/PayloadTypes.mjs +4 -0
- package/dist/es/Session.mjs +690 -0
- package/dist/es/api/fetchEventSource/fetch.mjs +112 -0
- package/dist/es/api/fetchEventSource/parse.mjs +97 -0
- package/dist/es/api/index.mjs +41 -0
- package/dist/es/index.mjs +11 -0
- package/dist/es/node_modules/@socket.io/component-emitter/lib/esm/index.mjs +54 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/has-cors.mjs +9 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseqs.mjs +18 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/parseuri.mjs +24 -0
- package/dist/es/node_modules/engine.io-client/build/esm/contrib/yeast.mjs +19 -0
- package/dist/es/node_modules/engine.io-client/build/esm/globalThis.browser.mjs +4 -0
- package/dist/es/node_modules/engine.io-client/build/esm/socket.mjs +317 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transport.mjs +113 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/index.mjs +11 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/polling.mjs +273 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.mjs +8 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/websocket.mjs +87 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/webtransport.mjs +52 -0
- package/dist/es/node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.mjs +21 -0
- package/dist/es/node_modules/engine.io-client/build/esm/util.mjs +23 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/commons.mjs +21 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/contrib/base64-arraybuffer.mjs +14 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/decodePacket.browser.mjs +39 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/encodePacket.browser.mjs +28 -0
- package/dist/es/node_modules/engine.io-parser/build/esm/index.mjs +105 -0
- package/dist/es/node_modules/js-base64/base64.mjs +31 -0
- package/dist/es/node_modules/socket.io-client/build/esm/contrib/backo2.mjs +26 -0
- package/dist/es/node_modules/socket.io-client/build/esm/index.mjs +25 -0
- package/dist/es/node_modules/socket.io-client/build/esm/manager.mjs +242 -0
- package/dist/es/node_modules/socket.io-client/build/esm/on.mjs +8 -0
- package/dist/es/node_modules/socket.io-client/build/esm/socket.mjs +608 -0
- package/dist/es/node_modules/socket.io-client/build/esm/url.mjs +19 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/binary.mjs +52 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/index.mjs +203 -0
- package/dist/es/node_modules/socket.io-parser/build/esm/is-binary.mjs +26 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/native.mjs +6 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/rng.mjs +10 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/stringify.mjs +9 -0
- package/dist/es/node_modules/uuid/dist/esm-browser/v4.mjs +19 -0
- package/dist/es/utils.mjs +11 -0
- package/dist/lib/index.js +4 -0
- package/dist/src/AgentSession.d.ts +2 -2
- package/dist/src/BotClient.d.ts +2 -2
- package/dist/src/DialogSession.d.ts +2 -2
- package/dist/src/Session.d.ts +9 -11
- package/dist/src/api/fetchEventSource/fetch.d.ts +1 -1
- package/dist/src/api/fetchEventSource/index.d.ts +1 -1
- package/package.json +18 -11
- package/dist/agent-cli-sdk.js +0 -33144
- package/dist/agent-cli-sdk.umd.cjs +0 -140
- package/dist/src/__ tests __/AgentClient.spec.d.ts +0 -1
- package/dist/src/__ tests __/AgentSession.spec.d.ts +0 -1
- package/dist/src/__ tests __/DialogClient.spec.d.ts +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var W = Object.defineProperty, j = Object.defineProperties;
|
|
2
|
+
var k = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var v = Object.getOwnPropertySymbols;
|
|
4
|
+
var A = Object.prototype.hasOwnProperty, R = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var I = (t, e, a) => e in t ? W(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a, E = (t, e) => {
|
|
6
|
+
for (var a in e || (e = {}))
|
|
7
|
+
A.call(e, a) && I(t, a, e[a]);
|
|
8
|
+
if (v)
|
|
9
|
+
for (var a of v(e))
|
|
10
|
+
R.call(e, a) && I(t, a, e[a]);
|
|
11
|
+
return t;
|
|
12
|
+
}, $ = (t, e) => j(t, k(e));
|
|
13
|
+
var q = (t, e) => {
|
|
14
|
+
var a = {};
|
|
15
|
+
for (var n in t)
|
|
16
|
+
A.call(t, n) && e.indexOf(n) < 0 && (a[n] = t[n]);
|
|
17
|
+
if (t != null && v)
|
|
18
|
+
for (var n of v(t))
|
|
19
|
+
e.indexOf(n) < 0 && R.call(t, n) && (a[n] = t[n]);
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var B = (t, e, a) => new Promise((n, w) => {
|
|
23
|
+
var o = (r) => {
|
|
24
|
+
try {
|
|
25
|
+
c(a.next(r));
|
|
26
|
+
} catch (d) {
|
|
27
|
+
w(d);
|
|
28
|
+
}
|
|
29
|
+
}, i = (r) => {
|
|
30
|
+
try {
|
|
31
|
+
c(a.throw(r));
|
|
32
|
+
} catch (d) {
|
|
33
|
+
w(d);
|
|
34
|
+
}
|
|
35
|
+
}, c = (r) => r.done ? n(r.value) : Promise.resolve(r.value).then(o, i);
|
|
36
|
+
c((a = a.apply(t, e)).next());
|
|
37
|
+
});
|
|
38
|
+
import { getBytes as z, getLines as G, getMessages as H } from "./parse.mjs";
|
|
39
|
+
const g = "text/event-stream", J = 1e3, D = "last-event-id";
|
|
40
|
+
function X(t, N) {
|
|
41
|
+
var u = N, {
|
|
42
|
+
signal: e,
|
|
43
|
+
headers: a,
|
|
44
|
+
onopen: n,
|
|
45
|
+
onmessage: w,
|
|
46
|
+
onclose: o,
|
|
47
|
+
onerror: i,
|
|
48
|
+
openWhenHidden: c,
|
|
49
|
+
fetch: r
|
|
50
|
+
} = u, d = q(u, [
|
|
51
|
+
"signal",
|
|
52
|
+
"headers",
|
|
53
|
+
"onopen",
|
|
54
|
+
"onmessage",
|
|
55
|
+
"onclose",
|
|
56
|
+
"onerror",
|
|
57
|
+
"openWhenHidden",
|
|
58
|
+
"fetch"
|
|
59
|
+
]);
|
|
60
|
+
return new Promise((L, M) => {
|
|
61
|
+
const f = E({}, a);
|
|
62
|
+
f.accept || (f.accept = g);
|
|
63
|
+
let l;
|
|
64
|
+
function C() {
|
|
65
|
+
l.abort(), document.hidden || b();
|
|
66
|
+
}
|
|
67
|
+
c || document.addEventListener("visibilitychange", C);
|
|
68
|
+
let T = J, y = 0;
|
|
69
|
+
function h() {
|
|
70
|
+
document.removeEventListener("visibilitychange", C), window.clearTimeout(y), l.abort();
|
|
71
|
+
}
|
|
72
|
+
e == null || e.addEventListener("abort", () => {
|
|
73
|
+
h(), L();
|
|
74
|
+
});
|
|
75
|
+
const P = r != null ? r : window.fetch, V = n != null ? n : K;
|
|
76
|
+
function b() {
|
|
77
|
+
return B(this, null, function* () {
|
|
78
|
+
var x;
|
|
79
|
+
l = new AbortController();
|
|
80
|
+
try {
|
|
81
|
+
const m = yield P(t, $(E({}, d), {
|
|
82
|
+
headers: f,
|
|
83
|
+
signal: l.signal
|
|
84
|
+
}));
|
|
85
|
+
yield V(m), yield z(m.body, G(H((s) => {
|
|
86
|
+
s ? f[D] = s : delete f[D];
|
|
87
|
+
}, (s) => {
|
|
88
|
+
T = s;
|
|
89
|
+
}, w))), o == null || o(), h(), L();
|
|
90
|
+
} catch (m) {
|
|
91
|
+
if (!l.signal.aborted)
|
|
92
|
+
try {
|
|
93
|
+
const s = (x = i == null ? void 0 : i(m)) != null ? x : T;
|
|
94
|
+
window.clearTimeout(y), y = window.setTimeout(b, s);
|
|
95
|
+
} catch (s) {
|
|
96
|
+
h(), M(s);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
b();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function K(t) {
|
|
105
|
+
const e = t.headers.get("content-type");
|
|
106
|
+
if (!(e != null && e.startsWith(g)))
|
|
107
|
+
throw new Error(`Expected content-type to be ${g}, Actual: ${e}`);
|
|
108
|
+
}
|
|
109
|
+
export {
|
|
110
|
+
g as EventStreamContentType,
|
|
111
|
+
X as fetchEventSource
|
|
112
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var b = (s, t, e) => new Promise((a, c) => {
|
|
2
|
+
var f = (r) => {
|
|
3
|
+
try {
|
|
4
|
+
i(e.next(r));
|
|
5
|
+
} catch (n) {
|
|
6
|
+
c(n);
|
|
7
|
+
}
|
|
8
|
+
}, l = (r) => {
|
|
9
|
+
try {
|
|
10
|
+
i(e.throw(r));
|
|
11
|
+
} catch (n) {
|
|
12
|
+
c(n);
|
|
13
|
+
}
|
|
14
|
+
}, i = (r) => r.done ? a(r.value) : Promise.resolve(r.value).then(f, l);
|
|
15
|
+
i((e = e.apply(s, t)).next());
|
|
16
|
+
});
|
|
17
|
+
function w(s, t) {
|
|
18
|
+
return b(this, null, function* () {
|
|
19
|
+
const e = s.getReader();
|
|
20
|
+
let a;
|
|
21
|
+
for (; !(a = yield e.read()).done; )
|
|
22
|
+
t(a.value);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function g(s) {
|
|
26
|
+
let t, e, a, c = !1, f;
|
|
27
|
+
return function(i) {
|
|
28
|
+
t === void 0 ? (t = i, e = 0, a = -1, f = !1) : t = h(t, i);
|
|
29
|
+
const r = t.length;
|
|
30
|
+
let n = 0;
|
|
31
|
+
for (; e < r; ) {
|
|
32
|
+
c && (t[e] === 10 && (n = ++e), c = !1);
|
|
33
|
+
let o = -1;
|
|
34
|
+
for (; e < r && o === -1; ++e)
|
|
35
|
+
switch (t[e]) {
|
|
36
|
+
case 58:
|
|
37
|
+
a === -1 && (a = e - n);
|
|
38
|
+
break;
|
|
39
|
+
case 13:
|
|
40
|
+
c = !1, e + 4 < r && t[e + 1] === 10 && t[e + 2] !== 13 && t[e - 1] !== 10 && t[e - 2] !== 13 && (f = !0);
|
|
41
|
+
case 10:
|
|
42
|
+
o = e;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
if (o === -1)
|
|
46
|
+
break;
|
|
47
|
+
s(t.subarray(n, o), a, f), n = e, a = -1, f = !1;
|
|
48
|
+
}
|
|
49
|
+
n === r ? t = void 0 : n !== 0 && (t = t.subarray(n), e -= n);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function k(s, t, e) {
|
|
53
|
+
let a = y();
|
|
54
|
+
const c = new TextDecoder();
|
|
55
|
+
return function(l, i, r) {
|
|
56
|
+
if (l.length === 0)
|
|
57
|
+
e == null || e(a), a = y();
|
|
58
|
+
else if (i > 0) {
|
|
59
|
+
const n = c.decode(l.subarray(0, i)), o = i + (l[i + 1] === 32 ? 2 : 1);
|
|
60
|
+
let d = c.decode(l.subarray(o));
|
|
61
|
+
switch (r && (d += `
|
|
62
|
+
`), n) {
|
|
63
|
+
case "data":
|
|
64
|
+
a.data = a.data ? a.data + `
|
|
65
|
+
` + d : d;
|
|
66
|
+
break;
|
|
67
|
+
case "event":
|
|
68
|
+
a.event = d;
|
|
69
|
+
break;
|
|
70
|
+
case "id":
|
|
71
|
+
s(a.id = d);
|
|
72
|
+
break;
|
|
73
|
+
case "retry":
|
|
74
|
+
const u = parseInt(d, 10);
|
|
75
|
+
isNaN(u) || t(a.retry = u);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function h(s, t) {
|
|
82
|
+
const e = new Uint8Array(s.length + t.length);
|
|
83
|
+
return e.set(s), e.set(t, s.length), e;
|
|
84
|
+
}
|
|
85
|
+
function y() {
|
|
86
|
+
return {
|
|
87
|
+
data: "",
|
|
88
|
+
event: "",
|
|
89
|
+
id: "",
|
|
90
|
+
retry: void 0
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
w as getBytes,
|
|
95
|
+
g as getLines,
|
|
96
|
+
k as getMessages
|
|
97
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var d = Object.defineProperty, h = Object.defineProperties;
|
|
2
|
+
var x = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var c = Object.getOwnPropertySymbols;
|
|
4
|
+
var E = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var a = (t, e, o) => e in t ? d(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o, f = (t, e) => {
|
|
6
|
+
for (var o in e || (e = {}))
|
|
7
|
+
E.call(e, o) && a(t, o, e[o]);
|
|
8
|
+
if (c)
|
|
9
|
+
for (var o of c(e))
|
|
10
|
+
I.call(e, o) && a(t, o, e[o]);
|
|
11
|
+
return t;
|
|
12
|
+
}, p = (t, e) => h(t, x(e));
|
|
13
|
+
import S from "axios";
|
|
14
|
+
import { isExpired as $ } from "../utils.mjs";
|
|
15
|
+
import { CVForceApi as C } from "@glodon-aiot/apis";
|
|
16
|
+
function z(t, e, o) {
|
|
17
|
+
const m = (r) => {
|
|
18
|
+
var i;
|
|
19
|
+
return e && ($(e) && o(403, "aiotToken is timeout"), r.headers = (i = r.headers) != null ? i : {}, r.headers = p(f({}, r.headers), {
|
|
20
|
+
Authorization: e ? `Bearer ${e}` : ""
|
|
21
|
+
})), r;
|
|
22
|
+
};
|
|
23
|
+
function u(r, i = !0) {
|
|
24
|
+
const n = `${t}${r}`, s = S.create({
|
|
25
|
+
baseURL: n
|
|
26
|
+
});
|
|
27
|
+
return i && s.interceptors.request.use(m), s;
|
|
28
|
+
}
|
|
29
|
+
const g = (r, i) => {
|
|
30
|
+
r === 401 && o(r, "aiotToken is invalid");
|
|
31
|
+
}, v = (r, i) => {
|
|
32
|
+
r !== 10001 && r !== 10215 && o(r, i);
|
|
33
|
+
}, A = u("/data/v1");
|
|
34
|
+
return new C(A, {
|
|
35
|
+
onHttpStatusError: g,
|
|
36
|
+
onAppStatusError: v
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
z as getCVForceService
|
|
41
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { configuration as t, configure as r } from "./Config.mjs";
|
|
2
|
+
import { default as a } from "./BotClient.mjs";
|
|
3
|
+
import { default as i } from "./Session.mjs";
|
|
4
|
+
import { default as l } from "./AgentPlugin.mjs";
|
|
5
|
+
export {
|
|
6
|
+
l as AgentPlugin,
|
|
7
|
+
a as BotClient,
|
|
8
|
+
i as Session,
|
|
9
|
+
t as configuration,
|
|
10
|
+
r as configure
|
|
11
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function r(t) {
|
|
2
|
+
if (t)
|
|
3
|
+
return n(t);
|
|
4
|
+
}
|
|
5
|
+
function n(t) {
|
|
6
|
+
for (var s in r.prototype)
|
|
7
|
+
t[s] = r.prototype[s];
|
|
8
|
+
return t;
|
|
9
|
+
}
|
|
10
|
+
r.prototype.on = r.prototype.addEventListener = function(t, s) {
|
|
11
|
+
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + t] = this._callbacks["$" + t] || []).push(s), this;
|
|
12
|
+
};
|
|
13
|
+
r.prototype.once = function(t, s) {
|
|
14
|
+
function e() {
|
|
15
|
+
this.off(t, e), s.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
return e.fn = s, this.on(t, e), this;
|
|
18
|
+
};
|
|
19
|
+
r.prototype.off = r.prototype.removeListener = r.prototype.removeAllListeners = r.prototype.removeEventListener = function(t, s) {
|
|
20
|
+
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
21
|
+
return this._callbacks = {}, this;
|
|
22
|
+
var e = this._callbacks["$" + t];
|
|
23
|
+
if (!e)
|
|
24
|
+
return this;
|
|
25
|
+
if (arguments.length == 1)
|
|
26
|
+
return delete this._callbacks["$" + t], this;
|
|
27
|
+
for (var a, i = 0; i < e.length; i++)
|
|
28
|
+
if (a = e[i], a === s || a.fn === s) {
|
|
29
|
+
e.splice(i, 1);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
return e.length === 0 && delete this._callbacks["$" + t], this;
|
|
33
|
+
};
|
|
34
|
+
r.prototype.emit = function(t) {
|
|
35
|
+
this._callbacks = this._callbacks || {};
|
|
36
|
+
for (var s = new Array(arguments.length - 1), e = this._callbacks["$" + t], a = 1; a < arguments.length; a++)
|
|
37
|
+
s[a - 1] = arguments[a];
|
|
38
|
+
if (e) {
|
|
39
|
+
e = e.slice(0);
|
|
40
|
+
for (var a = 0, i = e.length; a < i; ++a)
|
|
41
|
+
e[a].apply(this, s);
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
};
|
|
45
|
+
r.prototype.emitReserved = r.prototype.emit;
|
|
46
|
+
r.prototype.listeners = function(t) {
|
|
47
|
+
return this._callbacks = this._callbacks || {}, this._callbacks["$" + t] || [];
|
|
48
|
+
};
|
|
49
|
+
r.prototype.hasListeners = function(t) {
|
|
50
|
+
return !!this.listeners(t).length;
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
r as Emitter
|
|
54
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function l(t) {
|
|
2
|
+
let e = "";
|
|
3
|
+
for (let n in t)
|
|
4
|
+
t.hasOwnProperty(n) && (e.length && (e += "&"), e += encodeURIComponent(n) + "=" + encodeURIComponent(t[n]));
|
|
5
|
+
return e;
|
|
6
|
+
}
|
|
7
|
+
function p(t) {
|
|
8
|
+
let e = {}, n = t.split("&");
|
|
9
|
+
for (let o = 0, i = n.length; o < i; o++) {
|
|
10
|
+
let r = n[o].split("=");
|
|
11
|
+
e[decodeURIComponent(r[0])] = decodeURIComponent(r[1]);
|
|
12
|
+
}
|
|
13
|
+
return e;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
p as decode,
|
|
17
|
+
l as encode
|
|
18
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const c = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, u = ["source", "protocol", "authority", "userInfo", "user", "password", "host", "port", "relative", "path", "directory", "file", "query", "anchor"];
|
|
2
|
+
function p(t) {
|
|
3
|
+
if (t.length > 2e3)
|
|
4
|
+
throw "URI too long";
|
|
5
|
+
const o = t, i = t.indexOf("["), r = t.indexOf("]");
|
|
6
|
+
i != -1 && r != -1 && (t = t.substring(0, i) + t.substring(i, r).replace(/:/g, ";") + t.substring(r, t.length));
|
|
7
|
+
let n = c.exec(t || ""), e = {}, s = 14;
|
|
8
|
+
for (; s--; )
|
|
9
|
+
e[u[s]] = n[s] || "";
|
|
10
|
+
return i != -1 && r != -1 && (e.source = o, e.host = e.host.substring(1, e.host.length - 1).replace(/;/g, ":"), e.authority = e.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), e.ipv6uri = !0), e.pathNames = a(e, e.path), e.queryKey = l(e, e.query), e;
|
|
11
|
+
}
|
|
12
|
+
function a(t, o) {
|
|
13
|
+
const i = /\/{2,9}/g, r = o.replace(i, "/").split("/");
|
|
14
|
+
return (o.slice(0, 1) == "/" || o.length === 0) && r.splice(0, 1), o.slice(-1) == "/" && r.splice(r.length - 1, 1), r;
|
|
15
|
+
}
|
|
16
|
+
function l(t, o) {
|
|
17
|
+
const i = {};
|
|
18
|
+
return o.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(r, n, e) {
|
|
19
|
+
n && (i[n] = e);
|
|
20
|
+
}), i;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
p as parse
|
|
24
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const c = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""), n = 64, i = {};
|
|
2
|
+
let r = 0, t = 0, l;
|
|
3
|
+
function a(e) {
|
|
4
|
+
let o = "";
|
|
5
|
+
do
|
|
6
|
+
o = c[e % n] + o, e = Math.floor(e / n);
|
|
7
|
+
while (e > 0);
|
|
8
|
+
return o;
|
|
9
|
+
}
|
|
10
|
+
function d() {
|
|
11
|
+
const e = a(+/* @__PURE__ */ new Date());
|
|
12
|
+
return e !== l ? (r = 0, l = e) : e + "." + a(r++);
|
|
13
|
+
}
|
|
14
|
+
for (; t < n; t++)
|
|
15
|
+
i[c[t]] = t;
|
|
16
|
+
export {
|
|
17
|
+
a as encode,
|
|
18
|
+
d as yeast
|
|
19
|
+
};
|