@seedprotocol/arweave 0.7.12 → 0.7.13-next.1527.g318ec68

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/index.js CHANGED
@@ -1,27 +1,27 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as ee, L as te, M as ne, N as re, O as ie, P as d, Q as f, R as p, S as ae, T as oe, U as se, V as ce, W as le, X as ue, Y as de, Z as fe, _ as pe, a as me, at as m, b as he, c as ge, d as _e, et as ve, f as h, g as ye, h as g, i as be, it as xe, j as Se, k as Ce, l as we, m as Te, n as Ee, nt as _, o as v, p as y, q as b, r as x, rt as S, s as C, t as w, tt as T, u as E, v as D, w as De, x as Oe, y as ke, z as Ae } from "./ArweaveClient-CFAd2I4l.js";
2
- import { parseFragment as je } from "parse5";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as ee, K as te, L as u, M as ne, N as re, O as d, P as ie, Q as ae, R as oe, S as se, T as ce, U as le, V as f, W as ue, X as p, Y as de, Z as fe, _ as pe, a as me, at as m, b as he, c as ge, ct as h, d as _e, et as ve, f as ye, g, h as be, i as xe, it as _, j as Se, k as Ce, l as we, lt as v, m as Te, n as Ee, nt as De, o as Oe, ot as y, p as b, q as x, r as S, rt as C, s as w, st as T, t as ke, tt as Ae, u as je, v as Me, w as Ne, x as Pe, y as Fe, z as Ie } from "./ArweaveClient-DENyqpd_.js";
2
+ import { parseFragment as Le } from "parse5";
3
3
  //#region src/easAttestationUrl.ts
4
- var Me = /(^|\.)easscan\.(org|xyz)$/i;
5
- function O(e) {
4
+ var Re = /(^|\.)easscan\.(org|xyz)$/i;
5
+ function E(e) {
6
6
  let t = e.trim();
7
7
  if (!t) return !1;
8
8
  try {
9
9
  let e = new URL(t);
10
- return Me.test(e.hostname) ? /\/attestation\/view\//i.test(e.pathname) : !1;
10
+ return Re.test(e.hostname) ? /\/attestation\/view\//i.test(e.pathname) : !1;
11
11
  } catch {
12
12
  return !1;
13
13
  }
14
14
  }
15
15
  //#endregion
16
16
  //#region src/relationSeedRef.ts
17
- function Ne(e) {
17
+ function ze(e) {
18
18
  let t = {
19
19
  localId: void 0,
20
20
  uid: void 0
21
21
  };
22
22
  return e && (e.length === 10 && (t.localId = e), e.startsWith("0x") && e.length === 66 && (t.uid = e)), t;
23
23
  }
24
- function k(e) {
24
+ function D(e) {
25
25
  if (e != null) {
26
26
  if (typeof e == "string") {
27
27
  let t = e.trim();
@@ -34,35 +34,35 @@ function k(e) {
34
34
  }
35
35
  }
36
36
  }
37
- var Pe = /^[a-zA-Z0-9_-]{10,21}$/;
38
- function A(e) {
39
- let t = Ne(e);
37
+ var Be = /^[a-zA-Z0-9_-]{10,21}$/;
38
+ function O(e) {
39
+ let t = ze(e);
40
40
  return t.localId || t.uid ? {
41
41
  seedLocalId: t.localId,
42
42
  seedUid: t.uid
43
- } : Pe.test(e) && !e.startsWith("0x") ? { seedLocalId: e } : {};
43
+ } : Be.test(e) && !e.startsWith("0x") ? { seedLocalId: e } : {};
44
44
  }
45
45
  //#endregion
46
46
  //#region src/mediaRef.ts
47
- var Fe = /^[a-zA-Z0-9_-]{43}$/;
48
- function Ie(e) {
47
+ var Ve = /^[a-zA-Z0-9_-]{43}$/;
48
+ function He(e) {
49
49
  return e == null ? "" : typeof e == "string" ? e.trim() : String(e).trim();
50
50
  }
51
- function j(e, t) {
51
+ function k(e, t) {
52
52
  let n = e[t];
53
53
  return n == null ? "" : typeof n == "string" ? n.trim() : typeof n == "number" || typeof n == "boolean" ? String(n) : "";
54
54
  }
55
- function Le(e) {
55
+ function Ue(e) {
56
56
  let t = e.trim();
57
57
  if (!t) return t;
58
58
  try {
59
- let e = k(JSON.parse(t));
59
+ let e = D(JSON.parse(t));
60
60
  if (e) return e;
61
61
  } catch {}
62
62
  return t;
63
63
  }
64
- function M(e, t) {
65
- let n = Ie(e);
64
+ function A(e, t) {
65
+ let n = He(e);
66
66
  if (!n) return { kind: "empty" };
67
67
  let r = t?.treatAs;
68
68
  if (r === "url") return {
@@ -80,14 +80,14 @@ function M(e, t) {
80
80
  kind: "unknown",
81
81
  raw: n
82
82
  };
83
- if (n.startsWith("http://") || n.startsWith("https://") || n.startsWith("blob:") || n.startsWith("data:")) return O(n) ? {
83
+ if (n.startsWith("http://") || n.startsWith("https://") || n.startsWith("blob:") || n.startsWith("data:")) return E(n) ? {
84
84
  kind: "nonMediaUrl",
85
85
  href: n
86
86
  } : {
87
87
  kind: "url",
88
88
  href: n
89
89
  };
90
- let i = Le(n), a = A(i);
90
+ let i = Ue(n), a = O(i);
91
91
  return a.seedUid ? {
92
92
  kind: "seedUid",
93
93
  uid: a.seedUid
@@ -97,7 +97,7 @@ function M(e, t) {
97
97
  } : i.startsWith("0x") && i.length === 66 ? {
98
98
  kind: "seedUid",
99
99
  uid: i
100
- } : Fe.test(i) && !i.startsWith("0x") ? {
100
+ } : Ve.test(i) && !i.startsWith("0x") ? {
101
101
  kind: "arweaveTxId",
102
102
  txId: i
103
103
  } : {
@@ -105,25 +105,25 @@ function M(e, t) {
105
105
  raw: n
106
106
  };
107
107
  }
108
- function N(e, t) {
109
- let n = j(e, t);
108
+ function j(e, t) {
109
+ let n = k(e, t);
110
110
  if (n) return n;
111
111
  let r = t.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
112
112
  if (r !== t) {
113
- let t = j(e, r);
113
+ let t = k(e, r);
114
114
  if (t) return t;
115
115
  }
116
116
  let i = t.split("_");
117
117
  if (i.length > 1) {
118
- let t = j(e, i[0] + i.slice(1).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(""));
118
+ let t = k(e, i[0] + i.slice(1).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(""));
119
119
  if (t) return t;
120
120
  }
121
121
  return "";
122
122
  }
123
- function Re(e, t) {
123
+ function We(e, t) {
124
124
  let n = {};
125
125
  for (let [r, i] of Object.entries(t)) {
126
- let t = N(e, r);
126
+ let t = j(e, r);
127
127
  if (!t) {
128
128
  n[r] = void 0;
129
129
  continue;
@@ -142,7 +142,7 @@ function Re(e, t) {
142
142
  };
143
143
  continue;
144
144
  }
145
- let a = M(t, { treatAs: i.treatAs });
145
+ let a = A(t, { treatAs: i.treatAs });
146
146
  n[r] = {
147
147
  role: i.role,
148
148
  raw: t,
@@ -151,31 +151,31 @@ function Re(e, t) {
151
151
  }
152
152
  return n;
153
153
  }
154
- function ze(e) {
155
- return `${(h()[0] ?? p.getBaseUrl()).replace(/\/+$/, "")}/raw/${e}`;
154
+ function Ge(e) {
155
+ return `${(b()[0] ?? f.getBaseUrl()).replace(/\/+$/, "")}/raw/${e}`;
156
156
  }
157
157
  //#endregion
158
158
  //#region src/gateway/publicUrl.ts
159
- function Be(e) {
159
+ function Ke(e) {
160
160
  try {
161
- let t = new URL(e).hostname.toLowerCase();
162
- return t === "localhost" || t.endsWith(".localhost") || t === "[::1]" || /^127\./.test(t);
161
+ let t = new URL(e), n = t.hostname.toLowerCase();
162
+ return n === "localhost" || n.endsWith(".localhost") || n === "[::1]" || /^127\./.test(n) ? !0 : t.pathname.replace(/\/+$/, "") !== "";
163
163
  } catch {
164
164
  return !0;
165
165
  }
166
166
  }
167
- function P() {
167
+ function M() {
168
168
  let e = g()?.publicArweaveBaseUrl;
169
169
  if (e) return e;
170
- let t = p.getBaseUrl();
171
- return Be(t) ? `https://${m() || "arweave.net"}` : t;
170
+ let t = f.getBaseUrl();
171
+ return Ke(t) ? `https://${v() || "arweave.net"}` : t;
172
172
  }
173
- function F(e) {
174
- return `${P()}/raw/${e}`;
173
+ function N(e) {
174
+ return `${M()}/raw/${e}`;
175
175
  }
176
176
  //#endregion
177
177
  //#region src/resolveSeedRssImageRelationRef.ts
178
- var I = [
178
+ var P = [
179
179
  "featureImage",
180
180
  "feature_image",
181
181
  "image",
@@ -186,49 +186,49 @@ var I = [
186
186
  "thumbnail_image",
187
187
  "thumbnailImage"
188
188
  ];
189
- function L(e) {
189
+ function F(e) {
190
190
  return e == null ? "" : typeof e == "string" ? e.trim() : typeof e == "number" || typeof e == "boolean" ? String(e) : "";
191
191
  }
192
- function R(e, ...t) {
192
+ function I(e, ...t) {
193
193
  for (let n of t) {
194
- let t = L(e[n]);
194
+ let t = F(e[n]);
195
195
  if (t) return t;
196
196
  }
197
197
  let n = t.map((e) => e.split(":").pop().toLowerCase());
198
198
  for (let [t, r] of Object.entries(e)) {
199
199
  let e = (t.includes(":") ? t.split(":").pop() : t).toLowerCase();
200
200
  if (n.some((t) => e === t.toLowerCase())) {
201
- let e = L(r);
201
+ let e = F(r);
202
202
  if (e) return e;
203
203
  }
204
204
  }
205
205
  return "";
206
206
  }
207
- function z(e) {
207
+ function L(e) {
208
208
  let t = e.trim();
209
209
  if (t && !t.startsWith("0x")) try {
210
- return F(t);
210
+ return N(t);
211
211
  } catch {
212
212
  return;
213
213
  }
214
214
  }
215
- function Ve(e) {
215
+ function qe(e) {
216
216
  let t = e.storageTransactionId?.trim();
217
217
  if (t) {
218
- let e = z(t);
218
+ let e = L(t);
219
219
  if (e) return e;
220
220
  }
221
221
  let n = e.arweaveUrl?.trim();
222
- if (n && !O(n)) return n;
222
+ if (n && !E(n)) return n;
223
223
  }
224
- function He(e) {
224
+ function Je(e) {
225
225
  let t = e.trim();
226
- if (!t || O(t)) return;
227
- let n = M(t);
226
+ if (!t || E(t)) return;
227
+ let n = A(t);
228
228
  switch (n.kind) {
229
229
  case "url": return { mediaUrl: n.href };
230
230
  case "arweaveTxId": {
231
- let e = z(n.txId);
231
+ let e = L(n.txId);
232
232
  return {
233
233
  storageTransactionId: n.txId,
234
234
  ...e ? { mediaUrl: e } : {}
@@ -236,7 +236,7 @@ function He(e) {
236
236
  }
237
237
  case "seedUid": return { seedUid: n.uid };
238
238
  default: {
239
- let e = z(t);
239
+ let e = L(t);
240
240
  return e ? {
241
241
  storageTransactionId: t,
242
242
  mediaUrl: e
@@ -244,46 +244,46 @@ function He(e) {
244
244
  }
245
245
  }
246
246
  }
247
- function Ue(e) {
248
- let t = R(e, "storageTransactionId", "storage_transaction_id"), n = R(e, "arweaveUrl", "arweave_url"), r = R(e, "seedUid", "SeedUid", "seed_uid"), i = R(e, "link", "Link"), a = Ve({
247
+ function Ye(e) {
248
+ let t = I(e, "storageTransactionId", "storage_transaction_id"), n = I(e, "arweaveUrl", "arweave_url"), r = I(e, "seedUid", "SeedUid", "seed_uid"), i = I(e, "link", "Link"), a = qe({
249
249
  storageTransactionId: t,
250
250
  arweaveUrl: n
251
- }) ?? (i && !O(i) ? i : void 0);
251
+ }) ?? (i && !E(i) ? i : void 0);
252
252
  if (t || n || r || a) return {
253
253
  ...t ? { storageTransactionId: t } : {},
254
- ...n && !O(n) ? { arweaveUrl: n } : {},
254
+ ...n && !E(n) ? { arweaveUrl: n } : {},
255
255
  ...r ? { seedUid: r } : {},
256
256
  ...a ? { mediaUrl: a } : {}
257
257
  };
258
258
  }
259
- function B(e) {
259
+ function R(e) {
260
260
  if (e != null) {
261
- if (typeof e == "string") return He(e);
261
+ if (typeof e == "string") return Je(e);
262
262
  if (Array.isArray(e)) for (let t of e) {
263
- let e = B(t);
263
+ let e = R(t);
264
264
  if (e?.mediaUrl || e?.storageTransactionId || e?.seedUid) return e;
265
265
  }
266
- else if (typeof e == "object") return Ue(e);
266
+ else if (typeof e == "object") return Ye(e);
267
267
  }
268
268
  }
269
- function We(e, t = I) {
269
+ function Xe(e, t = P) {
270
270
  for (let n of t) {
271
271
  if (!(n in e)) continue;
272
- let t = B(e[n]);
272
+ let t = R(e[n]);
273
273
  if (t) return t;
274
274
  }
275
275
  }
276
276
  //#endregion
277
277
  //#region src/ArweaveClient/transactionTagsByIds.ts
278
- var Ge = 100, V = "\n query GetTransactionsTagsByIds($ids: [ID!], $first: Int) {\n transactions(ids: $ids, first: $first) {\n edges {\n node {\n id\n tags {\n name\n value\n }\n }\n }\n }\n }\n";
279
- async function Ke(e, t) {
278
+ var Ze = 100, z = "\n query GetTransactionsTagsByIds($ids: [ID!], $first: Int) {\n transactions(ids: $ids, first: $first) {\n edges {\n node {\n id\n tags {\n name\n value\n }\n }\n }\n }\n }\n";
279
+ async function Qe(e, t) {
280
280
  let n = /* @__PURE__ */ new Map(), r = Array.from(new Set(e.filter((e) => typeof e == "string" && e.trim())));
281
281
  if (r.length === 0) return n;
282
- let i = t?.client ?? p.getArweaveClient(), a = Math.max(1, Math.min(t?.batchSize ?? 100, 100));
282
+ let i = t?.client ?? f.getArweaveClient(), a = Math.max(1, Math.min(t?.batchSize ?? 100, 100));
283
283
  for (let e = 0; e < r.length; e += a) {
284
284
  let o = r.slice(e, e + a);
285
285
  try {
286
- let e = await i.request(V, {
286
+ let e = await i.request(z, {
287
287
  ids: o,
288
288
  first: o.length
289
289
  });
@@ -302,15 +302,15 @@ async function Ke(e, t) {
302
302
  }
303
303
  //#endregion
304
304
  //#region src/ArweaveClient/uploadApiVerification.ts
305
- function H(e) {
305
+ function B(e) {
306
306
  return e.trim().replace(/\/+$/, "");
307
307
  }
308
- function U(e, t) {
309
- return `${H(e)}/api/upload/arweave/data/${encodeURIComponent(t)}`;
308
+ function V(e, t) {
309
+ return `${B(e)}/api/upload/arweave/data/${encodeURIComponent(t)}`;
310
310
  }
311
- var qe = 45e3;
312
- async function Je(e, t, n) {
313
- let r = U(e, t), i = n?.timeoutMs ?? qe, a = new AbortController(), o = setTimeout(() => a.abort(), i);
311
+ var $e = 45e3;
312
+ async function et(e, t, n) {
313
+ let r = V(e, t), i = n?.timeoutMs ?? $e, a = new AbortController(), o = setTimeout(() => a.abort(), i);
314
314
  try {
315
315
  let e = await fetch(r, { signal: a.signal });
316
316
  return clearTimeout(o), e.status === 404 ? {
@@ -335,16 +335,16 @@ async function Je(e, t, n) {
335
335
  }
336
336
  //#endregion
337
337
  //#region src/ArweaveClient/arweaveL1UploadApi.ts
338
- var Ye = "\n query ArweaveGatewayTransaction($id: String!) {\n transaction(id: $id) {\n id\n bundledIn {\n id\n }\n block {\n height\n timestamp\n }\n }\n }\n";
339
- function W(e, t) {
340
- return `${H(e)}/api/upload/arweave/status/${encodeURIComponent(t)}`;
338
+ var tt = "\n query ArweaveGatewayTransaction($id: String!) {\n transaction(id: $id) {\n id\n bundledIn {\n id\n }\n block {\n height\n timestamp\n }\n }\n }\n";
339
+ function H(e, t) {
340
+ return `${B(e)}/api/upload/arweave/status/${encodeURIComponent(t)}`;
341
341
  }
342
- function Xe(e) {
342
+ function nt(e) {
343
343
  let t = e.l1;
344
344
  return t ? t.meetsMinConfirmations === !0 || t.confirmed === !0 : !1;
345
345
  }
346
- async function Ze(e, t) {
347
- let n = W(e, t);
346
+ async function rt(e, t) {
347
+ let n = H(e, t);
348
348
  try {
349
349
  let e = await fetch(n);
350
350
  if (!e.ok) return null;
@@ -354,7 +354,7 @@ async function Ze(e, t) {
354
354
  return null;
355
355
  }
356
356
  }
357
- async function G(e, t, n) {
357
+ async function U(e, t, n) {
358
358
  let r = e.trim();
359
359
  if (!r) return null;
360
360
  try {
@@ -362,7 +362,7 @@ async function G(e, t, n) {
362
362
  method: "POST",
363
363
  headers: { "Content-Type": "application/json" },
364
364
  body: JSON.stringify({
365
- query: Ye,
365
+ query: tt,
366
366
  variables: { id: t }
367
367
  }),
368
368
  signal: n?.signal
@@ -386,26 +386,26 @@ async function G(e, t, n) {
386
386
  return null;
387
387
  }
388
388
  }
389
- async function Qe(e, t, n) {
390
- let r = _(), i = e?.trim(), o = "https", s = null;
389
+ async function it(e, t, n) {
390
+ let r = y(), i = e?.trim(), a = "https", o = null;
391
391
  if (i) try {
392
392
  let e = new URL(i);
393
- o = e.protocol === "http:" ? "http" : "https", s = e.hostname || null;
393
+ a = e.protocol === "http:" ? "http" : "https", o = e.hostname || null;
394
394
  } catch {
395
- s = null;
395
+ o = null;
396
396
  }
397
- let c = s && s.length > 0 ? T(s) : [...r], l = n?.signal;
398
- for (let e of c) {
399
- let r = `${o}://${e}`;
400
- if (!await a(r, l ?? void 0)) continue;
401
- let i = await G(`${o}://${e}/graphql`, t, n);
397
+ let s = o && o.length > 0 ? m(o) : [...r], c = n?.signal;
398
+ for (let e of s) {
399
+ let r = `${a}://${e}`;
400
+ if (!await d(r, { signal: c ?? void 0 })) continue;
401
+ let i = await U(`${a}://${e}/graphql`, t, n);
402
402
  if (i !== null) return i;
403
403
  }
404
404
  return null;
405
405
  }
406
406
  //#endregion
407
407
  //#region src/gateway/seedGatewayConfig.ts
408
- function $e(e) {
408
+ function at(e) {
409
409
  let t = e.gateway ?? {};
410
410
  return {
411
411
  transport: t.transport,
@@ -423,7 +423,7 @@ function $e(e) {
423
423
  }
424
424
  };
425
425
  }
426
- function et(e) {
426
+ function ot(e) {
427
427
  return {
428
428
  transport: e.gatewayTransport,
429
429
  arweaveDomain: e.arweaveDomain,
@@ -438,21 +438,47 @@ function et(e) {
438
438
  }
439
439
  //#endregion
440
440
  //#region src/htmlLinks.ts
441
- var K = "[A-Za-z0-9_-]{43}", q = RegExp(`^ar://(${K})([/?#].*)?$`), tt = RegExp(`/raw/(${K})(/.*)?$`), nt = RegExp(`^/(${K})(/.*)?$`), J = (e) => {
441
+ var W = "[A-Za-z0-9_-]{43}", st = RegExp(`^ar://(${W})([/?#].*)?$`), ct = RegExp(`/raw/(${W})(/.*)?$`), G = RegExp(`^/(${W})(/.*)?$`), K = (e) => {
442
442
  try {
443
443
  return new URL(e).host.toLowerCase();
444
444
  } catch {
445
445
  return;
446
446
  }
447
447
  };
448
- function rt(e, t) {
448
+ function q(e) {
449
+ try {
450
+ let t = new URL(e);
451
+ return {
452
+ origin: t.origin,
453
+ path: t.pathname.replace(/\/+$/, "")
454
+ };
455
+ } catch {
456
+ return;
457
+ }
458
+ }
459
+ function J(e, t) {
460
+ let n;
461
+ return t.forEach((t, r) => {
462
+ let i = q(t);
463
+ i && i.origin === e.origin && (!i.path || e.pathname.startsWith(`${i.path}/`)) && (n && n.prefixLength >= i.path.length || (n = {
464
+ index: r,
465
+ path: e.pathname.slice(i.path.length),
466
+ prefixLength: i.path.length
467
+ }));
468
+ }), n && {
469
+ index: n.index,
470
+ path: n.path
471
+ };
472
+ }
473
+ function lt(e, t) {
449
474
  let n = e.toLowerCase();
450
- if (S(n.replace(/:\d+$/, ""))) return !0;
451
- for (let e of [...t.map(J), ...u]) if (e && (n === e || n.endsWith(`.${e}`))) return !0;
475
+ if (T(n.replace(/:\d+$/, ""))) return !0;
476
+ let r = t.filter((e) => q(e)?.path === "");
477
+ for (let e of [...r.map(K), ..._]) if (e && (n === e || n.endsWith(`.${e}`))) return !0;
452
478
  return !1;
453
479
  }
454
480
  function Y(e, t) {
455
- let n = e.trim(), r = q.exec(n);
481
+ let n = e.trim(), r = st.exec(n);
456
482
  if (r) return {
457
483
  transactionId: r[1],
458
484
  form: "raw",
@@ -465,33 +491,37 @@ function Y(e, t) {
465
491
  } catch {
466
492
  return;
467
493
  }
468
- let a = i.search + i.hash, o = tt.exec(i.pathname);
494
+ let a = i.search + i.hash, o = ct.exec(i.pathname);
469
495
  if (o) return {
470
496
  transactionId: o[1],
471
497
  form: "raw",
472
498
  rest: (o[2] ?? "") + a
473
499
  };
474
- let s = nt.exec(i.pathname);
475
- if (s && rt(i.host, t?.baseUrls ?? h())) return {
476
- transactionId: s[1],
500
+ let s = t?.baseUrls ?? b(), c = J(i, s), l = c && G.exec(c.path) || (lt(i.host, s) ? G.exec(i.pathname) : null);
501
+ if (l) return {
502
+ transactionId: l[1],
477
503
  form: "bare",
478
- rest: (s[2] ?? "") + a
504
+ rest: (l[2] ?? "") + a
479
505
  };
480
506
  }
481
507
  function X(e, t) {
482
508
  return `${t.replace(/\/+$/, "")}${e.form === "raw" ? "/raw/" : "/"}${e.transactionId}${e.rest}`;
483
509
  }
484
- function it(e, t) {
485
- let n = t?.baseUrls ?? h(), r = Y(e, { baseUrls: n });
510
+ function ut(e, t) {
511
+ let n = t?.baseUrls ?? b(), r = Y(e, { baseUrls: n });
486
512
  if (!r) return;
487
- let i = n[n.findIndex((t) => e.startsWith(`${t.replace(/\/+$/, "")}/`)) + 1];
488
- return i ? X(r, i) : void 0;
513
+ let i = -1;
514
+ try {
515
+ i = J(new URL(e.trim()), n)?.index ?? -1;
516
+ } catch {}
517
+ let a = n[i + 1];
518
+ return a ? X(r, a) : void 0;
489
519
  }
490
- function at(e) {
520
+ function dt(e) {
491
521
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;");
492
522
  }
493
523
  function Z(e, t) {
494
- let n = je(e, { sourceCodeLocationInfo: !0 }), r = [], i = (e) => {
524
+ let n = Le(e, { sourceCodeLocationInfo: !0 }), r = [], i = (e) => {
495
525
  if (e.nodeName === "#text" || e.nodeName === "#comment") return;
496
526
  let n = e;
497
527
  if (n.attrs?.length) for (let e of n.attrs) {
@@ -500,7 +530,7 @@ function Z(e, t) {
500
530
  i !== void 0 && a && r.push({
501
531
  start: a.startOffset,
502
532
  end: a.endOffset,
503
- text: `${e.name}="${at(i)}"`
533
+ text: `${e.name}="${dt(i)}"`
504
534
  });
505
535
  }
506
536
  let a = n;
@@ -513,12 +543,12 @@ function Z(e, t) {
513
543
  for (let e of r.sort((e, t) => t.start - e.start)) a = a.slice(0, e.start) + e.text + a.slice(e.end);
514
544
  return a;
515
545
  }
516
- var ot = /* @__PURE__ */ new Set([
546
+ var ft = /* @__PURE__ */ new Set([
517
547
  "src",
518
548
  "href",
519
549
  "poster"
520
550
  ]);
521
- function st(e, t) {
551
+ function pt(e, t) {
522
552
  let n = !1, r = e.split(",").map((e) => {
523
553
  let r = /^(\s*)(\S+)(.*)$/s.exec(e);
524
554
  if (!r) return e;
@@ -528,8 +558,8 @@ function st(e, t) {
528
558
  return n ? r.join(",") : void 0;
529
559
  }
530
560
  function Q(e, t, n) {
531
- if (e === "srcset") return st(t, n);
532
- if (!ot.has(e)) return;
561
+ if (e === "srcset") return pt(t, n);
562
+ if (!ft.has(e)) return;
533
563
  let r = n(t.trim());
534
564
  return r === void 0 || r === t ? void 0 : r;
535
565
  }
@@ -537,11 +567,11 @@ function $(e, t) {
537
567
  if (e.includes("ar://") || e.includes("/raw/")) return !0;
538
568
  let n = e.toLowerCase();
539
569
  if (n.includes("arweave.net") || n.includes("ar-io.net")) return !0;
540
- for (let e of [...t.map(J), ...u]) if (e && n.includes(e)) return !0;
570
+ for (let e of [...t.map(K), ..._]) if (e && n.includes(e)) return !0;
541
571
  return !1;
542
572
  }
543
- function ct(e, t) {
544
- let n = t?.baseUrls ?? h(), r = n[0];
573
+ function mt(e, t) {
574
+ let n = t?.baseUrls ?? b(), r = n[0];
545
575
  if (!r || !e || !$(e, n)) return e;
546
576
  let i = (e) => {
547
577
  let t = Y(e, { baseUrls: n });
@@ -551,8 +581,8 @@ function ct(e, t) {
551
581
  };
552
582
  return Z(e, (e, t, n) => Q(t, n, i));
553
583
  }
554
- function lt(e, { to: t = "gateway", publicBaseUrl: n, baseUrls: r }) {
555
- let i = [n, ...r ?? h()];
584
+ function ht(e, { to: t = "gateway", publicBaseUrl: n, baseUrls: r }) {
585
+ let i = [n, ...r ?? b()];
556
586
  if (!e || !$(e, i)) return e;
557
587
  let a = (e) => {
558
588
  let r = Y(e, { baseUrls: i });
@@ -563,6 +593,6 @@ function lt(e, { to: t = "gateway", publicBaseUrl: n, baseUrls: r }) {
563
593
  return Z(e, (e, t, n) => Q(t, n, a));
564
594
  }
565
595
  //#endregion
566
- export { b as ARWEAVE_HOST_ENV_KEYS, p as ArweaveClient, p as BaseArweaveClient, u as DEFAULT_ARWEAVE_GATEWAYS, de as DEFAULT_ARWEAVE_GRAPHQL_URL, ue as DEFAULT_ARWEAVE_HOST, ge as DEFAULT_ARWEAVE_RAW_READ_TIMEOUT_MS, fe as DEFAULT_GATEWAY_SIDECAR_HOST, f as DEFAULT_GATEWAY_SIDECAR_PORT, e as DEFAULT_SEED_FEED_HYPER_KEY, ve as DEFAULT_SEED_GATEWAY_HYPER_KEY, Ee as DEFAULT_TRANSACTION_STATUS_TIMEOUT_MS, x as DEFAULT_TRANSACTION_STATUS_TOTAL_TIMEOUT_MS, w as DefaultArweaveClient, Ae as DuplicateArweaveModuleError, v as GET_ARWEAVE_TRANSACTIONS, V as GET_TRANSACTIONS_TAGS_BY_IDS, C as GET_TRANSACTION_TAGS, be as MIN_TRANSACTION_STATUS_ATTEMPT_MS, I as SEED_RSS_IMAGE_RELATION_FIELD_KEYS, Ge as TRANSACTION_TAGS_BATCH_SIZE, n as assertSingleArweaveModule, Ce as beginGatewayHostHalfOpenProbe, X as buildArweaveTransactionLink, M as classifyMediaRef, t as configureGatewayCircuitBreaker, we as ensureArweaveReadGatewayForFallback, ae as ensureReadGatewaySelected, E as fetchArweaveRawFromBaseUrl, _e as fetchArweaveRawTextAcrossGateways, me as fetchTransactionStatusAcrossGateways, h as getArweaveReadBaseUrls, T as getArweaveReadGatewayHostsForPrimary, Ze as getArweaveUploadStatus, ze as getArweaveUrlForTransaction, _ as getDefaultArweaveReadGatewayHostsOrdered, N as getFeedItemStringField, Se as getGatewayHostCircuitState, r as getLastHealthyReadGatewayHost, Te as getPreferredArweaveReadBaseUrls, P as getPublicArweaveBaseUrl, F as getPublicArweaveRawUrl, D as getReadGatewayHostsForConfig, y as getResolvedArweaveReadBaseUrls, g as getResolvedSeedGatewayEndpoints, c as getResponseMediaType, Ke as getTransactionTagsByIds, U as getUploadApiArweaveDataUrl, W as getUploadApiArweaveStatusUrl, Je as getUploadPipelineTransactionStatus, se as hasArweaveContentReadTransform, De as invalidateReadGatewayCache, ke as invalidateSidecarProbeCache, Xe as isArweaveL1AnchoringComplete, O as isEasAttestationExplorerUrl, ne as isGatewayHostCircuitOpen, S as isKnownArweaveGatewayHostname, oe as isReadGatewayKnownHealthy, re as listOpenGatewayCircuitHosts, Q as mapUrlAttribute, xe as mergePrimaryHostWithDefaults, it as nextArweaveGatewayUrl, Re as normalizeFeedItemFields, d as normalizeGatewayHostKey, k as normalizeRelationPropertyValue, H as normalizeUploadApiBaseUrl, Y as parseArweaveTransactionLink, a as probeGateway, lt as publishedArweaveLinksInHtml, G as queryArweaveGatewayTransaction, Qe as queryArweaveGatewayTransactionWithFallback, le as readArweaveContentResponse, o as recordGatewayHostFailure, l as recordGatewayHostSuccess, ct as rehostArweaveLinksInHtml, ce as resetArweaveClientOwnerForTests, i as resetArweaveReadGatewayForTests, te as resetGatewayCircuitBreakerForTests, m as resolveArweaveHostFromEnv, he as resolveProxyBaseUrl, Oe as resolveSeedGatewayEndpoints, A as resolveSeedIdsFromRefString, We as resolveSeedRssImageRelationFromItem, B as resolveSeedRssImageRelationRef, Z as rewriteHtmlAttributes, et as seedGatewayConfigFromClientContext, $e as seedGatewayConfigFromSeedConfig, ie as selectFirstHealthyReadGateway, s as setArweaveContentReadTransform, ye as setPreferredArweaveReadBaseUrls, pe as setResolvedSeedGatewayEndpoints, ee as transformArweaveContent };
596
+ export { ke as ARWEAVE_GRAPHQL_TIMEOUT_MS, p as ARWEAVE_HOST_ENV_KEYS, f as ArweaveClient, f as BaseArweaveClient, fe as DEFAULT_ARWEAVE_GATEWAYS, ae as DEFAULT_ARWEAVE_GRAPHQL_URL, e as DEFAULT_ARWEAVE_HOST, we as DEFAULT_ARWEAVE_RAW_READ_TIMEOUT_MS, ve as DEFAULT_GATEWAY_SIDECAR_HOST, Ae as DEFAULT_GATEWAY_SIDECAR_PORT, De as DEFAULT_SEED_FEED_HYPER_KEY, C as DEFAULT_SEED_GATEWAY_HYPER_KEY, S as DEFAULT_TRANSACTION_STATUS_TIMEOUT_MS, xe as DEFAULT_TRANSACTION_STATUS_TOTAL_TIMEOUT_MS, Ee as DefaultArweaveClient, c as DuplicateArweaveModuleError, w as GET_ARWEAVE_TRANSACTIONS, z as GET_TRANSACTIONS_TAGS_BY_IDS, ge as GET_TRANSACTION_TAGS, _ as KNOWN_ARWEAVE_GATEWAYS, me as MIN_TRANSACTION_STATUS_ATTEMPT_MS, P as SEED_RSS_IMAGE_RELATION_FIELD_KEYS, Ze as TRANSACTION_TAGS_BATCH_SIZE, le as assertSingleArweaveModule, Se as beginGatewayHostHalfOpenProbe, X as buildArweaveTransactionLink, ne as cancelGatewayHostHalfOpenProbe, A as classifyMediaRef, re as configureGatewayCircuitBreaker, je as ensureArweaveReadGatewayForFallback, Ne as ensureReadGatewaySelected, _e as fetchArweaveRawFromBaseUrl, ye as fetchArweaveRawTextAcrossGateways, Oe as fetchTransactionStatusAcrossGateways, b as getArweaveReadBaseUrls, m as getArweaveReadGatewayHostsForPrimary, rt as getArweaveUploadStatus, Ge as getArweaveUrlForTransaction, y as getDefaultArweaveReadGatewayHostsOrdered, j as getFeedItemStringField, ie as getGatewayHostCircuitState, ce as getLastHealthyReadGatewayHost, be as getPreferredArweaveReadBaseUrls, M as getPublicArweaveBaseUrl, N as getPublicArweaveRawUrl, Fe as getReadGatewayHostsForConfig, Te as getResolvedArweaveReadBaseUrls, g as getResolvedSeedGatewayEndpoints, s as getResponseMediaType, Qe as getTransactionTagsByIds, V as getUploadApiArweaveDataUrl, H as getUploadApiArweaveStatusUrl, et as getUploadPipelineTransactionStatus, te as hasArweaveContentReadTransform, a as invalidateReadGatewayCache, he as invalidateSidecarProbeCache, nt as isArweaveL1AnchoringComplete, E as isEasAttestationExplorerUrl, o as isGatewayHostCircuitOpen, T as isKnownArweaveGatewayHostname, i as isReadGatewayKnownHealthy, l as listOpenGatewayCircuitHosts, Q as mapUrlAttribute, h as mergePrimaryHostWithDefaults, ut as nextArweaveGatewayUrl, We as normalizeFeedItemFields, u as normalizeGatewayHostKey, D as normalizeRelationPropertyValue, B as normalizeUploadApiBaseUrl, Y as parseArweaveTransactionLink, d as probeGateway, ht as publishedArweaveLinksInHtml, U as queryArweaveGatewayTransaction, it as queryArweaveGatewayTransactionWithFallback, x as readArweaveContentResponse, oe as recordGatewayHostFailure, Ie as recordGatewayHostSuccess, mt as rehostArweaveLinksInHtml, ue as resetArweaveClientOwnerForTests, Ce as resetArweaveReadGatewayForTests, n as resetGatewayCircuitBreakerForTests, v as resolveArweaveHostFromEnv, Pe as resolveProxyBaseUrl, se as resolveSeedGatewayEndpoints, O as resolveSeedIdsFromRefString, Xe as resolveSeedRssImageRelationFromItem, R as resolveSeedRssImageRelationRef, r as resolveSidecarOrigin, Z as rewriteHtmlAttributes, ot as seedGatewayConfigFromClientContext, at as seedGatewayConfigFromSeedConfig, t as selectFirstHealthyReadGateway, ee as setArweaveContentReadTransform, pe as setPreferredArweaveReadBaseUrls, Me as setResolvedSeedGatewayEndpoints, de as transformArweaveContent };
567
597
 
568
598
  //# sourceMappingURL=index.js.map