image-salon-sdk 1.0.13 → 1.0.15
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/dist/image-salon-sdk.js +1110 -1135
- package/dist/image-salon-sdk.umd.cjs +5 -4
- package/dist/image-salon.d.ts +8 -10
- package/dist/style.css +1 -1
- package/dist/types/image-salon-types.d.ts +0 -6
- package/package.json +1 -1
package/dist/image-salon-sdk.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
1
|
import './style.css';
|
|
2
2
|
var qt = Object.defineProperty;
|
|
3
|
-
var st = (
|
|
4
|
-
throw TypeError(
|
|
3
|
+
var st = (i) => {
|
|
4
|
+
throw TypeError(i);
|
|
5
5
|
};
|
|
6
|
-
var Kt = (
|
|
7
|
-
var
|
|
8
|
-
var u = (
|
|
9
|
-
const
|
|
6
|
+
var Kt = (i, e, t) => e in i ? qt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
7
|
+
var _ = (i, e, t) => Kt(i, typeof e != "symbol" ? e + "" : e, t), ot = (i, e, t) => e.has(i) || st("Cannot " + t);
|
|
8
|
+
var u = (i, e, t) => (ot(i, e, "read from private field"), t ? t.call(i) : e.get(i)), L = (i, e, t) => e.has(i) ? st("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), p = (i, e, t, n) => (ot(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t);
|
|
9
|
+
const S = document.createElementNS(
|
|
10
10
|
"http://www.w3.org/2000/svg",
|
|
11
11
|
"svg"
|
|
12
12
|
);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const Le = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
28
|
-
Le.setAttribute("x1", "12");
|
|
29
|
-
Le.setAttribute("x2", "12");
|
|
30
|
-
Le.setAttribute("y1", "8");
|
|
31
|
-
Le.setAttribute("y2", "12");
|
|
13
|
+
S.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
14
|
+
S.setAttribute("width", "20");
|
|
15
|
+
S.setAttribute("height", "20");
|
|
16
|
+
S.setAttribute("viewBox", "0 0 24 24");
|
|
17
|
+
S.setAttribute("fill", "none");
|
|
18
|
+
S.setAttribute("stroke", "#ee3f3f");
|
|
19
|
+
S.setAttribute("stroke-width", "2");
|
|
20
|
+
S.setAttribute("stroke-linecap", "round");
|
|
21
|
+
S.setAttribute("stroke-linejoin", "round");
|
|
22
|
+
S.classList.add("lucide", "lucide-circle-alert");
|
|
23
|
+
const je = document.createElementNS("http://www.w3.org/2000/svg", "circle");
|
|
24
|
+
je.setAttribute("cx", "12");
|
|
25
|
+
je.setAttribute("cy", "12");
|
|
26
|
+
je.setAttribute("r", "10");
|
|
32
27
|
const De = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
33
28
|
De.setAttribute("x1", "12");
|
|
34
|
-
De.setAttribute("x2", "12
|
|
35
|
-
De.setAttribute("y1", "
|
|
36
|
-
De.setAttribute("y2", "
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
De.setAttribute("x2", "12");
|
|
30
|
+
De.setAttribute("y1", "8");
|
|
31
|
+
De.setAttribute("y2", "12");
|
|
32
|
+
const _e = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
33
|
+
_e.setAttribute("x1", "12");
|
|
34
|
+
_e.setAttribute("x2", "12.01");
|
|
35
|
+
_e.setAttribute("y1", "16");
|
|
36
|
+
_e.setAttribute("y2", "16");
|
|
37
|
+
S.appendChild(je);
|
|
38
|
+
S.appendChild(De);
|
|
39
|
+
S.appendChild(_e);
|
|
40
|
+
function K(i, e, t) {
|
|
41
|
+
let n = document.createElement(i);
|
|
42
42
|
return n.className += e, t && t.appendChild(n), n;
|
|
43
43
|
}
|
|
44
|
-
var
|
|
44
|
+
var ee;
|
|
45
45
|
class Xt {
|
|
46
46
|
constructor() {
|
|
47
|
-
|
|
48
|
-
p(this,
|
|
47
|
+
L(this, ee);
|
|
48
|
+
p(this, ee, document.createElementNS(
|
|
49
49
|
"http://www.w3.org/2000/svg",
|
|
50
50
|
"svg"
|
|
51
|
-
)), u(this,
|
|
51
|
+
)), u(this, ee).setAttribute("viewBox", "25 25 50 50"), u(this, ee).classList.add("loader-svg");
|
|
52
52
|
const e = document.createElementNS(
|
|
53
53
|
"http://www.w3.org/2000/svg",
|
|
54
54
|
"circle"
|
|
55
55
|
);
|
|
56
|
-
e.setAttribute("r", "20"), e.setAttribute("cy", "50"), e.setAttribute("cx", "50"), e.classList.add("loader-circle"), u(this,
|
|
56
|
+
e.setAttribute("r", "20"), e.setAttribute("cy", "50"), e.setAttribute("cx", "50"), e.classList.add("loader-circle"), u(this, ee).appendChild(e);
|
|
57
57
|
}
|
|
58
58
|
show(e) {
|
|
59
|
-
e.appendChild(u(this,
|
|
59
|
+
e.appendChild(u(this, ee));
|
|
60
60
|
}
|
|
61
61
|
hide() {
|
|
62
|
-
u(this,
|
|
62
|
+
u(this, ee).remove();
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
const at = new Xt(),
|
|
65
|
+
ee = new WeakMap();
|
|
66
|
+
const at = new Xt(), We = document.body;
|
|
67
67
|
class Gt {
|
|
68
68
|
constructor() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.main =
|
|
69
|
+
_(this, "main");
|
|
70
|
+
_(this, "dialogHeader");
|
|
71
|
+
_(this, "dialogBody");
|
|
72
|
+
_(this, "dialogFooter");
|
|
73
|
+
_(this, "confirmButton");
|
|
74
|
+
_(this, "cancelButton");
|
|
75
|
+
_(this, "confirmCallback");
|
|
76
|
+
_(this, "cancelCallback");
|
|
77
|
+
this.main = K("div"), this.dialogHeader = K("div"), this.dialogBody = K("div"), this.dialogFooter = K("div"), this.confirmButton = document.createElement("button"), this.cancelButton = document.createElement("button"), this.confirmCallback = void 0, this.cancelCallback = void 0;
|
|
78
78
|
}
|
|
79
79
|
show(e) {
|
|
80
|
-
this.main =
|
|
81
|
-
const t =
|
|
82
|
-
return this.dialogHeader =
|
|
80
|
+
this.main = K("div", "dialog", We);
|
|
81
|
+
const t = K("div", "dialog-content", this.main);
|
|
82
|
+
return this.dialogHeader = K("div", "dialog-header", t), this.dialogBody = K("div", "dialog-body", t), this.dialogFooter = K("div", "dialog-footer", t), this.confirmButton = K(
|
|
83
83
|
"button",
|
|
84
84
|
"dialog-btn confirm",
|
|
85
85
|
this.dialogFooter
|
|
86
|
-
), this.confirmButton.type = "button", this.confirmButton.disabled = !0, this.cancelButton =
|
|
86
|
+
), this.confirmButton.type = "button", this.confirmButton.disabled = !0, this.cancelButton = K(
|
|
87
87
|
"button",
|
|
88
88
|
"dialog-btn cancel",
|
|
89
89
|
this.dialogFooter
|
|
90
|
-
), this.cancelButton.type = "button", typeof e.title == "string" ? this.dialogHeader.innerHTML = e.title : (this.dialogHeader.innerHTML = "", this.dialogHeader.appendChild(e.title)), typeof e.content == "string" ? this.dialogBody.innerHTML = e.content : (this.dialogBody.innerHTML = "", this.dialogBody.appendChild(e.content)), this.confirmButton.textContent = e.confirmButtonText || "Upload", this.cancelButton.textContent = e.cancelButtonText || "Cancel",
|
|
91
|
-
const
|
|
90
|
+
), this.cancelButton.type = "button", typeof e.title == "string" ? this.dialogHeader.innerHTML = e.title : (this.dialogHeader.innerHTML = "", this.dialogHeader.appendChild(e.title)), typeof e.content == "string" ? this.dialogBody.innerHTML = e.content : (this.dialogBody.innerHTML = "", this.dialogBody.appendChild(e.content)), this.confirmButton.textContent = e.confirmButtonText || "Upload", this.cancelButton.textContent = e.cancelButtonText || "Cancel", We.classList.add("dialog-visible"), new Promise((n) => {
|
|
91
|
+
const r = (s) => () => {
|
|
92
92
|
this.hide(), n(s === "confirm");
|
|
93
93
|
};
|
|
94
|
-
this.confirmCallback = e.onConfirm ||
|
|
94
|
+
this.confirmCallback = e.onConfirm || r("confirm"), this.confirmButton.addEventListener("click", this.confirmCallback), this.cancelCallback = e.onCancel || r("cancel"), this.cancelButton.addEventListener("click", this.cancelCallback);
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
hide() {
|
|
98
|
-
|
|
98
|
+
We.classList.remove("dialog-visible"), this.main.remove();
|
|
99
99
|
}
|
|
100
100
|
updateUploadBtnText(e) {
|
|
101
101
|
this.confirmButton && (this.confirmButton.textContent = e);
|
|
@@ -107,42 +107,42 @@ class Gt {
|
|
|
107
107
|
e ? (at.show(this.confirmButton), this.disableConfirmButton(!0)) : (at.hide(), this.disableConfirmButton(!1));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const
|
|
111
|
-
function
|
|
110
|
+
const Ee = new Gt();
|
|
111
|
+
function $(i, e) {
|
|
112
112
|
const t = document.createElement("div");
|
|
113
|
-
return
|
|
113
|
+
return i && t.classList.add(i), e && (t.id = e), t;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function Z(i, e, t) {
|
|
116
116
|
const n = document.createElement("p");
|
|
117
|
-
return e && n.classList.add(e), t && (n.id = t),
|
|
117
|
+
return e && n.classList.add(e), t && (n.id = t), i && (n.textContent = i), n;
|
|
118
118
|
}
|
|
119
|
-
function Jt(
|
|
120
|
-
const
|
|
121
|
-
return
|
|
119
|
+
function Jt(i, e, t, n) {
|
|
120
|
+
const r = document.createElement("img");
|
|
121
|
+
return r.classList.add(e), r.src = i, r;
|
|
122
122
|
}
|
|
123
|
-
function Ht(
|
|
124
|
-
const n = document.createElement("video"),
|
|
125
|
-
return n.classList.add(e),
|
|
123
|
+
function Ht(i, e, t) {
|
|
124
|
+
const n = document.createElement("video"), r = document.createElement("source");
|
|
125
|
+
return n.classList.add(e), r.src = i, n.appendChild(r), n;
|
|
126
126
|
}
|
|
127
|
-
function Zt(
|
|
128
|
-
const n = document.createElement("audio"),
|
|
129
|
-
return n.classList.add(e), n.controls = !0,
|
|
127
|
+
function Zt(i, e, t) {
|
|
128
|
+
const n = document.createElement("audio"), r = document.createElement("source");
|
|
129
|
+
return n.classList.add(e), n.controls = !0, r.src = i, n.appendChild(r), n;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Oe(i, e, t, n, r) {
|
|
132
132
|
const s = document.createElement("button");
|
|
133
|
-
return e && s.classList.add(e), t && (s.id = t),
|
|
133
|
+
return e && s.classList.add(e), t && (s.id = t), i && (s.textContent = i), r && (s.innerHTML = r), s.disabled = n, s;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Yt(i) {
|
|
136
136
|
const e = document.createElement("input");
|
|
137
|
-
return e.type =
|
|
137
|
+
return e.type = i, e;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function zt() {
|
|
140
140
|
return document.createElement("select");
|
|
141
141
|
}
|
|
142
|
-
function Qt(
|
|
142
|
+
function Qt(i) {
|
|
143
143
|
const e = document.createDocumentFragment();
|
|
144
|
-
if ((
|
|
145
|
-
|
|
144
|
+
if ((i == null ? void 0 : i.length) > 0)
|
|
145
|
+
i.forEach((t) => {
|
|
146
146
|
const n = document.createElement("option");
|
|
147
147
|
n.value = t.value, n.textContent = t.label, e.appendChild(n);
|
|
148
148
|
});
|
|
@@ -152,33 +152,33 @@ function Qt(r) {
|
|
|
152
152
|
}
|
|
153
153
|
return e;
|
|
154
154
|
}
|
|
155
|
-
function Nt(
|
|
156
|
-
let e = typeof
|
|
155
|
+
function Nt(i) {
|
|
156
|
+
let e = typeof i;
|
|
157
157
|
if (e == "object") {
|
|
158
|
-
if (Array.isArray(
|
|
158
|
+
if (Array.isArray(i))
|
|
159
159
|
return "array";
|
|
160
|
-
if (
|
|
160
|
+
if (i === null)
|
|
161
161
|
return "null";
|
|
162
162
|
}
|
|
163
163
|
return e;
|
|
164
164
|
}
|
|
165
|
-
function en(
|
|
166
|
-
return
|
|
165
|
+
function en(i) {
|
|
166
|
+
return i !== null && typeof i == "object" && !Array.isArray(i);
|
|
167
167
|
}
|
|
168
|
-
let
|
|
169
|
-
for (let
|
|
170
|
-
Pe[
|
|
171
|
-
Pe[45] =
|
|
172
|
-
Pe[95] =
|
|
173
|
-
function Et(
|
|
174
|
-
let e =
|
|
175
|
-
|
|
176
|
-
let t = new Uint8Array(e), n = 0,
|
|
177
|
-
for (let a = 0; a <
|
|
178
|
-
if (s = Pe[
|
|
179
|
-
switch (
|
|
168
|
+
let se = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), Pe = [];
|
|
169
|
+
for (let i = 0; i < se.length; i++)
|
|
170
|
+
Pe[se[i].charCodeAt(0)] = i;
|
|
171
|
+
Pe[45] = se.indexOf("+");
|
|
172
|
+
Pe[95] = se.indexOf("/");
|
|
173
|
+
function Et(i) {
|
|
174
|
+
let e = i.length * 3 / 4;
|
|
175
|
+
i[i.length - 2] == "=" ? e -= 2 : i[i.length - 1] == "=" && (e -= 1);
|
|
176
|
+
let t = new Uint8Array(e), n = 0, r = 0, s, o = 0;
|
|
177
|
+
for (let a = 0; a < i.length; a++) {
|
|
178
|
+
if (s = Pe[i.charCodeAt(a)], s === void 0)
|
|
179
|
+
switch (i[a]) {
|
|
180
180
|
case "=":
|
|
181
|
-
|
|
181
|
+
r = 0;
|
|
182
182
|
case `
|
|
183
183
|
`:
|
|
184
184
|
case "\r":
|
|
@@ -188,89 +188,89 @@ function Et(r) {
|
|
|
188
188
|
default:
|
|
189
189
|
throw Error("invalid base64 string.");
|
|
190
190
|
}
|
|
191
|
-
switch (
|
|
191
|
+
switch (r) {
|
|
192
192
|
case 0:
|
|
193
|
-
o = s,
|
|
193
|
+
o = s, r = 1;
|
|
194
194
|
break;
|
|
195
195
|
case 1:
|
|
196
|
-
t[n++] = o << 2 | (s & 48) >> 4, o = s,
|
|
196
|
+
t[n++] = o << 2 | (s & 48) >> 4, o = s, r = 2;
|
|
197
197
|
break;
|
|
198
198
|
case 2:
|
|
199
|
-
t[n++] = (o & 15) << 4 | (s & 60) >> 2, o = s,
|
|
199
|
+
t[n++] = (o & 15) << 4 | (s & 60) >> 2, o = s, r = 3;
|
|
200
200
|
break;
|
|
201
201
|
case 3:
|
|
202
|
-
t[n++] = (o & 3) << 6 | s,
|
|
202
|
+
t[n++] = (o & 3) << 6 | s, r = 0;
|
|
203
203
|
break;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
if (
|
|
206
|
+
if (r == 1)
|
|
207
207
|
throw Error("invalid base64 string.");
|
|
208
208
|
return t.subarray(0, n);
|
|
209
209
|
}
|
|
210
|
-
function kt(
|
|
211
|
-
let e = "", t = 0, n,
|
|
212
|
-
for (let s = 0; s <
|
|
213
|
-
switch (n =
|
|
210
|
+
function kt(i) {
|
|
211
|
+
let e = "", t = 0, n, r = 0;
|
|
212
|
+
for (let s = 0; s < i.length; s++)
|
|
213
|
+
switch (n = i[s], t) {
|
|
214
214
|
case 0:
|
|
215
|
-
e +=
|
|
215
|
+
e += se[n >> 2], r = (n & 3) << 4, t = 1;
|
|
216
216
|
break;
|
|
217
217
|
case 1:
|
|
218
|
-
e +=
|
|
218
|
+
e += se[r | n >> 4], r = (n & 15) << 2, t = 2;
|
|
219
219
|
break;
|
|
220
220
|
case 2:
|
|
221
|
-
e +=
|
|
221
|
+
e += se[r | n >> 6], e += se[n & 63], t = 0;
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
|
-
return t && (e +=
|
|
224
|
+
return t && (e += se[r], e += "=", t == 1 && (e += "=")), e;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
227
|
-
(function(
|
|
228
|
-
|
|
229
|
-
(e(n) ? n[
|
|
230
|
-
},
|
|
231
|
-
for (let { no: s, wireType: o, data: a } of
|
|
232
|
-
|
|
233
|
-
},
|
|
226
|
+
var k;
|
|
227
|
+
(function(i) {
|
|
228
|
+
i.symbol = Symbol.for("protobuf-ts/unknown"), i.onRead = (t, n, r, s, o) => {
|
|
229
|
+
(e(n) ? n[i.symbol] : n[i.symbol] = []).push({ no: r, wireType: s, data: o });
|
|
230
|
+
}, i.onWrite = (t, n, r) => {
|
|
231
|
+
for (let { no: s, wireType: o, data: a } of i.list(n))
|
|
232
|
+
r.tag(s, o).raw(a);
|
|
233
|
+
}, i.list = (t, n) => {
|
|
234
234
|
if (e(t)) {
|
|
235
|
-
let
|
|
236
|
-
return n ?
|
|
235
|
+
let r = t[i.symbol];
|
|
236
|
+
return n ? r.filter((s) => s.no == n) : r;
|
|
237
237
|
}
|
|
238
238
|
return [];
|
|
239
|
-
},
|
|
240
|
-
const e = (t) => t && Array.isArray(t[
|
|
241
|
-
})(
|
|
242
|
-
function tn(
|
|
243
|
-
return Object.assign(Object.assign({},
|
|
239
|
+
}, i.last = (t, n) => i.list(t, n).slice(-1)[0];
|
|
240
|
+
const e = (t) => t && Array.isArray(t[i.symbol]);
|
|
241
|
+
})(k || (k = {}));
|
|
242
|
+
function tn(i, e) {
|
|
243
|
+
return Object.assign(Object.assign({}, i), e);
|
|
244
244
|
}
|
|
245
245
|
var m;
|
|
246
|
-
(function(
|
|
247
|
-
|
|
246
|
+
(function(i) {
|
|
247
|
+
i[i.Varint = 0] = "Varint", i[i.Bit64 = 1] = "Bit64", i[i.LengthDelimited = 2] = "LengthDelimited", i[i.StartGroup = 3] = "StartGroup", i[i.EndGroup = 4] = "EndGroup", i[i.Bit32 = 5] = "Bit32";
|
|
248
248
|
})(m || (m = {}));
|
|
249
249
|
function nn() {
|
|
250
|
-
let
|
|
250
|
+
let i = 0, e = 0;
|
|
251
251
|
for (let n = 0; n < 28; n += 7) {
|
|
252
|
-
let
|
|
253
|
-
if (
|
|
254
|
-
return this.assertBounds(), [
|
|
252
|
+
let r = this.buf[this.pos++];
|
|
253
|
+
if (i |= (r & 127) << n, !(r & 128))
|
|
254
|
+
return this.assertBounds(), [i, e];
|
|
255
255
|
}
|
|
256
256
|
let t = this.buf[this.pos++];
|
|
257
|
-
if (
|
|
258
|
-
return this.assertBounds(), [
|
|
257
|
+
if (i |= (t & 15) << 28, e = (t & 112) >> 4, !(t & 128))
|
|
258
|
+
return this.assertBounds(), [i, e];
|
|
259
259
|
for (let n = 3; n <= 31; n += 7) {
|
|
260
|
-
let
|
|
261
|
-
if (e |= (
|
|
262
|
-
return this.assertBounds(), [
|
|
260
|
+
let r = this.buf[this.pos++];
|
|
261
|
+
if (e |= (r & 127) << n, !(r & 128))
|
|
262
|
+
return this.assertBounds(), [i, e];
|
|
263
263
|
}
|
|
264
264
|
throw new Error("invalid varint");
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function qe(i, e, t) {
|
|
267
267
|
for (let s = 0; s < 28; s = s + 7) {
|
|
268
|
-
const o =
|
|
268
|
+
const o = i >>> s, a = !(!(o >>> 7) && e == 0), l = (a ? o | 128 : o) & 255;
|
|
269
269
|
if (t.push(l), !a)
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
|
-
const n =
|
|
273
|
-
if (t.push((
|
|
272
|
+
const n = i >>> 28 & 15 | (e & 7) << 4, r = !!(e >> 3);
|
|
273
|
+
if (t.push((r ? n | 128 : n) & 255), !!r) {
|
|
274
274
|
for (let s = 3; s < 31; s = s + 7) {
|
|
275
275
|
const o = e >>> s, a = !!(o >>> 7), l = (a ? o | 128 : o) & 255;
|
|
276
276
|
if (t.push(l), !a)
|
|
@@ -280,24 +280,24 @@ function We(r, e, t) {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
const Se = 65536 * 65536;
|
|
283
|
-
function It(
|
|
284
|
-
let e =
|
|
285
|
-
e && (
|
|
283
|
+
function It(i) {
|
|
284
|
+
let e = i[0] == "-";
|
|
285
|
+
e && (i = i.slice(1));
|
|
286
286
|
const t = 1e6;
|
|
287
|
-
let n = 0,
|
|
287
|
+
let n = 0, r = 0;
|
|
288
288
|
function s(o, a) {
|
|
289
|
-
const l = Number(
|
|
290
|
-
|
|
289
|
+
const l = Number(i.slice(o, a));
|
|
290
|
+
r *= t, n = n * t + l, n >= Se && (r = r + (n / Se | 0), n = n % Se);
|
|
291
291
|
}
|
|
292
|
-
return s(-24, -18), s(-18, -12), s(-12, -6), s(-6), [e, n,
|
|
292
|
+
return s(-24, -18), s(-18, -12), s(-12, -6), s(-6), [e, n, r];
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function Ze(i, e) {
|
|
295
295
|
if (e >>> 0 <= 2097151)
|
|
296
|
-
return "" + (Se * e + (
|
|
297
|
-
let t =
|
|
296
|
+
return "" + (Se * e + (i >>> 0));
|
|
297
|
+
let t = i & 16777215, n = (i >>> 24 | e << 8) >>> 0 & 16777215, r = e >> 16 & 65535, s = t + n * 6777216 + r * 6710656, o = n + r * 8147497, a = r * 2, l = 1e7;
|
|
298
298
|
s >= l && (o += Math.floor(s / l), s %= l), o >= l && (a += Math.floor(o / l), o %= l);
|
|
299
|
-
function c(
|
|
300
|
-
let y =
|
|
299
|
+
function c(f, g) {
|
|
300
|
+
let y = f ? String(f) : "";
|
|
301
301
|
return g ? "0000000".slice(y.length) + y : y;
|
|
302
302
|
}
|
|
303
303
|
return c(
|
|
@@ -316,53 +316,53 @@ function He(r, e) {
|
|
|
316
316
|
1
|
|
317
317
|
);
|
|
318
318
|
}
|
|
319
|
-
function lt(
|
|
320
|
-
if (
|
|
321
|
-
for (;
|
|
322
|
-
e.push(
|
|
323
|
-
e.push(
|
|
319
|
+
function lt(i, e) {
|
|
320
|
+
if (i >= 0) {
|
|
321
|
+
for (; i > 127; )
|
|
322
|
+
e.push(i & 127 | 128), i = i >>> 7;
|
|
323
|
+
e.push(i);
|
|
324
324
|
} else {
|
|
325
325
|
for (let t = 0; t < 9; t++)
|
|
326
|
-
e.push(
|
|
326
|
+
e.push(i & 127 | 128), i = i >> 7;
|
|
327
327
|
e.push(1);
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
function rn() {
|
|
331
|
-
let
|
|
332
|
-
if (!(
|
|
331
|
+
let i = this.buf[this.pos++], e = i & 127;
|
|
332
|
+
if (!(i & 128))
|
|
333
333
|
return this.assertBounds(), e;
|
|
334
|
-
if (
|
|
334
|
+
if (i = this.buf[this.pos++], e |= (i & 127) << 7, !(i & 128))
|
|
335
335
|
return this.assertBounds(), e;
|
|
336
|
-
if (
|
|
336
|
+
if (i = this.buf[this.pos++], e |= (i & 127) << 14, !(i & 128))
|
|
337
337
|
return this.assertBounds(), e;
|
|
338
|
-
if (
|
|
338
|
+
if (i = this.buf[this.pos++], e |= (i & 127) << 21, !(i & 128))
|
|
339
339
|
return this.assertBounds(), e;
|
|
340
|
-
|
|
341
|
-
for (let t = 5;
|
|
342
|
-
|
|
343
|
-
if (
|
|
340
|
+
i = this.buf[this.pos++], e |= (i & 15) << 28;
|
|
341
|
+
for (let t = 5; i & 128 && t < 10; t++)
|
|
342
|
+
i = this.buf[this.pos++];
|
|
343
|
+
if (i & 128)
|
|
344
344
|
throw new Error("invalid varint");
|
|
345
345
|
return this.assertBounds(), e >>> 0;
|
|
346
346
|
}
|
|
347
347
|
let T;
|
|
348
348
|
function sn() {
|
|
349
|
-
const
|
|
350
|
-
T = globalThis.BigInt !== void 0 && typeof
|
|
349
|
+
const i = new DataView(new ArrayBuffer(8));
|
|
350
|
+
T = globalThis.BigInt !== void 0 && typeof i.getBigInt64 == "function" && typeof i.getBigUint64 == "function" && typeof i.setBigInt64 == "function" && typeof i.setBigUint64 == "function" ? {
|
|
351
351
|
MIN: BigInt("-9223372036854775808"),
|
|
352
352
|
MAX: BigInt("9223372036854775807"),
|
|
353
353
|
UMIN: BigInt("0"),
|
|
354
354
|
UMAX: BigInt("18446744073709551615"),
|
|
355
355
|
C: BigInt,
|
|
356
|
-
V:
|
|
356
|
+
V: i
|
|
357
357
|
} : void 0;
|
|
358
358
|
}
|
|
359
359
|
sn();
|
|
360
|
-
function Tt(
|
|
361
|
-
if (!
|
|
360
|
+
function Tt(i) {
|
|
361
|
+
if (!i)
|
|
362
362
|
throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
|
|
363
363
|
}
|
|
364
|
-
const At = /^-?[0-9]+$/,
|
|
365
|
-
class
|
|
364
|
+
const At = /^-?[0-9]+$/, Me = 4294967296, Ue = 2147483648;
|
|
365
|
+
class Ot {
|
|
366
366
|
/**
|
|
367
367
|
* Create a new instance with the given bits.
|
|
368
368
|
*/
|
|
@@ -379,13 +379,13 @@ class Ft {
|
|
|
379
379
|
* Convert to a native number.
|
|
380
380
|
*/
|
|
381
381
|
toNumber() {
|
|
382
|
-
let e = this.hi *
|
|
382
|
+
let e = this.hi * Me + (this.lo >>> 0);
|
|
383
383
|
if (!Number.isSafeInteger(e))
|
|
384
384
|
throw new Error("cannot convert to safe number");
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
class
|
|
388
|
+
class R extends Ot {
|
|
389
389
|
/**
|
|
390
390
|
* Create instance from a `string`, `number` or `bigint`.
|
|
391
391
|
*/
|
|
@@ -409,7 +409,7 @@ class x extends Ft {
|
|
|
409
409
|
throw new Error("signed value for ulong");
|
|
410
410
|
if (e > T.UMAX)
|
|
411
411
|
throw new Error("ulong too large");
|
|
412
|
-
return T.V.setBigUint64(0, e, !0), new
|
|
412
|
+
return T.V.setBigUint64(0, e, !0), new R(T.V.getInt32(0, !0), T.V.getInt32(4, !0));
|
|
413
413
|
}
|
|
414
414
|
else
|
|
415
415
|
switch (typeof e) {
|
|
@@ -418,10 +418,10 @@ class x extends Ft {
|
|
|
418
418
|
return this.ZERO;
|
|
419
419
|
if (e = e.trim(), !At.test(e))
|
|
420
420
|
throw new Error("string is no integer");
|
|
421
|
-
let [t, n,
|
|
421
|
+
let [t, n, r] = It(e);
|
|
422
422
|
if (t)
|
|
423
423
|
throw new Error("signed value for ulong");
|
|
424
|
-
return new
|
|
424
|
+
return new R(n, r);
|
|
425
425
|
case "number":
|
|
426
426
|
if (e == 0)
|
|
427
427
|
return this.ZERO;
|
|
@@ -429,7 +429,7 @@ class x extends Ft {
|
|
|
429
429
|
throw new Error("number is no integer");
|
|
430
430
|
if (e < 0)
|
|
431
431
|
throw new Error("signed value for ulong");
|
|
432
|
-
return new
|
|
432
|
+
return new R(e, e / Me);
|
|
433
433
|
}
|
|
434
434
|
throw new Error("unknown value " + typeof e);
|
|
435
435
|
}
|
|
@@ -437,7 +437,7 @@ class x extends Ft {
|
|
|
437
437
|
* Convert to decimal string.
|
|
438
438
|
*/
|
|
439
439
|
toString() {
|
|
440
|
-
return T ? this.toBigInt().toString() :
|
|
440
|
+
return T ? this.toBigInt().toString() : Ze(this.lo, this.hi);
|
|
441
441
|
}
|
|
442
442
|
/**
|
|
443
443
|
* Convert to native bigint.
|
|
@@ -446,8 +446,8 @@ class x extends Ft {
|
|
|
446
446
|
return Tt(T), T.V.setInt32(0, this.lo, !0), T.V.setInt32(4, this.hi, !0), T.V.getBigUint64(0, !0);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
|
|
450
|
-
class B extends
|
|
449
|
+
R.ZERO = new R(0, 0);
|
|
450
|
+
class B extends Ot {
|
|
451
451
|
/**
|
|
452
452
|
* Create instance from a `string`, `number` or `bigint`.
|
|
453
453
|
*/
|
|
@@ -480,20 +480,20 @@ class B extends Ft {
|
|
|
480
480
|
return this.ZERO;
|
|
481
481
|
if (e = e.trim(), !At.test(e))
|
|
482
482
|
throw new Error("string is no integer");
|
|
483
|
-
let [t, n,
|
|
483
|
+
let [t, n, r] = It(e);
|
|
484
484
|
if (t) {
|
|
485
|
-
if (
|
|
485
|
+
if (r > Ue || r == Ue && n != 0)
|
|
486
486
|
throw new Error("signed long too small");
|
|
487
|
-
} else if (
|
|
487
|
+
} else if (r >= Ue)
|
|
488
488
|
throw new Error("signed long too large");
|
|
489
|
-
let s = new B(n,
|
|
489
|
+
let s = new B(n, r);
|
|
490
490
|
return t ? s.negate() : s;
|
|
491
491
|
case "number":
|
|
492
492
|
if (e == 0)
|
|
493
493
|
return this.ZERO;
|
|
494
494
|
if (!Number.isSafeInteger(e))
|
|
495
495
|
throw new Error("number is no integer");
|
|
496
|
-
return e > 0 ? new B(e, e /
|
|
496
|
+
return e > 0 ? new B(e, e / Me) : new B(-e, -e / Me).negate();
|
|
497
497
|
}
|
|
498
498
|
throw new Error("unknown value " + typeof e);
|
|
499
499
|
}
|
|
@@ -519,9 +519,9 @@ class B extends Ft {
|
|
|
519
519
|
return this.toBigInt().toString();
|
|
520
520
|
if (this.isNegative()) {
|
|
521
521
|
let e = this.negate();
|
|
522
|
-
return "-" +
|
|
522
|
+
return "-" + Ze(e.lo, e.hi);
|
|
523
523
|
}
|
|
524
|
-
return
|
|
524
|
+
return Ze(this.lo, this.hi);
|
|
525
525
|
}
|
|
526
526
|
/**
|
|
527
527
|
* Convert to native bigint.
|
|
@@ -533,10 +533,10 @@ class B extends Ft {
|
|
|
533
533
|
B.ZERO = new B(0, 0);
|
|
534
534
|
const ct = {
|
|
535
535
|
readUnknownField: !0,
|
|
536
|
-
readerFactory: (
|
|
536
|
+
readerFactory: (i) => new an(i)
|
|
537
537
|
};
|
|
538
|
-
function on(
|
|
539
|
-
return
|
|
538
|
+
function on(i) {
|
|
539
|
+
return i ? Object.assign(Object.assign({}, ct), i) : ct;
|
|
540
540
|
}
|
|
541
541
|
class an {
|
|
542
542
|
constructor(e, t) {
|
|
@@ -575,9 +575,9 @@ class an {
|
|
|
575
575
|
this.pos += n;
|
|
576
576
|
break;
|
|
577
577
|
case m.StartGroup:
|
|
578
|
-
let
|
|
579
|
-
for (; (
|
|
580
|
-
this.skip(
|
|
578
|
+
let r;
|
|
579
|
+
for (; (r = this.tag()[1]) !== m.EndGroup; )
|
|
580
|
+
this.skip(r);
|
|
581
581
|
break;
|
|
582
582
|
default:
|
|
583
583
|
throw new Error("cant skip wire type " + e);
|
|
@@ -614,7 +614,7 @@ class an {
|
|
|
614
614
|
* Read a `uint64` field, an unsigned 64-bit varint.
|
|
615
615
|
*/
|
|
616
616
|
uint64() {
|
|
617
|
-
return new
|
|
617
|
+
return new R(...this.varint64());
|
|
618
618
|
}
|
|
619
619
|
/**
|
|
620
620
|
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
|
@@ -646,7 +646,7 @@ class an {
|
|
|
646
646
|
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
|
|
647
647
|
*/
|
|
648
648
|
fixed64() {
|
|
649
|
-
return new
|
|
649
|
+
return new R(this.sfixed32(), this.sfixed32());
|
|
650
650
|
}
|
|
651
651
|
/**
|
|
652
652
|
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
|
@@ -680,35 +680,35 @@ class an {
|
|
|
680
680
|
return this.textDecoder.decode(this.bytes());
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
|
-
function w(
|
|
684
|
-
if (!
|
|
683
|
+
function w(i, e) {
|
|
684
|
+
if (!i)
|
|
685
685
|
throw new Error(e);
|
|
686
686
|
}
|
|
687
|
-
const ln = 34028234663852886e22, cn = -34028234663852886e22, hn = 4294967295, un = 2147483647,
|
|
688
|
-
function
|
|
689
|
-
if (typeof
|
|
690
|
-
throw new Error("invalid int 32: " + typeof
|
|
691
|
-
if (!Number.isInteger(
|
|
692
|
-
throw new Error("invalid int 32: " +
|
|
687
|
+
const ln = 34028234663852886e22, cn = -34028234663852886e22, hn = 4294967295, un = 2147483647, fn = -2147483648;
|
|
688
|
+
function Le(i) {
|
|
689
|
+
if (typeof i != "number")
|
|
690
|
+
throw new Error("invalid int 32: " + typeof i);
|
|
691
|
+
if (!Number.isInteger(i) || i > un || i < fn)
|
|
692
|
+
throw new Error("invalid int 32: " + i);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
695
|
-
if (typeof
|
|
696
|
-
throw new Error("invalid uint 32: " + typeof
|
|
697
|
-
if (!Number.isInteger(
|
|
698
|
-
throw new Error("invalid uint 32: " +
|
|
694
|
+
function Ve(i) {
|
|
695
|
+
if (typeof i != "number")
|
|
696
|
+
throw new Error("invalid uint 32: " + typeof i);
|
|
697
|
+
if (!Number.isInteger(i) || i > hn || i < 0)
|
|
698
|
+
throw new Error("invalid uint 32: " + i);
|
|
699
699
|
}
|
|
700
|
-
function et(
|
|
701
|
-
if (typeof
|
|
702
|
-
throw new Error("invalid float 32: " + typeof
|
|
703
|
-
if (Number.isFinite(
|
|
704
|
-
throw new Error("invalid float 32: " +
|
|
700
|
+
function et(i) {
|
|
701
|
+
if (typeof i != "number")
|
|
702
|
+
throw new Error("invalid float 32: " + typeof i);
|
|
703
|
+
if (Number.isFinite(i) && (i > ln || i < cn))
|
|
704
|
+
throw new Error("invalid float 32: " + i);
|
|
705
705
|
}
|
|
706
706
|
const ht = {
|
|
707
707
|
writeUnknownFields: !0,
|
|
708
708
|
writerFactory: () => new mn()
|
|
709
709
|
};
|
|
710
|
-
function
|
|
711
|
-
return
|
|
710
|
+
function dn(i) {
|
|
711
|
+
return i ? Object.assign(Object.assign({}, ht), i) : ht;
|
|
712
712
|
}
|
|
713
713
|
class mn {
|
|
714
714
|
constructor(e) {
|
|
@@ -720,11 +720,11 @@ class mn {
|
|
|
720
720
|
finish() {
|
|
721
721
|
this.chunks.push(new Uint8Array(this.buf));
|
|
722
722
|
let e = 0;
|
|
723
|
-
for (let
|
|
724
|
-
e += this.chunks[
|
|
723
|
+
for (let r = 0; r < this.chunks.length; r++)
|
|
724
|
+
e += this.chunks[r].length;
|
|
725
725
|
let t = new Uint8Array(e), n = 0;
|
|
726
|
-
for (let
|
|
727
|
-
t.set(this.chunks[
|
|
726
|
+
for (let r = 0; r < this.chunks.length; r++)
|
|
727
|
+
t.set(this.chunks[r], n), n += this.chunks[r].length;
|
|
728
728
|
return this.chunks = [], t;
|
|
729
729
|
}
|
|
730
730
|
/**
|
|
@@ -766,7 +766,7 @@ class mn {
|
|
|
766
766
|
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
767
767
|
*/
|
|
768
768
|
uint32(e) {
|
|
769
|
-
for (
|
|
769
|
+
for (Ve(e); e > 127; )
|
|
770
770
|
this.buf.push(e & 127 | 128), e = e >>> 7;
|
|
771
771
|
return this.buf.push(e), this;
|
|
772
772
|
}
|
|
@@ -774,7 +774,7 @@ class mn {
|
|
|
774
774
|
* Write a `int32` value, a signed 32 bit varint.
|
|
775
775
|
*/
|
|
776
776
|
int32(e) {
|
|
777
|
-
return
|
|
777
|
+
return Le(e), lt(e, this.buf), this;
|
|
778
778
|
}
|
|
779
779
|
/**
|
|
780
780
|
* Write a `bool` value, a variant.
|
|
@@ -814,7 +814,7 @@ class mn {
|
|
|
814
814
|
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
815
815
|
*/
|
|
816
816
|
fixed32(e) {
|
|
817
|
-
|
|
817
|
+
Ve(e);
|
|
818
818
|
let t = new Uint8Array(4);
|
|
819
819
|
return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
|
|
820
820
|
}
|
|
@@ -822,7 +822,7 @@ class mn {
|
|
|
822
822
|
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
823
823
|
*/
|
|
824
824
|
sfixed32(e) {
|
|
825
|
-
|
|
825
|
+
Le(e);
|
|
826
826
|
let t = new Uint8Array(4);
|
|
827
827
|
return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
|
|
828
828
|
}
|
|
@@ -830,42 +830,42 @@ class mn {
|
|
|
830
830
|
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
831
831
|
*/
|
|
832
832
|
sint32(e) {
|
|
833
|
-
return
|
|
833
|
+
return Le(e), e = (e << 1 ^ e >> 31) >>> 0, lt(e, this.buf), this;
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
837
837
|
*/
|
|
838
838
|
sfixed64(e) {
|
|
839
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer),
|
|
840
|
-
return n.setInt32(0,
|
|
839
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), r = B.from(e);
|
|
840
|
+
return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
|
|
841
841
|
}
|
|
842
842
|
/**
|
|
843
843
|
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
|
|
844
844
|
*/
|
|
845
845
|
fixed64(e) {
|
|
846
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer),
|
|
847
|
-
return n.setInt32(0,
|
|
846
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), r = R.from(e);
|
|
847
|
+
return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
|
|
848
848
|
}
|
|
849
849
|
/**
|
|
850
850
|
* Write a `int64` value, a signed 64-bit varint.
|
|
851
851
|
*/
|
|
852
852
|
int64(e) {
|
|
853
853
|
let t = B.from(e);
|
|
854
|
-
return
|
|
854
|
+
return qe(t.lo, t.hi, this.buf), this;
|
|
855
855
|
}
|
|
856
856
|
/**
|
|
857
857
|
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
858
858
|
*/
|
|
859
859
|
sint64(e) {
|
|
860
|
-
let t = B.from(e), n = t.hi >> 31,
|
|
861
|
-
return
|
|
860
|
+
let t = B.from(e), n = t.hi >> 31, r = t.lo << 1 ^ n, s = (t.hi << 1 | t.lo >>> 31) ^ n;
|
|
861
|
+
return qe(r, s, this.buf), this;
|
|
862
862
|
}
|
|
863
863
|
/**
|
|
864
864
|
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
865
865
|
*/
|
|
866
866
|
uint64(e) {
|
|
867
|
-
let t =
|
|
868
|
-
return
|
|
867
|
+
let t = R.from(e);
|
|
868
|
+
return qe(t.lo, t.hi, this.buf), this;
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
871
|
const ut = {
|
|
@@ -873,54 +873,54 @@ const ut = {
|
|
|
873
873
|
enumAsInteger: !1,
|
|
874
874
|
useProtoFieldName: !1,
|
|
875
875
|
prettySpaces: 0
|
|
876
|
-
},
|
|
876
|
+
}, ft = {
|
|
877
877
|
ignoreUnknownFields: !1
|
|
878
878
|
};
|
|
879
|
-
function pn(
|
|
880
|
-
return
|
|
879
|
+
function pn(i) {
|
|
880
|
+
return i ? Object.assign(Object.assign({}, ft), i) : ft;
|
|
881
881
|
}
|
|
882
|
-
function gn(
|
|
883
|
-
return
|
|
882
|
+
function gn(i) {
|
|
883
|
+
return i ? Object.assign(Object.assign({}, ut), i) : ut;
|
|
884
884
|
}
|
|
885
|
-
function bn(
|
|
885
|
+
function bn(i, e) {
|
|
886
886
|
var t, n;
|
|
887
|
-
let
|
|
888
|
-
return
|
|
887
|
+
let r = Object.assign(Object.assign({}, i), e);
|
|
888
|
+
return r.typeRegistry = [...(t = i == null ? void 0 : i.typeRegistry) !== null && t !== void 0 ? t : [], ...(n = e == null ? void 0 : e.typeRegistry) !== null && n !== void 0 ? n : []], r;
|
|
889
889
|
}
|
|
890
|
-
const
|
|
891
|
-
function
|
|
890
|
+
const Ft = Symbol.for("protobuf-ts/message-type");
|
|
891
|
+
function Ye(i) {
|
|
892
892
|
let e = !1;
|
|
893
893
|
const t = [];
|
|
894
|
-
for (let n = 0; n <
|
|
895
|
-
let
|
|
896
|
-
|
|
894
|
+
for (let n = 0; n < i.length; n++) {
|
|
895
|
+
let r = i.charAt(n);
|
|
896
|
+
r == "_" ? e = !0 : /\d/.test(r) ? (t.push(r), e = !0) : e ? (t.push(r.toUpperCase()), e = !1) : n == 0 ? t.push(r.toLowerCase()) : t.push(r);
|
|
897
897
|
}
|
|
898
898
|
return t.join("");
|
|
899
899
|
}
|
|
900
900
|
var h;
|
|
901
|
-
(function(
|
|
902
|
-
|
|
901
|
+
(function(i) {
|
|
902
|
+
i[i.DOUBLE = 1] = "DOUBLE", i[i.FLOAT = 2] = "FLOAT", i[i.INT64 = 3] = "INT64", i[i.UINT64 = 4] = "UINT64", i[i.INT32 = 5] = "INT32", i[i.FIXED64 = 6] = "FIXED64", i[i.FIXED32 = 7] = "FIXED32", i[i.BOOL = 8] = "BOOL", i[i.STRING = 9] = "STRING", i[i.BYTES = 12] = "BYTES", i[i.UINT32 = 13] = "UINT32", i[i.SFIXED32 = 15] = "SFIXED32", i[i.SFIXED64 = 16] = "SFIXED64", i[i.SINT32 = 17] = "SINT32", i[i.SINT64 = 18] = "SINT64";
|
|
903
903
|
})(h || (h = {}));
|
|
904
|
-
var
|
|
905
|
-
(function(
|
|
906
|
-
|
|
907
|
-
})(
|
|
908
|
-
var
|
|
909
|
-
(function(
|
|
910
|
-
|
|
911
|
-
})(
|
|
912
|
-
function wn(
|
|
913
|
-
var e, t, n,
|
|
914
|
-
return
|
|
904
|
+
var Y;
|
|
905
|
+
(function(i) {
|
|
906
|
+
i[i.BIGINT = 0] = "BIGINT", i[i.STRING = 1] = "STRING", i[i.NUMBER = 2] = "NUMBER";
|
|
907
|
+
})(Y || (Y = {}));
|
|
908
|
+
var $e;
|
|
909
|
+
(function(i) {
|
|
910
|
+
i[i.NO = 0] = "NO", i[i.PACKED = 1] = "PACKED", i[i.UNPACKED = 2] = "UNPACKED";
|
|
911
|
+
})($e || ($e = {}));
|
|
912
|
+
function wn(i) {
|
|
913
|
+
var e, t, n, r;
|
|
914
|
+
return i.localName = (e = i.localName) !== null && e !== void 0 ? e : Ye(i.name), i.jsonName = (t = i.jsonName) !== null && t !== void 0 ? t : Ye(i.name), i.repeat = (n = i.repeat) !== null && n !== void 0 ? n : $e.NO, i.opt = (r = i.opt) !== null && r !== void 0 ? r : i.repeat || i.oneof ? !1 : i.kind == "message", i;
|
|
915
915
|
}
|
|
916
|
-
function yn(
|
|
917
|
-
if (typeof
|
|
916
|
+
function yn(i) {
|
|
917
|
+
if (typeof i != "object" || i === null || !i.hasOwnProperty("oneofKind"))
|
|
918
918
|
return !1;
|
|
919
|
-
switch (typeof
|
|
919
|
+
switch (typeof i.oneofKind) {
|
|
920
920
|
case "string":
|
|
921
|
-
return
|
|
921
|
+
return i[i.oneofKind] === void 0 ? !1 : Object.keys(i).length == 2;
|
|
922
922
|
case "undefined":
|
|
923
|
-
return Object.keys(
|
|
923
|
+
return Object.keys(i).length == 1;
|
|
924
924
|
default:
|
|
925
925
|
return !1;
|
|
926
926
|
}
|
|
@@ -934,20 +934,20 @@ class Nn {
|
|
|
934
934
|
if (this.data)
|
|
935
935
|
return;
|
|
936
936
|
const e = [], t = [], n = [];
|
|
937
|
-
for (let
|
|
938
|
-
if (
|
|
939
|
-
n.includes(
|
|
937
|
+
for (let r of this.fields)
|
|
938
|
+
if (r.oneof)
|
|
939
|
+
n.includes(r.oneof) || (n.push(r.oneof), e.push(r.oneof), t.push(r.oneof));
|
|
940
940
|
else
|
|
941
|
-
switch (t.push(
|
|
941
|
+
switch (t.push(r.localName), r.kind) {
|
|
942
942
|
case "scalar":
|
|
943
943
|
case "enum":
|
|
944
|
-
(!
|
|
944
|
+
(!r.opt || r.repeat) && e.push(r.localName);
|
|
945
945
|
break;
|
|
946
946
|
case "message":
|
|
947
|
-
|
|
947
|
+
r.repeat && e.push(r.localName);
|
|
948
948
|
break;
|
|
949
949
|
case "map":
|
|
950
|
-
e.push(
|
|
950
|
+
e.push(r.localName);
|
|
951
951
|
break;
|
|
952
952
|
}
|
|
953
953
|
this.data = { req: e, known: t, oneofs: Object.values(n) };
|
|
@@ -978,8 +978,8 @@ class Nn {
|
|
|
978
978
|
if (e == null || typeof e != "object")
|
|
979
979
|
return !1;
|
|
980
980
|
this.prepare();
|
|
981
|
-
let
|
|
982
|
-
if (
|
|
981
|
+
let r = Object.keys(e), s = this.data;
|
|
982
|
+
if (r.length < s.req.length || s.req.some((o) => !r.includes(o)) || !n && r.some((o) => !s.known.includes(o)))
|
|
983
983
|
return !1;
|
|
984
984
|
if (t < 1)
|
|
985
985
|
return !0;
|
|
@@ -998,54 +998,54 @@ class Nn {
|
|
|
998
998
|
return !1;
|
|
999
999
|
return !0;
|
|
1000
1000
|
}
|
|
1001
|
-
field(e, t, n,
|
|
1001
|
+
field(e, t, n, r) {
|
|
1002
1002
|
let s = t.repeat;
|
|
1003
1003
|
switch (t.kind) {
|
|
1004
1004
|
case "scalar":
|
|
1005
|
-
return e === void 0 ? t.opt : s ? this.scalars(e, t.T,
|
|
1005
|
+
return e === void 0 ? t.opt : s ? this.scalars(e, t.T, r, t.L) : this.scalar(e, t.T, t.L);
|
|
1006
1006
|
case "enum":
|
|
1007
|
-
return e === void 0 ? t.opt : s ? this.scalars(e, h.INT32,
|
|
1007
|
+
return e === void 0 ? t.opt : s ? this.scalars(e, h.INT32, r) : this.scalar(e, h.INT32);
|
|
1008
1008
|
case "message":
|
|
1009
|
-
return e === void 0 ? !0 : s ? this.messages(e, t.T(), n,
|
|
1009
|
+
return e === void 0 ? !0 : s ? this.messages(e, t.T(), n, r) : this.message(e, t.T(), n, r);
|
|
1010
1010
|
case "map":
|
|
1011
1011
|
if (typeof e != "object" || e === null)
|
|
1012
1012
|
return !1;
|
|
1013
|
-
if (
|
|
1013
|
+
if (r < 2)
|
|
1014
1014
|
return !0;
|
|
1015
|
-
if (!this.mapKeys(e, t.K,
|
|
1015
|
+
if (!this.mapKeys(e, t.K, r))
|
|
1016
1016
|
return !1;
|
|
1017
1017
|
switch (t.V.kind) {
|
|
1018
1018
|
case "scalar":
|
|
1019
|
-
return this.scalars(Object.values(e), t.V.T,
|
|
1019
|
+
return this.scalars(Object.values(e), t.V.T, r, t.V.L);
|
|
1020
1020
|
case "enum":
|
|
1021
|
-
return this.scalars(Object.values(e), h.INT32,
|
|
1021
|
+
return this.scalars(Object.values(e), h.INT32, r);
|
|
1022
1022
|
case "message":
|
|
1023
|
-
return this.messages(Object.values(e), t.V.T(), n,
|
|
1023
|
+
return this.messages(Object.values(e), t.V.T(), n, r);
|
|
1024
1024
|
}
|
|
1025
1025
|
break;
|
|
1026
1026
|
}
|
|
1027
1027
|
return !0;
|
|
1028
1028
|
}
|
|
1029
|
-
message(e, t, n,
|
|
1030
|
-
return n ? t.isAssignable(e,
|
|
1029
|
+
message(e, t, n, r) {
|
|
1030
|
+
return n ? t.isAssignable(e, r) : t.is(e, r);
|
|
1031
1031
|
}
|
|
1032
|
-
messages(e, t, n,
|
|
1032
|
+
messages(e, t, n, r) {
|
|
1033
1033
|
if (!Array.isArray(e))
|
|
1034
1034
|
return !1;
|
|
1035
|
-
if (
|
|
1035
|
+
if (r < 2)
|
|
1036
1036
|
return !0;
|
|
1037
1037
|
if (n) {
|
|
1038
|
-
for (let s = 0; s < e.length && s <
|
|
1039
|
-
if (!t.isAssignable(e[s],
|
|
1038
|
+
for (let s = 0; s < e.length && s < r; s++)
|
|
1039
|
+
if (!t.isAssignable(e[s], r - 1))
|
|
1040
1040
|
return !1;
|
|
1041
1041
|
} else
|
|
1042
|
-
for (let s = 0; s < e.length && s <
|
|
1043
|
-
if (!t.is(e[s],
|
|
1042
|
+
for (let s = 0; s < e.length && s < r; s++)
|
|
1043
|
+
if (!t.is(e[s], r - 1))
|
|
1044
1044
|
return !1;
|
|
1045
1045
|
return !0;
|
|
1046
1046
|
}
|
|
1047
1047
|
scalar(e, t, n) {
|
|
1048
|
-
let
|
|
1048
|
+
let r = typeof e;
|
|
1049
1049
|
switch (t) {
|
|
1050
1050
|
case h.UINT64:
|
|
1051
1051
|
case h.FIXED64:
|
|
@@ -1053,62 +1053,62 @@ class Nn {
|
|
|
1053
1053
|
case h.SFIXED64:
|
|
1054
1054
|
case h.SINT64:
|
|
1055
1055
|
switch (n) {
|
|
1056
|
-
case
|
|
1057
|
-
return
|
|
1058
|
-
case
|
|
1059
|
-
return
|
|
1056
|
+
case Y.BIGINT:
|
|
1057
|
+
return r == "bigint";
|
|
1058
|
+
case Y.NUMBER:
|
|
1059
|
+
return r == "number" && !isNaN(e);
|
|
1060
1060
|
default:
|
|
1061
|
-
return
|
|
1061
|
+
return r == "string";
|
|
1062
1062
|
}
|
|
1063
1063
|
case h.BOOL:
|
|
1064
|
-
return
|
|
1064
|
+
return r == "boolean";
|
|
1065
1065
|
case h.STRING:
|
|
1066
|
-
return
|
|
1066
|
+
return r == "string";
|
|
1067
1067
|
case h.BYTES:
|
|
1068
1068
|
return e instanceof Uint8Array;
|
|
1069
1069
|
case h.DOUBLE:
|
|
1070
1070
|
case h.FLOAT:
|
|
1071
|
-
return
|
|
1071
|
+
return r == "number" && !isNaN(e);
|
|
1072
1072
|
default:
|
|
1073
|
-
return
|
|
1073
|
+
return r == "number" && Number.isInteger(e);
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
scalars(e, t, n,
|
|
1076
|
+
scalars(e, t, n, r) {
|
|
1077
1077
|
if (!Array.isArray(e))
|
|
1078
1078
|
return !1;
|
|
1079
1079
|
if (n < 2)
|
|
1080
1080
|
return !0;
|
|
1081
1081
|
if (Array.isArray(e)) {
|
|
1082
1082
|
for (let s = 0; s < e.length && s < n; s++)
|
|
1083
|
-
if (!this.scalar(e[s], t,
|
|
1083
|
+
if (!this.scalar(e[s], t, r))
|
|
1084
1084
|
return !1;
|
|
1085
1085
|
}
|
|
1086
1086
|
return !0;
|
|
1087
1087
|
}
|
|
1088
1088
|
mapKeys(e, t, n) {
|
|
1089
|
-
let
|
|
1089
|
+
let r = Object.keys(e);
|
|
1090
1090
|
switch (t) {
|
|
1091
1091
|
case h.INT32:
|
|
1092
1092
|
case h.FIXED32:
|
|
1093
1093
|
case h.SFIXED32:
|
|
1094
1094
|
case h.SINT32:
|
|
1095
1095
|
case h.UINT32:
|
|
1096
|
-
return this.scalars(
|
|
1096
|
+
return this.scalars(r.slice(0, n).map((s) => parseInt(s)), t, n);
|
|
1097
1097
|
case h.BOOL:
|
|
1098
|
-
return this.scalars(
|
|
1098
|
+
return this.scalars(r.slice(0, n).map((s) => s == "true" ? !0 : s == "false" ? !1 : s), t, n);
|
|
1099
1099
|
default:
|
|
1100
|
-
return this.scalars(
|
|
1100
|
+
return this.scalars(r, t, n, Y.STRING);
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function G(i, e) {
|
|
1105
1105
|
switch (e) {
|
|
1106
|
-
case
|
|
1107
|
-
return
|
|
1108
|
-
case
|
|
1109
|
-
return
|
|
1106
|
+
case Y.BIGINT:
|
|
1107
|
+
return i.toBigInt();
|
|
1108
|
+
case Y.NUMBER:
|
|
1109
|
+
return i.toNumber();
|
|
1110
1110
|
default:
|
|
1111
|
-
return
|
|
1111
|
+
return i.toString();
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
|
1114
1114
|
class En {
|
|
@@ -1127,8 +1127,8 @@ class En {
|
|
|
1127
1127
|
// Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
|
|
1128
1128
|
assert(e, t, n) {
|
|
1129
1129
|
if (!e) {
|
|
1130
|
-
let
|
|
1131
|
-
throw (
|
|
1130
|
+
let r = Nt(n);
|
|
1131
|
+
throw (r == "number" || r == "boolean") && (r = n.toString()), new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`);
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
1134
|
/**
|
|
@@ -1142,7 +1142,7 @@ class En {
|
|
|
1142
1142
|
*/
|
|
1143
1143
|
read(e, t, n) {
|
|
1144
1144
|
this.prepare();
|
|
1145
|
-
const
|
|
1145
|
+
const r = [];
|
|
1146
1146
|
for (const [s, o] of Object.entries(e)) {
|
|
1147
1147
|
const a = this.fMap[s];
|
|
1148
1148
|
if (!a) {
|
|
@@ -1155,9 +1155,9 @@ class En {
|
|
|
1155
1155
|
if (a.oneof) {
|
|
1156
1156
|
if (o === null && (a.kind !== "enum" || a.T()[0] !== "google.protobuf.NullValue"))
|
|
1157
1157
|
continue;
|
|
1158
|
-
if (
|
|
1158
|
+
if (r.includes(a.oneof))
|
|
1159
1159
|
throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);
|
|
1160
|
-
|
|
1160
|
+
r.push(a.oneof), c = t[a.oneof] = {
|
|
1161
1161
|
oneofKind: l
|
|
1162
1162
|
};
|
|
1163
1163
|
} else
|
|
@@ -1166,31 +1166,31 @@ class En {
|
|
|
1166
1166
|
if (o === null)
|
|
1167
1167
|
continue;
|
|
1168
1168
|
this.assert(en(o), a.name, o);
|
|
1169
|
-
const
|
|
1169
|
+
const f = c[l];
|
|
1170
1170
|
for (const [g, y] of Object.entries(o)) {
|
|
1171
1171
|
this.assert(y !== null, a.name + " map value", null);
|
|
1172
|
-
let
|
|
1172
|
+
let O;
|
|
1173
1173
|
switch (a.V.kind) {
|
|
1174
1174
|
case "message":
|
|
1175
|
-
|
|
1175
|
+
O = a.V.T().internalJsonRead(y, n);
|
|
1176
1176
|
break;
|
|
1177
1177
|
case "enum":
|
|
1178
|
-
if (
|
|
1178
|
+
if (O = this.enum(a.V.T(), y, a.name, n.ignoreUnknownFields), O === !1)
|
|
1179
1179
|
continue;
|
|
1180
1180
|
break;
|
|
1181
1181
|
case "scalar":
|
|
1182
|
-
|
|
1182
|
+
O = this.scalar(y, a.V.T, a.V.L, a.name);
|
|
1183
1183
|
break;
|
|
1184
1184
|
}
|
|
1185
|
-
this.assert(
|
|
1186
|
-
let
|
|
1187
|
-
a.K == h.BOOL && (
|
|
1185
|
+
this.assert(O !== void 0, a.name + " map value", y);
|
|
1186
|
+
let E = g;
|
|
1187
|
+
a.K == h.BOOL && (E = E == "true" ? !0 : E == "false" ? !1 : E), E = this.scalar(E, a.K, Y.STRING, a.name).toString(), f[E] = O;
|
|
1188
1188
|
}
|
|
1189
1189
|
} else if (a.repeat) {
|
|
1190
1190
|
if (o === null)
|
|
1191
1191
|
continue;
|
|
1192
1192
|
this.assert(Array.isArray(o), a.name, o);
|
|
1193
|
-
const
|
|
1193
|
+
const f = c[l];
|
|
1194
1194
|
for (const g of o) {
|
|
1195
1195
|
this.assert(g !== null, a.name, null);
|
|
1196
1196
|
let y;
|
|
@@ -1206,7 +1206,7 @@ class En {
|
|
|
1206
1206
|
y = this.scalar(g, a.T, a.L, a.name);
|
|
1207
1207
|
break;
|
|
1208
1208
|
}
|
|
1209
|
-
this.assert(y !== void 0, a.name, o),
|
|
1209
|
+
this.assert(y !== void 0, a.name, o), f.push(y);
|
|
1210
1210
|
}
|
|
1211
1211
|
} else
|
|
1212
1212
|
switch (a.kind) {
|
|
@@ -1218,10 +1218,10 @@ class En {
|
|
|
1218
1218
|
c[l] = a.T().internalJsonRead(o, n, c[l]);
|
|
1219
1219
|
break;
|
|
1220
1220
|
case "enum":
|
|
1221
|
-
let
|
|
1222
|
-
if (
|
|
1221
|
+
let f = this.enum(a.T(), o, a.name, n.ignoreUnknownFields);
|
|
1222
|
+
if (f === !1)
|
|
1223
1223
|
continue;
|
|
1224
|
-
c[l] =
|
|
1224
|
+
c[l] = f;
|
|
1225
1225
|
break;
|
|
1226
1226
|
case "scalar":
|
|
1227
1227
|
c[l] = this.scalar(o, a.T, a.L, a.name);
|
|
@@ -1234,7 +1234,7 @@ class En {
|
|
|
1234
1234
|
*
|
|
1235
1235
|
* google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
|
|
1236
1236
|
*/
|
|
1237
|
-
enum(e, t, n,
|
|
1237
|
+
enum(e, t, n, r) {
|
|
1238
1238
|
if (e[0] == "google.protobuf.NullValue" && w(t === null || t === "NULL_VALUE", `Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`), t === null)
|
|
1239
1239
|
return 0;
|
|
1240
1240
|
switch (typeof t) {
|
|
@@ -1244,11 +1244,11 @@ class En {
|
|
|
1244
1244
|
let s = t;
|
|
1245
1245
|
e[2] && t.substring(0, e[2].length) === e[2] && (s = t.substring(e[2].length));
|
|
1246
1246
|
let o = e[1][s];
|
|
1247
|
-
return typeof o > "u" &&
|
|
1247
|
+
return typeof o > "u" && r ? !1 : (w(typeof o == "number", `Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`), o);
|
|
1248
1248
|
}
|
|
1249
1249
|
w(!1, `Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`);
|
|
1250
1250
|
}
|
|
1251
|
-
scalar(e, t, n,
|
|
1251
|
+
scalar(e, t, n, r) {
|
|
1252
1252
|
let s;
|
|
1253
1253
|
try {
|
|
1254
1254
|
switch (t) {
|
|
@@ -1292,22 +1292,22 @@ class En {
|
|
|
1292
1292
|
let a;
|
|
1293
1293
|
if (typeof e == "number" ? a = e : e === "" ? s = "empty string" : typeof e == "string" && (e.trim().length !== e.length ? s = "extra whitespace" : a = Number(e)), a === void 0)
|
|
1294
1294
|
break;
|
|
1295
|
-
return t == h.UINT32 ?
|
|
1295
|
+
return t == h.UINT32 ? Ve(a) : Le(a), a;
|
|
1296
1296
|
case h.INT64:
|
|
1297
1297
|
case h.SFIXED64:
|
|
1298
1298
|
case h.SINT64:
|
|
1299
1299
|
if (e === null)
|
|
1300
|
-
return
|
|
1300
|
+
return G(B.ZERO, n);
|
|
1301
1301
|
if (typeof e != "number" && typeof e != "string")
|
|
1302
1302
|
break;
|
|
1303
|
-
return
|
|
1303
|
+
return G(B.from(e), n);
|
|
1304
1304
|
case h.FIXED64:
|
|
1305
1305
|
case h.UINT64:
|
|
1306
1306
|
if (e === null)
|
|
1307
|
-
return
|
|
1307
|
+
return G(R.ZERO, n);
|
|
1308
1308
|
if (typeof e != "number" && typeof e != "string")
|
|
1309
1309
|
break;
|
|
1310
|
-
return
|
|
1310
|
+
return G(R.from(e), n);
|
|
1311
1311
|
case h.BOOL:
|
|
1312
1312
|
if (e === null)
|
|
1313
1313
|
return !1;
|
|
@@ -1338,7 +1338,7 @@ class En {
|
|
|
1338
1338
|
} catch (o) {
|
|
1339
1339
|
s = o.message;
|
|
1340
1340
|
}
|
|
1341
|
-
this.assert(!1,
|
|
1341
|
+
this.assert(!1, r + (s ? " - " + s : ""), e);
|
|
1342
1342
|
}
|
|
1343
1343
|
}
|
|
1344
1344
|
class kn {
|
|
@@ -1350,14 +1350,14 @@ class kn {
|
|
|
1350
1350
|
* Converts the message to a JSON object, based on the field descriptors.
|
|
1351
1351
|
*/
|
|
1352
1352
|
write(e, t) {
|
|
1353
|
-
const n = {},
|
|
1353
|
+
const n = {}, r = e;
|
|
1354
1354
|
for (const s of this.fields) {
|
|
1355
1355
|
if (!s.oneof) {
|
|
1356
|
-
let c = this.field(s,
|
|
1356
|
+
let c = this.field(s, r[s.localName], t);
|
|
1357
1357
|
c !== void 0 && (n[t.useProtoFieldName ? s.name : s.jsonName] = c);
|
|
1358
1358
|
continue;
|
|
1359
1359
|
}
|
|
1360
|
-
const o =
|
|
1360
|
+
const o = r[s.oneof];
|
|
1361
1361
|
if (o.oneofKind !== s.localName)
|
|
1362
1362
|
continue;
|
|
1363
1363
|
const a = s.kind == "scalar" || s.kind == "enum" ? Object.assign(Object.assign({}, t), { emitDefaultValues: !0 }) : t;
|
|
@@ -1367,34 +1367,34 @@ class kn {
|
|
|
1367
1367
|
return n;
|
|
1368
1368
|
}
|
|
1369
1369
|
field(e, t, n) {
|
|
1370
|
-
let
|
|
1370
|
+
let r;
|
|
1371
1371
|
if (e.kind == "map") {
|
|
1372
1372
|
w(typeof t == "object" && t !== null);
|
|
1373
1373
|
const s = {};
|
|
1374
1374
|
switch (e.V.kind) {
|
|
1375
1375
|
case "scalar":
|
|
1376
1376
|
for (const [l, c] of Object.entries(t)) {
|
|
1377
|
-
const
|
|
1378
|
-
w(
|
|
1377
|
+
const f = this.scalar(e.V.T, c, e.name, !1, !0);
|
|
1378
|
+
w(f !== void 0), s[l.toString()] = f;
|
|
1379
1379
|
}
|
|
1380
1380
|
break;
|
|
1381
1381
|
case "message":
|
|
1382
1382
|
const o = e.V.T();
|
|
1383
1383
|
for (const [l, c] of Object.entries(t)) {
|
|
1384
|
-
const
|
|
1385
|
-
w(
|
|
1384
|
+
const f = this.message(o, c, e.name, n);
|
|
1385
|
+
w(f !== void 0), s[l.toString()] = f;
|
|
1386
1386
|
}
|
|
1387
1387
|
break;
|
|
1388
1388
|
case "enum":
|
|
1389
1389
|
const a = e.V.T();
|
|
1390
1390
|
for (const [l, c] of Object.entries(t)) {
|
|
1391
1391
|
w(c === void 0 || typeof c == "number");
|
|
1392
|
-
const
|
|
1393
|
-
w(
|
|
1392
|
+
const f = this.enum(a, c, e.name, !1, !0, n.enumAsInteger);
|
|
1393
|
+
w(f !== void 0), s[l.toString()] = f;
|
|
1394
1394
|
}
|
|
1395
1395
|
break;
|
|
1396
1396
|
}
|
|
1397
|
-
(n.emitDefaultValues || Object.keys(s).length > 0) && (
|
|
1397
|
+
(n.emitDefaultValues || Object.keys(s).length > 0) && (r = s);
|
|
1398
1398
|
} else if (e.repeat) {
|
|
1399
1399
|
w(Array.isArray(t));
|
|
1400
1400
|
const s = [];
|
|
@@ -1421,51 +1421,51 @@ class kn {
|
|
|
1421
1421
|
}
|
|
1422
1422
|
break;
|
|
1423
1423
|
}
|
|
1424
|
-
(n.emitDefaultValues || s.length > 0 || n.emitDefaultValues) && (
|
|
1424
|
+
(n.emitDefaultValues || s.length > 0 || n.emitDefaultValues) && (r = s);
|
|
1425
1425
|
} else
|
|
1426
1426
|
switch (e.kind) {
|
|
1427
1427
|
case "scalar":
|
|
1428
|
-
|
|
1428
|
+
r = this.scalar(e.T, t, e.name, e.opt, n.emitDefaultValues);
|
|
1429
1429
|
break;
|
|
1430
1430
|
case "enum":
|
|
1431
|
-
|
|
1431
|
+
r = this.enum(e.T(), t, e.name, e.opt, n.emitDefaultValues, n.enumAsInteger);
|
|
1432
1432
|
break;
|
|
1433
1433
|
case "message":
|
|
1434
|
-
|
|
1434
|
+
r = this.message(e.T(), t, e.name, n);
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
|
-
return
|
|
1437
|
+
return r;
|
|
1438
1438
|
}
|
|
1439
1439
|
/**
|
|
1440
1440
|
* Returns `null` as the default for google.protobuf.NullValue.
|
|
1441
1441
|
*/
|
|
1442
|
-
enum(e, t, n,
|
|
1442
|
+
enum(e, t, n, r, s, o) {
|
|
1443
1443
|
if (e[0] == "google.protobuf.NullValue")
|
|
1444
|
-
return !s && !
|
|
1444
|
+
return !s && !r ? void 0 : null;
|
|
1445
1445
|
if (t === void 0) {
|
|
1446
|
-
w(
|
|
1446
|
+
w(r);
|
|
1447
1447
|
return;
|
|
1448
1448
|
}
|
|
1449
|
-
if (!(t === 0 && !s && !
|
|
1449
|
+
if (!(t === 0 && !s && !r))
|
|
1450
1450
|
return w(typeof t == "number"), w(Number.isInteger(t)), o || !e[1].hasOwnProperty(t) ? t : e[2] ? e[2] + e[1][t] : e[1][t];
|
|
1451
1451
|
}
|
|
1452
|
-
message(e, t, n,
|
|
1453
|
-
return t === void 0 ?
|
|
1452
|
+
message(e, t, n, r) {
|
|
1453
|
+
return t === void 0 ? r.emitDefaultValues ? null : void 0 : e.internalJsonWrite(t, r);
|
|
1454
1454
|
}
|
|
1455
|
-
scalar(e, t, n,
|
|
1455
|
+
scalar(e, t, n, r, s) {
|
|
1456
1456
|
if (t === void 0) {
|
|
1457
|
-
w(
|
|
1457
|
+
w(r);
|
|
1458
1458
|
return;
|
|
1459
1459
|
}
|
|
1460
|
-
const o = s ||
|
|
1460
|
+
const o = s || r;
|
|
1461
1461
|
switch (e) {
|
|
1462
1462
|
case h.INT32:
|
|
1463
1463
|
case h.SFIXED32:
|
|
1464
1464
|
case h.SINT32:
|
|
1465
|
-
return t === 0 ? o ? 0 : void 0 : (
|
|
1465
|
+
return t === 0 ? o ? 0 : void 0 : (Le(t), t);
|
|
1466
1466
|
case h.FIXED32:
|
|
1467
1467
|
case h.UINT32:
|
|
1468
|
-
return t === 0 ? o ? 0 : void 0 : (
|
|
1468
|
+
return t === 0 ? o ? 0 : void 0 : (Ve(t), t);
|
|
1469
1469
|
case h.FLOAT:
|
|
1470
1470
|
et(t);
|
|
1471
1471
|
case h.DOUBLE:
|
|
@@ -1477,7 +1477,7 @@ class kn {
|
|
|
1477
1477
|
case h.UINT64:
|
|
1478
1478
|
case h.FIXED64:
|
|
1479
1479
|
w(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
|
|
1480
|
-
let a =
|
|
1480
|
+
let a = R.from(t);
|
|
1481
1481
|
return a.isZero() && !o ? void 0 : a.toString();
|
|
1482
1482
|
case h.INT64:
|
|
1483
1483
|
case h.SFIXED64:
|
|
@@ -1490,17 +1490,17 @@ class kn {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
|
-
function ze(
|
|
1494
|
-
switch (
|
|
1493
|
+
function ze(i, e = Y.STRING) {
|
|
1494
|
+
switch (i) {
|
|
1495
1495
|
case h.BOOL:
|
|
1496
1496
|
return !1;
|
|
1497
1497
|
case h.UINT64:
|
|
1498
1498
|
case h.FIXED64:
|
|
1499
|
-
return
|
|
1499
|
+
return G(R.ZERO, e);
|
|
1500
1500
|
case h.INT64:
|
|
1501
1501
|
case h.SFIXED64:
|
|
1502
1502
|
case h.SINT64:
|
|
1503
|
-
return
|
|
1503
|
+
return G(B.ZERO, e);
|
|
1504
1504
|
case h.DOUBLE:
|
|
1505
1505
|
case h.FLOAT:
|
|
1506
1506
|
return 0;
|
|
@@ -1532,47 +1532,47 @@ class In {
|
|
|
1532
1532
|
* If a message field is already present, it will be merged with the
|
|
1533
1533
|
* new data.
|
|
1534
1534
|
*/
|
|
1535
|
-
read(e, t, n,
|
|
1535
|
+
read(e, t, n, r) {
|
|
1536
1536
|
this.prepare();
|
|
1537
|
-
const s =
|
|
1537
|
+
const s = r === void 0 ? e.len : e.pos + r;
|
|
1538
1538
|
for (; e.pos < s; ) {
|
|
1539
1539
|
const [o, a] = e.tag(), l = this.fieldNoToField.get(o);
|
|
1540
1540
|
if (!l) {
|
|
1541
1541
|
let y = n.readUnknownField;
|
|
1542
1542
|
if (y == "throw")
|
|
1543
1543
|
throw new Error(`Unknown field ${o} (wire type ${a}) for ${this.info.typeName}`);
|
|
1544
|
-
let
|
|
1545
|
-
y !== !1 && (y === !0 ?
|
|
1544
|
+
let O = e.skip(a);
|
|
1545
|
+
y !== !1 && (y === !0 ? k.onRead : y)(this.info.typeName, t, o, a, O);
|
|
1546
1546
|
continue;
|
|
1547
1547
|
}
|
|
1548
|
-
let c = t,
|
|
1548
|
+
let c = t, f = l.repeat, g = l.localName;
|
|
1549
1549
|
switch (l.oneof && (c = c[l.oneof], c.oneofKind !== g && (c = t[l.oneof] = {
|
|
1550
1550
|
oneofKind: g
|
|
1551
1551
|
})), l.kind) {
|
|
1552
1552
|
case "scalar":
|
|
1553
1553
|
case "enum":
|
|
1554
|
-
let y = l.kind == "enum" ? h.INT32 : l.T,
|
|
1555
|
-
if (
|
|
1556
|
-
let
|
|
1554
|
+
let y = l.kind == "enum" ? h.INT32 : l.T, O = l.kind == "scalar" ? l.L : void 0;
|
|
1555
|
+
if (f) {
|
|
1556
|
+
let F = c[g];
|
|
1557
1557
|
if (a == m.LengthDelimited && y != h.STRING && y != h.BYTES) {
|
|
1558
|
-
let
|
|
1559
|
-
for (; e.pos <
|
|
1560
|
-
|
|
1558
|
+
let q = e.uint32() + e.pos;
|
|
1559
|
+
for (; e.pos < q; )
|
|
1560
|
+
F.push(this.scalar(e, y, O));
|
|
1561
1561
|
} else
|
|
1562
|
-
|
|
1562
|
+
F.push(this.scalar(e, y, O));
|
|
1563
1563
|
} else
|
|
1564
|
-
c[g] = this.scalar(e, y,
|
|
1564
|
+
c[g] = this.scalar(e, y, O);
|
|
1565
1565
|
break;
|
|
1566
1566
|
case "message":
|
|
1567
|
-
if (
|
|
1568
|
-
let
|
|
1569
|
-
|
|
1567
|
+
if (f) {
|
|
1568
|
+
let F = c[g], q = l.T().internalBinaryRead(e, e.uint32(), n);
|
|
1569
|
+
F.push(q);
|
|
1570
1570
|
} else
|
|
1571
1571
|
c[g] = l.T().internalBinaryRead(e, e.uint32(), n, c[g]);
|
|
1572
1572
|
break;
|
|
1573
1573
|
case "map":
|
|
1574
|
-
let [
|
|
1575
|
-
c[g][
|
|
1574
|
+
let [E, le] = this.mapEntry(l, e, n);
|
|
1575
|
+
c[g][E] = le;
|
|
1576
1576
|
break;
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
@@ -1581,12 +1581,12 @@ class In {
|
|
|
1581
1581
|
* Read a map field, expecting key field = 1, value field = 2
|
|
1582
1582
|
*/
|
|
1583
1583
|
mapEntry(e, t, n) {
|
|
1584
|
-
let
|
|
1584
|
+
let r = t.uint32(), s = t.pos + r, o, a;
|
|
1585
1585
|
for (; t.pos < s; ) {
|
|
1586
1586
|
let [l, c] = t.tag();
|
|
1587
1587
|
switch (l) {
|
|
1588
1588
|
case 1:
|
|
1589
|
-
e.K == h.BOOL ? o = t.bool().toString() : o = this.scalar(t, e.K,
|
|
1589
|
+
e.K == h.BOOL ? o = t.bool().toString() : o = this.scalar(t, e.K, Y.STRING);
|
|
1590
1590
|
break;
|
|
1591
1591
|
case 2:
|
|
1592
1592
|
switch (e.V.kind) {
|
|
@@ -1636,11 +1636,11 @@ class In {
|
|
|
1636
1636
|
case h.FLOAT:
|
|
1637
1637
|
return e.float();
|
|
1638
1638
|
case h.INT64:
|
|
1639
|
-
return
|
|
1639
|
+
return G(e.int64(), n);
|
|
1640
1640
|
case h.UINT64:
|
|
1641
|
-
return
|
|
1641
|
+
return G(e.uint64(), n);
|
|
1642
1642
|
case h.FIXED64:
|
|
1643
|
-
return
|
|
1643
|
+
return G(e.fixed64(), n);
|
|
1644
1644
|
case h.FIXED32:
|
|
1645
1645
|
return e.fixed32();
|
|
1646
1646
|
case h.BYTES:
|
|
@@ -1650,11 +1650,11 @@ class In {
|
|
|
1650
1650
|
case h.SFIXED32:
|
|
1651
1651
|
return e.sfixed32();
|
|
1652
1652
|
case h.SFIXED64:
|
|
1653
|
-
return
|
|
1653
|
+
return G(e.sfixed64(), n);
|
|
1654
1654
|
case h.SINT32:
|
|
1655
1655
|
return e.sint32();
|
|
1656
1656
|
case h.SINT64:
|
|
1657
|
-
return
|
|
1657
|
+
return G(e.sint64(), n);
|
|
1658
1658
|
}
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
@@ -1676,23 +1676,23 @@ class Tn {
|
|
|
1676
1676
|
for (const s of this.fields) {
|
|
1677
1677
|
let o, a, l = s.repeat, c = s.localName;
|
|
1678
1678
|
if (s.oneof) {
|
|
1679
|
-
const
|
|
1680
|
-
if (
|
|
1679
|
+
const f = e[s.oneof];
|
|
1680
|
+
if (f.oneofKind !== c)
|
|
1681
1681
|
continue;
|
|
1682
|
-
o =
|
|
1682
|
+
o = f[c], a = !0;
|
|
1683
1683
|
} else
|
|
1684
1684
|
o = e[c], a = !1;
|
|
1685
1685
|
switch (s.kind) {
|
|
1686
1686
|
case "scalar":
|
|
1687
1687
|
case "enum":
|
|
1688
|
-
let
|
|
1688
|
+
let f = s.kind == "enum" ? h.INT32 : s.T;
|
|
1689
1689
|
if (l)
|
|
1690
|
-
if (w(Array.isArray(o)), l ==
|
|
1691
|
-
this.packed(t,
|
|
1690
|
+
if (w(Array.isArray(o)), l == $e.PACKED)
|
|
1691
|
+
this.packed(t, f, s.no, o);
|
|
1692
1692
|
else
|
|
1693
1693
|
for (const g of o)
|
|
1694
|
-
this.scalar(t,
|
|
1695
|
-
else o === void 0 ? w(s.opt) : this.scalar(t,
|
|
1694
|
+
this.scalar(t, f, s.no, g, !0);
|
|
1695
|
+
else o === void 0 ? w(s.opt) : this.scalar(t, f, s.no, o, a || s.opt);
|
|
1696
1696
|
break;
|
|
1697
1697
|
case "message":
|
|
1698
1698
|
if (l) {
|
|
@@ -1709,22 +1709,22 @@ class Tn {
|
|
|
1709
1709
|
break;
|
|
1710
1710
|
}
|
|
1711
1711
|
}
|
|
1712
|
-
let
|
|
1713
|
-
|
|
1712
|
+
let r = n.writeUnknownFields;
|
|
1713
|
+
r !== !1 && (r === !0 ? k.onWrite : r)(this.info.typeName, e, t);
|
|
1714
1714
|
}
|
|
1715
|
-
mapEntry(e, t, n,
|
|
1715
|
+
mapEntry(e, t, n, r, s) {
|
|
1716
1716
|
e.tag(n.no, m.LengthDelimited), e.fork();
|
|
1717
|
-
let o =
|
|
1717
|
+
let o = r;
|
|
1718
1718
|
switch (n.K) {
|
|
1719
1719
|
case h.INT32:
|
|
1720
1720
|
case h.FIXED32:
|
|
1721
1721
|
case h.UINT32:
|
|
1722
1722
|
case h.SFIXED32:
|
|
1723
1723
|
case h.SINT32:
|
|
1724
|
-
o = Number.parseInt(
|
|
1724
|
+
o = Number.parseInt(r);
|
|
1725
1725
|
break;
|
|
1726
1726
|
case h.BOOL:
|
|
1727
|
-
w(
|
|
1727
|
+
w(r == "true" || r == "false"), o = r == "true";
|
|
1728
1728
|
break;
|
|
1729
1729
|
}
|
|
1730
1730
|
switch (this.scalar(e, n.K, 1, o, !0), n.V.kind) {
|
|
@@ -1740,26 +1740,26 @@ class Tn {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
e.join();
|
|
1742
1742
|
}
|
|
1743
|
-
message(e, t, n,
|
|
1744
|
-
s !== void 0 && (n.internalBinaryWrite(s, e.tag(
|
|
1743
|
+
message(e, t, n, r, s) {
|
|
1744
|
+
s !== void 0 && (n.internalBinaryWrite(s, e.tag(r, m.LengthDelimited).fork(), t), e.join());
|
|
1745
1745
|
}
|
|
1746
1746
|
/**
|
|
1747
1747
|
* Write a single scalar value.
|
|
1748
1748
|
*/
|
|
1749
|
-
scalar(e, t, n,
|
|
1750
|
-
let [o, a, l] = this.scalarInfo(t,
|
|
1751
|
-
(!l || s) && (e.tag(n, o), e[a](
|
|
1749
|
+
scalar(e, t, n, r, s) {
|
|
1750
|
+
let [o, a, l] = this.scalarInfo(t, r);
|
|
1751
|
+
(!l || s) && (e.tag(n, o), e[a](r));
|
|
1752
1752
|
}
|
|
1753
1753
|
/**
|
|
1754
1754
|
* Write an array of scalar values in packed format.
|
|
1755
1755
|
*/
|
|
1756
|
-
packed(e, t, n,
|
|
1757
|
-
if (!
|
|
1756
|
+
packed(e, t, n, r) {
|
|
1757
|
+
if (!r.length)
|
|
1758
1758
|
return;
|
|
1759
1759
|
w(t !== h.BYTES && t !== h.STRING), e.tag(n, m.LengthDelimited), e.fork();
|
|
1760
1760
|
let [, s] = this.scalarInfo(t);
|
|
1761
|
-
for (let o = 0; o <
|
|
1762
|
-
e[s](
|
|
1761
|
+
for (let o = 0; o < r.length; o++)
|
|
1762
|
+
e[s](r[o]);
|
|
1763
1763
|
e.join();
|
|
1764
1764
|
}
|
|
1765
1765
|
/**
|
|
@@ -1773,60 +1773,60 @@ class Tn {
|
|
|
1773
1773
|
* If argument `value` is omitted, [2] is always false.
|
|
1774
1774
|
*/
|
|
1775
1775
|
scalarInfo(e, t) {
|
|
1776
|
-
let n = m.Varint,
|
|
1776
|
+
let n = m.Varint, r, s = t === void 0, o = t === 0;
|
|
1777
1777
|
switch (e) {
|
|
1778
1778
|
case h.INT32:
|
|
1779
|
-
|
|
1779
|
+
r = "int32";
|
|
1780
1780
|
break;
|
|
1781
1781
|
case h.STRING:
|
|
1782
|
-
o = s || !t.length, n = m.LengthDelimited,
|
|
1782
|
+
o = s || !t.length, n = m.LengthDelimited, r = "string";
|
|
1783
1783
|
break;
|
|
1784
1784
|
case h.BOOL:
|
|
1785
|
-
o = t === !1,
|
|
1785
|
+
o = t === !1, r = "bool";
|
|
1786
1786
|
break;
|
|
1787
1787
|
case h.UINT32:
|
|
1788
|
-
|
|
1788
|
+
r = "uint32";
|
|
1789
1789
|
break;
|
|
1790
1790
|
case h.DOUBLE:
|
|
1791
|
-
n = m.Bit64,
|
|
1791
|
+
n = m.Bit64, r = "double";
|
|
1792
1792
|
break;
|
|
1793
1793
|
case h.FLOAT:
|
|
1794
|
-
n = m.Bit32,
|
|
1794
|
+
n = m.Bit32, r = "float";
|
|
1795
1795
|
break;
|
|
1796
1796
|
case h.INT64:
|
|
1797
|
-
o = s || B.from(t).isZero(),
|
|
1797
|
+
o = s || B.from(t).isZero(), r = "int64";
|
|
1798
1798
|
break;
|
|
1799
1799
|
case h.UINT64:
|
|
1800
|
-
o = s ||
|
|
1800
|
+
o = s || R.from(t).isZero(), r = "uint64";
|
|
1801
1801
|
break;
|
|
1802
1802
|
case h.FIXED64:
|
|
1803
|
-
o = s ||
|
|
1803
|
+
o = s || R.from(t).isZero(), n = m.Bit64, r = "fixed64";
|
|
1804
1804
|
break;
|
|
1805
1805
|
case h.BYTES:
|
|
1806
|
-
o = s || !t.byteLength, n = m.LengthDelimited,
|
|
1806
|
+
o = s || !t.byteLength, n = m.LengthDelimited, r = "bytes";
|
|
1807
1807
|
break;
|
|
1808
1808
|
case h.FIXED32:
|
|
1809
|
-
n = m.Bit32,
|
|
1809
|
+
n = m.Bit32, r = "fixed32";
|
|
1810
1810
|
break;
|
|
1811
1811
|
case h.SFIXED32:
|
|
1812
|
-
n = m.Bit32,
|
|
1812
|
+
n = m.Bit32, r = "sfixed32";
|
|
1813
1813
|
break;
|
|
1814
1814
|
case h.SFIXED64:
|
|
1815
|
-
o = s || B.from(t).isZero(), n = m.Bit64,
|
|
1815
|
+
o = s || B.from(t).isZero(), n = m.Bit64, r = "sfixed64";
|
|
1816
1816
|
break;
|
|
1817
1817
|
case h.SINT32:
|
|
1818
|
-
|
|
1818
|
+
r = "sint32";
|
|
1819
1819
|
break;
|
|
1820
1820
|
case h.SINT64:
|
|
1821
|
-
o = s || B.from(t).isZero(),
|
|
1821
|
+
o = s || B.from(t).isZero(), r = "sint64";
|
|
1822
1822
|
break;
|
|
1823
1823
|
}
|
|
1824
|
-
return [n,
|
|
1824
|
+
return [n, r, s || o];
|
|
1825
1825
|
}
|
|
1826
1826
|
}
|
|
1827
|
-
function An(
|
|
1828
|
-
const e =
|
|
1829
|
-
for (let t of
|
|
1827
|
+
function An(i) {
|
|
1828
|
+
const e = i.messagePrototype ? Object.create(i.messagePrototype) : Object.defineProperty({}, Ft, { value: i });
|
|
1829
|
+
for (let t of i.fields) {
|
|
1830
1830
|
let n = t.localName;
|
|
1831
1831
|
if (!t.opt)
|
|
1832
1832
|
if (t.oneof)
|
|
@@ -1848,19 +1848,19 @@ function An(r) {
|
|
|
1848
1848
|
}
|
|
1849
1849
|
return e;
|
|
1850
1850
|
}
|
|
1851
|
-
function
|
|
1852
|
-
let n,
|
|
1853
|
-
for (let o of
|
|
1851
|
+
function x(i, e, t) {
|
|
1852
|
+
let n, r = t, s;
|
|
1853
|
+
for (let o of i.fields) {
|
|
1854
1854
|
let a = o.localName;
|
|
1855
1855
|
if (o.oneof) {
|
|
1856
|
-
const l =
|
|
1856
|
+
const l = r[o.oneof];
|
|
1857
1857
|
if ((l == null ? void 0 : l.oneofKind) == null)
|
|
1858
1858
|
continue;
|
|
1859
1859
|
if (n = l[a], s = e[o.oneof], s.oneofKind = l.oneofKind, n == null) {
|
|
1860
1860
|
delete s[a];
|
|
1861
1861
|
continue;
|
|
1862
1862
|
}
|
|
1863
|
-
} else if (n =
|
|
1863
|
+
} else if (n = r[a], s = e, n == null)
|
|
1864
1864
|
continue;
|
|
1865
1865
|
switch (o.repeat && (s[a].length = n.length), o.kind) {
|
|
1866
1866
|
case "scalar":
|
|
@@ -1886,30 +1886,30 @@ function C(r, e, t) {
|
|
|
1886
1886
|
break;
|
|
1887
1887
|
case "message":
|
|
1888
1888
|
let c = o.V.T();
|
|
1889
|
-
for (let
|
|
1890
|
-
s[a][
|
|
1889
|
+
for (let f of Object.keys(n))
|
|
1890
|
+
s[a][f] = c.create(n[f]);
|
|
1891
1891
|
break;
|
|
1892
1892
|
}
|
|
1893
1893
|
break;
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
1896
|
}
|
|
1897
|
-
function
|
|
1897
|
+
function On(i, e, t) {
|
|
1898
1898
|
if (e === t)
|
|
1899
1899
|
return !0;
|
|
1900
1900
|
if (!e || !t)
|
|
1901
1901
|
return !1;
|
|
1902
|
-
for (let n of
|
|
1903
|
-
let
|
|
1902
|
+
for (let n of i.fields) {
|
|
1903
|
+
let r = n.localName, s = n.oneof ? e[n.oneof][r] : e[r], o = n.oneof ? t[n.oneof][r] : t[r];
|
|
1904
1904
|
switch (n.kind) {
|
|
1905
1905
|
case "enum":
|
|
1906
1906
|
case "scalar":
|
|
1907
1907
|
let a = n.kind == "enum" ? h.INT32 : n.T;
|
|
1908
|
-
if (!(n.repeat ?
|
|
1908
|
+
if (!(n.repeat ? dt(a, s, o) : Lt(a, s, o)))
|
|
1909
1909
|
return !1;
|
|
1910
1910
|
break;
|
|
1911
1911
|
case "map":
|
|
1912
|
-
if (!(n.V.kind == "message" ? mt(n.V.T(),
|
|
1912
|
+
if (!(n.V.kind == "message" ? mt(n.V.T(), Re(s), Re(o)) : dt(n.V.kind == "enum" ? h.INT32 : n.V.T, Re(s), Re(o))))
|
|
1913
1913
|
return !1;
|
|
1914
1914
|
break;
|
|
1915
1915
|
case "message":
|
|
@@ -1921,44 +1921,44 @@ function Fn(r, e, t) {
|
|
|
1921
1921
|
}
|
|
1922
1922
|
return !0;
|
|
1923
1923
|
}
|
|
1924
|
-
const
|
|
1925
|
-
function
|
|
1924
|
+
const Re = Object.values;
|
|
1925
|
+
function Lt(i, e, t) {
|
|
1926
1926
|
if (e === t)
|
|
1927
1927
|
return !0;
|
|
1928
|
-
if (
|
|
1928
|
+
if (i !== h.BYTES)
|
|
1929
1929
|
return !1;
|
|
1930
|
-
let n = e,
|
|
1931
|
-
if (n.length !==
|
|
1930
|
+
let n = e, r = t;
|
|
1931
|
+
if (n.length !== r.length)
|
|
1932
1932
|
return !1;
|
|
1933
1933
|
for (let s = 0; s < n.length; s++)
|
|
1934
|
-
if (n[s] !=
|
|
1934
|
+
if (n[s] != r[s])
|
|
1935
1935
|
return !1;
|
|
1936
1936
|
return !0;
|
|
1937
1937
|
}
|
|
1938
|
-
function
|
|
1938
|
+
function dt(i, e, t) {
|
|
1939
1939
|
if (e.length !== t.length)
|
|
1940
1940
|
return !1;
|
|
1941
1941
|
for (let n = 0; n < e.length; n++)
|
|
1942
|
-
if (!
|
|
1942
|
+
if (!Lt(i, e[n], t[n]))
|
|
1943
1943
|
return !1;
|
|
1944
1944
|
return !0;
|
|
1945
1945
|
}
|
|
1946
|
-
function mt(
|
|
1946
|
+
function mt(i, e, t) {
|
|
1947
1947
|
if (e.length !== t.length)
|
|
1948
1948
|
return !1;
|
|
1949
1949
|
for (let n = 0; n < e.length; n++)
|
|
1950
|
-
if (!
|
|
1950
|
+
if (!i.equals(e[n], t[n]))
|
|
1951
1951
|
return !1;
|
|
1952
1952
|
return !0;
|
|
1953
1953
|
}
|
|
1954
|
-
const
|
|
1955
|
-
class
|
|
1954
|
+
const Fn = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
|
|
1955
|
+
class P {
|
|
1956
1956
|
constructor(e, t, n) {
|
|
1957
|
-
this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(wn), this.options = n ?? {}, this.messagePrototype = Object.create(null, Object.assign(Object.assign({},
|
|
1957
|
+
this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(wn), this.options = n ?? {}, this.messagePrototype = Object.create(null, Object.assign(Object.assign({}, Fn), { [Ft]: { value: this } })), this.refTypeCheck = new Nn(this), this.refJsonReader = new En(this), this.refJsonWriter = new kn(this), this.refBinReader = new In(this), this.refBinWriter = new Tn(this);
|
|
1958
1958
|
}
|
|
1959
1959
|
create(e) {
|
|
1960
1960
|
let t = An(this);
|
|
1961
|
-
return e !== void 0 &&
|
|
1961
|
+
return e !== void 0 && x(this, t, e), t;
|
|
1962
1962
|
}
|
|
1963
1963
|
/**
|
|
1964
1964
|
* Clone the message.
|
|
@@ -1967,7 +1967,7 @@ class j {
|
|
|
1967
1967
|
*/
|
|
1968
1968
|
clone(e) {
|
|
1969
1969
|
let t = this.create();
|
|
1970
|
-
return
|
|
1970
|
+
return x(this, t, e), t;
|
|
1971
1971
|
}
|
|
1972
1972
|
/**
|
|
1973
1973
|
* Determines whether two message of the same type have the same field values.
|
|
@@ -1976,7 +1976,7 @@ class j {
|
|
|
1976
1976
|
* Will also return true if both messages are `undefined`.
|
|
1977
1977
|
*/
|
|
1978
1978
|
equals(e, t) {
|
|
1979
|
-
return
|
|
1979
|
+
return On(this, e, t);
|
|
1980
1980
|
}
|
|
1981
1981
|
/**
|
|
1982
1982
|
* Is the given value assignable to our message type
|
|
@@ -1996,7 +1996,7 @@ class j {
|
|
|
1996
1996
|
* Copy partial data into the target message.
|
|
1997
1997
|
*/
|
|
1998
1998
|
mergePartial(e, t) {
|
|
1999
|
-
|
|
1999
|
+
x(this, e, t);
|
|
2000
2000
|
}
|
|
2001
2001
|
/**
|
|
2002
2002
|
* Create a new message from binary format.
|
|
@@ -2031,14 +2031,14 @@ class j {
|
|
|
2031
2031
|
*/
|
|
2032
2032
|
toJsonString(e, t) {
|
|
2033
2033
|
var n;
|
|
2034
|
-
let
|
|
2035
|
-
return JSON.stringify(
|
|
2034
|
+
let r = this.toJson(e, t);
|
|
2035
|
+
return JSON.stringify(r, null, (n = t == null ? void 0 : t.prettySpaces) !== null && n !== void 0 ? n : 0);
|
|
2036
2036
|
}
|
|
2037
2037
|
/**
|
|
2038
2038
|
* Write the message to binary format.
|
|
2039
2039
|
*/
|
|
2040
2040
|
toBinary(e, t) {
|
|
2041
|
-
let n =
|
|
2041
|
+
let n = dn(t);
|
|
2042
2042
|
return this.internalBinaryWrite(e, n.writerFactory(), n).finish();
|
|
2043
2043
|
}
|
|
2044
2044
|
/**
|
|
@@ -2051,8 +2051,8 @@ class j {
|
|
|
2051
2051
|
*/
|
|
2052
2052
|
internalJsonRead(e, t, n) {
|
|
2053
2053
|
if (e !== null && typeof e == "object" && !Array.isArray(e)) {
|
|
2054
|
-
let
|
|
2055
|
-
return this.refJsonReader.read(e,
|
|
2054
|
+
let r = n ?? this.create();
|
|
2055
|
+
return this.refJsonReader.read(e, r, t), r;
|
|
2056
2056
|
}
|
|
2057
2057
|
throw new Error(`Unable to parse message ${this.typeName} from JSON ${Nt(e)}.`);
|
|
2058
2058
|
}
|
|
@@ -2083,19 +2083,19 @@ class j {
|
|
|
2083
2083
|
* the target according to protobuf rules. If the target is
|
|
2084
2084
|
* omitted, a new instance is created first.
|
|
2085
2085
|
*/
|
|
2086
|
-
internalBinaryRead(e, t, n,
|
|
2087
|
-
let s =
|
|
2086
|
+
internalBinaryRead(e, t, n, r) {
|
|
2087
|
+
let s = r ?? this.create();
|
|
2088
2088
|
return this.refBinReader.read(e, s, n, t), s;
|
|
2089
2089
|
}
|
|
2090
2090
|
}
|
|
2091
|
-
function
|
|
2092
|
-
var t, n,
|
|
2093
|
-
let s =
|
|
2094
|
-
return s.service = e, s.localName = (t = s.localName) !== null && t !== void 0 ? t :
|
|
2091
|
+
function Ln(i, e) {
|
|
2092
|
+
var t, n, r;
|
|
2093
|
+
let s = i;
|
|
2094
|
+
return s.service = e, s.localName = (t = s.localName) !== null && t !== void 0 ? t : Ye(s.name), s.serverStreaming = !!s.serverStreaming, s.clientStreaming = !!s.clientStreaming, s.options = (n = s.options) !== null && n !== void 0 ? n : {}, s.idempotency = (r = s.idempotency) !== null && r !== void 0 ? r : void 0, s;
|
|
2095
2095
|
}
|
|
2096
2096
|
class tt {
|
|
2097
2097
|
constructor(e, t, n) {
|
|
2098
|
-
this.typeName = e, this.methods = t.map((
|
|
2098
|
+
this.typeName = e, this.methods = t.map((r) => Ln(r, this)), this.options = n ?? {};
|
|
2099
2099
|
}
|
|
2100
2100
|
}
|
|
2101
2101
|
class I extends Error {
|
|
@@ -2108,49 +2108,49 @@ class I extends Error {
|
|
|
2108
2108
|
let t = Object.entries(this.meta);
|
|
2109
2109
|
if (t.length) {
|
|
2110
2110
|
e.push(""), e.push("Meta:");
|
|
2111
|
-
for (let [n,
|
|
2112
|
-
e.push(` ${n}: ${
|
|
2111
|
+
for (let [n, r] of t)
|
|
2112
|
+
e.push(` ${n}: ${r}`);
|
|
2113
2113
|
}
|
|
2114
2114
|
return e.join(`
|
|
2115
2115
|
`);
|
|
2116
2116
|
}
|
|
2117
2117
|
}
|
|
2118
|
-
function
|
|
2118
|
+
function Bn(i, e) {
|
|
2119
2119
|
if (!e)
|
|
2120
|
-
return
|
|
2120
|
+
return i;
|
|
2121
2121
|
let t = {};
|
|
2122
|
-
|
|
2122
|
+
xe(i, t), xe(e, t);
|
|
2123
2123
|
for (let n of Object.keys(e)) {
|
|
2124
|
-
let
|
|
2124
|
+
let r = e[n];
|
|
2125
2125
|
switch (n) {
|
|
2126
2126
|
case "jsonOptions":
|
|
2127
|
-
t.jsonOptions = bn(
|
|
2127
|
+
t.jsonOptions = bn(i.jsonOptions, t.jsonOptions);
|
|
2128
2128
|
break;
|
|
2129
2129
|
case "binaryOptions":
|
|
2130
|
-
t.binaryOptions = tn(
|
|
2130
|
+
t.binaryOptions = tn(i.binaryOptions, t.binaryOptions);
|
|
2131
2131
|
break;
|
|
2132
2132
|
case "meta":
|
|
2133
|
-
t.meta = {},
|
|
2133
|
+
t.meta = {}, xe(i.meta, t.meta), xe(e.meta, t.meta);
|
|
2134
2134
|
break;
|
|
2135
2135
|
case "interceptors":
|
|
2136
|
-
t.interceptors =
|
|
2136
|
+
t.interceptors = i.interceptors ? i.interceptors.concat(r) : r.concat();
|
|
2137
2137
|
break;
|
|
2138
2138
|
}
|
|
2139
2139
|
}
|
|
2140
2140
|
return t;
|
|
2141
2141
|
}
|
|
2142
|
-
function
|
|
2143
|
-
if (!
|
|
2142
|
+
function xe(i, e) {
|
|
2143
|
+
if (!i)
|
|
2144
2144
|
return;
|
|
2145
2145
|
let t = e;
|
|
2146
|
-
for (let [n,
|
|
2147
|
-
|
|
2146
|
+
for (let [n, r] of Object.entries(i))
|
|
2147
|
+
r instanceof Date ? t[n] = new Date(r.getTime()) : Array.isArray(r) ? t[n] = r.concat() : t[n] = r;
|
|
2148
2148
|
}
|
|
2149
2149
|
var W;
|
|
2150
|
-
(function(
|
|
2151
|
-
|
|
2150
|
+
(function(i) {
|
|
2151
|
+
i[i.PENDING = 0] = "PENDING", i[i.REJECTED = 1] = "REJECTED", i[i.RESOLVED = 2] = "RESOLVED";
|
|
2152
2152
|
})(W || (W = {}));
|
|
2153
|
-
class
|
|
2153
|
+
class ce {
|
|
2154
2154
|
/**
|
|
2155
2155
|
* @param preventUnhandledRejectionWarning - prevents the warning
|
|
2156
2156
|
* "Unhandled Promise rejection" by adding a noop rejection handler.
|
|
@@ -2301,7 +2301,7 @@ class Dn {
|
|
|
2301
2301
|
let e = this._itState;
|
|
2302
2302
|
w(e, "bad state"), w(!e.p, "iterator contract broken");
|
|
2303
2303
|
let t = e.q.shift();
|
|
2304
|
-
return t ? "value" in t ? Promise.resolve(t) : Promise.reject(t) : (e.p = new
|
|
2304
|
+
return t ? "value" in t ? Promise.resolve(t) : Promise.reject(t) : (e.p = new ce(), e.p.promise);
|
|
2305
2305
|
}
|
|
2306
2306
|
};
|
|
2307
2307
|
}
|
|
@@ -2317,36 +2317,36 @@ class Dn {
|
|
|
2317
2317
|
t.q.push(e);
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
|
-
var
|
|
2321
|
-
function
|
|
2320
|
+
var _n = function(i, e, t, n) {
|
|
2321
|
+
function r(s) {
|
|
2322
2322
|
return s instanceof t ? s : new t(function(o) {
|
|
2323
2323
|
o(s);
|
|
2324
2324
|
});
|
|
2325
2325
|
}
|
|
2326
2326
|
return new (t || (t = Promise))(function(s, o) {
|
|
2327
|
-
function a(
|
|
2327
|
+
function a(f) {
|
|
2328
2328
|
try {
|
|
2329
|
-
c(n.next(
|
|
2329
|
+
c(n.next(f));
|
|
2330
2330
|
} catch (g) {
|
|
2331
2331
|
o(g);
|
|
2332
2332
|
}
|
|
2333
2333
|
}
|
|
2334
|
-
function l(
|
|
2334
|
+
function l(f) {
|
|
2335
2335
|
try {
|
|
2336
|
-
c(n.throw(
|
|
2336
|
+
c(n.throw(f));
|
|
2337
2337
|
} catch (g) {
|
|
2338
2338
|
o(g);
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
|
-
function c(
|
|
2342
|
-
|
|
2341
|
+
function c(f) {
|
|
2342
|
+
f.done ? s(f.value) : r(f.value).then(a, l);
|
|
2343
2343
|
}
|
|
2344
|
-
c((n = n.apply(
|
|
2344
|
+
c((n = n.apply(i, e || [])).next());
|
|
2345
2345
|
});
|
|
2346
2346
|
};
|
|
2347
|
-
class
|
|
2348
|
-
constructor(e, t, n,
|
|
2349
|
-
this.method = e, this.requestHeaders = t, this.request = n, this.headers =
|
|
2347
|
+
class Un {
|
|
2348
|
+
constructor(e, t, n, r, s, o, a) {
|
|
2349
|
+
this.method = e, this.requestHeaders = t, this.request = n, this.headers = r, this.response = s, this.status = o, this.trailers = a;
|
|
2350
2350
|
}
|
|
2351
2351
|
/**
|
|
2352
2352
|
* If you are only interested in the final outcome of this call,
|
|
@@ -2356,8 +2356,8 @@ class _n {
|
|
|
2356
2356
|
return this.promiseFinished().then((n) => e ? Promise.resolve(e(n)) : n, (n) => t ? Promise.resolve(t(n)) : Promise.reject(n));
|
|
2357
2357
|
}
|
|
2358
2358
|
promiseFinished() {
|
|
2359
|
-
return
|
|
2360
|
-
let [e, t, n,
|
|
2359
|
+
return _n(this, void 0, void 0, function* () {
|
|
2360
|
+
let [e, t, n, r] = yield Promise.all([this.headers, this.response, this.status, this.trailers]);
|
|
2361
2361
|
return {
|
|
2362
2362
|
method: this.method,
|
|
2363
2363
|
requestHeaders: this.requestHeaders,
|
|
@@ -2365,41 +2365,41 @@ class _n {
|
|
|
2365
2365
|
headers: e,
|
|
2366
2366
|
response: t,
|
|
2367
2367
|
status: n,
|
|
2368
|
-
trailers:
|
|
2368
|
+
trailers: r
|
|
2369
2369
|
};
|
|
2370
2370
|
});
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
|
-
var Rn = function(
|
|
2374
|
-
function
|
|
2373
|
+
var Rn = function(i, e, t, n) {
|
|
2374
|
+
function r(s) {
|
|
2375
2375
|
return s instanceof t ? s : new t(function(o) {
|
|
2376
2376
|
o(s);
|
|
2377
2377
|
});
|
|
2378
2378
|
}
|
|
2379
2379
|
return new (t || (t = Promise))(function(s, o) {
|
|
2380
|
-
function a(
|
|
2380
|
+
function a(f) {
|
|
2381
2381
|
try {
|
|
2382
|
-
c(n.next(
|
|
2382
|
+
c(n.next(f));
|
|
2383
2383
|
} catch (g) {
|
|
2384
2384
|
o(g);
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
2387
|
-
function l(
|
|
2387
|
+
function l(f) {
|
|
2388
2388
|
try {
|
|
2389
|
-
c(n.throw(
|
|
2389
|
+
c(n.throw(f));
|
|
2390
2390
|
} catch (g) {
|
|
2391
2391
|
o(g);
|
|
2392
2392
|
}
|
|
2393
2393
|
}
|
|
2394
|
-
function c(
|
|
2395
|
-
|
|
2394
|
+
function c(f) {
|
|
2395
|
+
f.done ? s(f.value) : r(f.value).then(a, l);
|
|
2396
2396
|
}
|
|
2397
|
-
c((n = n.apply(
|
|
2397
|
+
c((n = n.apply(i, e || [])).next());
|
|
2398
2398
|
});
|
|
2399
2399
|
};
|
|
2400
2400
|
class xn {
|
|
2401
|
-
constructor(e, t, n,
|
|
2402
|
-
this.method = e, this.requestHeaders = t, this.request = n, this.headers =
|
|
2401
|
+
constructor(e, t, n, r, s, o, a) {
|
|
2402
|
+
this.method = e, this.requestHeaders = t, this.request = n, this.headers = r, this.responses = s, this.status = o, this.trailers = a;
|
|
2403
2403
|
}
|
|
2404
2404
|
/**
|
|
2405
2405
|
* Instead of awaiting the response status and trailers, you can
|
|
@@ -2424,78 +2424,78 @@ class xn {
|
|
|
2424
2424
|
});
|
|
2425
2425
|
}
|
|
2426
2426
|
}
|
|
2427
|
-
function
|
|
2427
|
+
function fe(i, e, t, n, r) {
|
|
2428
2428
|
var s;
|
|
2429
2429
|
{
|
|
2430
2430
|
let o = (a, l, c) => e.unary(a, l, c);
|
|
2431
2431
|
for (const a of ((s = n.interceptors) !== null && s !== void 0 ? s : []).filter((l) => l.interceptUnary).reverse()) {
|
|
2432
2432
|
const l = o;
|
|
2433
|
-
o = (c,
|
|
2433
|
+
o = (c, f, g) => a.interceptUnary(l, c, f, g);
|
|
2434
2434
|
}
|
|
2435
|
-
return o(t,
|
|
2435
|
+
return o(t, r, n);
|
|
2436
2436
|
}
|
|
2437
2437
|
}
|
|
2438
|
-
var
|
|
2439
|
-
(function(
|
|
2440
|
-
|
|
2441
|
-
})(
|
|
2442
|
-
var Cn = function(
|
|
2443
|
-
function
|
|
2438
|
+
var d;
|
|
2439
|
+
(function(i) {
|
|
2440
|
+
i[i.OK = 0] = "OK", i[i.CANCELLED = 1] = "CANCELLED", i[i.UNKNOWN = 2] = "UNKNOWN", i[i.INVALID_ARGUMENT = 3] = "INVALID_ARGUMENT", i[i.DEADLINE_EXCEEDED = 4] = "DEADLINE_EXCEEDED", i[i.NOT_FOUND = 5] = "NOT_FOUND", i[i.ALREADY_EXISTS = 6] = "ALREADY_EXISTS", i[i.PERMISSION_DENIED = 7] = "PERMISSION_DENIED", i[i.UNAUTHENTICATED = 16] = "UNAUTHENTICATED", i[i.RESOURCE_EXHAUSTED = 8] = "RESOURCE_EXHAUSTED", i[i.FAILED_PRECONDITION = 9] = "FAILED_PRECONDITION", i[i.ABORTED = 10] = "ABORTED", i[i.OUT_OF_RANGE = 11] = "OUT_OF_RANGE", i[i.UNIMPLEMENTED = 12] = "UNIMPLEMENTED", i[i.INTERNAL = 13] = "INTERNAL", i[i.UNAVAILABLE = 14] = "UNAVAILABLE", i[i.DATA_LOSS = 15] = "DATA_LOSS";
|
|
2441
|
+
})(d || (d = {}));
|
|
2442
|
+
var Cn = function(i, e, t, n) {
|
|
2443
|
+
function r(s) {
|
|
2444
2444
|
return s instanceof t ? s : new t(function(o) {
|
|
2445
2445
|
o(s);
|
|
2446
2446
|
});
|
|
2447
2447
|
}
|
|
2448
2448
|
return new (t || (t = Promise))(function(s, o) {
|
|
2449
|
-
function a(
|
|
2449
|
+
function a(f) {
|
|
2450
2450
|
try {
|
|
2451
|
-
c(n.next(
|
|
2451
|
+
c(n.next(f));
|
|
2452
2452
|
} catch (g) {
|
|
2453
2453
|
o(g);
|
|
2454
2454
|
}
|
|
2455
2455
|
}
|
|
2456
|
-
function l(
|
|
2456
|
+
function l(f) {
|
|
2457
2457
|
try {
|
|
2458
|
-
c(n.throw(
|
|
2458
|
+
c(n.throw(f));
|
|
2459
2459
|
} catch (g) {
|
|
2460
2460
|
o(g);
|
|
2461
2461
|
}
|
|
2462
2462
|
}
|
|
2463
|
-
function c(
|
|
2464
|
-
|
|
2463
|
+
function c(f) {
|
|
2464
|
+
f.done ? s(f.value) : r(f.value).then(a, l);
|
|
2465
2465
|
}
|
|
2466
|
-
c((n = n.apply(
|
|
2466
|
+
c((n = n.apply(i, e || [])).next());
|
|
2467
2467
|
});
|
|
2468
2468
|
};
|
|
2469
|
-
function pt(
|
|
2469
|
+
function pt(i, e, t, n, r) {
|
|
2470
2470
|
if (n)
|
|
2471
2471
|
for (let [s, o] of Object.entries(n))
|
|
2472
2472
|
if (typeof o == "string")
|
|
2473
|
-
|
|
2473
|
+
i.append(s, o);
|
|
2474
2474
|
else
|
|
2475
2475
|
for (let a of o)
|
|
2476
|
-
|
|
2477
|
-
if (
|
|
2476
|
+
i.append(s, a);
|
|
2477
|
+
if (i.set("Content-Type", e === "text" ? "application/grpc-web-text" : "application/grpc-web+proto"), e == "text" && i.set("Accept", "application/grpc-web-text"), i.set("X-Grpc-Web", "1"), typeof t == "number") {
|
|
2478
2478
|
if (t <= 0)
|
|
2479
|
-
throw new I(`timeout ${t} ms exceeded`,
|
|
2480
|
-
|
|
2479
|
+
throw new I(`timeout ${t} ms exceeded`, d[d.DEADLINE_EXCEEDED]);
|
|
2480
|
+
i.set("grpc-timeout", `${t}m`);
|
|
2481
2481
|
} else if (t) {
|
|
2482
2482
|
const s = t.getTime(), o = Date.now();
|
|
2483
2483
|
if (s <= o)
|
|
2484
|
-
throw new I(`deadline ${t} exceeded`,
|
|
2485
|
-
|
|
2484
|
+
throw new I(`deadline ${t} exceeded`, d[d.DEADLINE_EXCEEDED]);
|
|
2485
|
+
i.set("grpc-timeout", `${s - o}m`);
|
|
2486
2486
|
}
|
|
2487
|
-
return
|
|
2487
|
+
return i;
|
|
2488
2488
|
}
|
|
2489
|
-
function gt(
|
|
2490
|
-
let t = new Uint8Array(5 +
|
|
2491
|
-
t[0] =
|
|
2492
|
-
for (let n =
|
|
2493
|
-
t[
|
|
2494
|
-
return t.set(
|
|
2489
|
+
function gt(i, e) {
|
|
2490
|
+
let t = new Uint8Array(5 + i.length);
|
|
2491
|
+
t[0] = J.DATA;
|
|
2492
|
+
for (let n = i.length, r = 4; r > 0; r--)
|
|
2493
|
+
t[r] = n % 256, n >>>= 8;
|
|
2494
|
+
return t.set(i, 5), e === "binary" ? t : kt(t);
|
|
2495
2495
|
}
|
|
2496
|
-
function
|
|
2496
|
+
function Qe(i, e, t) {
|
|
2497
2497
|
if (arguments.length === 1) {
|
|
2498
|
-
let l =
|
|
2498
|
+
let l = i, c;
|
|
2499
2499
|
try {
|
|
2500
2500
|
c = l.type;
|
|
2501
2501
|
} catch {
|
|
@@ -2504,49 +2504,49 @@ function Ye(r, e, t) {
|
|
|
2504
2504
|
case "error":
|
|
2505
2505
|
case "opaque":
|
|
2506
2506
|
case "opaqueredirect":
|
|
2507
|
-
throw new I(`fetch response type ${l.type}`,
|
|
2507
|
+
throw new I(`fetch response type ${l.type}`, d[d.UNKNOWN]);
|
|
2508
2508
|
}
|
|
2509
|
-
return
|
|
2509
|
+
return Qe(Vn(l.headers), l.status, l.statusText);
|
|
2510
2510
|
}
|
|
2511
|
-
let n =
|
|
2512
|
-
return (o === void 0 || o ===
|
|
2511
|
+
let n = i, r = e >= 200 && e < 300, s = Dt(n), [o, a] = Bt(n);
|
|
2512
|
+
return (o === void 0 || o === d.OK) && !r && (o = $n(e), a = t), [o, a, s];
|
|
2513
2513
|
}
|
|
2514
|
-
function bt(
|
|
2515
|
-
let e = Mn(
|
|
2516
|
-
return [t ??
|
|
2514
|
+
function bt(i) {
|
|
2515
|
+
let e = Mn(i), [t, n] = Bt(e), r = Dt(e);
|
|
2516
|
+
return [t ?? d.OK, n, r];
|
|
2517
2517
|
}
|
|
2518
|
-
var
|
|
2519
|
-
(function(
|
|
2520
|
-
|
|
2521
|
-
})(
|
|
2522
|
-
function wt(
|
|
2518
|
+
var J;
|
|
2519
|
+
(function(i) {
|
|
2520
|
+
i[i.DATA = 0] = "DATA", i[i.TRAILER = 128] = "TRAILER";
|
|
2521
|
+
})(J || (J = {}));
|
|
2522
|
+
function wt(i, e, t) {
|
|
2523
2523
|
return Cn(this, void 0, void 0, function* () {
|
|
2524
|
-
let n,
|
|
2525
|
-
if (
|
|
2526
|
-
let a =
|
|
2524
|
+
let n, r = "", s = new Uint8Array(0), o = Sn(e);
|
|
2525
|
+
if (vn(i)) {
|
|
2526
|
+
let a = i.getReader();
|
|
2527
2527
|
n = {
|
|
2528
2528
|
next: () => a.read()
|
|
2529
2529
|
};
|
|
2530
2530
|
} else
|
|
2531
|
-
n =
|
|
2531
|
+
n = i[Symbol.asyncIterator]();
|
|
2532
2532
|
for (; ; ) {
|
|
2533
2533
|
let a = yield n.next();
|
|
2534
2534
|
if (a.value !== void 0) {
|
|
2535
2535
|
if (o === "text") {
|
|
2536
2536
|
for (let c = 0; c < a.value.length; c++)
|
|
2537
|
-
|
|
2538
|
-
let l =
|
|
2537
|
+
r += String.fromCharCode(a.value[c]);
|
|
2538
|
+
let l = r.length - r.length % 4;
|
|
2539
2539
|
if (l === 0)
|
|
2540
2540
|
continue;
|
|
2541
|
-
s = yt(s, Et(
|
|
2541
|
+
s = yt(s, Et(r.substring(0, l))), r = r.substring(l);
|
|
2542
2542
|
} else
|
|
2543
2543
|
s = yt(s, a.value);
|
|
2544
|
-
for (; s.length >= 5 && s[0] ===
|
|
2544
|
+
for (; s.length >= 5 && s[0] === J.DATA; ) {
|
|
2545
2545
|
let l = 0;
|
|
2546
2546
|
for (let c = 1; c < 5; c++)
|
|
2547
2547
|
l = (l << 8) + s[c];
|
|
2548
2548
|
if (s.length - 5 >= l)
|
|
2549
|
-
t(
|
|
2549
|
+
t(J.DATA, s.subarray(5, 5 + l)), s = s.subarray(5 + l);
|
|
2550
2550
|
else
|
|
2551
2551
|
break;
|
|
2552
2552
|
}
|
|
@@ -2554,21 +2554,21 @@ function wt(r, e, t) {
|
|
|
2554
2554
|
if (a.done) {
|
|
2555
2555
|
if (s.length === 0)
|
|
2556
2556
|
break;
|
|
2557
|
-
if (s[0] !==
|
|
2558
|
-
throw new I("premature EOF",
|
|
2559
|
-
t(
|
|
2557
|
+
if (s[0] !== J.TRAILER || s.length < 5)
|
|
2558
|
+
throw new I("premature EOF", d[d.DATA_LOSS]);
|
|
2559
|
+
t(J.TRAILER, s.subarray(5));
|
|
2560
2560
|
break;
|
|
2561
2561
|
}
|
|
2562
2562
|
}
|
|
2563
2563
|
});
|
|
2564
2564
|
}
|
|
2565
|
-
const
|
|
2566
|
-
function yt(
|
|
2567
|
-
let t = new Uint8Array(
|
|
2568
|
-
return t.set(
|
|
2565
|
+
const vn = (i) => typeof i.getReader == "function";
|
|
2566
|
+
function yt(i, e) {
|
|
2567
|
+
let t = new Uint8Array(i.length + e.length);
|
|
2568
|
+
return t.set(i), t.set(e, i.length), t;
|
|
2569
2569
|
}
|
|
2570
|
-
function
|
|
2571
|
-
switch (
|
|
2570
|
+
function Sn(i) {
|
|
2571
|
+
switch (i) {
|
|
2572
2572
|
case "application/grpc-web-text":
|
|
2573
2573
|
case "application/grpc-web-text+proto":
|
|
2574
2574
|
return "text";
|
|
@@ -2577,30 +2577,30 @@ function vn(r) {
|
|
|
2577
2577
|
return "binary";
|
|
2578
2578
|
case void 0:
|
|
2579
2579
|
case null:
|
|
2580
|
-
throw new I("missing response content type",
|
|
2580
|
+
throw new I("missing response content type", d[d.INTERNAL]);
|
|
2581
2581
|
default:
|
|
2582
|
-
throw new I("unexpected response content type: " +
|
|
2582
|
+
throw new I("unexpected response content type: " + i, d[d.INTERNAL]);
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
|
-
function
|
|
2586
|
-
let e, t, n =
|
|
2585
|
+
function Bt(i) {
|
|
2586
|
+
let e, t, n = i["grpc-message"];
|
|
2587
2587
|
if (n !== void 0) {
|
|
2588
2588
|
if (Array.isArray(n))
|
|
2589
|
-
return [
|
|
2589
|
+
return [d.INTERNAL, "invalid grpc-web message"];
|
|
2590
2590
|
t = n;
|
|
2591
2591
|
}
|
|
2592
|
-
let
|
|
2593
|
-
if (
|
|
2594
|
-
if (Array.isArray(
|
|
2595
|
-
return [
|
|
2596
|
-
if (e = parseInt(
|
|
2597
|
-
return [
|
|
2592
|
+
let r = i["grpc-status"];
|
|
2593
|
+
if (r !== void 0) {
|
|
2594
|
+
if (Array.isArray(r))
|
|
2595
|
+
return [d.INTERNAL, "invalid grpc-web status"];
|
|
2596
|
+
if (e = parseInt(r, 10), d[e] === void 0)
|
|
2597
|
+
return [d.INTERNAL, "invalid grpc-web status"];
|
|
2598
2598
|
}
|
|
2599
2599
|
return [e, t];
|
|
2600
2600
|
}
|
|
2601
|
-
function Dt(
|
|
2601
|
+
function Dt(i) {
|
|
2602
2602
|
let e = {};
|
|
2603
|
-
for (let [t, n] of Object.entries(
|
|
2603
|
+
for (let [t, n] of Object.entries(i))
|
|
2604
2604
|
switch (t) {
|
|
2605
2605
|
case "grpc-message":
|
|
2606
2606
|
case "grpc-status":
|
|
@@ -2611,65 +2611,65 @@ function Dt(r) {
|
|
|
2611
2611
|
}
|
|
2612
2612
|
return e;
|
|
2613
2613
|
}
|
|
2614
|
-
function Mn(
|
|
2614
|
+
function Mn(i) {
|
|
2615
2615
|
let e = {};
|
|
2616
|
-
for (let t of String.fromCharCode.apply(String,
|
|
2616
|
+
for (let t of String.fromCharCode.apply(String, i).trim().split(`\r
|
|
2617
2617
|
`)) {
|
|
2618
2618
|
if (t == "")
|
|
2619
2619
|
continue;
|
|
2620
|
-
let [n, ...
|
|
2621
|
-
const s =
|
|
2620
|
+
let [n, ...r] = t.split(":");
|
|
2621
|
+
const s = r.join(":").trim();
|
|
2622
2622
|
n = n.trim();
|
|
2623
2623
|
let o = e[n];
|
|
2624
2624
|
typeof o == "string" ? e[n] = [o, s] : Array.isArray(o) ? o.push(s) : e[n] = s;
|
|
2625
2625
|
}
|
|
2626
2626
|
return e;
|
|
2627
2627
|
}
|
|
2628
|
-
function Vn(
|
|
2628
|
+
function Vn(i) {
|
|
2629
2629
|
let e = {};
|
|
2630
|
-
return
|
|
2631
|
-
let
|
|
2632
|
-
typeof
|
|
2630
|
+
return i.forEach((t, n) => {
|
|
2631
|
+
let r = e[n];
|
|
2632
|
+
typeof r == "string" ? e[n] = [r, t] : Array.isArray(r) ? r.push(t) : e[n] = t;
|
|
2633
2633
|
}), e;
|
|
2634
2634
|
}
|
|
2635
|
-
function $n(
|
|
2636
|
-
switch (
|
|
2635
|
+
function $n(i) {
|
|
2636
|
+
switch (i) {
|
|
2637
2637
|
case 200:
|
|
2638
|
-
return
|
|
2638
|
+
return d.OK;
|
|
2639
2639
|
case 400:
|
|
2640
|
-
return
|
|
2640
|
+
return d.INVALID_ARGUMENT;
|
|
2641
2641
|
case 401:
|
|
2642
|
-
return
|
|
2642
|
+
return d.UNAUTHENTICATED;
|
|
2643
2643
|
case 403:
|
|
2644
|
-
return
|
|
2644
|
+
return d.PERMISSION_DENIED;
|
|
2645
2645
|
case 404:
|
|
2646
|
-
return
|
|
2646
|
+
return d.NOT_FOUND;
|
|
2647
2647
|
case 409:
|
|
2648
|
-
return
|
|
2648
|
+
return d.ABORTED;
|
|
2649
2649
|
case 412:
|
|
2650
|
-
return
|
|
2650
|
+
return d.FAILED_PRECONDITION;
|
|
2651
2651
|
case 429:
|
|
2652
|
-
return
|
|
2652
|
+
return d.RESOURCE_EXHAUSTED;
|
|
2653
2653
|
case 499:
|
|
2654
|
-
return
|
|
2654
|
+
return d.CANCELLED;
|
|
2655
2655
|
case 500:
|
|
2656
|
-
return
|
|
2656
|
+
return d.UNKNOWN;
|
|
2657
2657
|
case 501:
|
|
2658
|
-
return
|
|
2658
|
+
return d.UNIMPLEMENTED;
|
|
2659
2659
|
case 503:
|
|
2660
|
-
return
|
|
2660
|
+
return d.UNAVAILABLE;
|
|
2661
2661
|
case 504:
|
|
2662
|
-
return
|
|
2662
|
+
return d.DEADLINE_EXCEEDED;
|
|
2663
2663
|
default:
|
|
2664
|
-
return
|
|
2664
|
+
return d.UNKNOWN;
|
|
2665
2665
|
}
|
|
2666
2666
|
}
|
|
2667
|
-
class
|
|
2667
|
+
class jn {
|
|
2668
2668
|
constructor(e) {
|
|
2669
2669
|
this.defaultOptions = e;
|
|
2670
2670
|
}
|
|
2671
2671
|
mergeOptions(e) {
|
|
2672
|
-
return
|
|
2672
|
+
return Bn(this.defaultOptions, e);
|
|
2673
2673
|
}
|
|
2674
2674
|
/**
|
|
2675
2675
|
* Create an URI for a gRPC web call.
|
|
@@ -2692,115 +2692,115 @@ class Pn {
|
|
|
2692
2692
|
return n.endsWith("/") && (n = n.substring(0, n.length - 1)), `${n}/${e.service.typeName}/${e.name}`;
|
|
2693
2693
|
}
|
|
2694
2694
|
clientStreaming(e) {
|
|
2695
|
-
const t = new I("Client streaming is not supported by grpc-web",
|
|
2695
|
+
const t = new I("Client streaming is not supported by grpc-web", d[d.UNIMPLEMENTED]);
|
|
2696
2696
|
throw t.methodName = e.name, t.serviceName = e.service.typeName, t;
|
|
2697
2697
|
}
|
|
2698
2698
|
duplex(e) {
|
|
2699
|
-
const t = new I("Duplex streaming is not supported by grpc-web",
|
|
2699
|
+
const t = new I("Duplex streaming is not supported by grpc-web", d[d.UNIMPLEMENTED]);
|
|
2700
2700
|
throw t.methodName = e.name, t.serviceName = e.service.typeName, t;
|
|
2701
2701
|
}
|
|
2702
2702
|
serverStreaming(e, t, n) {
|
|
2703
|
-
var
|
|
2704
|
-
let l = n, c = (
|
|
2705
|
-
return globalThis.fetch(g, Object.assign(Object.assign({},
|
|
2703
|
+
var r, s, o, a;
|
|
2704
|
+
let l = n, c = (r = l.format) !== null && r !== void 0 ? r : "text", f = (s = l.fetchInit) !== null && s !== void 0 ? s : {}, g = this.makeUrl(e, l), y = e.I.toBinary(t, l.binaryOptions), O = new ce(), E = new Dn(), le = !0, F, q = new ce(), H, de = new ce();
|
|
2705
|
+
return globalThis.fetch(g, Object.assign(Object.assign({}, f), {
|
|
2706
2706
|
method: "POST",
|
|
2707
2707
|
headers: pt(new globalThis.Headers(), c, l.timeout, l.meta),
|
|
2708
2708
|
body: gt(y, c),
|
|
2709
2709
|
signal: (o = n.abort) !== null && o !== void 0 ? o : null
|
|
2710
2710
|
// node-fetch@3.0.0-beta.9 rejects `undefined`
|
|
2711
2711
|
})).then((N) => {
|
|
2712
|
-
let [b, D,
|
|
2713
|
-
if (
|
|
2714
|
-
throw new I(D ??
|
|
2715
|
-
return b != null && (
|
|
2716
|
-
code:
|
|
2717
|
-
detail: D ??
|
|
2712
|
+
let [b, D, V] = Qe(N);
|
|
2713
|
+
if (O.resolve(V), b != null && b !== d.OK)
|
|
2714
|
+
throw new I(D ?? d[b], d[b], V);
|
|
2715
|
+
return b != null && (F = {
|
|
2716
|
+
code: d[b],
|
|
2717
|
+
detail: D ?? d[b]
|
|
2718
2718
|
}), N;
|
|
2719
2719
|
}).then((N) => {
|
|
2720
2720
|
if (!N.body)
|
|
2721
|
-
throw new I("missing response body",
|
|
2721
|
+
throw new I("missing response body", d[d.INTERNAL]);
|
|
2722
2722
|
return wt(N.body, N.headers.get("content-type"), (b, D) => {
|
|
2723
2723
|
switch (b) {
|
|
2724
|
-
case
|
|
2725
|
-
|
|
2724
|
+
case J.DATA:
|
|
2725
|
+
E.notifyMessage(e.O.fromBinary(D, l.binaryOptions)), le = !1;
|
|
2726
2726
|
break;
|
|
2727
|
-
case
|
|
2728
|
-
let
|
|
2729
|
-
[
|
|
2730
|
-
code:
|
|
2731
|
-
detail:
|
|
2727
|
+
case J.TRAILER:
|
|
2728
|
+
let V, Q;
|
|
2729
|
+
[V, Q, H] = bt(D), F = {
|
|
2730
|
+
code: d[V],
|
|
2731
|
+
detail: Q ?? d[V]
|
|
2732
2732
|
};
|
|
2733
2733
|
break;
|
|
2734
2734
|
}
|
|
2735
2735
|
});
|
|
2736
2736
|
}).then(() => {
|
|
2737
|
-
if (!
|
|
2738
|
-
throw new I("missing trailers",
|
|
2739
|
-
if (!
|
|
2740
|
-
throw new I("missing status",
|
|
2741
|
-
if (
|
|
2742
|
-
throw new I(
|
|
2743
|
-
|
|
2737
|
+
if (!H && !le)
|
|
2738
|
+
throw new I("missing trailers", d[d.DATA_LOSS]);
|
|
2739
|
+
if (!F)
|
|
2740
|
+
throw new I("missing status", d[d.INTERNAL]);
|
|
2741
|
+
if (F.code !== "OK")
|
|
2742
|
+
throw new I(F.detail, F.code, H);
|
|
2743
|
+
E.notifyComplete(), q.resolve(F), de.resolve(H || {});
|
|
2744
2744
|
}).catch((N) => {
|
|
2745
2745
|
let b;
|
|
2746
|
-
N instanceof I ? b = N : N instanceof Error && N.name === "AbortError" ? b = new I(N.message,
|
|
2747
|
-
}), new xn(e, (a = l.meta) !== null && a !== void 0 ? a : {}, t,
|
|
2746
|
+
N instanceof I ? b = N : N instanceof Error && N.name === "AbortError" ? b = new I(N.message, d[d.CANCELLED]) : b = new I(N instanceof Error ? N.message : "" + N, d[d.INTERNAL]), b.methodName = e.name, b.serviceName = e.service.typeName, O.rejectPending(b), E.notifyError(b), q.rejectPending(b), de.rejectPending(b);
|
|
2747
|
+
}), new xn(e, (a = l.meta) !== null && a !== void 0 ? a : {}, t, O.promise, E, q.promise, de.promise);
|
|
2748
2748
|
}
|
|
2749
2749
|
unary(e, t, n) {
|
|
2750
|
-
var
|
|
2751
|
-
let l = n, c = (
|
|
2752
|
-
return globalThis.fetch(g, Object.assign(Object.assign({},
|
|
2750
|
+
var r, s, o, a;
|
|
2751
|
+
let l = n, c = (r = l.format) !== null && r !== void 0 ? r : "text", f = (s = l.fetchInit) !== null && s !== void 0 ? s : {}, g = this.makeUrl(e, l), y = e.I.toBinary(t, l.binaryOptions), O = new ce(), E, le = new ce(), F, q = new ce(), H, de = new ce();
|
|
2752
|
+
return globalThis.fetch(g, Object.assign(Object.assign({}, f), {
|
|
2753
2753
|
method: "POST",
|
|
2754
2754
|
headers: pt(new globalThis.Headers(), c, l.timeout, l.meta),
|
|
2755
2755
|
body: gt(y, c),
|
|
2756
2756
|
signal: (o = n.abort) !== null && o !== void 0 ? o : null
|
|
2757
2757
|
// node-fetch@3.0.0-beta.9 rejects `undefined`
|
|
2758
2758
|
})).then((N) => {
|
|
2759
|
-
let [b, D,
|
|
2760
|
-
if (
|
|
2761
|
-
throw new I(D ??
|
|
2762
|
-
return b != null && (
|
|
2763
|
-
code:
|
|
2764
|
-
detail: D ??
|
|
2759
|
+
let [b, D, V] = Qe(N);
|
|
2760
|
+
if (O.resolve(V), b != null && b !== d.OK)
|
|
2761
|
+
throw new I(D ?? d[b], d[b], V);
|
|
2762
|
+
return b != null && (F = {
|
|
2763
|
+
code: d[b],
|
|
2764
|
+
detail: D ?? d[b]
|
|
2765
2765
|
}), N;
|
|
2766
2766
|
}).then((N) => {
|
|
2767
2767
|
if (!N.body)
|
|
2768
|
-
throw new I("missing response body",
|
|
2768
|
+
throw new I("missing response body", d[d.INTERNAL]);
|
|
2769
2769
|
return wt(N.body, N.headers.get("content-type"), (b, D) => {
|
|
2770
2770
|
switch (b) {
|
|
2771
|
-
case
|
|
2772
|
-
if (
|
|
2773
|
-
throw new I("unary call received 2nd message",
|
|
2774
|
-
|
|
2771
|
+
case J.DATA:
|
|
2772
|
+
if (E)
|
|
2773
|
+
throw new I("unary call received 2nd message", d[d.DATA_LOSS]);
|
|
2774
|
+
E = e.O.fromBinary(D, l.binaryOptions);
|
|
2775
2775
|
break;
|
|
2776
|
-
case
|
|
2777
|
-
let
|
|
2778
|
-
[
|
|
2779
|
-
code:
|
|
2780
|
-
detail:
|
|
2776
|
+
case J.TRAILER:
|
|
2777
|
+
let V, Q;
|
|
2778
|
+
[V, Q, H] = bt(D), F = {
|
|
2779
|
+
code: d[V],
|
|
2780
|
+
detail: Q ?? d[V]
|
|
2781
2781
|
};
|
|
2782
2782
|
break;
|
|
2783
2783
|
}
|
|
2784
2784
|
});
|
|
2785
2785
|
}).then(() => {
|
|
2786
|
-
if (!
|
|
2787
|
-
throw new I("missing trailers",
|
|
2788
|
-
if (!
|
|
2789
|
-
throw new I("missing status",
|
|
2790
|
-
if (!
|
|
2791
|
-
throw new I("expected error status",
|
|
2792
|
-
if (!
|
|
2793
|
-
throw new I(
|
|
2794
|
-
if (
|
|
2795
|
-
throw new I(
|
|
2796
|
-
|
|
2786
|
+
if (!H && E)
|
|
2787
|
+
throw new I("missing trailers", d[d.DATA_LOSS]);
|
|
2788
|
+
if (!F)
|
|
2789
|
+
throw new I("missing status", d[d.INTERNAL]);
|
|
2790
|
+
if (!E && F.code === "OK")
|
|
2791
|
+
throw new I("expected error status", d[d.DATA_LOSS]);
|
|
2792
|
+
if (!E)
|
|
2793
|
+
throw new I(F.detail, F.code, H);
|
|
2794
|
+
if (le.resolve(E), F.code !== "OK")
|
|
2795
|
+
throw new I(F.detail, F.code, H);
|
|
2796
|
+
q.resolve(F), de.resolve(H || {});
|
|
2797
2797
|
}).catch((N) => {
|
|
2798
2798
|
let b;
|
|
2799
|
-
N instanceof I ? b = N : N instanceof Error && N.name === "AbortError" ? b = new I(N.message,
|
|
2800
|
-
}), new
|
|
2799
|
+
N instanceof I ? b = N : N instanceof Error && N.name === "AbortError" ? b = new I(N.message, d[d.CANCELLED]) : b = new I(N instanceof Error ? N.message : "" + N, d[d.INTERNAL]), b.methodName = e.name, b.serviceName = e.service.typeName, O.rejectPending(b), le.rejectPending(b), q.rejectPending(b), de.rejectPending(b);
|
|
2800
|
+
}), new Un(e, (a = l.meta) !== null && a !== void 0 ? a : {}, t, O.promise, le.promise, q.promise, de.promise);
|
|
2801
2801
|
}
|
|
2802
2802
|
}
|
|
2803
|
-
class
|
|
2803
|
+
class Pn extends P {
|
|
2804
2804
|
constructor() {
|
|
2805
2805
|
super("com.hamropatro.grpc.cms.CreateFolderRequest", [
|
|
2806
2806
|
{
|
|
@@ -2828,10 +2828,10 @@ class jn extends j {
|
|
|
2828
2828
|
}
|
|
2829
2829
|
create(e) {
|
|
2830
2830
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2831
|
-
return t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 &&
|
|
2831
|
+
return t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 && x(this, t, e), t;
|
|
2832
2832
|
}
|
|
2833
|
-
internalBinaryRead(e, t, n,
|
|
2834
|
-
let s =
|
|
2833
|
+
internalBinaryRead(e, t, n, r) {
|
|
2834
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
2835
2835
|
for (; e.pos < o; ) {
|
|
2836
2836
|
let [a, l] = e.tag();
|
|
2837
2837
|
switch (a) {
|
|
@@ -2851,20 +2851,20 @@ class jn extends j {
|
|
|
2851
2851
|
let c = n.readUnknownField;
|
|
2852
2852
|
if (c === "throw")
|
|
2853
2853
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
2854
|
-
let
|
|
2855
|
-
c !== !1 && (c === !0 ?
|
|
2854
|
+
let f = e.skip(l);
|
|
2855
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
2856
2856
|
}
|
|
2857
2857
|
}
|
|
2858
2858
|
return s;
|
|
2859
2859
|
}
|
|
2860
2860
|
internalBinaryWrite(e, t, n) {
|
|
2861
2861
|
e.name !== "" && t.tag(1, m.LengthDelimited).string(e.name), e.nestedFolderName !== "" && t.tag(2, m.LengthDelimited).string(e.nestedFolderName), e.createdBy !== "" && t.tag(3, m.LengthDelimited).string(e.createdBy);
|
|
2862
|
-
let
|
|
2863
|
-
return
|
|
2862
|
+
let r = n.writeUnknownFields;
|
|
2863
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
2864
2864
|
}
|
|
2865
2865
|
}
|
|
2866
|
-
const
|
|
2867
|
-
class Wn extends
|
|
2866
|
+
const _t = new Pn();
|
|
2867
|
+
class Wn extends P {
|
|
2868
2868
|
constructor() {
|
|
2869
2869
|
super("com.hamropatro.grpc.cms.GetAllFoldersRequest", [
|
|
2870
2870
|
{
|
|
@@ -2885,10 +2885,10 @@ class Wn extends j {
|
|
|
2885
2885
|
}
|
|
2886
2886
|
create(e) {
|
|
2887
2887
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2888
|
-
return t.cursor = "", t.limit = 0, e !== void 0 &&
|
|
2888
|
+
return t.cursor = "", t.limit = 0, e !== void 0 && x(this, t, e), t;
|
|
2889
2889
|
}
|
|
2890
|
-
internalBinaryRead(e, t, n,
|
|
2891
|
-
let s =
|
|
2890
|
+
internalBinaryRead(e, t, n, r) {
|
|
2891
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
2892
2892
|
for (; e.pos < o; ) {
|
|
2893
2893
|
let [a, l] = e.tag();
|
|
2894
2894
|
switch (a) {
|
|
@@ -2904,23 +2904,23 @@ class Wn extends j {
|
|
|
2904
2904
|
let c = n.readUnknownField;
|
|
2905
2905
|
if (c === "throw")
|
|
2906
2906
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
2907
|
-
let
|
|
2908
|
-
c !== !1 && (c === !0 ?
|
|
2907
|
+
let f = e.skip(l);
|
|
2908
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
2909
2909
|
}
|
|
2910
2910
|
}
|
|
2911
2911
|
return s;
|
|
2912
2912
|
}
|
|
2913
2913
|
internalBinaryWrite(e, t, n) {
|
|
2914
2914
|
e.cursor !== "" && t.tag(1, m.LengthDelimited).string(e.cursor), e.limit !== 0 && t.tag(2, m.Varint).int32(e.limit);
|
|
2915
|
-
let
|
|
2916
|
-
return
|
|
2915
|
+
let r = n.writeUnknownFields;
|
|
2916
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
2917
2917
|
}
|
|
2918
2918
|
}
|
|
2919
|
-
const
|
|
2920
|
-
class qn extends
|
|
2919
|
+
const Ut = new Wn();
|
|
2920
|
+
class qn extends P {
|
|
2921
2921
|
constructor() {
|
|
2922
2922
|
super("com.hamropatro.grpc.cms.GetAllFoldersResponse", [
|
|
2923
|
-
{ no: 1, name: "folder", kind: "message", repeat: 1, T: () =>
|
|
2923
|
+
{ no: 1, name: "folder", kind: "message", repeat: 1, T: () => Ie },
|
|
2924
2924
|
{
|
|
2925
2925
|
no: 2,
|
|
2926
2926
|
name: "next_cursor",
|
|
@@ -2939,16 +2939,16 @@ class qn extends j {
|
|
|
2939
2939
|
}
|
|
2940
2940
|
create(e) {
|
|
2941
2941
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
2942
|
-
return t.folder = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 &&
|
|
2942
|
+
return t.folder = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 && x(this, t, e), t;
|
|
2943
2943
|
}
|
|
2944
|
-
internalBinaryRead(e, t, n,
|
|
2945
|
-
let s =
|
|
2944
|
+
internalBinaryRead(e, t, n, r) {
|
|
2945
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
2946
2946
|
for (; e.pos < o; ) {
|
|
2947
2947
|
let [a, l] = e.tag();
|
|
2948
2948
|
switch (a) {
|
|
2949
2949
|
case /* repeated com.hamropatro.grpc.cms.Folder folder */
|
|
2950
2950
|
1:
|
|
2951
|
-
s.folder.push(
|
|
2951
|
+
s.folder.push(Ie.internalBinaryRead(e, e.uint32(), n));
|
|
2952
2952
|
break;
|
|
2953
2953
|
case /* string next_cursor */
|
|
2954
2954
|
2:
|
|
@@ -2962,22 +2962,22 @@ class qn extends j {
|
|
|
2962
2962
|
let c = n.readUnknownField;
|
|
2963
2963
|
if (c === "throw")
|
|
2964
2964
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
2965
|
-
let
|
|
2966
|
-
c !== !1 && (c === !0 ?
|
|
2965
|
+
let f = e.skip(l);
|
|
2966
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
2967
2967
|
}
|
|
2968
2968
|
}
|
|
2969
2969
|
return s;
|
|
2970
2970
|
}
|
|
2971
2971
|
internalBinaryWrite(e, t, n) {
|
|
2972
2972
|
for (let s = 0; s < e.folder.length; s++)
|
|
2973
|
-
|
|
2973
|
+
Ie.internalBinaryWrite(e.folder[s], t.tag(1, m.LengthDelimited).fork(), n).join();
|
|
2974
2974
|
e.nextCursor !== "" && t.tag(2, m.LengthDelimited).string(e.nextCursor), e.hasMore !== !1 && t.tag(3, m.Varint).bool(e.hasMore);
|
|
2975
|
-
let
|
|
2976
|
-
return
|
|
2975
|
+
let r = n.writeUnknownFields;
|
|
2976
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
2977
2977
|
}
|
|
2978
2978
|
}
|
|
2979
2979
|
const Kn = new qn();
|
|
2980
|
-
class Xn extends
|
|
2980
|
+
class Xn extends P {
|
|
2981
2981
|
constructor() {
|
|
2982
2982
|
super("com.hamropatro.grpc.cms.Folder", [
|
|
2983
2983
|
{
|
|
@@ -3012,10 +3012,10 @@ class Xn extends j {
|
|
|
3012
3012
|
}
|
|
3013
3013
|
create(e) {
|
|
3014
3014
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3015
|
-
return t.key = "", t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 &&
|
|
3015
|
+
return t.key = "", t.name = "", t.nestedFolderName = "", t.createdBy = "", e !== void 0 && x(this, t, e), t;
|
|
3016
3016
|
}
|
|
3017
|
-
internalBinaryRead(e, t, n,
|
|
3018
|
-
let s =
|
|
3017
|
+
internalBinaryRead(e, t, n, r) {
|
|
3018
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3019
3019
|
for (; e.pos < o; ) {
|
|
3020
3020
|
let [a, l] = e.tag();
|
|
3021
3021
|
switch (a) {
|
|
@@ -3039,54 +3039,54 @@ class Xn extends j {
|
|
|
3039
3039
|
let c = n.readUnknownField;
|
|
3040
3040
|
if (c === "throw")
|
|
3041
3041
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3042
|
-
let
|
|
3043
|
-
c !== !1 && (c === !0 ?
|
|
3042
|
+
let f = e.skip(l);
|
|
3043
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3044
3044
|
}
|
|
3045
3045
|
}
|
|
3046
3046
|
return s;
|
|
3047
3047
|
}
|
|
3048
3048
|
internalBinaryWrite(e, t, n) {
|
|
3049
3049
|
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.name !== "" && t.tag(2, m.LengthDelimited).string(e.name), e.nestedFolderName !== "" && t.tag(3, m.LengthDelimited).string(e.nestedFolderName), e.createdBy !== "" && t.tag(4, m.LengthDelimited).string(e.createdBy);
|
|
3050
|
-
let
|
|
3051
|
-
return
|
|
3050
|
+
let r = n.writeUnknownFields;
|
|
3051
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3052
3052
|
}
|
|
3053
3053
|
}
|
|
3054
|
-
const
|
|
3055
|
-
{ name: "createFolder", options: {}, I:
|
|
3056
|
-
{ name: "getFolders", options: {}, I:
|
|
3057
|
-
{ name: "updateFolder", options: {}, I:
|
|
3054
|
+
const Ie = new Xn(), Ke = new tt("com.hamropatro.grpc.cms.FolderService", [
|
|
3055
|
+
{ name: "createFolder", options: {}, I: _t, O: Ie },
|
|
3056
|
+
{ name: "getFolders", options: {}, I: Ut, O: Kn },
|
|
3057
|
+
{ name: "updateFolder", options: {}, I: Ie, O: Ie }
|
|
3058
3058
|
]);
|
|
3059
3059
|
class Gn {
|
|
3060
3060
|
constructor(e) {
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3061
|
+
_(this, "typeName", Ke.typeName);
|
|
3062
|
+
_(this, "methods", Ke.methods);
|
|
3063
|
+
_(this, "options", Ke.options);
|
|
3064
3064
|
this._transport = e;
|
|
3065
3065
|
}
|
|
3066
3066
|
/**
|
|
3067
3067
|
* @generated from protobuf rpc: createFolder(com.hamropatro.grpc.cms.CreateFolderRequest) returns (com.hamropatro.grpc.cms.Folder);
|
|
3068
3068
|
*/
|
|
3069
3069
|
createFolder(e, t) {
|
|
3070
|
-
const n = this.methods[0],
|
|
3071
|
-
return
|
|
3070
|
+
const n = this.methods[0], r = this._transport.mergeOptions(t);
|
|
3071
|
+
return fe("unary", this._transport, n, r, e);
|
|
3072
3072
|
}
|
|
3073
3073
|
/**
|
|
3074
3074
|
* @generated from protobuf rpc: getFolders(com.hamropatro.grpc.cms.GetAllFoldersRequest) returns (com.hamropatro.grpc.cms.GetAllFoldersResponse);
|
|
3075
3075
|
*/
|
|
3076
3076
|
getFolders(e, t) {
|
|
3077
|
-
const n = this.methods[1],
|
|
3078
|
-
return
|
|
3077
|
+
const n = this.methods[1], r = this._transport.mergeOptions(t);
|
|
3078
|
+
return fe("unary", this._transport, n, r, e);
|
|
3079
3079
|
}
|
|
3080
3080
|
/**
|
|
3081
3081
|
* @generated from protobuf rpc: updateFolder(com.hamropatro.grpc.cms.Folder) returns (com.hamropatro.grpc.cms.Folder);
|
|
3082
3082
|
*/
|
|
3083
3083
|
updateFolder(e, t) {
|
|
3084
|
-
const n = this.methods[2],
|
|
3085
|
-
return
|
|
3084
|
+
const n = this.methods[2], r = this._transport.mergeOptions(t);
|
|
3085
|
+
return fe("unary", this._transport, n, r, e);
|
|
3086
3086
|
}
|
|
3087
3087
|
}
|
|
3088
|
-
var nt = /* @__PURE__ */ ((
|
|
3089
|
-
class Jn extends
|
|
3088
|
+
var nt = /* @__PURE__ */ ((i) => (i[i.IMAGE = 0] = "IMAGE", i[i.AUDIO = 1] = "AUDIO", i[i.VIDEO = 2] = "VIDEO", i[i.ALL = 3] = "ALL", i))(nt || {});
|
|
3089
|
+
class Jn extends P {
|
|
3090
3090
|
constructor() {
|
|
3091
3091
|
super("com.hamropatro.grpc.cms.CreateFileRequest", [
|
|
3092
3092
|
{
|
|
@@ -3122,10 +3122,10 @@ class Jn extends j {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
create(e) {
|
|
3124
3124
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3125
|
-
return t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.type = 0, e !== void 0 &&
|
|
3125
|
+
return t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.type = 0, e !== void 0 && x(this, t, e), t;
|
|
3126
3126
|
}
|
|
3127
|
-
internalBinaryRead(e, t, n,
|
|
3128
|
-
let s =
|
|
3127
|
+
internalBinaryRead(e, t, n, r) {
|
|
3128
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3129
3129
|
for (; e.pos < o; ) {
|
|
3130
3130
|
let [a, l] = e.tag();
|
|
3131
3131
|
switch (a) {
|
|
@@ -3153,20 +3153,20 @@ class Jn extends j {
|
|
|
3153
3153
|
let c = n.readUnknownField;
|
|
3154
3154
|
if (c === "throw")
|
|
3155
3155
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3156
|
-
let
|
|
3157
|
-
c !== !1 && (c === !0 ?
|
|
3156
|
+
let f = e.skip(l);
|
|
3157
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3158
3158
|
}
|
|
3159
3159
|
}
|
|
3160
3160
|
return s;
|
|
3161
3161
|
}
|
|
3162
3162
|
internalBinaryWrite(e, t, n) {
|
|
3163
3163
|
e.name !== "" && t.tag(1, m.LengthDelimited).string(e.name), e.folderName !== "" && t.tag(2, m.LengthDelimited).string(e.folderName), e.nestedFolderName !== "" && t.tag(3, m.LengthDelimited).string(e.nestedFolderName), e.url !== "" && t.tag(4, m.LengthDelimited).string(e.url), e.type !== 0 && t.tag(5, m.Varint).int32(e.type);
|
|
3164
|
-
let
|
|
3165
|
-
return
|
|
3164
|
+
let r = n.writeUnknownFields;
|
|
3165
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3166
3166
|
}
|
|
3167
3167
|
}
|
|
3168
3168
|
const Rt = new Jn();
|
|
3169
|
-
class Hn extends
|
|
3169
|
+
class Hn extends P {
|
|
3170
3170
|
constructor() {
|
|
3171
3171
|
super("com.hamropatro.grpc.cms.File", [
|
|
3172
3172
|
{
|
|
@@ -3219,15 +3219,15 @@ class Hn extends j {
|
|
|
3219
3219
|
/*ScalarType.STRING*/
|
|
3220
3220
|
},
|
|
3221
3221
|
{ no: 8, name: "type", kind: "enum", T: () => ["com.hamropatro.grpc.cms.FileType", nt] },
|
|
3222
|
-
{ no: 9, name: "metadata", kind: "message", T: () =>
|
|
3222
|
+
{ no: 9, name: "metadata", kind: "message", T: () => Xe }
|
|
3223
3223
|
]);
|
|
3224
3224
|
}
|
|
3225
3225
|
create(e) {
|
|
3226
3226
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3227
|
-
return t.key = "", t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.thumborUrl = "", t.proxyUrl = "", t.type = 0, e !== void 0 &&
|
|
3227
|
+
return t.key = "", t.name = "", t.folderName = "", t.nestedFolderName = "", t.url = "", t.thumborUrl = "", t.proxyUrl = "", t.type = 0, e !== void 0 && x(this, t, e), t;
|
|
3228
3228
|
}
|
|
3229
|
-
internalBinaryRead(e, t, n,
|
|
3230
|
-
let s =
|
|
3229
|
+
internalBinaryRead(e, t, n, r) {
|
|
3230
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3231
3231
|
for (; e.pos < o; ) {
|
|
3232
3232
|
let [a, l] = e.tag();
|
|
3233
3233
|
switch (a) {
|
|
@@ -3265,26 +3265,26 @@ class Hn extends j {
|
|
|
3265
3265
|
break;
|
|
3266
3266
|
case /* com.hamropatro.grpc.cms.FileMetadata metadata */
|
|
3267
3267
|
9:
|
|
3268
|
-
s.metadata =
|
|
3268
|
+
s.metadata = Xe.internalBinaryRead(e, e.uint32(), n, s.metadata);
|
|
3269
3269
|
break;
|
|
3270
3270
|
default:
|
|
3271
3271
|
let c = n.readUnknownField;
|
|
3272
3272
|
if (c === "throw")
|
|
3273
3273
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3274
|
-
let
|
|
3275
|
-
c !== !1 && (c === !0 ?
|
|
3274
|
+
let f = e.skip(l);
|
|
3275
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3276
3276
|
}
|
|
3277
3277
|
}
|
|
3278
3278
|
return s;
|
|
3279
3279
|
}
|
|
3280
3280
|
internalBinaryWrite(e, t, n) {
|
|
3281
|
-
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.name !== "" && t.tag(2, m.LengthDelimited).string(e.name), e.folderName !== "" && t.tag(3, m.LengthDelimited).string(e.folderName), e.nestedFolderName !== "" && t.tag(4, m.LengthDelimited).string(e.nestedFolderName), e.url !== "" && t.tag(5, m.LengthDelimited).string(e.url), e.thumborUrl !== "" && t.tag(6, m.LengthDelimited).string(e.thumborUrl), e.proxyUrl !== "" && t.tag(7, m.LengthDelimited).string(e.proxyUrl), e.type !== 0 && t.tag(8, m.Varint).int32(e.type), e.metadata &&
|
|
3282
|
-
let
|
|
3283
|
-
return
|
|
3281
|
+
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.name !== "" && t.tag(2, m.LengthDelimited).string(e.name), e.folderName !== "" && t.tag(3, m.LengthDelimited).string(e.folderName), e.nestedFolderName !== "" && t.tag(4, m.LengthDelimited).string(e.nestedFolderName), e.url !== "" && t.tag(5, m.LengthDelimited).string(e.url), e.thumborUrl !== "" && t.tag(6, m.LengthDelimited).string(e.thumborUrl), e.proxyUrl !== "" && t.tag(7, m.LengthDelimited).string(e.proxyUrl), e.type !== 0 && t.tag(8, m.Varint).int32(e.type), e.metadata && Xe.internalBinaryWrite(e.metadata, t.tag(9, m.LengthDelimited).fork(), n).join();
|
|
3282
|
+
let r = n.writeUnknownFields;
|
|
3283
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3284
3284
|
}
|
|
3285
3285
|
}
|
|
3286
|
-
const
|
|
3287
|
-
class Zn extends
|
|
3286
|
+
const Te = new Hn();
|
|
3287
|
+
class Zn extends P {
|
|
3288
3288
|
constructor() {
|
|
3289
3289
|
super("com.hamropatro.grpc.cms.FileMetadata", [
|
|
3290
3290
|
{
|
|
@@ -3319,10 +3319,10 @@ class Zn extends j {
|
|
|
3319
3319
|
}
|
|
3320
3320
|
create(e) {
|
|
3321
3321
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3322
|
-
return t.height = 0, t.width = 0, t.backgroundColor = "", t.aspectRatio = 0, e !== void 0 &&
|
|
3322
|
+
return t.height = 0, t.width = 0, t.backgroundColor = "", t.aspectRatio = 0, e !== void 0 && x(this, t, e), t;
|
|
3323
3323
|
}
|
|
3324
|
-
internalBinaryRead(e, t, n,
|
|
3325
|
-
let s =
|
|
3324
|
+
internalBinaryRead(e, t, n, r) {
|
|
3325
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3326
3326
|
for (; e.pos < o; ) {
|
|
3327
3327
|
let [a, l] = e.tag();
|
|
3328
3328
|
switch (a) {
|
|
@@ -3346,20 +3346,20 @@ class Zn extends j {
|
|
|
3346
3346
|
let c = n.readUnknownField;
|
|
3347
3347
|
if (c === "throw")
|
|
3348
3348
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3349
|
-
let
|
|
3350
|
-
c !== !1 && (c === !0 ?
|
|
3349
|
+
let f = e.skip(l);
|
|
3350
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3351
3351
|
}
|
|
3352
3352
|
}
|
|
3353
3353
|
return s;
|
|
3354
3354
|
}
|
|
3355
3355
|
internalBinaryWrite(e, t, n) {
|
|
3356
3356
|
e.height !== 0 && t.tag(1, m.Varint).int32(e.height), e.width !== 0 && t.tag(2, m.Varint).int32(e.width), e.backgroundColor !== "" && t.tag(3, m.LengthDelimited).string(e.backgroundColor), e.aspectRatio !== 0 && t.tag(4, m.Bit64).double(e.aspectRatio);
|
|
3357
|
-
let
|
|
3358
|
-
return
|
|
3357
|
+
let r = n.writeUnknownFields;
|
|
3358
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3359
3359
|
}
|
|
3360
3360
|
}
|
|
3361
|
-
const
|
|
3362
|
-
class
|
|
3361
|
+
const Xe = new Zn();
|
|
3362
|
+
class Yn extends P {
|
|
3363
3363
|
constructor() {
|
|
3364
3364
|
super("com.hamropatro.grpc.cms.DeleteFileRequest", [
|
|
3365
3365
|
{
|
|
@@ -3373,10 +3373,10 @@ class zn extends j {
|
|
|
3373
3373
|
}
|
|
3374
3374
|
create(e) {
|
|
3375
3375
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3376
|
-
return t.key = "", e !== void 0 &&
|
|
3376
|
+
return t.key = "", e !== void 0 && x(this, t, e), t;
|
|
3377
3377
|
}
|
|
3378
|
-
internalBinaryRead(e, t, n,
|
|
3379
|
-
let s =
|
|
3378
|
+
internalBinaryRead(e, t, n, r) {
|
|
3379
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3380
3380
|
for (; e.pos < o; ) {
|
|
3381
3381
|
let [a, l] = e.tag();
|
|
3382
3382
|
switch (a) {
|
|
@@ -3388,20 +3388,20 @@ class zn extends j {
|
|
|
3388
3388
|
let c = n.readUnknownField;
|
|
3389
3389
|
if (c === "throw")
|
|
3390
3390
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3391
|
-
let
|
|
3392
|
-
c !== !1 && (c === !0 ?
|
|
3391
|
+
let f = e.skip(l);
|
|
3392
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3393
3393
|
}
|
|
3394
3394
|
}
|
|
3395
3395
|
return s;
|
|
3396
3396
|
}
|
|
3397
3397
|
internalBinaryWrite(e, t, n) {
|
|
3398
3398
|
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key);
|
|
3399
|
-
let
|
|
3400
|
-
return
|
|
3399
|
+
let r = n.writeUnknownFields;
|
|
3400
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3401
3401
|
}
|
|
3402
3402
|
}
|
|
3403
|
-
const
|
|
3404
|
-
class Qn extends
|
|
3403
|
+
const zn = new Yn();
|
|
3404
|
+
class Qn extends P {
|
|
3405
3405
|
constructor() {
|
|
3406
3406
|
super("com.hamropatro.grpc.cms.DeleteFileResponse", [
|
|
3407
3407
|
{
|
|
@@ -3415,10 +3415,10 @@ class Qn extends j {
|
|
|
3415
3415
|
}
|
|
3416
3416
|
create(e) {
|
|
3417
3417
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3418
|
-
return t.isDeleted = !1, e !== void 0 &&
|
|
3418
|
+
return t.isDeleted = !1, e !== void 0 && x(this, t, e), t;
|
|
3419
3419
|
}
|
|
3420
|
-
internalBinaryRead(e, t, n,
|
|
3421
|
-
let s =
|
|
3420
|
+
internalBinaryRead(e, t, n, r) {
|
|
3421
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3422
3422
|
for (; e.pos < o; ) {
|
|
3423
3423
|
let [a, l] = e.tag();
|
|
3424
3424
|
switch (a) {
|
|
@@ -3430,20 +3430,20 @@ class Qn extends j {
|
|
|
3430
3430
|
let c = n.readUnknownField;
|
|
3431
3431
|
if (c === "throw")
|
|
3432
3432
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3433
|
-
let
|
|
3434
|
-
c !== !1 && (c === !0 ?
|
|
3433
|
+
let f = e.skip(l);
|
|
3434
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3435
3435
|
}
|
|
3436
3436
|
}
|
|
3437
3437
|
return s;
|
|
3438
3438
|
}
|
|
3439
3439
|
internalBinaryWrite(e, t, n) {
|
|
3440
3440
|
e.isDeleted !== !1 && t.tag(1, m.Varint).bool(e.isDeleted);
|
|
3441
|
-
let
|
|
3442
|
-
return
|
|
3441
|
+
let r = n.writeUnknownFields;
|
|
3442
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3443
3443
|
}
|
|
3444
3444
|
}
|
|
3445
|
-
const
|
|
3446
|
-
class
|
|
3445
|
+
const ei = new Qn();
|
|
3446
|
+
class ti extends P {
|
|
3447
3447
|
constructor() {
|
|
3448
3448
|
super("com.hamropatro.grpc.cms.GetFilesByFolderRequest", [
|
|
3449
3449
|
{
|
|
@@ -3471,10 +3471,10 @@ class tr extends j {
|
|
|
3471
3471
|
}
|
|
3472
3472
|
create(e) {
|
|
3473
3473
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3474
|
-
return t.folderName = "", t.cursor = "", t.limit = 0, e !== void 0 &&
|
|
3474
|
+
return t.folderName = "", t.cursor = "", t.limit = 0, e !== void 0 && x(this, t, e), t;
|
|
3475
3475
|
}
|
|
3476
|
-
internalBinaryRead(e, t, n,
|
|
3477
|
-
let s =
|
|
3476
|
+
internalBinaryRead(e, t, n, r) {
|
|
3477
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3478
3478
|
for (; e.pos < o; ) {
|
|
3479
3479
|
let [a, l] = e.tag();
|
|
3480
3480
|
switch (a) {
|
|
@@ -3494,23 +3494,23 @@ class tr extends j {
|
|
|
3494
3494
|
let c = n.readUnknownField;
|
|
3495
3495
|
if (c === "throw")
|
|
3496
3496
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3497
|
-
let
|
|
3498
|
-
c !== !1 && (c === !0 ?
|
|
3497
|
+
let f = e.skip(l);
|
|
3498
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3499
3499
|
}
|
|
3500
3500
|
}
|
|
3501
3501
|
return s;
|
|
3502
3502
|
}
|
|
3503
3503
|
internalBinaryWrite(e, t, n) {
|
|
3504
3504
|
e.folderName !== "" && t.tag(1, m.LengthDelimited).string(e.folderName), e.cursor !== "" && t.tag(2, m.LengthDelimited).string(e.cursor), e.limit !== 0 && t.tag(3, m.Varint).int32(e.limit);
|
|
3505
|
-
let
|
|
3506
|
-
return
|
|
3505
|
+
let r = n.writeUnknownFields;
|
|
3506
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3507
3507
|
}
|
|
3508
3508
|
}
|
|
3509
|
-
const xt = new
|
|
3510
|
-
class
|
|
3509
|
+
const xt = new ti();
|
|
3510
|
+
class ni extends P {
|
|
3511
3511
|
constructor() {
|
|
3512
3512
|
super("com.hamropatro.grpc.cms.GetFilesByFolderResponse", [
|
|
3513
|
-
{ no: 1, name: "files", kind: "message", repeat: 1, T: () =>
|
|
3513
|
+
{ no: 1, name: "files", kind: "message", repeat: 1, T: () => Te },
|
|
3514
3514
|
{
|
|
3515
3515
|
no: 2,
|
|
3516
3516
|
name: "next_cursor",
|
|
@@ -3529,16 +3529,16 @@ class nr extends j {
|
|
|
3529
3529
|
}
|
|
3530
3530
|
create(e) {
|
|
3531
3531
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3532
|
-
return t.files = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 &&
|
|
3532
|
+
return t.files = [], t.nextCursor = "", t.hasMore = !1, e !== void 0 && x(this, t, e), t;
|
|
3533
3533
|
}
|
|
3534
|
-
internalBinaryRead(e, t, n,
|
|
3535
|
-
let s =
|
|
3534
|
+
internalBinaryRead(e, t, n, r) {
|
|
3535
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3536
3536
|
for (; e.pos < o; ) {
|
|
3537
3537
|
let [a, l] = e.tag();
|
|
3538
3538
|
switch (a) {
|
|
3539
3539
|
case /* repeated com.hamropatro.grpc.cms.File files */
|
|
3540
3540
|
1:
|
|
3541
|
-
s.files.push(
|
|
3541
|
+
s.files.push(Te.internalBinaryRead(e, e.uint32(), n));
|
|
3542
3542
|
break;
|
|
3543
3543
|
case /* string next_cursor */
|
|
3544
3544
|
2:
|
|
@@ -3552,80 +3552,80 @@ class nr extends j {
|
|
|
3552
3552
|
let c = n.readUnknownField;
|
|
3553
3553
|
if (c === "throw")
|
|
3554
3554
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3555
|
-
let
|
|
3556
|
-
c !== !1 && (c === !0 ?
|
|
3555
|
+
let f = e.skip(l);
|
|
3556
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3557
3557
|
}
|
|
3558
3558
|
}
|
|
3559
3559
|
return s;
|
|
3560
3560
|
}
|
|
3561
3561
|
internalBinaryWrite(e, t, n) {
|
|
3562
3562
|
for (let s = 0; s < e.files.length; s++)
|
|
3563
|
-
|
|
3563
|
+
Te.internalBinaryWrite(e.files[s], t.tag(1, m.LengthDelimited).fork(), n).join();
|
|
3564
3564
|
e.nextCursor !== "" && t.tag(2, m.LengthDelimited).string(e.nextCursor), e.hasMore !== !1 && t.tag(3, m.Varint).bool(e.hasMore);
|
|
3565
|
-
let
|
|
3566
|
-
return
|
|
3565
|
+
let r = n.writeUnknownFields;
|
|
3566
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3567
3567
|
}
|
|
3568
3568
|
}
|
|
3569
|
-
const
|
|
3570
|
-
{ name: "createFile", options: {}, I: Rt, O:
|
|
3571
|
-
{ name: "updateFile", options: {}, I:
|
|
3572
|
-
{ name: "deleteFile", options: {}, I:
|
|
3573
|
-
{ name: "getFilesByFolder", options: {}, I: xt, O:
|
|
3569
|
+
const ii = new ni(), Ge = new tt("com.hamropatro.grpc.cms.FileService", [
|
|
3570
|
+
{ name: "createFile", options: {}, I: Rt, O: Te },
|
|
3571
|
+
{ name: "updateFile", options: {}, I: Te, O: Te },
|
|
3572
|
+
{ name: "deleteFile", options: {}, I: zn, O: ei },
|
|
3573
|
+
{ name: "getFilesByFolder", options: {}, I: xt, O: ii }
|
|
3574
3574
|
]);
|
|
3575
|
-
class
|
|
3575
|
+
class ri {
|
|
3576
3576
|
constructor(e) {
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3577
|
+
_(this, "typeName", Ge.typeName);
|
|
3578
|
+
_(this, "methods", Ge.methods);
|
|
3579
|
+
_(this, "options", Ge.options);
|
|
3580
3580
|
this._transport = e;
|
|
3581
3581
|
}
|
|
3582
3582
|
/**
|
|
3583
3583
|
* @generated from protobuf rpc: createFile(com.hamropatro.grpc.cms.CreateFileRequest) returns (com.hamropatro.grpc.cms.File);
|
|
3584
3584
|
*/
|
|
3585
3585
|
createFile(e, t) {
|
|
3586
|
-
const n = this.methods[0],
|
|
3587
|
-
return
|
|
3586
|
+
const n = this.methods[0], r = this._transport.mergeOptions(t);
|
|
3587
|
+
return fe("unary", this._transport, n, r, e);
|
|
3588
3588
|
}
|
|
3589
3589
|
/**
|
|
3590
3590
|
* @generated from protobuf rpc: updateFile(com.hamropatro.grpc.cms.File) returns (com.hamropatro.grpc.cms.File);
|
|
3591
3591
|
*/
|
|
3592
3592
|
updateFile(e, t) {
|
|
3593
|
-
const n = this.methods[1],
|
|
3594
|
-
return
|
|
3593
|
+
const n = this.methods[1], r = this._transport.mergeOptions(t);
|
|
3594
|
+
return fe("unary", this._transport, n, r, e);
|
|
3595
3595
|
}
|
|
3596
3596
|
/**
|
|
3597
3597
|
* @generated from protobuf rpc: deleteFile(com.hamropatro.grpc.cms.DeleteFileRequest) returns (com.hamropatro.grpc.cms.DeleteFileResponse);
|
|
3598
3598
|
*/
|
|
3599
3599
|
deleteFile(e, t) {
|
|
3600
|
-
const n = this.methods[2],
|
|
3601
|
-
return
|
|
3600
|
+
const n = this.methods[2], r = this._transport.mergeOptions(t);
|
|
3601
|
+
return fe("unary", this._transport, n, r, e);
|
|
3602
3602
|
}
|
|
3603
3603
|
/**
|
|
3604
3604
|
* @generated from protobuf rpc: getFilesByFolder(com.hamropatro.grpc.cms.GetFilesByFolderRequest) returns (com.hamropatro.grpc.cms.GetFilesByFolderResponse);
|
|
3605
3605
|
*/
|
|
3606
3606
|
getFilesByFolder(e, t) {
|
|
3607
|
-
const n = this.methods[3],
|
|
3608
|
-
return
|
|
3607
|
+
const n = this.methods[3], r = this._transport.mergeOptions(t);
|
|
3608
|
+
return fe("unary", this._transport, n, r, e);
|
|
3609
3609
|
}
|
|
3610
3610
|
}
|
|
3611
|
-
class
|
|
3611
|
+
class si extends P {
|
|
3612
3612
|
constructor() {
|
|
3613
3613
|
super("com.hamropatro.grpc.cms.ImageUploadRequest", []);
|
|
3614
3614
|
}
|
|
3615
3615
|
create(e) {
|
|
3616
3616
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3617
|
-
return e !== void 0 &&
|
|
3617
|
+
return e !== void 0 && x(this, t, e), t;
|
|
3618
3618
|
}
|
|
3619
|
-
internalBinaryRead(e, t, n,
|
|
3620
|
-
return
|
|
3619
|
+
internalBinaryRead(e, t, n, r) {
|
|
3620
|
+
return r ?? this.create();
|
|
3621
3621
|
}
|
|
3622
3622
|
internalBinaryWrite(e, t, n) {
|
|
3623
|
-
let
|
|
3624
|
-
return
|
|
3623
|
+
let r = n.writeUnknownFields;
|
|
3624
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3625
3625
|
}
|
|
3626
3626
|
}
|
|
3627
|
-
const Ct = new
|
|
3628
|
-
class
|
|
3627
|
+
const Ct = new si();
|
|
3628
|
+
class oi extends P {
|
|
3629
3629
|
constructor() {
|
|
3630
3630
|
super("com.hamropatro.grpc.cms.ImageUploadResponse", [
|
|
3631
3631
|
{
|
|
@@ -3646,10 +3646,10 @@ class or extends j {
|
|
|
3646
3646
|
}
|
|
3647
3647
|
create(e) {
|
|
3648
3648
|
const t = globalThis.Object.create(this.messagePrototype);
|
|
3649
|
-
return t.key = "", t.url = "", e !== void 0 &&
|
|
3649
|
+
return t.key = "", t.url = "", e !== void 0 && x(this, t, e), t;
|
|
3650
3650
|
}
|
|
3651
|
-
internalBinaryRead(e, t, n,
|
|
3652
|
-
let s =
|
|
3651
|
+
internalBinaryRead(e, t, n, r) {
|
|
3652
|
+
let s = r ?? this.create(), o = e.pos + t;
|
|
3653
3653
|
for (; e.pos < o; ) {
|
|
3654
3654
|
let [a, l] = e.tag();
|
|
3655
3655
|
switch (a) {
|
|
@@ -3665,247 +3665,247 @@ class or extends j {
|
|
|
3665
3665
|
let c = n.readUnknownField;
|
|
3666
3666
|
if (c === "throw")
|
|
3667
3667
|
throw new globalThis.Error(`Unknown field ${a} (wire type ${l}) for ${this.typeName}`);
|
|
3668
|
-
let
|
|
3669
|
-
c !== !1 && (c === !0 ?
|
|
3668
|
+
let f = e.skip(l);
|
|
3669
|
+
c !== !1 && (c === !0 ? k.onRead : c)(this.typeName, s, a, l, f);
|
|
3670
3670
|
}
|
|
3671
3671
|
}
|
|
3672
3672
|
return s;
|
|
3673
3673
|
}
|
|
3674
3674
|
internalBinaryWrite(e, t, n) {
|
|
3675
3675
|
e.key !== "" && t.tag(1, m.LengthDelimited).string(e.key), e.url !== "" && t.tag(2, m.LengthDelimited).string(e.url);
|
|
3676
|
-
let
|
|
3677
|
-
return
|
|
3676
|
+
let r = n.writeUnknownFields;
|
|
3677
|
+
return r !== !1 && (r == !0 ? k.onWrite : r)(this.typeName, e, t), t;
|
|
3678
3678
|
}
|
|
3679
3679
|
}
|
|
3680
|
-
const
|
|
3681
|
-
{ name: "Upload", options: {}, I: Ct, O:
|
|
3680
|
+
const ai = new oi(), Je = new tt("com.hamropatro.grpc.cms.ImageUploadService", [
|
|
3681
|
+
{ name: "Upload", options: {}, I: Ct, O: ai }
|
|
3682
3682
|
]);
|
|
3683
|
-
class
|
|
3683
|
+
class li {
|
|
3684
3684
|
constructor(e) {
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3685
|
+
_(this, "typeName", Je.typeName);
|
|
3686
|
+
_(this, "methods", Je.methods);
|
|
3687
|
+
_(this, "options", Je.options);
|
|
3688
3688
|
this._transport = e;
|
|
3689
3689
|
}
|
|
3690
3690
|
/**
|
|
3691
3691
|
* @generated from protobuf rpc: Upload(com.hamropatro.grpc.cms.ImageUploadRequest) returns (com.hamropatro.grpc.cms.ImageUploadResponse);
|
|
3692
3692
|
*/
|
|
3693
3693
|
upload(e, t) {
|
|
3694
|
-
const n = this.methods[0],
|
|
3695
|
-
return
|
|
3694
|
+
const n = this.methods[0], r = this._transport.mergeOptions(t);
|
|
3695
|
+
return fe("unary", this._transport, n, r, e);
|
|
3696
3696
|
}
|
|
3697
3697
|
}
|
|
3698
|
-
const
|
|
3698
|
+
const ci = {
|
|
3699
3699
|
baseUrl: "https://hamro-cms-backend-grpc.hamrostack.com"
|
|
3700
|
-
},
|
|
3701
|
-
baseUrl:
|
|
3702
|
-
}),
|
|
3700
|
+
}, it = new jn({
|
|
3701
|
+
baseUrl: ci.baseUrl
|
|
3702
|
+
}), vt = new Gn(it), Ce = _t.create(), He = Ut.create(), St = new ri(it), ke = Rt.create(), ve = xt.create(), hi = new li(it);
|
|
3703
3703
|
Ct.create();
|
|
3704
3704
|
const Mt = async () => {
|
|
3705
3705
|
try {
|
|
3706
|
-
return await
|
|
3706
|
+
return await hi.upload(
|
|
3707
3707
|
Mt
|
|
3708
3708
|
);
|
|
3709
|
-
} catch (
|
|
3710
|
-
throw
|
|
3709
|
+
} catch (i) {
|
|
3710
|
+
throw i;
|
|
3711
3711
|
}
|
|
3712
|
-
},
|
|
3712
|
+
}, ui = async (i, e) => {
|
|
3713
3713
|
try {
|
|
3714
|
-
const t =
|
|
3715
|
-
return await fetch(
|
|
3714
|
+
const t = fi(i, e), r = (await Mt()).response.url;
|
|
3715
|
+
return await fetch(r, {
|
|
3716
3716
|
method: "PUT",
|
|
3717
3717
|
headers: {
|
|
3718
3718
|
"Content-Type": "image/*",
|
|
3719
3719
|
"x-amz-acl": "public-read"
|
|
3720
3720
|
},
|
|
3721
3721
|
body: t
|
|
3722
|
-
}),
|
|
3722
|
+
}), r == null ? void 0 : r.split("?")[0];
|
|
3723
3723
|
} catch (t) {
|
|
3724
3724
|
throw t;
|
|
3725
3725
|
}
|
|
3726
|
-
},
|
|
3726
|
+
}, fi = (i, e) => {
|
|
3727
3727
|
const t = e.type.split("/")[0];
|
|
3728
3728
|
let n = "";
|
|
3729
|
-
t === "video" ? n =
|
|
3730
|
-
const
|
|
3731
|
-
for (let o = 0; o <
|
|
3732
|
-
s[o] =
|
|
3729
|
+
t === "video" ? n = i == null ? void 0 : i.replace(/^data:video\/\w+;base64,/, "") : t === "image" && (n = i == null ? void 0 : i.replace(/^data:image\/\w+;base64,/, ""));
|
|
3730
|
+
const r = atob(n), s = new Uint8Array(r.length);
|
|
3731
|
+
for (let o = 0; o < r.length; o++)
|
|
3732
|
+
s[o] = r.charCodeAt(o);
|
|
3733
3733
|
return s;
|
|
3734
|
-
},
|
|
3734
|
+
}, di = async (i, e = 20) => {
|
|
3735
3735
|
try {
|
|
3736
|
-
return
|
|
3736
|
+
return He.cursor = i, He.limit = e, await vt.getFolders(He);
|
|
3737
3737
|
} catch (t) {
|
|
3738
3738
|
throw t;
|
|
3739
3739
|
}
|
|
3740
|
-
},
|
|
3740
|
+
}, mi = async (i, e, t) => {
|
|
3741
3741
|
try {
|
|
3742
|
-
return
|
|
3743
|
-
|
|
3742
|
+
return Ce.name = i, Ce.nestedFolderName = e, Ce.createdBy = t, await vt.createFolder(
|
|
3743
|
+
Ce
|
|
3744
3744
|
);
|
|
3745
3745
|
} catch (n) {
|
|
3746
3746
|
throw n;
|
|
3747
3747
|
}
|
|
3748
|
-
},
|
|
3748
|
+
}, pi = async (i, e, t, n, r) => {
|
|
3749
3749
|
try {
|
|
3750
|
-
return
|
|
3751
|
-
|
|
3750
|
+
return ke.name = i, ke.nestedFolderName = e, ke.url = t, ke.type = n, ke.folderName = r, await St.createFile(
|
|
3751
|
+
ke
|
|
3752
3752
|
);
|
|
3753
3753
|
} catch (s) {
|
|
3754
3754
|
throw s;
|
|
3755
3755
|
}
|
|
3756
|
-
},
|
|
3756
|
+
}, gi = async (i, e, t) => {
|
|
3757
3757
|
try {
|
|
3758
|
-
return
|
|
3759
|
-
|
|
3758
|
+
return ve.folderName = i, ve.cursor = e, ve.limit = t, await St.getFilesByFolder(
|
|
3759
|
+
ve
|
|
3760
3760
|
);
|
|
3761
3761
|
} catch (n) {
|
|
3762
3762
|
throw n;
|
|
3763
3763
|
}
|
|
3764
3764
|
};
|
|
3765
|
-
var
|
|
3765
|
+
var oe = /* @__PURE__ */ ((i) => (i[i.IMAGE = 0] = "IMAGE", i[i.AUDIO = 1] = "AUDIO", i[i.VIDEO = 2] = "VIDEO", i[i.ALL = 3] = "ALL", i))(oe || {});
|
|
3766
3766
|
const Fe = {
|
|
3767
3767
|
0: "IMAGE",
|
|
3768
3768
|
1: "AUDIO",
|
|
3769
3769
|
2: "VIDEO",
|
|
3770
3770
|
3: "ALL"
|
|
3771
3771
|
};
|
|
3772
|
-
function
|
|
3773
|
-
switch (
|
|
3772
|
+
function bi(i) {
|
|
3773
|
+
switch (i) {
|
|
3774
3774
|
case "image":
|
|
3775
|
-
return Fe[
|
|
3775
|
+
return Fe[oe.IMAGE];
|
|
3776
3776
|
case "video":
|
|
3777
|
-
return Fe[
|
|
3777
|
+
return Fe[oe.VIDEO];
|
|
3778
3778
|
case "audio":
|
|
3779
|
-
return Fe[
|
|
3779
|
+
return Fe[oe.AUDIO];
|
|
3780
3780
|
default:
|
|
3781
|
-
return Fe[
|
|
3781
|
+
return Fe[oe.ALL];
|
|
3782
3782
|
}
|
|
3783
3783
|
}
|
|
3784
|
-
const
|
|
3784
|
+
const z = document.createElementNS(
|
|
3785
3785
|
"http://www.w3.org/2000/svg",
|
|
3786
3786
|
"svg"
|
|
3787
3787
|
);
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3788
|
+
z.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
3789
|
+
z.setAttribute("x", "0px");
|
|
3790
|
+
z.setAttribute("y", "0px");
|
|
3791
|
+
z.setAttribute("width", "18");
|
|
3792
|
+
z.setAttribute("height", "18");
|
|
3793
|
+
z.setAttribute("viewBox", "0 0 50 50");
|
|
3794
|
+
z.setAttribute("fill", "#ee3f3f");
|
|
3795
3795
|
const Vt = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3796
3796
|
Vt.setAttribute(
|
|
3797
3797
|
"d",
|
|
3798
3798
|
"M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"
|
|
3799
3799
|
);
|
|
3800
|
-
|
|
3801
|
-
const
|
|
3800
|
+
z.appendChild(Vt);
|
|
3801
|
+
const ae = document.createElementNS(
|
|
3802
3802
|
"http://www.w3.org/2000/svg",
|
|
3803
3803
|
"svg"
|
|
3804
3804
|
);
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
const
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
const
|
|
3828
|
-
|
|
3805
|
+
ae.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
3806
|
+
ae.setAttribute("x", "0px");
|
|
3807
|
+
ae.setAttribute("y", "0px");
|
|
3808
|
+
ae.setAttribute("width", "24");
|
|
3809
|
+
ae.setAttribute("height", "24");
|
|
3810
|
+
ae.setAttribute("viewBox", "0 0 256 256");
|
|
3811
|
+
ae.setAttribute("style", "fill:#000000;");
|
|
3812
|
+
const C = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
3813
|
+
C.setAttribute("fill", "#ffffff");
|
|
3814
|
+
C.setAttribute("fill-rule", "nonzero");
|
|
3815
|
+
C.setAttribute("stroke", "none");
|
|
3816
|
+
C.setAttribute("stroke-width", "1");
|
|
3817
|
+
C.setAttribute("stroke-linecap", "butt");
|
|
3818
|
+
C.setAttribute("stroke-linejoin", "miter");
|
|
3819
|
+
C.setAttribute("stroke-miterlimit", "10");
|
|
3820
|
+
C.setAttribute("stroke-dasharray", "");
|
|
3821
|
+
C.setAttribute("stroke-dashoffset", "0");
|
|
3822
|
+
C.setAttribute("font-family", "none");
|
|
3823
|
+
C.setAttribute("font-weight", "none");
|
|
3824
|
+
C.setAttribute("font-size", "none");
|
|
3825
|
+
C.setAttribute("text-anchor", "none");
|
|
3826
|
+
C.setAttribute("style", "mix-blend-mode: normal");
|
|
3827
|
+
const rt = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
3828
|
+
rt.setAttribute("transform", "scale(10.66667,10.66667)");
|
|
3829
3829
|
const $t = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3830
3830
|
$t.setAttribute(
|
|
3831
3831
|
"d",
|
|
3832
3832
|
"M4,4c-1.09425,0 -2,0.90575 -2,2v12c0,1.09426 0.90575,2 2,2h16c1.09426,0 2,-0.90574 2,-2v-10c0,-1.09425 -0.90574,-2 -2,-2h-8l-2,-2zM4,6h5.17188l2,2h8.82813v10h-16z"
|
|
3833
3833
|
);
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
const
|
|
3834
|
+
rt.appendChild($t);
|
|
3835
|
+
C.appendChild(rt);
|
|
3836
|
+
ae.appendChild(C);
|
|
3837
|
+
const M = document.createElementNS(
|
|
3838
3838
|
"http://www.w3.org/2000/svg",
|
|
3839
3839
|
"svg"
|
|
3840
3840
|
);
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
const
|
|
3852
|
-
|
|
3841
|
+
M.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
3842
|
+
M.setAttribute("width", "24");
|
|
3843
|
+
M.setAttribute("height", "24");
|
|
3844
|
+
M.setAttribute("viewBox", "0 0 24 24");
|
|
3845
|
+
M.setAttribute("fill", "none");
|
|
3846
|
+
M.setAttribute("stroke", "white");
|
|
3847
|
+
M.setAttribute("stroke-width", "2");
|
|
3848
|
+
M.setAttribute("stroke-linecap", "round");
|
|
3849
|
+
M.setAttribute("stroke-linejoin", "round");
|
|
3850
|
+
M.setAttribute("class", "lucide lucide-cloud-upload");
|
|
3851
|
+
const jt = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3852
|
+
jt.setAttribute(
|
|
3853
3853
|
"d",
|
|
3854
3854
|
"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242"
|
|
3855
3855
|
);
|
|
3856
|
-
const
|
|
3857
|
-
|
|
3856
|
+
const Pt = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3857
|
+
Pt.setAttribute("d", "M12 12v9");
|
|
3858
3858
|
const Wt = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3859
3859
|
Wt.setAttribute("d", "m16 16-4-4-4 4");
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
var
|
|
3864
|
-
class
|
|
3860
|
+
M.appendChild(jt);
|
|
3861
|
+
M.appendChild(Pt);
|
|
3862
|
+
M.appendChild(Wt);
|
|
3863
|
+
var me, pe, U, te, he, ge, A, v, ue, X, be, Ae, Be, ne, ie, we, j, re, ye, Ne;
|
|
3864
|
+
class yi {
|
|
3865
3865
|
constructor(e) {
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
p(this,
|
|
3866
|
+
L(this, me);
|
|
3867
|
+
L(this, pe);
|
|
3868
|
+
L(this, U);
|
|
3869
|
+
L(this, te);
|
|
3870
|
+
L(this, he);
|
|
3871
|
+
L(this, ge);
|
|
3872
|
+
L(this, A, []);
|
|
3873
|
+
L(this, v, []);
|
|
3874
|
+
L(this, ue);
|
|
3875
|
+
L(this, X);
|
|
3876
|
+
L(this, be);
|
|
3877
|
+
L(this, Ae, []);
|
|
3878
|
+
L(this, Be);
|
|
3879
|
+
L(this, ne);
|
|
3880
|
+
L(this, ie);
|
|
3881
|
+
L(this, we);
|
|
3882
|
+
L(this, j);
|
|
3883
|
+
L(this, re);
|
|
3884
|
+
L(this, ye);
|
|
3885
|
+
L(this, Ne);
|
|
3886
|
+
p(this, te, null), p(this, ue, !1), p(this, X, !1), p(this, Be, e.handleUpload.bind(this)), p(this, ne, 0), p(this, j, ""), p(this, ye, ""), p(this, Ne, !1);
|
|
3887
3887
|
}
|
|
3888
3888
|
create(e) {
|
|
3889
3889
|
const {
|
|
3890
3890
|
parentContainerId: t,
|
|
3891
3891
|
buttonText: n,
|
|
3892
|
-
buttonClass:
|
|
3892
|
+
buttonClass: r,
|
|
3893
3893
|
buttonStyle: s,
|
|
3894
3894
|
buttonIcon: o
|
|
3895
3895
|
} = e;
|
|
3896
|
-
p(this,
|
|
3897
|
-
const a =
|
|
3896
|
+
p(this, me, document.getElementById(t));
|
|
3897
|
+
const a = Oe(
|
|
3898
3898
|
n || "Browser Files",
|
|
3899
|
-
|
|
3899
|
+
r || "browse-image-button"
|
|
3900
3900
|
);
|
|
3901
3901
|
return a.type = "button", s && Object.assign(a.style, s), o && a.appendChild(o), a.addEventListener("click", () => {
|
|
3902
|
-
this.
|
|
3903
|
-
}), u(this,
|
|
3902
|
+
this._selectedImageContainer();
|
|
3903
|
+
}), u(this, me) && u(this, me).appendChild(a), u(this, me);
|
|
3904
3904
|
}
|
|
3905
|
-
|
|
3905
|
+
_selectedImageContainer() {
|
|
3906
3906
|
var s;
|
|
3907
3907
|
this._fetchAllFolders();
|
|
3908
|
-
const e =
|
|
3908
|
+
const e = Oe(
|
|
3909
3909
|
"",
|
|
3910
3910
|
"dialog-modal-close-btn",
|
|
3911
3911
|
"",
|
|
@@ -3913,272 +3913,247 @@ class yr {
|
|
|
3913
3913
|
'<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="24" height="24" viewBox="0 0 50 50"> <path d="M 9.15625 6.3125 L 6.3125 9.15625 L 22.15625 25 L 6.21875 40.96875 L 9.03125 43.78125 L 25 27.84375 L 40.9375 43.78125 L 43.78125 40.9375 L 27.84375 25 L 43.6875 9.15625 L 40.84375 6.3125 L 25 22.15625 Z"></path> </svg>'
|
|
3914
3914
|
);
|
|
3915
3915
|
e.addEventListener("click", () => {
|
|
3916
|
-
|
|
3917
|
-
}), p(this,
|
|
3918
|
-
const t = this._createUploadOptions(), n = this._createBrowseMoreContainer(),
|
|
3919
|
-
u(this,
|
|
3916
|
+
Ee.hide(), p(this, A, []), p(this, v, []), p(this, j, "");
|
|
3917
|
+
}), p(this, ge, `Upload (${(s = u(this, A)) == null ? void 0 : s.length})`), p(this, pe, $("browse-container"));
|
|
3918
|
+
const t = this._createUploadOptions(), n = this._createBrowseMoreContainer(), r = this._createBrowseImageMain();
|
|
3919
|
+
u(this, pe).append(
|
|
3920
3920
|
t,
|
|
3921
3921
|
n,
|
|
3922
|
-
|
|
3923
|
-
),
|
|
3922
|
+
r
|
|
3923
|
+
), Ee.show({
|
|
3924
3924
|
title: e,
|
|
3925
|
-
content: u(this,
|
|
3926
|
-
confirmButtonText: u(this,
|
|
3925
|
+
content: u(this, pe),
|
|
3926
|
+
confirmButtonText: u(this, ge),
|
|
3927
3927
|
onConfirm: () => {
|
|
3928
|
-
u(this, Be).call(this);
|
|
3928
|
+
u(this, Be).call(this), Ee.hide(), p(this, A, []);
|
|
3929
3929
|
},
|
|
3930
3930
|
onCancel: () => {
|
|
3931
|
-
|
|
3931
|
+
Ee.hide(), p(this, A, []), p(this, v, []), p(this, j, "");
|
|
3932
3932
|
}
|
|
3933
3933
|
});
|
|
3934
3934
|
}
|
|
3935
3935
|
_createAllAndSelectedTab(e) {
|
|
3936
|
-
const t =
|
|
3936
|
+
const t = $("select-options"), n = Z("Browse", "select"), r = Z(
|
|
3937
3937
|
"Selected",
|
|
3938
3938
|
"select",
|
|
3939
3939
|
"selected-images-tab"
|
|
3940
3940
|
);
|
|
3941
|
-
n.classList.add("selected"), [n,
|
|
3941
|
+
n.classList.add("selected"), [n, r].forEach((o, a) => {
|
|
3942
3942
|
o.addEventListener("click", () => {
|
|
3943
3943
|
var l;
|
|
3944
|
-
p(this,
|
|
3944
|
+
p(this, ne, a), (l = document.querySelector(".select.selected")) == null || l.classList.remove("selected"), o.classList.add("selected"), this._updateSelectedImageListContainerUI();
|
|
3945
3945
|
});
|
|
3946
|
-
}), t.append(n,
|
|
3946
|
+
}), t.append(n, r), e.appendChild(t);
|
|
3947
3947
|
}
|
|
3948
3948
|
_createUploadOptions() {
|
|
3949
|
-
const e =
|
|
3950
|
-
return
|
|
3951
|
-
|
|
3949
|
+
const e = $("browse-options"), t = Z("From Computer", "options");
|
|
3950
|
+
return Z("From URL", "options"), t.classList.add("selected"), [t].forEach((r) => {
|
|
3951
|
+
r.addEventListener("click", () => {
|
|
3952
3952
|
var s;
|
|
3953
|
-
(s = document.querySelector(".options.selected")) == null || s.classList.remove("selected"),
|
|
3953
|
+
(s = document.querySelector(".options.selected")) == null || s.classList.remove("selected"), r.classList.add("selected");
|
|
3954
3954
|
});
|
|
3955
|
-
}), p(this,
|
|
3956
|
-
"Browse More Medias",
|
|
3957
|
-
"browse-more-btn"
|
|
3958
|
-
)), u(this, J).type = "button", e.append(t, u(this, J)), e;
|
|
3955
|
+
}), p(this, he, Oe("Upload Medias", "browse-more-btn")), u(this, he).type = "button", e.append(t, u(this, he)), e;
|
|
3959
3956
|
}
|
|
3960
3957
|
_createBrowseMoreContainer() {
|
|
3961
|
-
p(this,
|
|
3962
|
-
const e =
|
|
3963
|
-
return e.style.display = "none", u(this,
|
|
3958
|
+
p(this, we, $("browse-more-btn-container")), this._createAllAndSelectedTab(u(this, we));
|
|
3959
|
+
const e = Yt("file");
|
|
3960
|
+
return e.style.display = "none", u(this, he).append(M), u(this, he).addEventListener(
|
|
3964
3961
|
"click",
|
|
3965
3962
|
() => e.click()
|
|
3966
3963
|
), e.addEventListener("change", () => {
|
|
3967
3964
|
const t = e.files[0], n = new FileReader();
|
|
3968
3965
|
n.readAsDataURL(t), n.onload = async () => {
|
|
3969
|
-
await this.
|
|
3966
|
+
await this._uploadAndAddSelectedImageList(
|
|
3967
|
+
n.result,
|
|
3968
|
+
t
|
|
3969
|
+
), e.value = "";
|
|
3970
3970
|
};
|
|
3971
|
-
}), this._createAndSelectFolderContainer(u(this,
|
|
3971
|
+
}), this._createAndSelectFolderContainer(u(this, we)), u(this, we);
|
|
3972
3972
|
}
|
|
3973
3973
|
_createAndSelectFolderContainer(e) {
|
|
3974
|
-
const t =
|
|
3974
|
+
const t = Oe(
|
|
3975
3975
|
"Create Folder",
|
|
3976
3976
|
"create-folder-btn"
|
|
3977
3977
|
);
|
|
3978
|
-
t.type = "button", t.append(
|
|
3978
|
+
t.type = "button", t.append(ae), t.addEventListener("click", () => {
|
|
3979
3979
|
const s = window.prompt("Please enter the folder name.");
|
|
3980
3980
|
s && this._createFolder(s);
|
|
3981
3981
|
});
|
|
3982
|
-
const n =
|
|
3983
|
-
p(this,
|
|
3982
|
+
const n = $("choose-create-folder-wrapper"), r = $("custom-select");
|
|
3983
|
+
p(this, ie, zt()), r.appendChild(u(this, ie)), this._updateSelectOptionsField(), n.append(r, t), e.appendChild(n);
|
|
3984
3984
|
}
|
|
3985
3985
|
_createBrowseImageMain() {
|
|
3986
3986
|
var t;
|
|
3987
|
-
const e =
|
|
3988
|
-
return p(this,
|
|
3989
|
-
`Selected Medias (${(t = u(this,
|
|
3990
|
-
)), u(this,
|
|
3991
|
-
u(this,
|
|
3992
|
-
u(this,
|
|
3987
|
+
const e = $("browse-image-main");
|
|
3988
|
+
return p(this, te, Z(
|
|
3989
|
+
`Selected Medias (${(t = u(this, A)) == null ? void 0 : t.length})`
|
|
3990
|
+
)), u(this, te).style.textAlign = "left", u(this, te).style.fontSize = "18px", p(this, U, $("selected-image-container")), u(this, U).addEventListener("scroll", () => {
|
|
3991
|
+
const n = u(this, U).clientHeight, r = u(this, U).scrollTop, s = u(this, U).scrollHeight;
|
|
3992
|
+
n + r >= s && u(this, Ne) && this._fetchFilesFromFolder(u(this, be));
|
|
3993
|
+
}), this._updateSelectedImageListContainerUI(), e.append(
|
|
3994
|
+
u(this, te),
|
|
3995
|
+
u(this, U)
|
|
3993
3996
|
), e;
|
|
3994
3997
|
}
|
|
3995
3998
|
_renderFetchingSkeletonUI() {
|
|
3996
3999
|
for (let e = 0; e < 4; e++) {
|
|
3997
|
-
const t =
|
|
3998
|
-
t.innerHTML = "", u(this,
|
|
4000
|
+
const t = $("skeleton");
|
|
4001
|
+
t.innerHTML = "", u(this, U).append(t);
|
|
3999
4002
|
}
|
|
4000
4003
|
}
|
|
4001
4004
|
_renderEmptyImageContainer() {
|
|
4002
|
-
if (u(this,
|
|
4003
|
-
const e =
|
|
4004
|
-
e.textContent = "No media selected", u(this,
|
|
4005
|
+
if (u(this, X) || u(this, ue)) return;
|
|
4006
|
+
const e = Z();
|
|
4007
|
+
e.textContent = "No media selected", u(this, U).appendChild(e);
|
|
4005
4008
|
}
|
|
4006
4009
|
_renderLoadingUI() {
|
|
4007
|
-
const e =
|
|
4008
|
-
e.innerHTML = "", u(this,
|
|
4009
|
-
}
|
|
4010
|
-
_fileCardBody(e
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4010
|
+
const e = $("skeleton");
|
|
4011
|
+
e.innerHTML = "", u(this, U).appendChild(e);
|
|
4012
|
+
}
|
|
4013
|
+
_fileCardBody(e) {
|
|
4014
|
+
var g, y, O;
|
|
4015
|
+
const t = $("selected-image-content"), n = Oe("x", "selected-image-btn");
|
|
4016
|
+
let r;
|
|
4017
|
+
(e == null ? void 0 : e.type) === oe.IMAGE && (r = Jt(e == null ? void 0 : e.url, "selected-image")), (e == null ? void 0 : e.type) === oe.VIDEO && (r = Ht(e == null ? void 0 : e.url, "uploaded-video")), (e == null ? void 0 : e.type) === oe.AUDIO && (r = Zt(e == null ? void 0 : e.url, "uploaded-audio"));
|
|
4018
|
+
const s = $(
|
|
4015
4019
|
"selected-image-wrapper",
|
|
4016
4020
|
"selected-image-wrapper"
|
|
4017
|
-
)
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
`${e == null ? void 0 : e.fileType} ${e != null && e.size ? " - " + Math.round((e == null ? void 0 : e.size) / 1024) + "KB" : ""}`,
|
|
4021
|
+
), o = Z(e.name, "selected-image-name"), a = Z(
|
|
4022
|
+
`${Fe[e == null ? void 0 : e.type]}`,
|
|
4023
|
+
"selected-image-type"
|
|
4024
|
+
), l = Z(
|
|
4025
|
+
` ${(g = e == null ? void 0 : e.metadata) == null ? void 0 : g.width} *
|
|
4026
|
+
${(y = e == null ? void 0 : e.metadata) == null ? void 0 : y.height}`,
|
|
4024
4027
|
"selected-image-size"
|
|
4025
4028
|
);
|
|
4026
|
-
|
|
4027
|
-
|
|
4029
|
+
t.appendChild(r), s.append(
|
|
4030
|
+
t,
|
|
4031
|
+
o,
|
|
4028
4032
|
a,
|
|
4029
4033
|
l,
|
|
4030
|
-
|
|
4031
|
-
), u(this,
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
);
|
|
4041
|
-
o.classList.contains("checked") ? (o.classList.remove("checked"), c !== -1 && u(this, k).splice(c, 1), u(this, _).push(e)) : (o.classList.add("checked"), u(this, k).push({
|
|
4042
|
-
url: e == null ? void 0 : e.url,
|
|
4043
|
-
name: e == null ? void 0 : e.name,
|
|
4044
|
-
fileType: e == null ? void 0 : e.fileType,
|
|
4045
|
-
size: e == null ? void 0 : e.size
|
|
4046
|
-
}), d !== -1 && u(this, _).splice(d, 1)), this._updateSelectedImagesContainerUI();
|
|
4034
|
+
n
|
|
4035
|
+
), (O = u(this, A)) != null && O.includes(e) && s.classList.add("checked"), u(this, U).style.width = "100%", u(this, U).appendChild(s);
|
|
4036
|
+
const c = u(this, A).findIndex(
|
|
4037
|
+
(E) => (E == null ? void 0 : E.key) === (e == null ? void 0 : e.key)
|
|
4038
|
+
), f = u(this, v).findIndex(
|
|
4039
|
+
(E) => (E == null ? void 0 : E.key) === (e == null ? void 0 : e.key)
|
|
4040
|
+
);
|
|
4041
|
+
n.addEventListener("click", () => {
|
|
4042
|
+
c !== -1 && u(this, A).splice(c, 1), f !== -1 && u(this, v).splice(f, 1), s.remove(), this._updateDialogContent();
|
|
4043
|
+
}), r.addEventListener("click", () => {
|
|
4044
|
+
s.classList.contains("checked") ? (s.classList.remove("checked"), u(this, ne) === 1 ? c !== -1 && (u(this, A).splice(c, 1), s.remove()) : (c !== -1 || f !== -1) && u(this, A).splice(c, 1)) : (s.classList.add("checked"), u(this, A).push(e)), this._updateSelectedImageListContainerUI();
|
|
4047
4045
|
});
|
|
4048
4046
|
}
|
|
4049
|
-
|
|
4050
|
-
this._fileCardBody(e
|
|
4047
|
+
_renderImageCard(e) {
|
|
4048
|
+
this._fileCardBody(e);
|
|
4051
4049
|
}
|
|
4052
|
-
|
|
4053
|
-
this._fileCardBody(e, !0);
|
|
4054
|
-
}
|
|
4055
|
-
_renderFetchedImagesContainerUI() {
|
|
4050
|
+
_renderImageListContainer() {
|
|
4056
4051
|
var e, t;
|
|
4057
|
-
((e = u(this,
|
|
4058
|
-
this.
|
|
4052
|
+
((e = u(this, v)) == null ? void 0 : e.length) > 0 && ((t = u(this, v)) == null || t.forEach((n) => {
|
|
4053
|
+
this._renderImageCard(n);
|
|
4059
4054
|
}));
|
|
4060
4055
|
}
|
|
4056
|
+
_renderSelectedImageListContainer() {
|
|
4057
|
+
var e;
|
|
4058
|
+
((e = u(this, A)) == null ? void 0 : e.length) > 0 && u(this, A).forEach((t) => {
|
|
4059
|
+
this._renderImageCard(t);
|
|
4060
|
+
});
|
|
4061
|
+
}
|
|
4061
4062
|
_renderErrorMessage() {
|
|
4062
|
-
p(this,
|
|
4063
|
-
const e =
|
|
4064
|
-
u(this,
|
|
4063
|
+
p(this, re, $("error-message-wrapper"));
|
|
4064
|
+
const e = Z(
|
|
4065
|
+
u(this, j),
|
|
4065
4066
|
"error-message"
|
|
4066
|
-
), t =
|
|
4067
|
-
|
|
4068
|
-
p(this,
|
|
4069
|
-
}, u(this,
|
|
4067
|
+
), t = z;
|
|
4068
|
+
z.style.cursor = "pointer", t.onclick = () => {
|
|
4069
|
+
p(this, j, ""), u(this, re).remove();
|
|
4070
|
+
}, u(this, re).append(S, e, t), u(this, pe).appendChild(u(this, re));
|
|
4070
4071
|
}
|
|
4071
4072
|
_removeErrorMessageContainer() {
|
|
4072
|
-
u(this,
|
|
4073
|
-
}
|
|
4074
|
-
_renderSelectedImagesContainerUI() {
|
|
4075
|
-
u(this, k).forEach((e) => {
|
|
4076
|
-
this._renderSelectedImageCard(e);
|
|
4077
|
-
});
|
|
4073
|
+
u(this, re) && u(this, re).remove();
|
|
4078
4074
|
}
|
|
4079
|
-
|
|
4080
|
-
var t, n,
|
|
4081
|
-
if (!u(this,
|
|
4082
|
-
u(this,
|
|
4075
|
+
_updateSelectedImageListContainerUI() {
|
|
4076
|
+
var t, n, r;
|
|
4077
|
+
if (!u(this, U)) return;
|
|
4078
|
+
u(this, U).innerHTML = "", u(this, X) && this._renderFetchingSkeletonUI(), u(this, ue) && this._renderLoadingUI(), u(this, ne) === 0 && ((t = u(this, A)) == null ? void 0 : t.length) === 0 && ((n = u(this, v)) == null ? void 0 : n.length) === 0 || u(this, ne) === 1 && ((r = u(this, A)) == null ? void 0 : r.length) === 0 ? (u(this, U).classList.add("no-selected-image-container"), this._renderEmptyImageContainer()) : (u(this, U).classList.remove(
|
|
4083
4079
|
"no-selected-image-container"
|
|
4084
|
-
), u(this,
|
|
4080
|
+
), u(this, ne) === 1 ? this._renderSelectedImageListContainer() : this._renderImageListContainer()), u(this, ie).disabled = u(this, X), this._updateDialogContent();
|
|
4085
4081
|
}
|
|
4086
4082
|
_updateSelectOptionsField() {
|
|
4087
4083
|
var n;
|
|
4088
|
-
const e = (n = u(this,
|
|
4089
|
-
value:
|
|
4090
|
-
label:
|
|
4084
|
+
const e = (n = u(this, Ae)) == null ? void 0 : n.map((r) => ({
|
|
4085
|
+
value: r.name,
|
|
4086
|
+
label: r.name
|
|
4091
4087
|
})), t = Qt(e);
|
|
4092
|
-
u(this,
|
|
4093
|
-
const s =
|
|
4094
|
-
p(this,
|
|
4088
|
+
u(this, ie).innerHTML = "", u(this, ie).append(t), u(this, ie).onchange = (r) => {
|
|
4089
|
+
const s = r.target;
|
|
4090
|
+
p(this, A, []), p(this, v, []), p(this, ye, ""), p(this, Ne, !1), p(this, be, s.value), this._fetchFilesFromFolder(s.value);
|
|
4095
4091
|
};
|
|
4096
4092
|
}
|
|
4097
4093
|
_updateDialogContent() {
|
|
4098
4094
|
var t, n;
|
|
4099
|
-
u(this,
|
|
4095
|
+
u(this, te).textContent = `Selected Medias (${u(this, A).length})`, p(this, ge, `Upload (${u(this, A).length})`);
|
|
4100
4096
|
const e = document.getElementById("selected-images-tab");
|
|
4101
|
-
e && (e.textContent = `Selected (${(t = u(this,
|
|
4102
|
-
}
|
|
4103
|
-
async
|
|
4104
|
-
var
|
|
4105
|
-
p(this,
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4097
|
+
e && (e.textContent = `Selected (${(t = u(this, A)) == null ? void 0 : t.length})`), Ee.updateUploadBtnText(u(this, ge)), Ee.disableConfirmButton(((n = u(this, A)) == null ? void 0 : n.length) <= 0);
|
|
4098
|
+
}
|
|
4099
|
+
async _uploadAndAddSelectedImageList(e, t) {
|
|
4100
|
+
var n;
|
|
4101
|
+
p(this, ue, !0), this._updateSelectedImageListContainerUI();
|
|
4102
|
+
try {
|
|
4103
|
+
const r = await ui(e, t), s = await pi(
|
|
4104
|
+
t == null ? void 0 : t.name,
|
|
4105
|
+
"",
|
|
4106
|
+
r,
|
|
4107
|
+
oe[bi((n = t.type) == null ? void 0 : n.split("/")[0])],
|
|
4108
|
+
u(this, be)
|
|
4109
|
+
);
|
|
4110
|
+
u(this, v).unshift(s == null ? void 0 : s.response);
|
|
4111
|
+
} catch {
|
|
4112
|
+
} finally {
|
|
4113
|
+
p(this, ue, !1), this._updateSelectedImageListContainerUI();
|
|
4114
|
+
}
|
|
4113
4115
|
}
|
|
4114
4116
|
async _createFolder(e, t = 2) {
|
|
4115
|
-
var n,
|
|
4117
|
+
var n, r;
|
|
4116
4118
|
try {
|
|
4117
|
-
const s = await
|
|
4118
|
-
(n = u(this,
|
|
4119
|
+
const s = await mi(e, "", "");
|
|
4120
|
+
(n = u(this, Ae)) == null || n.unshift(s.response), this._updateSelectOptionsField(), p(this, A, []), p(this, v, []), this._fetchFilesFromFolder((r = s.response) == null ? void 0 : r.name);
|
|
4119
4121
|
} catch {
|
|
4120
4122
|
if (t > 1)
|
|
4121
4123
|
this._createFolder(e, --t);
|
|
4122
4124
|
else
|
|
4123
|
-
throw p(this,
|
|
4125
|
+
throw p(this, j, "Error creating folder: " + e), this._renderErrorMessage(), new Error(u(this, j));
|
|
4124
4126
|
}
|
|
4125
4127
|
}
|
|
4126
4128
|
async _upload() {
|
|
4127
|
-
|
|
4128
|
-
if (!u(this, k) || u(this, k).length === 0)
|
|
4129
|
-
throw new Error("No medias to upload");
|
|
4130
|
-
p(this, R, ""), this._removeErrorMessageContainer(), p(this, Q, !0), u(this, J).disabled = !0, G.updateUploadBtnText(`Uploading (${(t = u(this, k)) == null ? void 0 : t.length})`), G.updateUploadBtn(u(this, Q));
|
|
4131
|
-
let e = [];
|
|
4132
|
-
try {
|
|
4133
|
-
return await this._uploadImages(e), p(this, Q, !1), p(this, k, []), p(this, _, []), G.hide(), u(this, J).disabled = !1, G.updateUploadBtn(u(this, Q)), e;
|
|
4134
|
-
} catch {
|
|
4135
|
-
throw p(this, R, "Error while uploading media. Please try again later"), new Error(u(this, R));
|
|
4136
|
-
} finally {
|
|
4137
|
-
p(this, Q, !1), u(this, J).disabled = !1, G.updateUploadBtnText(`Upload(${(n = u(this, k)) == null ? void 0 : n.length})`), G.updateUploadBtn(u(this, Q)), this._renderErrorMessage();
|
|
4138
|
-
}
|
|
4139
|
-
}
|
|
4140
|
-
async _uploadImages(e) {
|
|
4141
|
-
for (const t of u(this, k)) {
|
|
4142
|
-
const n = await pr(
|
|
4143
|
-
t == null ? void 0 : t.name,
|
|
4144
|
-
"",
|
|
4145
|
-
t == null ? void 0 : t.url,
|
|
4146
|
-
q[t == null ? void 0 : t.fileType],
|
|
4147
|
-
u(this, Ie)
|
|
4148
|
-
);
|
|
4149
|
-
e.push(n.response);
|
|
4150
|
-
}
|
|
4129
|
+
return u(this, A);
|
|
4151
4130
|
}
|
|
4152
4131
|
async _fetchFilesFromFolder(e) {
|
|
4153
|
-
p(this,
|
|
4132
|
+
p(this, X, !0), this._updateSelectedImageListContainerUI();
|
|
4154
4133
|
try {
|
|
4155
|
-
const
|
|
4156
|
-
|
|
4157
|
-
name: s.name,
|
|
4158
|
-
fileType: Fe[s.type]
|
|
4159
|
-
}));
|
|
4160
|
-
u(this, _).push(...i);
|
|
4134
|
+
const t = await gi(e, u(this, ye), 10), n = t.response.files;
|
|
4135
|
+
u(this, v).push(...n), p(this, ye, t.response.nextCursor), p(this, Ne, t.response.hasMore);
|
|
4161
4136
|
} catch {
|
|
4162
|
-
throw this._renderErrorMessage(), p(this,
|
|
4137
|
+
throw this._renderErrorMessage(), p(this, j, "Error while fetching files from folder" + e), new Error(
|
|
4163
4138
|
"Something went wrong. Error while fetching files from folder" + e
|
|
4164
4139
|
);
|
|
4165
4140
|
} finally {
|
|
4166
|
-
p(this,
|
|
4141
|
+
p(this, X, !1), this._updateSelectedImageListContainerUI();
|
|
4167
4142
|
}
|
|
4168
4143
|
}
|
|
4169
4144
|
async _fetchAllFolders() {
|
|
4170
|
-
p(this,
|
|
4145
|
+
p(this, X, !0), p(this, j, ""), this._updateSelectedImageListContainerUI(), this._removeErrorMessageContainer();
|
|
4171
4146
|
try {
|
|
4172
|
-
const t = (await
|
|
4173
|
-
p(this,
|
|
4147
|
+
const t = (await di("", 50)).response.folder;
|
|
4148
|
+
p(this, be, t[0].name), this._fetchFilesFromFolder(t[0].name), p(this, Ae, t);
|
|
4174
4149
|
} catch {
|
|
4175
|
-
p(this,
|
|
4150
|
+
p(this, X, !1), p(this, j, "Folder not found. Please create a folder or try again later"), this._renderErrorMessage();
|
|
4176
4151
|
} finally {
|
|
4177
4152
|
this._updateSelectOptionsField();
|
|
4178
4153
|
}
|
|
4179
4154
|
}
|
|
4180
4155
|
}
|
|
4181
|
-
|
|
4156
|
+
me = new WeakMap(), pe = new WeakMap(), U = new WeakMap(), te = new WeakMap(), he = new WeakMap(), ge = new WeakMap(), A = new WeakMap(), v = new WeakMap(), ue = new WeakMap(), X = new WeakMap(), be = new WeakMap(), Ae = new WeakMap(), Be = new WeakMap(), ne = new WeakMap(), ie = new WeakMap(), we = new WeakMap(), j = new WeakMap(), re = new WeakMap(), ye = new WeakMap(), Ne = new WeakMap();
|
|
4182
4157
|
export {
|
|
4183
|
-
|
|
4158
|
+
yi as default
|
|
4184
4159
|
};
|