@qaecy/cue-sdk 0.0.55 → 0.0.58

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.
@@ -1,10 +1,10 @@
1
1
  import { getApps as to, initializeApp as eo } from "firebase/app";
2
- import { getDownloadURL as Nt, ref as k, getMetadata as jt, getBlob as oo, updateMetadata as ro, uploadBytesResumable as so, uploadString as ao, listAll as nt, deleteObject as io, getStorage as no, connectStorageEmulator as co } from "firebase/storage";
2
+ import { getDownloadURL as Nt, ref as x, getMetadata as jt, getBlob as oo, updateMetadata as ro, uploadBytesResumable as so, uploadString as ao, listAll as pt, deleteObject as io, getStorage as no, connectStorageEmulator as co } from "firebase/storage";
3
3
  import { Writer as po } from "n3";
4
- import { getAuth as lo, connectAuthEmulator as ho, onIdTokenChanged as uo, getIdTokenResult as ot, signInWithEmailAndPassword as go, GoogleAuthProvider as bt, OAuthProvider as _t, signInWithPopup as mo, signInWithRedirect as wo, getRedirectResult as fo, signOut as ct, signInWithCustomToken as Lt, sendPasswordResetEmail as yo, onAuthStateChanged as bo, fetchSignInMethodsForEmail as _o, linkWithPopup as vo, unlink as Eo, reauthenticateWithCredential as Ut, EmailAuthProvider as pt, updatePassword as To, linkWithCredential as So, verifyBeforeUpdateEmail as Io, sendEmailVerification as Co } from "firebase/auth";
5
- import { v5 as xo } from "uuid";
4
+ import { ActionCodeOperation as V, getAuth as lo, connectAuthEmulator as ho, onIdTokenChanged as uo, getIdTokenResult as st, signInWithEmailAndPassword as go, GoogleAuthProvider as tt, OAuthProvider as _t, signInWithPopup as mo, signInWithCredential as wo, signInWithRedirect as fo, getRedirectResult as yo, signOut as lt, signInWithCustomToken as Lt, checkActionCode as bo, applyActionCode as _o, confirmPasswordReset as vo, onAuthStateChanged as Eo, fetchSignInMethodsForEmail as To, linkWithPopup as So, unlink as Io, reauthenticateWithCredential as Co, EmailAuthProvider as Ut, updatePassword as ko, linkWithCredential as xo } from "firebase/auth";
5
+ import { v5 as $o } from "uuid";
6
6
  import "spark-md5";
7
- const ko = [423, 429, 503];
7
+ const Oo = [423, 429, 503];
8
8
  class Ne extends Error {
9
9
  constructor(t, e, o) {
10
10
  super(`QLever throttled the request (HTTP ${e}): ${t}`), this.status = e, this.retryAfterSeconds = o, this.name = "QLeverThrottledError";
@@ -12,7 +12,7 @@ class Ne extends Error {
12
12
  status;
13
13
  retryAfterSeconds;
14
14
  }
15
- function $o(s) {
15
+ function Ro(s) {
16
16
  const t = s.headers.get("retry-after");
17
17
  if (!t) return;
18
18
  const e = Number(t);
@@ -20,10 +20,10 @@ function $o(s) {
20
20
  const o = Date.parse(t);
21
21
  if (!Number.isNaN(o)) return Math.max(0, (o - Date.now()) / 1e3);
22
22
  }
23
- async function W(s) {
23
+ async function X(s) {
24
24
  const t = await s.text();
25
- if (ko.includes(s.status))
26
- throw new Ne(t, s.status, $o(s));
25
+ if (Oo.includes(s.status))
26
+ throw new Ne(t, s.status, Ro(s));
27
27
  return t;
28
28
  }
29
29
  class O {
@@ -116,7 +116,7 @@ class O {
116
116
  );
117
117
  }
118
118
  if (!o.ok) {
119
- const r = await W(o);
119
+ const r = await X(o);
120
120
  throw new Error(`QLever query failed (HTTP ${o.status}): ${r}`);
121
121
  }
122
122
  return await o.json();
@@ -134,7 +134,7 @@ class O {
134
134
  body: new URLSearchParams({ query: t })
135
135
  });
136
136
  if (!o.ok) {
137
- const r = await W(o);
137
+ const r = await X(o);
138
138
  throw new Error(`QLever subset failed (HTTP ${o.status}): ${r}`);
139
139
  }
140
140
  return await o.text();
@@ -151,7 +151,7 @@ class O {
151
151
  body: new URLSearchParams({ update: t })
152
152
  });
153
153
  if (!e.ok) {
154
- const o = await W(e);
154
+ const o = await X(e);
155
155
  throw new Error(`SPARQL update failed (HTTP ${e.status}): ${o}`);
156
156
  }
157
157
  return await e.json();
@@ -200,10 +200,10 @@ class O {
200
200
  ...this.baseHeaders,
201
201
  "Content-Type": "application/n-quads",
202
202
  "Content-Encoding": "gzip"
203
- }, r = Ao() ? {
203
+ }, r = Do() ? {
204
204
  method: "POST",
205
205
  headers: o,
206
- body: Ro(t).pipeThrough(new CompressionStream("gzip")),
206
+ body: Po(t).pipeThrough(new CompressionStream("gzip")),
207
207
  // Required for a streaming body; also switches the request to
208
208
  // chunked transfer encoding, which the service handles because it
209
209
  // never buffers the body itself.
@@ -211,10 +211,10 @@ class O {
211
211
  } : {
212
212
  method: "POST",
213
213
  headers: o,
214
- body: await Po(Buffer.from(await je(t), "utf-8"))
214
+ body: await No(Buffer.from(await je(t), "utf-8"))
215
215
  }, a = await fetch(e, r);
216
216
  if (!a.ok) {
217
- const i = await W(a);
217
+ const i = await X(a);
218
218
  throw new Error(`QLever data POST failed (HTTP ${a.status}): ${i}`);
219
219
  }
220
220
  });
@@ -226,8 +226,8 @@ function je(s) {
226
226
  o.addQuads(s), o.end((r, a) => r ? e(r) : t(a));
227
227
  });
228
228
  }
229
- const Oo = 5e3;
230
- function Ro(s) {
229
+ const Ao = 5e3;
230
+ function Po(s) {
231
231
  const t = new TextEncoder();
232
232
  let e = 0;
233
233
  return new ReadableStream({
@@ -236,16 +236,16 @@ function Ro(s) {
236
236
  o.close();
237
237
  return;
238
238
  }
239
- const r = s.slice(e, e + Oo);
239
+ const r = s.slice(e, e + Ao);
240
240
  e += r.length, o.enqueue(t.encode(await je(r)));
241
241
  }
242
242
  });
243
243
  }
244
- let P;
245
- function Ao() {
246
- if (P !== void 0) return P;
244
+ let D;
245
+ function Do() {
246
+ if (D !== void 0) return D;
247
247
  if (typeof process < "u" && process.env?.QLEVER_DISABLE_REQUEST_STREAMING === "true" || typeof CompressionStream > "u" || typeof ReadableStream > "u")
248
- return P = !1;
248
+ return D = !1;
249
249
  try {
250
250
  let s = !1;
251
251
  const t = new Request("https://a.invalid/", {
@@ -255,13 +255,13 @@ function Ao() {
255
255
  return s = !0, "half";
256
256
  }
257
257
  }).headers.has("Content-Type");
258
- P = s && !t;
258
+ D = s && !t;
259
259
  } catch {
260
- P = !1;
260
+ D = !1;
261
261
  }
262
- return P;
262
+ return D;
263
263
  }
264
- async function Po(s) {
264
+ async function No(s) {
265
265
  const t = new CompressionStream("gzip"), e = t.writable.getWriter();
266
266
  e.write(new Uint8Array(s)), e.close();
267
267
  const o = [], r = t.readable.getReader();
@@ -276,7 +276,7 @@ async function Po(s) {
276
276
  i.set(c, n), n += c.byteLength;
277
277
  return i.buffer;
278
278
  }
279
- class Do {
279
+ class jo {
280
280
  constructor(t) {
281
281
  if (this.options = t, this.options.graphType !== "qlever")
282
282
  throw new Error(`Unsupported graph type: ${this.options.graphType}`);
@@ -313,57 +313,57 @@ class Do {
313
313
  return this._db.deleteData(t);
314
314
  }
315
315
  }
316
- function V(s) {
316
+ function J(s) {
317
317
  const t = s;
318
318
  return t?.code === "storage/object-not-found" || t?.status === 404;
319
319
  }
320
- class No {
320
+ class Lo {
321
321
  constructor(t) {
322
322
  this.storage = t;
323
323
  }
324
324
  storage;
325
325
  async getDownloadURL(t) {
326
326
  try {
327
- return await Nt(k(this.storage, t));
327
+ return await Nt(x(this.storage, t));
328
328
  } catch (e) {
329
- if (V(e)) return;
329
+ if (J(e)) return;
330
330
  throw e;
331
331
  }
332
332
  }
333
333
  async getCacheBustedUrl(t) {
334
- const e = k(this.storage, t);
334
+ const e = x(this.storage, t);
335
335
  try {
336
336
  const o = await jt(e);
337
337
  return `${await Nt(e)}&t=${encodeURIComponent(o.updated)}`;
338
338
  } catch (o) {
339
- if (V(o)) return;
339
+ if (J(o)) return;
340
340
  throw o;
341
341
  }
342
342
  }
343
343
  async getFile(t) {
344
344
  try {
345
- return await oo(k(this.storage, t));
345
+ return await oo(x(this.storage, t));
346
346
  } catch (e) {
347
- if (V(e)) return;
347
+ if (J(e)) return;
348
348
  throw e;
349
349
  }
350
350
  }
351
351
  async getMetadata(t) {
352
352
  try {
353
- const e = await jt(k(this.storage, t));
353
+ const e = await jt(x(this.storage, t));
354
354
  return { updated: e.updated, contentType: e.contentType, size: e.size, customMetadata: e.customMetadata };
355
355
  } catch (e) {
356
- if (V(e)) return;
356
+ if (J(e)) return;
357
357
  throw e;
358
358
  }
359
359
  }
360
360
  async setMetadata(t, e) {
361
- await ro(k(this.storage, t), { customMetadata: e });
361
+ await ro(x(this.storage, t), { customMetadata: e });
362
362
  }
363
363
  upload(t, e, o = {}) {
364
364
  const r = {};
365
365
  o.contentType && (r.contentType = o.contentType), o.contentEncoding && (r.contentEncoding = o.contentEncoding), o.customMetadata && (r.customMetadata = o.customMetadata);
366
- const a = so(k(this.storage, t), e, Object.keys(r).length ? r : void 0);
366
+ const a = so(x(this.storage, t), e, Object.keys(r).length ? r : void 0);
367
367
  return {
368
368
  complete: () => new Promise((i, n) => {
369
369
  a.on("state_changed", void 0, n, () => i());
@@ -375,14 +375,14 @@ class No {
375
375
  };
376
376
  }
377
377
  async uploadString(t, e, o, r) {
378
- await ao(k(this.storage, t), e, o, r ? { customMetadata: r } : void 0);
378
+ await ao(x(this.storage, t), e, o, r ? { customMetadata: r } : void 0);
379
379
  }
380
380
  async listFiles(t) {
381
- return (await nt(k(this.storage, t))).items.map((o) => o.name);
381
+ return (await pt(x(this.storage, t))).items.map((o) => o.name);
382
382
  }
383
383
  async listFilesRecursive(t) {
384
384
  const e = async (o) => {
385
- const r = await nt(k(this.storage, o));
385
+ const r = await pt(x(this.storage, o));
386
386
  let a = r.items.map((i) => i.fullPath);
387
387
  for (const i of r.prefixes) a = a.concat(await e(i.fullPath));
388
388
  return a;
@@ -392,7 +392,7 @@ class No {
392
392
  async deleteDirectory(t) {
393
393
  let e = 0;
394
394
  const o = async (r) => {
395
- const a = await nt(k(this.storage, r));
395
+ const a = await pt(x(this.storage, r));
396
396
  for (const i of a.items)
397
397
  await io(i), e++;
398
398
  for (const i of a.prefixes) await o(i.fullPath);
@@ -400,8 +400,8 @@ class No {
400
400
  return await o(t), e;
401
401
  }
402
402
  }
403
- const jo = 3, Lo = 3, Uo = 50;
404
- class Mo {
403
+ const Uo = 3, Mo = 3, Fo = 50;
404
+ class qo {
405
405
  constructor(t) {
406
406
  this.init = t, this.done = this.run().then(
407
407
  () => {
@@ -440,7 +440,7 @@ class Mo {
440
440
  }
441
441
  // ─── The upload ───────────────────────────────────────────────────────────
442
442
  async run() {
443
- const { bucket: t, path: e, body: o, options: r } = this.init, a = await X(
443
+ const { bucket: t, path: e, body: o, options: r } = this.init, a = await Y(
444
444
  await this.init.call("POST", "uploads", void 0, {
445
445
  bucket: t,
446
446
  path: e,
@@ -461,7 +461,7 @@ class Mo {
461
461
  if (i.length === 0) break;
462
462
  await this.sendParts(i);
463
463
  }
464
- await this.untilRunning(), await X(await this.init.call("POST", "uploads/complete", void 0, this.ref()));
464
+ await this.untilRunning(), await Y(await this.init.call("POST", "uploads/complete", void 0, this.ref()));
465
465
  } catch (i) {
466
466
  throw await this.init.call("DELETE", "uploads", this.ref()).catch(() => {
467
467
  }), i;
@@ -472,7 +472,7 @@ class Mo {
472
472
  for (; this.state === "running" && e.length; )
473
473
  await this.sendPart(e.shift());
474
474
  };
475
- await Promise.all(Array.from({ length: Math.min(jo, e.length) }, o));
475
+ await Promise.all(Array.from({ length: Math.min(Uo, e.length) }, o));
476
476
  }
477
477
  async sendPart(t) {
478
478
  const { partSize: e } = this.created, o = this.init.body.slice((t - 1) * e, t * e);
@@ -487,7 +487,7 @@ class Mo {
487
487
  return;
488
488
  } catch (i) {
489
489
  if (a.signal.aborted) return;
490
- if (r >= Lo) throw i;
490
+ if (r >= Mo) throw i;
491
491
  this.urls.delete(t), await new Promise((n) => setTimeout(n, 500 * 2 ** r));
492
492
  } finally {
493
493
  this.inFlight.delete(a);
@@ -498,7 +498,7 @@ class Mo {
498
498
  async partUrl(t) {
499
499
  const e = this.urls.get(t);
500
500
  if (e) return e;
501
- const o = this.partNumbers().filter((n) => n >= t && !this.finished.has(n)).slice(0, Uo), r = await this.init.call("POST", "uploads/parts", void 0, { ...this.ref(), partNumbers: o }), { urls: a } = await X(r);
501
+ const o = this.partNumbers().filter((n) => n >= t && !this.finished.has(n)).slice(0, Fo), r = await this.init.call("POST", "uploads/parts", void 0, { ...this.ref(), partNumbers: o }), { urls: a } = await Y(r);
502
502
  for (const [n, c] of Object.entries(a)) this.urls.set(Number(n), c);
503
503
  const i = this.urls.get(t);
504
504
  if (!i) throw new Error(`No URL for part ${t}`);
@@ -507,7 +507,7 @@ class Mo {
507
507
  /** After a pause, trust the service's record of what arrived, and refresh URLs that may have expired. */
508
508
  async syncFinished() {
509
509
  this.resumed = !1, this.urls.clear();
510
- const { parts: t } = await X(await this.init.call("GET", "uploads/parts", this.ref()));
510
+ const { parts: t } = await Y(await this.init.call("GET", "uploads/parts", this.ref()));
511
511
  this.finished.clear();
512
512
  for (const e of t) this.finished.set(e.partNumber, e.size);
513
513
  this.emit();
@@ -532,17 +532,17 @@ class Mo {
532
532
  for (const o of this.listeners) o(e, t);
533
533
  }
534
534
  }
535
- async function X(s) {
535
+ async function Y(s) {
536
536
  if (!s.ok) {
537
537
  const t = new Error(`Storage request failed: HTTP ${s.status}`);
538
538
  throw t.status = s.status, t;
539
539
  }
540
540
  return s.status === 204 ? void 0 : s.json();
541
541
  }
542
- const Fo = "/bff/storage";
543
- class qo {
542
+ const zo = "/bff/storage";
543
+ class Bo {
544
544
  constructor(t, e) {
545
- this.bucket = t, this.options = e, this.base = `${e.gatewayUrl.replace(/\/$/, "")}${Fo}`, this.plainFetch = e.plainFetch ?? ((o, r) => fetch(o, r));
545
+ this.bucket = t, this.options = e, this.base = `${e.gatewayUrl.replace(/\/$/, "")}${zo}`, this.plainFetch = e.plainFetch ?? ((o, r) => fetch(o, r));
546
546
  }
547
547
  bucket;
548
548
  options;
@@ -571,10 +571,10 @@ class qo {
571
571
  async getMetadata(t) {
572
572
  const e = await this.call("GET", "objects/metadata", t, { bucket: this.bucket, path: t });
573
573
  if (e.status !== 404)
574
- return (await U(e)).json();
574
+ return (await M(e)).json();
575
575
  }
576
576
  async setMetadata(t, e) {
577
- await U(
577
+ await M(
578
578
  await this.call("PATCH", "objects/metadata", t, void 0, {
579
579
  bucket: this.bucket,
580
580
  path: t,
@@ -584,7 +584,7 @@ class qo {
584
584
  }
585
585
  upload(t, e, o = {}) {
586
586
  const r = e instanceof Blob ? e : new Blob([e]);
587
- return new Mo({
587
+ return new qo({
588
588
  bucket: this.bucket,
589
589
  path: t,
590
590
  body: r,
@@ -594,7 +594,7 @@ class qo {
594
594
  });
595
595
  }
596
596
  async uploadString(t, e, o, r) {
597
- const { bytes: a, contentType: i } = Bo(e, o);
597
+ const { bytes: a, contentType: i } = Ho(e, o);
598
598
  await this.upload(t, a, { customMetadata: r, contentType: i }).complete();
599
599
  }
600
600
  async listFiles(t) {
@@ -603,30 +603,30 @@ class qo {
603
603
  }
604
604
  async listFilesRecursive(t) {
605
605
  const e = await this.call("GET", "objects", t, { bucket: this.bucket, prefix: t });
606
- return (await (await U(e)).json()).names;
606
+ return (await (await M(e)).json()).names;
607
607
  }
608
608
  async deleteDirectory(t) {
609
609
  const e = await this.call("DELETE", "objects", t, { bucket: this.bucket, prefix: t });
610
- return (await (await U(e)).json()).deleted;
610
+ return (await (await M(e)).json()).deleted;
611
611
  }
612
612
  // ─── Helpers ──────────────────────────────────────────────────────────────
613
613
  async signedUrl(t) {
614
614
  const e = this.bucket === "public" ? await this.plainFetch(`${this.base}/public/url?${new URLSearchParams({ path: t })}`) : await this.call("GET", "objects/url", t, { bucket: this.bucket, path: t });
615
615
  if (e.status !== 404)
616
- return (await U(e)).json();
616
+ return (await M(e)).json();
617
617
  }
618
618
  /** One request to the storage module, scoped to the project `path` names. */
619
619
  call(t, e, o, r, a, i, n) {
620
- const c = `${this.base}/${e}${r ? `?${new URLSearchParams(r)}` : ""}`, p = { "cue-project-id": zo(this.bucket, o) };
620
+ const c = `${this.base}/${e}${r ? `?${new URLSearchParams(r)}` : ""}`, p = { "cue-project-id": Go(this.bucket, o) };
621
621
  let h;
622
622
  return a !== void 0 ? (p["Content-Type"] = "application/json", h = JSON.stringify(a)) : i !== void 0 && (p["Content-Type"] = "application/octet-stream", h = i), this.options.fetch(c, { method: t, headers: p, body: h, ...n ? { signal: n } : {} });
623
623
  }
624
624
  }
625
- function zo(s, t) {
625
+ function Go(s, t) {
626
626
  const e = t.split("/");
627
627
  return s === "persistence" && e[0] === "portal" && e[1] === "projects" ? e[2] ?? "" : e[0];
628
628
  }
629
- async function U(s) {
629
+ async function M(s) {
630
630
  if (s.ok) return s;
631
631
  let t = "";
632
632
  try {
@@ -636,31 +636,31 @@ async function U(s) {
636
636
  const e = new Error(`Storage request failed: HTTP ${s.status}${t ? ` — ${t}` : ""}`);
637
637
  throw e.status = s.status, e;
638
638
  }
639
- function Bo(s, t) {
639
+ function Ho(s, t) {
640
640
  switch (t) {
641
641
  case "raw":
642
642
  return { bytes: new TextEncoder().encode(s) };
643
643
  case "base64":
644
- return { bytes: lt(s) };
644
+ return { bytes: ht(s) };
645
645
  case "base64url":
646
- return { bytes: lt(s.replace(/-/g, "+").replace(/_/g, "/")) };
646
+ return { bytes: ht(s.replace(/-/g, "+").replace(/_/g, "/")) };
647
647
  case "data_url": {
648
648
  const e = s.match(/^data:([^;,]*)(;base64)?,(.*)$/s);
649
649
  if (!e) throw new Error("Invalid data URL");
650
650
  const [, o, r, a] = e;
651
651
  return {
652
- bytes: r ? lt(a) : new TextEncoder().encode(decodeURIComponent(a)),
652
+ bytes: r ? ht(a) : new TextEncoder().encode(decodeURIComponent(a)),
653
653
  ...o ? { contentType: o } : {}
654
654
  };
655
655
  }
656
656
  }
657
657
  }
658
- function lt(s) {
658
+ function ht(s) {
659
659
  const t = s + "=".repeat((4 - s.length % 4) % 4), e = atob(t), o = new Uint8Array(e.length);
660
660
  for (let r = 0; r < e.length; r++) o[r] = e.charCodeAt(r);
661
661
  return o;
662
662
  }
663
- const Go = {
663
+ const Wo = {
664
664
  raw: "storageRaw",
665
665
  processed: "storageProcessed",
666
666
  logs: "storageLogs",
@@ -669,7 +669,7 @@ const Go = {
669
669
  persistence: "storagePersistence",
670
670
  sessions: "storageSessions"
671
671
  };
672
- class rt {
672
+ class at {
673
673
  constructor(t) {
674
674
  this.options = t;
675
675
  }
@@ -715,11 +715,11 @@ class rt {
715
715
  if (e) return e;
716
716
  if (this.driverKind(t) === "gateway") {
717
717
  if (!this.options.gateway) throw new Error(`Bucket ${t} is on the gateway driver, but no gateway is configured`);
718
- e = new qo(t, this.options.gateway);
718
+ e = new Bo(t, this.options.gateway);
719
719
  } else {
720
- const o = this.options[Go[t]];
720
+ const o = this.options[Wo[t]];
721
721
  if (!o) throw new Error(`Bucket ${t} is on the firebase driver, but has no FirebaseStorage`);
722
- e = new No(o);
722
+ e = new Lo(o);
723
723
  }
724
724
  return this._drivers.set(t, e), e;
725
725
  }
@@ -834,8 +834,8 @@ class rt {
834
834
  * other suffixes upload uncompressed exactly as before, flag or not.
835
835
  */
836
836
  async uploadRaw(t, e, o, r = 3, a, i, n = !1) {
837
- const c = n && rt._GZIP_SUFFIXES.has((o.suffix ?? "").toLowerCase()), p = c ? await rt._gzipEncode(e) : e, h = c ? { contentEncoding: "gzip", customMetadata: { ...o, content_encoding: "gzip" } } : { customMetadata: o };
838
- let d = 0, u;
837
+ const c = n && at._GZIP_SUFFIXES.has((o.suffix ?? "").toLowerCase()), p = c ? await at._gzipEncode(e) : e, h = c ? { contentEncoding: "gzip", customMetadata: { ...o, content_encoding: "gzip" } } : { customMetadata: o };
838
+ let d = 0, g;
839
839
  for (; d < r; )
840
840
  try {
841
841
  if (a?.aborted) throw new DOMException("Upload cancelled", "AbortError");
@@ -852,9 +852,9 @@ class rt {
852
852
  } catch (w) {
853
853
  if (a?.aborted || w instanceof DOMException && w.name === "AbortError")
854
854
  throw a?.aborted ? new DOMException("Upload cancelled", "AbortError") : w;
855
- u = w, d++, d < r && await new Promise((f) => setTimeout(f, 1e3 * d));
855
+ g = w, d++, d < r && await new Promise((f) => setTimeout(f, 1e3 * d));
856
856
  }
857
- throw u;
857
+ throw g;
858
858
  }
859
859
  /**
860
860
  * Upload data to the processed bucket.
@@ -868,19 +868,19 @@ class rt {
868
868
  return this.listFiles("raw", t);
869
869
  }
870
870
  }
871
- const ht = {
871
+ const dt = {
872
872
  apiKey: "AIzaSyAiW42QBx9HS4Khu88pCW7MV66IhBAQul0",
873
873
  appId: "1:151132927589:web:d2ffdb377dfadfd23ab88c",
874
874
  measurementId: "G-YT4PK6HGZD"
875
- }, Mt = "qaecy-mvp-406413", Ho = "734737865998", Wo = "sessions_eu_west6", Vo = "spaces_chats_eu_west6", Xo = "spaces_raw_eu_west6", Jo = "spaces_processed_eu_west6", Yo = "logs_eu_west6", Qo = "cue_public_eu_west6", Ko = "db_persistence_eu_west6", g = "/bff", Zo = `${g}/admin/consumption`, tr = `${g}/admin/profile/organizations`, Ft = `${g}/admin/profile/api-keys`, qt = `${g}/admin/profile/api-keys`, er = `${g}/admin/profile/terms`, or = `${g}/admin/profile/sso-sign-in`, rr = `${g}/admin/profile/analytics-notice`, sr = `${g}/admin/usage/view`, ar = (s) => `${g}/admin/organizations/${s}/members`, ir = (s) => `${g}/admin/organizations/${s}/admins`, zt = (s) => `${g}/admin/organizations/${s}/credits`, nr = (s) => `${g}/admin/organizations/${s}/credits/report`, cr = (s, t) => `${g}/admin/organizations/${s}/credits/report/${t}/by-file-type`, pr = (s, t) => `${g}/admin/organizations/${s}/traffic/report/${t}`, lr = (s, t) => `${g}/admin/organizations/${s}/usage/report/${t}`, hr = `${g}/admin/user/signup`, dr = `${g}/admin/user/signup/resend`, ur = `${g}/admin/user/settings`, gr = `${g}/admin/users/settings`, mr = `${g}/admin/organization/signup`, wr = `${g}/admin/organization/own`, fr = `${g}/admin/organization/join-request`, yr = `${g}/admin/organization/join-by-email-domain`, br = (s) => `${g}/admin/organization/${s}/credits`, _r = (s) => `${g}/admin/organization/${s}/plan`, vr = (s) => `${g}/admin/organization/${s}/checkout`, Er = (s) => `${g}/admin/organization/${s}/billing-portal`, Tr = (s) => `${g}/admin/organization/${s}/members`, Sr = (s, t) => `${g}/admin/organization/${s}/members/${t}/role`, Ir = (s, t) => `${g}/admin/organization/${s}/members/${t}`, Bt = `${g}/admin/projects`, Cr = `${g}/admin/organizations`, xr = `${g}/admin/organizations/search`, kr = (s) => `${g}/admin/organizations/${s}/projects`, $r = `${g}/admin/projects/search`, Or = `${g}/admin/users/search`, Rr = (s) => `${g}/admin/users/${s}/detail`, Ar = `${g}/admin/users/superadmins`, Pr = `${g}/admin/users/deleted`, Gt = (s) => `${g}/admin/user/${s}`, Dr = (s) => `${g}/admin/user/${s}/restore`, Ht = (s) => `${g}/admin/user/${s}/superadmin`, Nr = `${g}/admin/user`, jr = `${g}/admin/organization`, Lr = (s) => `${g}/admin/organization/${s}`, Ur = (s) => `${g}/admin/organization/${s}/restore`, Mr = (s) => `${g}/admin/organization/${s}/domains`, Fr = (s) => `${g}/admin/project/${s}/organization`, qr = `${g}/admin/organizations/deleted`, zr = `${g}/admin/users/without-org`, Br = `${g}/admin/users/without-project`, Gr = `${g}/admin/projects/without-users`, Hr = `${g}/admin/projects/without-admins`, Wr = `${g}/admin/organizations/without-users`, Vr = `${g}/admin/organizations/without-admins`, Xr = `${g}/admin/project`, Jr = (s) => `${g}/admin/project/${s}`, Yr = (s) => `${g}/admin/project/${s}`, Qr = (s) => `${g}/admin/project/${s}/restore`, Kr = (s) => `${g}/admin/project/${s}/members`, Zr = (s, t) => `${g}/admin/project/${s}/members/${t}/role`, ts = (s, t) => `${g}/admin/project/${s}/members/${t}`, es = (s) => `${g}/admin/projects/${s}/metadata`, os = (s) => `${g}/admin/project/${s}/metadata`, rs = "/assistant/search", ss = "/mcp", as = "/index/search", is = "/index/lookup", ns = "/index/available-filters", Le = "/cue/qlever/query", cs = "/cue/qlever/update", ps = "/cue/qlever/shacl", ls = "/cue/qlever/admin/rebuild", Wt = "/cue/qlever/admin/migrate", hs = "/cue-db/admin/stats", ds = "/cue-db/admin/stats/refresh", us = "/cue-db/warm-up", Vt = `${g}/file-system-structure/batch`, gs = (s) => `${g}/document/${s}/reprocess`, Xt = `${g}/entity-mention/batch`, ms = `${g}/selector/batch`, ws = `${g}/content-category/change`, fs = (s) => `${g}/document/${s}/alternative-representation`, ys = `${g}/dms-sync/providers`, bs = (s) => `${g}/dms-sync/${s}/preview`, _s = (s) => `${g}/dms-sync/${s}/sync`, vs = "/storage/sessions", Es = "/storage/raw", Ue = "/storage/processed", Ts = `${g}/processing-status`, Ss = `${g}/processing-status/mine`, Jt = "microsoft.com", Yt = "superadmin", Ct = "https://cue.qaecy.com/r/", Qt = {
876
- raw: Xo,
877
- processed: Jo,
878
- public: Qo,
879
- logs: Yo,
880
- chatSessions: Vo,
881
- persistence: Ko,
882
- sessions: Wo
883
- }, Is = {
875
+ }, Mt = "qaecy-mvp-406413", Vo = "734737865998", Xo = "sessions_eu_west6", Jo = "spaces_chats_eu_west6", Yo = "spaces_raw_eu_west6", Qo = "spaces_processed_eu_west6", Ko = "logs_eu_west6", Zo = "cue_public_eu_west6", tr = "db_persistence_eu_west6", u = "/bff", er = `${u}/admin/consumption`, or = `${u}/admin/profile/organizations`, Ft = `${u}/admin/profile/api-keys`, qt = `${u}/admin/profile/api-keys`, rr = `${u}/admin/profile/terms`, sr = `${u}/admin/profile/sso-sign-in`, ar = `${u}/admin/profile/analytics-notice`, ir = `${u}/admin/profile/email`, nr = `${u}/admin/usage/view`, cr = (s) => `${u}/admin/organizations/${s}/members`, pr = (s) => `${u}/admin/organizations/${s}/admins`, zt = (s) => `${u}/admin/organizations/${s}/credits`, lr = (s) => `${u}/admin/organizations/${s}/credits/report`, hr = (s, t) => `${u}/admin/organizations/${s}/credits/report/${t}/by-file-type`, dr = (s, t) => `${u}/admin/organizations/${s}/traffic/report/${t}`, ur = (s, t) => `${u}/admin/organizations/${s}/usage/report/${t}`, gr = `${u}/admin/user/signup`, mr = `${u}/admin/user/signup/resend`, wr = `${u}/admin/user/password-reset`, fr = `${u}/admin/user/settings`, yr = `${u}/admin/users/settings`, br = `${u}/admin/organization/signup`, _r = `${u}/admin/organization/own`, vr = `${u}/admin/organization/join-request`, Er = `${u}/admin/organization/join-by-email-domain`, Tr = (s) => `${u}/admin/organization/${s}/credits`, Sr = (s) => `${u}/admin/organization/${s}/plan`, Ir = (s) => `${u}/admin/organization/${s}/checkout`, Cr = (s) => `${u}/admin/organization/${s}/billing-portal`, kr = (s) => `${u}/admin/organization/${s}/members`, xr = (s, t) => `${u}/admin/organization/${s}/members/${t}/role`, $r = (s, t) => `${u}/admin/organization/${s}/members/${t}`, Bt = `${u}/admin/projects`, Or = `${u}/admin/organizations`, Rr = `${u}/admin/organizations/search`, Ar = (s) => `${u}/admin/organizations/${s}/projects`, Pr = `${u}/admin/projects/search`, Dr = `${u}/admin/users/search`, Nr = (s) => `${u}/admin/users/${s}/detail`, jr = `${u}/admin/users/superadmins`, Lr = `${u}/admin/users/deleted`, Gt = (s) => `${u}/admin/user/${s}`, Ur = (s) => `${u}/admin/user/${s}/restore`, Ht = (s) => `${u}/admin/user/${s}/superadmin`, Mr = `${u}/admin/user`, Fr = `${u}/admin/organization`, qr = (s) => `${u}/admin/organization/${s}`, zr = (s) => `${u}/admin/organization/${s}/restore`, Br = (s) => `${u}/admin/organization/${s}/domains`, Gr = (s) => `${u}/admin/project/${s}/organization`, Hr = `${u}/admin/organizations/deleted`, Wr = `${u}/admin/users/without-org`, Vr = `${u}/admin/users/without-project`, Xr = `${u}/admin/projects/without-users`, Jr = `${u}/admin/projects/without-admins`, Yr = `${u}/admin/organizations/without-users`, Qr = `${u}/admin/organizations/without-admins`, Kr = `${u}/admin/project`, Zr = (s) => `${u}/admin/project/${s}`, ts = (s) => `${u}/admin/project/${s}`, es = (s) => `${u}/admin/project/${s}/restore`, os = (s) => `${u}/admin/project/${s}/members`, rs = (s, t) => `${u}/admin/project/${s}/members/${t}/role`, ss = (s, t) => `${u}/admin/project/${s}/members/${t}`, as = (s) => `${u}/admin/projects/${s}/metadata`, is = (s) => `${u}/admin/project/${s}/metadata`, ns = "/assistant/search", cs = "/mcp", ps = "/index/search", ls = "/index/lookup", hs = "/index/available-filters", Le = "/cue/qlever/query", ds = "/cue/qlever/update", us = "/cue/qlever/shacl", gs = "/cue/qlever/admin/rebuild", Wt = "/cue/qlever/admin/migrate", ms = "/cue-db/admin/stats", ws = "/cue-db/admin/stats/refresh", fs = "/cue-db/warm-up", Vt = `${u}/file-system-structure/batch`, ys = (s) => `${u}/document/${s}/reprocess`, Xt = `${u}/entity-mention/batch`, bs = `${u}/selector/batch`, _s = `${u}/content-category/change`, vs = (s) => `${u}/document/${s}/alternative-representation`, Es = `${u}/dms-sync/providers`, Ts = (s) => `${u}/dms-sync/${s}/preview`, Ss = (s) => `${u}/dms-sync/${s}/sync`, Is = "/storage/sessions", Cs = "/storage/raw", Ue = "/storage/processed", ks = `${u}/processing-status`, xs = `${u}/processing-status/mine`, Jt = "microsoft.com", Yt = "superadmin", Ct = "https://cue.qaecy.com/r/", Qt = {
876
+ raw: Yo,
877
+ processed: Qo,
878
+ public: Zo,
879
+ logs: Ko,
880
+ chatSessions: Jo,
881
+ persistence: tr,
882
+ sessions: Xo
883
+ }, $s = {
884
884
  raw: "storageRaw",
885
885
  processed: "storageProcessed",
886
886
  public: "storagePublic",
@@ -888,7 +888,7 @@ const ht = {
888
888
  chatSessions: "storageChatSessions",
889
889
  persistence: "storagePersistence",
890
890
  sessions: "storageSessions"
891
- }, Cs = ["raw", "processed", "public", "persistence"];
891
+ }, Os = ["raw", "processed", "public", "persistence"];
892
892
  function Kt(s, t, e, o = {}, r = !1) {
893
893
  const a = o.drivers ?? {}, i = {
894
894
  drivers: a,
@@ -900,9 +900,9 @@ function Kt(s, t, e, o = {}, r = !1) {
900
900
  for (const n of Object.keys(Qt)) {
901
901
  if ((a[n] ?? "firebase") !== "firebase") continue;
902
902
  const c = no(s, o.buckets?.[n] ?? Qt[n]);
903
- r && Cs.includes(n) && co(c, e.storageEmulatorHost, e.storageEmulatorPort), i[Is[n]] = c;
903
+ r && Os.includes(n) && co(c, e.storageEmulatorHost, e.storageEmulatorPort), i[$s[n]] = c;
904
904
  }
905
- return new rt(i);
905
+ return new at(i);
906
906
  }
907
907
  class T {
908
908
  _value;
@@ -925,7 +925,7 @@ class T {
925
925
  return this;
926
926
  }
927
927
  }
928
- function xt(s, t) {
928
+ function kt(s, t) {
929
929
  const e = /* @__PURE__ */ new Set();
930
930
  let o = t(), r = !1;
931
931
  const a = [], i = () => {
@@ -947,14 +947,20 @@ function xt(s, t) {
947
947
  }
948
948
  };
949
949
  }
950
- class z extends Error {
950
+ const Rs = {
951
+ [V.PASSWORD_RESET]: "resetPassword",
952
+ [V.VERIFY_EMAIL]: "verifyEmail",
953
+ [V.VERIFY_AND_CHANGE_EMAIL]: "changeEmail",
954
+ [V.RECOVER_EMAIL]: "recoverEmail"
955
+ };
956
+ class B extends Error {
951
957
  constructor(t, e, o) {
952
958
  super(t), this.code = e, this.cause = o, this.name = "CueAuthError";
953
959
  }
954
960
  code;
955
961
  cause;
956
962
  }
957
- const xs = {
963
+ const As = {
958
964
  "auth/invalid-credential": "Incorrect email or password.",
959
965
  "auth/invalid-login-credentials": "Incorrect email or password.",
960
966
  "auth/wrong-password": "Incorrect email or password.",
@@ -969,12 +975,15 @@ const xs = {
969
975
  "auth/popup-closed-by-user": "The sign-in popup was closed before sign-in finished.",
970
976
  "auth/cancelled-popup-request": "The sign-in popup was closed before sign-in finished.",
971
977
  "auth/account-exists-with-different-credential": "An account with this email already exists. Sign in with your email and password instead.",
972
- "auth/admin-restricted-operation": "No account exists for this user. Ask your administrator for an invitation."
978
+ "auth/admin-restricted-operation": "No account exists for this user. Ask your administrator for an invitation.",
979
+ "auth/expired-action-code": "This link has expired.",
980
+ "auth/invalid-action-code": "This link is invalid or has already been used.",
981
+ "auth/weak-password": "Choose a stronger password."
973
982
  }, Me = "Sign-in failed. Please try again, or contact support if the problem persists.";
974
- function J(s) {
975
- if (s instanceof z) return s;
976
- const t = s?.code, e = typeof t == "string" && t.startsWith("auth/") ? t : void 0, o = (e && xs[e]) ?? Me;
977
- return new z(o, e, s);
983
+ function R(s) {
984
+ if (s instanceof B) return s;
985
+ const t = s?.code, e = typeof t == "string" && t.startsWith("auth/") ? t : void 0, o = (e && As[e]) ?? Me;
986
+ return new B(o, e, s);
978
987
  }
979
988
  class Zt {
980
989
  _auth;
@@ -996,7 +1005,7 @@ class Zt {
996
1005
  constructor(t, e = !1, o) {
997
1006
  this._auth = lo(t), this._endpoints = o, e && ho(this._auth, o.authEmulatorUrl, {
998
1007
  disableWarnings: !0
999
- }), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal = xt([this._userSignal], () => {
1008
+ }), this.user = this._userSignal.asReadonly(), this.token = this._tokenSignal.asReadonly(), this.isSuperAdmin = this._isSuperAdminSignal.asReadonly(), this._userIdsSignal = kt([this._userSignal], () => {
1000
1009
  const r = this._userSignal.get();
1001
1010
  if (!r) return [];
1002
1011
  const a = /* @__PURE__ */ new Set([r.uid]);
@@ -1009,7 +1018,7 @@ class Zt {
1009
1018
  if (this._userSignal.set(t), t) {
1010
1019
  const e = await t.getIdToken();
1011
1020
  this._tokenSignal.set(e);
1012
- const o = await ot(t);
1021
+ const o = await st(t);
1013
1022
  this._isSuperAdminSignal.set(o.claims.role === Yt);
1014
1023
  } else
1015
1024
  this._tokenSignal.set(null), this._isSuperAdminSignal.set(!1);
@@ -1027,28 +1036,46 @@ class Zt {
1027
1036
  e.email,
1028
1037
  e.password
1029
1038
  ).catch((a) => {
1030
- throw J(a);
1039
+ throw R(a);
1031
1040
  })).user;
1032
1041
  }
1033
- const o = t === "google" ? new bt() : new _t(Jt);
1042
+ const o = t === "google" ? new tt() : new _t(Jt);
1034
1043
  this._ssoPending = !0;
1035
1044
  try {
1036
1045
  const r = await mo(this._auth, o).catch((a) => {
1037
- throw J(a);
1046
+ throw R(a);
1038
1047
  });
1039
1048
  return await this._confirmSsoSignIn(), r.user;
1040
1049
  } finally {
1041
1050
  this._ssoPending = !1, await this._publish(this._auth.currentUser);
1042
1051
  }
1043
1052
  }
1053
+ /**
1054
+ * Sign in with Google tokens obtained outside Firebase's popup, e.g. by the desktop app
1055
+ * through the gateway's OAuth pages in the system browser (Google refuses OAuth inside
1056
+ * embedded webviews). Same checks as the popup: the backend confirms the SSO sign-in.
1057
+ */
1058
+ async signInWithGoogleTokens(t) {
1059
+ if (!t.idToken && !t.accessToken) throw new Error("An ID token or an access token is required.");
1060
+ const e = tt.credential(t.idToken ?? null, t.accessToken ?? null);
1061
+ this._ssoPending = !0;
1062
+ try {
1063
+ const o = await wo(this._auth, e).catch((r) => {
1064
+ throw R(r);
1065
+ });
1066
+ return await this._confirmSsoSignIn(), o.user;
1067
+ } finally {
1068
+ this._ssoPending = !1, await this._publish(this._auth.currentUser);
1069
+ }
1070
+ }
1044
1071
  /**
1045
1072
  * Initiate a redirect-based sign-in (mobile / iframe contexts where popups
1046
1073
  * are blocked). Call `checkRedirectResult()` on the next page load to
1047
1074
  * retrieve the result.
1048
1075
  */
1049
1076
  async signInWithRedirect(t) {
1050
- const e = t === "google" ? new bt() : new _t(Jt);
1051
- await wo(this._auth, e);
1077
+ const e = t === "google" ? new tt() : new _t(Jt);
1078
+ await fo(this._auth, e);
1052
1079
  }
1053
1080
  /**
1054
1081
  * Retrieve the result of a redirect sign-in. Returns the signed-in `User`
@@ -1056,8 +1083,8 @@ class Zt {
1056
1083
  * Call this once on app startup before showing a sign-in UI.
1057
1084
  */
1058
1085
  async checkRedirectResult() {
1059
- const t = await fo(this._auth).catch((e) => {
1060
- throw J(e);
1086
+ const t = await yo(this._auth).catch((e) => {
1087
+ throw R(e);
1061
1088
  });
1062
1089
  return t ? (await this._confirmSsoSignIn(), t.user) : null;
1063
1090
  }
@@ -1069,13 +1096,13 @@ class Zt {
1069
1096
  */
1070
1097
  async _confirmSsoSignIn() {
1071
1098
  const t = await this.authenticatedFetch(
1072
- `${this._endpoints.gatewayUrl}${or}`,
1099
+ `${this._endpoints.gatewayUrl}${sr}`,
1073
1100
  { method: "POST" }
1074
1101
  ).catch(async (e) => {
1075
- throw await ct(this._auth), new z(Me, "cue/sso-unconfirmed", e);
1102
+ throw await lt(this._auth), new B(Me, "cue/sso-unconfirmed", e);
1076
1103
  });
1077
1104
  if (!t.ok)
1078
- throw await ct(this._auth), t.status === 403 ? new z("No account exists for this user. Ask your administrator for an invitation, or sign up.", "cue/sso-no-account") : new z(`Sign-in could not be confirmed (${t.status}). Please try again.`, "cue/sso-unconfirmed");
1105
+ throw await lt(this._auth), t.status === 403 ? new B("No account exists for this user. Ask your administrator for an invitation, or sign up.", "cue/sso-no-account") : new B(`Sign-in could not be confirmed (${t.status}). Please try again.`, "cue/sso-unconfirmed");
1079
1106
  }
1080
1107
  /**
1081
1108
  * One-shot async check — returns `true` if the current user has the
@@ -1084,7 +1111,7 @@ class Zt {
1084
1111
  */
1085
1112
  async checkSuperAdmin() {
1086
1113
  const t = this._auth.currentUser;
1087
- return t ? (await ot(t)).claims.role === Yt : !1;
1114
+ return t ? (await st(t)).claims.role === Yt : !1;
1088
1115
  }
1089
1116
  /** Sign in with a Cue API key. `projectId` is optional — omit it when no project context is available (e.g. admin flows). */
1090
1117
  async signInWithApiKey(t, e) {
@@ -1114,7 +1141,7 @@ class Zt {
1114
1141
  */
1115
1142
  async mintAppSessionToken() {
1116
1143
  const t = await this.authenticatedFetch(
1117
- `${this._endpoints.gatewayUrl}${g}/app-session-token`,
1144
+ `${this._endpoints.gatewayUrl}${u}/app-session-token`,
1118
1145
  { method: "POST" }
1119
1146
  );
1120
1147
  if (!t.ok) {
@@ -1125,20 +1152,59 @@ class Zt {
1125
1152
  return e;
1126
1153
  }
1127
1154
  /**
1128
- * Send a password-reset email. Firebase's email-enumeration protection makes
1129
- * this succeed silently for unknown addresses, so callers should word their
1130
- * confirmation as "if an account exists…".
1155
+ * Send a password-reset email (through the Cue backend, in the Cue layout).
1156
+ * The backend answers the same for unknown addresses, so callers should word
1157
+ * their confirmation as "if an account exists…".
1131
1158
  */
1132
1159
  async resetPassword(t) {
1133
1160
  const e = t.trim();
1134
1161
  if (!e) throw new Error("email is required for password reset");
1135
- await yo(this._auth, e).catch((o) => {
1136
- throw J(o);
1162
+ const o = await fetch(`${this._endpoints.gatewayUrl}${wr}`, {
1163
+ method: "POST",
1164
+ headers: { "Content-Type": "application/json" },
1165
+ body: JSON.stringify({ email: e })
1166
+ }).catch((a) => {
1167
+ throw R({ code: "auth/network-request-failed", cause: a });
1168
+ });
1169
+ if (o.ok) return;
1170
+ const r = o.status === 400 ? "auth/invalid-email" : o.status === 429 ? "auth/too-many-requests" : void 0;
1171
+ throw R({ code: r, status: o.status });
1172
+ }
1173
+ /** Reads an email action link's code without using it up. */
1174
+ async inspectActionCode(t) {
1175
+ const e = await bo(this._auth, t).catch((o) => {
1176
+ throw R(o);
1137
1177
  });
1178
+ return {
1179
+ operation: Rs[e.operation] ?? "other",
1180
+ email: e.data.email ?? "",
1181
+ previousEmail: e.data.previousEmail ?? void 0
1182
+ };
1183
+ }
1184
+ /** Uses a verify-email, change-email or recover-email code. */
1185
+ async applyActionCode(t) {
1186
+ await _o(this._auth, t).catch((e) => {
1187
+ throw R(e);
1188
+ });
1189
+ }
1190
+ /** Sets a new password with a reset code from a password-reset email. */
1191
+ async confirmPasswordReset(t, e) {
1192
+ await vo(this._auth, t, e).catch((o) => {
1193
+ throw R(o);
1194
+ });
1195
+ }
1196
+ /**
1197
+ * Re-reads the signed-in user from Firebase and refreshes the token, e.g. so
1198
+ * `emailVerified` is current after a verification link was used. Resolves to
1199
+ * the fresh `emailVerified`, or false when signed out.
1200
+ */
1201
+ async refreshUser() {
1202
+ const t = this._auth.currentUser;
1203
+ return t ? (await t.reload(), await t.getIdToken(!0), t.emailVerified) : !1;
1138
1204
  }
1139
1205
  /** Sign out the current user */
1140
1206
  async signOut() {
1141
- await ct(this._auth);
1207
+ await lt(this._auth);
1142
1208
  }
1143
1209
  /** Currently signed-in user, or null if not authenticated */
1144
1210
  get currentUser() {
@@ -1146,7 +1212,7 @@ class Zt {
1146
1212
  }
1147
1213
  /** Subscribe to authentication state changes. Returns an unsubscribe function. */
1148
1214
  onAuthStateChanged(t) {
1149
- return bo(this._auth, t);
1215
+ return Eo(this._auth, t);
1150
1216
  }
1151
1217
  /** Get the Firebase ID token for the current user, or null if not authenticated */
1152
1218
  async getToken(t = !1) {
@@ -1178,7 +1244,7 @@ class Zt {
1178
1244
  return this._auth;
1179
1245
  }
1180
1246
  }
1181
- class kt extends Error {
1247
+ class xt extends Error {
1182
1248
  constructor(t, e, o) {
1183
1249
  super(t), this.status = e, this.code = o;
1184
1250
  }
@@ -1201,7 +1267,7 @@ class te {
1201
1267
  */
1202
1268
  async signUp(t, e, o, r) {
1203
1269
  return this._publicPost(
1204
- hr,
1270
+ gr,
1205
1271
  { name: t, email: e, password: o, termsVersion: r },
1206
1272
  "Sign-up failed"
1207
1273
  );
@@ -1215,11 +1281,11 @@ class te {
1215
1281
  * 'domainBlocked' for the mappable failure modes.
1216
1282
  */
1217
1283
  async signUpWithOrganization(t) {
1218
- return this._publicPost(mr, t, "Organisation sign-up failed");
1284
+ return this._publicPost(br, t, "Organisation sign-up failed");
1219
1285
  }
1220
1286
  /** Re-send the verification + set-password emails after a sign-up. */
1221
1287
  async resendSignUpEmails(t) {
1222
- return this._publicPost(dr, { email: t }, "Resend failed");
1288
+ return this._publicPost(mr, { email: t }, "Resend failed");
1223
1289
  }
1224
1290
  async _publicPost(t, e, o) {
1225
1291
  const r = await fetch(`${this._gatewayUrl}${t}`, {
@@ -1229,7 +1295,7 @@ class te {
1229
1295
  });
1230
1296
  if (!r.ok) {
1231
1297
  const a = await r.json().catch(() => ({}));
1232
- throw new kt(
1298
+ throw new xt(
1233
1299
  a?.message ?? `${o} (${r.status})`,
1234
1300
  r.status,
1235
1301
  a?.code
@@ -1238,8 +1304,8 @@ class te {
1238
1304
  return r.json();
1239
1305
  }
1240
1306
  }
1241
- const ks = {
1242
- raw: Es,
1307
+ const Ps = {
1308
+ raw: Cs,
1243
1309
  processed: Ue
1244
1310
  };
1245
1311
  class ee {
@@ -1260,7 +1326,7 @@ class ee {
1260
1326
  * @param bucket - `'raw'` (default, original uploads) or `'processed'` (derived artefacts).
1261
1327
  */
1262
1328
  getDownloadUrl(t, e, o, r = "raw") {
1263
- return `${this._gatewayUrl}${ks[r]}/${t}/${e}${o}`;
1329
+ return `${this._gatewayUrl}${Ps[r]}/${t}/${e}${o}`;
1264
1330
  }
1265
1331
  /**
1266
1332
  * Returns a gateway download URL for an alternative representation using its
@@ -1288,8 +1354,8 @@ class ee {
1288
1354
  return i.blob();
1289
1355
  }
1290
1356
  }
1291
- const oe = `${g}/tables`;
1292
- class $s {
1357
+ const oe = `${u}/tables`;
1358
+ class Ds {
1293
1359
  constructor(t, e) {
1294
1360
  this._auth = t, this._gatewayUrl = e;
1295
1361
  }
@@ -1327,8 +1393,8 @@ class $s {
1327
1393
  throw new Error(`Failed to save tables: ${o.status} ${o.statusText}`);
1328
1394
  }
1329
1395
  }
1330
- const Os = "/semantic-extraction/extract";
1331
- class Rs {
1396
+ const Ns = "/semantic-extraction/extract";
1397
+ class js {
1332
1398
  constructor(t, e) {
1333
1399
  this._auth = t, this._gatewayUrl = e;
1334
1400
  }
@@ -1345,7 +1411,7 @@ class Rs {
1345
1411
  const e = t.rdfFormat ?? "json-ld", o = new FormData();
1346
1412
  o.append("file", t.image, "page.png"), o.append("project_schema", JSON.stringify(t.projectSchema)), o.append("space_id", t.projectId), o.append("rdf_format", e), t.category && o.append("category", t.category), t.text && o.append("text", t.text);
1347
1413
  const r = await this._auth.authenticatedFetch(
1348
- `${this._gatewayUrl}${Os}`,
1414
+ `${this._gatewayUrl}${Ns}`,
1349
1415
  {
1350
1416
  method: "POST",
1351
1417
  // Do NOT set Content-Type; browser sets it with the correct boundary.
@@ -1366,7 +1432,7 @@ class Rs {
1366
1432
  return { jsonld: await r.json() };
1367
1433
  }
1368
1434
  }
1369
- class As {
1435
+ class Ls {
1370
1436
  constructor(t, e) {
1371
1437
  this._auth = t, this._gatewayUrl = e;
1372
1438
  }
@@ -1382,7 +1448,7 @@ class As {
1382
1448
  * @param contextId - The context document ID (without the `.json.gz` suffix).
1383
1449
  */
1384
1450
  async getContext(t, e) {
1385
- const o = `${this._gatewayUrl}${vs}/${t}/contexts/${e}.json.gz`, r = await this._auth.authenticatedFetch(o, {
1451
+ const o = `${this._gatewayUrl}${Is}/${t}/contexts/${e}.json.gz`, r = await this._auth.authenticatedFetch(o, {
1386
1452
  headers: {
1387
1453
  "cue-project-id": t,
1388
1454
  // Prevent the HTTP layer from auto-decompressing so we can handle it explicitly.
@@ -1395,7 +1461,7 @@ class As {
1395
1461
  return JSON.parse(await new Response(i).text());
1396
1462
  }
1397
1463
  }
1398
- function Ps(s) {
1464
+ function Us(s) {
1399
1465
  const t = s.graph?.datasets?.[0] ?? { sizeInBytes: null };
1400
1466
  return {
1401
1467
  created: t.created ?? null,
@@ -1425,7 +1491,7 @@ function Ps(s) {
1425
1491
  history: (t.history ?? []).map(({ sizeInBytes: e, ...o }) => ({ ...o, graphSizeInBytes: e ?? null }))
1426
1492
  };
1427
1493
  }
1428
- class Ds {
1494
+ class Ms {
1429
1495
  constructor(t, e) {
1430
1496
  this._auth = t, this._gatewayUrl = e;
1431
1497
  }
@@ -1433,7 +1499,7 @@ class Ds {
1433
1499
  _gatewayUrl;
1434
1500
  async search(t, e, o) {
1435
1501
  const r = await this._auth.authenticatedFetch(
1436
- `${this._gatewayUrl}${as}`,
1502
+ `${this._gatewayUrl}${ps}`,
1437
1503
  {
1438
1504
  method: "POST",
1439
1505
  headers: { "Content-Type": "application/json", "x-project-id": e },
@@ -1446,7 +1512,7 @@ class Ds {
1446
1512
  async lookup(t, e, o) {
1447
1513
  console.log(`CueIndexApi.lookup: input=${t}, projectId=${e}, opts=${JSON.stringify(o)}`);
1448
1514
  const r = await this._auth.authenticatedFetch(
1449
- `${this._gatewayUrl}${is}`,
1515
+ `${this._gatewayUrl}${ls}`,
1450
1516
  {
1451
1517
  method: "POST",
1452
1518
  headers: { "Content-Type": "application/json", "x-project-id": e },
@@ -1470,7 +1536,7 @@ class Ds {
1470
1536
  async availableFilters(t, e) {
1471
1537
  console.log(`CueIndexApi.availableFilters(projectId=${t}, applied=${JSON.stringify(e)})`);
1472
1538
  const o = await this._auth.authenticatedFetch(
1473
- `${this._gatewayUrl}${ns}`,
1539
+ `${this._gatewayUrl}${hs}`,
1474
1540
  {
1475
1541
  method: "POST",
1476
1542
  headers: { "Content-Type": "application/json", "x-project-id": t },
@@ -1492,7 +1558,7 @@ class Ds {
1492
1558
  */
1493
1559
  async rebuild(t, e) {
1494
1560
  const o = await this._auth.authenticatedFetch(
1495
- `${this._gatewayUrl}${ls}`,
1561
+ `${this._gatewayUrl}${gs}`,
1496
1562
  { method: "POST", headers: { "x-project-id": t } }
1497
1563
  );
1498
1564
  if (!o.ok || !o.body)
@@ -1581,8 +1647,8 @@ class Ds {
1581
1647
  const d = n.split(`
1582
1648
  `);
1583
1649
  n = d.pop() ?? "";
1584
- for (const u of d)
1585
- u.trim() && (c = JSON.parse(u), e?.(c.message));
1650
+ for (const g of d)
1651
+ g.trim() && (c = JSON.parse(g), e?.(c.message));
1586
1652
  }
1587
1653
  if (!c) throw new Error("Index migrate-all produced no response.");
1588
1654
  if (c.status === "error") throw new Error(c.message);
@@ -1595,11 +1661,11 @@ class Ds {
1595
1661
  */
1596
1662
  async stats(t) {
1597
1663
  const e = await this._auth.authenticatedFetch(
1598
- `${this._gatewayUrl}${hs}`,
1664
+ `${this._gatewayUrl}${ms}`,
1599
1665
  { headers: { "x-project-id": t } }
1600
1666
  );
1601
1667
  if (!e.ok) throw new Error(`Index stats failed: ${e.status} ${e.statusText}`);
1602
- return Ps(await e.json());
1668
+ return Us(await e.json());
1603
1669
  }
1604
1670
  /**
1605
1671
  * Recomputes the graph engine's stats aggregate (document count, index size,
@@ -1613,7 +1679,7 @@ class Ds {
1613
1679
  */
1614
1680
  async refreshStats(t) {
1615
1681
  const e = await this._auth.authenticatedFetch(
1616
- `${this._gatewayUrl}${ds}`,
1682
+ `${this._gatewayUrl}${ws}`,
1617
1683
  { method: "POST", headers: t ? { "x-project-id": t } : {} }
1618
1684
  );
1619
1685
  if (!e.ok)
@@ -1629,15 +1695,15 @@ class Ds {
1629
1695
  */
1630
1696
  async warmUp(t) {
1631
1697
  const e = await this._auth.authenticatedFetch(
1632
- `${this._gatewayUrl}${us}`,
1698
+ `${this._gatewayUrl}${fs}`,
1633
1699
  { method: "POST", headers: { "x-project-id": t } }
1634
1700
  );
1635
1701
  if (!e.ok) throw new Error(`Wake-up failed: ${e.status} ${e.statusText}`);
1636
1702
  return "Project woken up.";
1637
1703
  }
1638
1704
  }
1639
- const Ns = "@qaecy/cue-sdk", js = "0.0.34";
1640
- function Ls(s) {
1705
+ const Fs = "@qaecy/cue-sdk", qs = "0.0.34";
1706
+ function zs(s) {
1641
1707
  const t = {};
1642
1708
  return new Headers(s).forEach((e, o) => {
1643
1709
  t[o] = e;
@@ -1647,10 +1713,10 @@ function Fe(s) {
1647
1713
  return s.filter((t) => t.type === "text").map((t) => t.text).join(`
1648
1714
  `);
1649
1715
  }
1650
- function Us(s) {
1716
+ function Bs(s) {
1651
1717
  return typeof s == "object" && s !== null && typeof s.error == "string" && !("id" in s);
1652
1718
  }
1653
- function Ms(s) {
1719
+ function Gs(s) {
1654
1720
  const t = s.structuredContent;
1655
1721
  if (t != null) return t;
1656
1722
  const e = Fe(s.content);
@@ -1660,7 +1726,7 @@ function Ms(s) {
1660
1726
  return e;
1661
1727
  }
1662
1728
  }
1663
- class Fs {
1729
+ class Hs {
1664
1730
  constructor(t, e) {
1665
1731
  this._auth = t, this._gatewayUrl = e;
1666
1732
  }
@@ -1670,15 +1736,15 @@ class Fs {
1670
1736
  const [{ Client: r }, { StreamableHTTPClientTransport: a }] = await Promise.all([
1671
1737
  import("@modelcontextprotocol/sdk/client/index.js"),
1672
1738
  import("@modelcontextprotocol/sdk/client/streamableHttp.js")
1673
- ]), i = new r({ name: Ns, version: js }), n = new a(
1674
- new URL(`${this._gatewayUrl}${ss}`),
1739
+ ]), i = new r({ name: Fs, version: qs }), n = new a(
1740
+ new URL(`${this._gatewayUrl}${cs}`),
1675
1741
  {
1676
1742
  // Route every MCP HTTP request through the SDK's authenticated fetch so
1677
1743
  // the gateway sees a Firebase Bearer token (and 401s trigger a refresh).
1678
1744
  // The transport passes headers as a `Headers` instance; authenticatedFetch
1679
1745
  // merges via object spread, which drops a `Headers` object — so flatten to
1680
1746
  // a plain record first to preserve content-type/accept/session headers.
1681
- fetch: (c, p) => this._auth.authenticatedFetch(c.toString(), { ...p, headers: Ls(p?.headers) })
1747
+ fetch: (c, p) => this._auth.authenticatedFetch(c.toString(), { ...p, headers: zs(p?.headers) })
1682
1748
  }
1683
1749
  );
1684
1750
  try {
@@ -1690,8 +1756,8 @@ class Fs {
1690
1756
  );
1691
1757
  if (c.isError)
1692
1758
  throw new Error(`MCP tool '${t}' failed: ${Fe(c.content) || "unknown error"}`);
1693
- const p = Ms(c);
1694
- if (Us(p))
1759
+ const p = Gs(c);
1760
+ if (Bs(p))
1695
1761
  throw new Error(`MCP tool '${t}' failed: ${p.error}`);
1696
1762
  return p;
1697
1763
  } finally {
@@ -1700,8 +1766,8 @@ class Fs {
1700
1766
  }
1701
1767
  }
1702
1768
  }
1703
- const re = `${g}/app-data`;
1704
- class qs {
1769
+ const re = `${u}/app-data`;
1770
+ class Ws {
1705
1771
  constructor(t, e) {
1706
1772
  this._auth = t, this._gatewayUrl = e;
1707
1773
  }
@@ -1746,8 +1812,8 @@ class qs {
1746
1812
  }
1747
1813
  }
1748
1814
  }
1749
- const D = `${g}/custom-apps`;
1750
- class zs {
1815
+ const N = `${u}/custom-apps`;
1816
+ class Vs {
1751
1817
  constructor(t, e) {
1752
1818
  this._auth = t, this._gatewayUrl = e;
1753
1819
  }
@@ -1756,7 +1822,7 @@ class zs {
1756
1822
  /** List every custom app shared within the given organization (metadata only, no HTML). */
1757
1823
  async list(t) {
1758
1824
  const e = await this._auth.authenticatedFetch(
1759
- `${this._gatewayUrl}${D}?organizationId=${encodeURIComponent(t)}`
1825
+ `${this._gatewayUrl}${N}?organizationId=${encodeURIComponent(t)}`
1760
1826
  );
1761
1827
  if (!e.ok)
1762
1828
  throw new Error(`Failed to list custom apps: ${e.status} ${e.statusText}`);
@@ -1765,7 +1831,7 @@ class zs {
1765
1831
  /** Fetch a single custom app's full record, including its HTML body. */
1766
1832
  async get(t) {
1767
1833
  const e = await this._auth.authenticatedFetch(
1768
- `${this._gatewayUrl}${D}/${encodeURIComponent(t)}`
1834
+ `${this._gatewayUrl}${N}/${encodeURIComponent(t)}`
1769
1835
  );
1770
1836
  if (!e.ok)
1771
1837
  throw new Error(`Failed to fetch custom app: ${e.status} ${e.statusText}`);
@@ -1773,7 +1839,7 @@ class zs {
1773
1839
  }
1774
1840
  /** Save a new custom app, shared with every member of `organizationID`. Any org member may create one. */
1775
1841
  async create(t) {
1776
- const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${D}`, {
1842
+ const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${N}`, {
1777
1843
  method: "POST",
1778
1844
  headers: { "Content-Type": "application/json" },
1779
1845
  body: JSON.stringify(t)
@@ -1785,7 +1851,7 @@ class zs {
1785
1851
  /** Update an existing custom app. Only the original author or an organization admin may do this. */
1786
1852
  async update(t, e) {
1787
1853
  const o = await this._auth.authenticatedFetch(
1788
- `${this._gatewayUrl}${D}/${encodeURIComponent(t)}`,
1854
+ `${this._gatewayUrl}${N}/${encodeURIComponent(t)}`,
1789
1855
  {
1790
1856
  method: "PUT",
1791
1857
  headers: { "Content-Type": "application/json" },
@@ -1803,7 +1869,7 @@ class zs {
1803
1869
  */
1804
1870
  async copy(t, e) {
1805
1871
  const o = await this._auth.authenticatedFetch(
1806
- `${this._gatewayUrl}${D}/${encodeURIComponent(t)}/copy`,
1872
+ `${this._gatewayUrl}${N}/${encodeURIComponent(t)}/copy`,
1807
1873
  {
1808
1874
  method: "POST",
1809
1875
  headers: { "Content-Type": "application/json" },
@@ -1817,14 +1883,14 @@ class zs {
1817
1883
  /** Delete a custom app. Only the original author or an organization admin may do this. */
1818
1884
  async remove(t) {
1819
1885
  const e = await this._auth.authenticatedFetch(
1820
- `${this._gatewayUrl}${D}/${encodeURIComponent(t)}`,
1886
+ `${this._gatewayUrl}${N}/${encodeURIComponent(t)}`,
1821
1887
  { method: "DELETE" }
1822
1888
  );
1823
1889
  if (!e.ok)
1824
1890
  throw new Error(`Failed to delete custom app: ${e.status} ${e.statusText}`);
1825
1891
  }
1826
1892
  }
1827
- class Bs {
1893
+ class Xs {
1828
1894
  constructor(t, e) {
1829
1895
  this._auth = t, this._gatewayUrl = e;
1830
1896
  }
@@ -1836,7 +1902,7 @@ class Bs {
1836
1902
  */
1837
1903
  async get() {
1838
1904
  const t = await this._auth.authenticatedFetch(
1839
- `${this._gatewayUrl}${gr}`,
1905
+ `${this._gatewayUrl}${yr}`,
1840
1906
  { headers: { "Content-Type": "application/json" } }
1841
1907
  );
1842
1908
  if (!t.ok)
@@ -1850,7 +1916,7 @@ class Bs {
1850
1916
  */
1851
1917
  async set(t) {
1852
1918
  const e = await this._auth.authenticatedFetch(
1853
- `${this._gatewayUrl}${ur}`,
1919
+ `${this._gatewayUrl}${fr}`,
1854
1920
  {
1855
1921
  method: "PUT",
1856
1922
  headers: { "Content-Type": "application/json" },
@@ -1869,8 +1935,8 @@ class Bs {
1869
1935
  }
1870
1936
  }
1871
1937
  }
1872
- const dt = 3e3;
1873
- class Gs {
1938
+ const ut = 3e3;
1939
+ class Js {
1874
1940
  constructor(t, e) {
1875
1941
  this._auth = t, this._gatewayUrl = e;
1876
1942
  }
@@ -1883,7 +1949,7 @@ class Gs {
1883
1949
  */
1884
1950
  watchStatus(t) {
1885
1951
  const { signal: e, close: o } = this._open(
1886
- Ts,
1952
+ ks,
1887
1953
  { projectId: t },
1888
1954
  `project "${t}"`
1889
1955
  );
@@ -1903,7 +1969,7 @@ class Gs {
1903
1969
  */
1904
1970
  watchMyStatus() {
1905
1971
  const { signal: t, close: e } = this._open(
1906
- Ss,
1972
+ xs,
1907
1973
  {},
1908
1974
  "current user"
1909
1975
  );
@@ -1923,11 +1989,11 @@ class Gs {
1923
1989
  const p = await this._auth.getToken();
1924
1990
  if (n) return;
1925
1991
  if (!p) {
1926
- i = setTimeout(c, dt);
1992
+ i = setTimeout(c, ut);
1927
1993
  return;
1928
1994
  }
1929
- const h = `${this._gatewayUrl.replace(/^http/, "ws")}${t}`, d = new URLSearchParams({ ...e, token: p }), u = `${h}?${d.toString()}`, w = `${h}?${new URLSearchParams({ ...e, token: "REDACTED" }).toString()}`;
1930
- a = new WebSocket(u), a.onopen = () => console.info(`[CueProcessingApi] connected for ${o}`), a.onmessage = (f) => {
1995
+ const h = `${this._gatewayUrl.replace(/^http/, "ws")}${t}`, d = new URLSearchParams({ ...e, token: p }), g = `${h}?${d.toString()}`, w = `${h}?${new URLSearchParams({ ...e, token: "REDACTED" }).toString()}`;
1996
+ a = new WebSocket(g), a.onopen = () => console.info(`[CueProcessingApi] connected for ${o}`), a.onmessage = (f) => {
1931
1997
  try {
1932
1998
  r.set(JSON.parse(f.data));
1933
1999
  } catch (y) {
@@ -1935,8 +2001,8 @@ class Gs {
1935
2001
  }
1936
2002
  }, a.onclose = (f) => {
1937
2003
  n || (console.warn(
1938
- `[CueProcessingApi] connection closed (code=${f.code}${f.reason ? `, reason=${f.reason}` : ""}), reconnecting in ${dt}ms`
1939
- ), i = setTimeout(c, dt));
2004
+ `[CueProcessingApi] connection closed (code=${f.code}${f.reason ? `, reason=${f.reason}` : ""}), reconnecting in ${ut}ms`
2005
+ ), i = setTimeout(c, ut));
1940
2006
  }, a.onerror = () => {
1941
2007
  console.warn(`[CueProcessingApi] WebSocket error for ${o} (url=${w})`);
1942
2008
  };
@@ -1949,7 +2015,7 @@ class Gs {
1949
2015
  };
1950
2016
  }
1951
2017
  }
1952
- class Hs {
2018
+ class Ys {
1953
2019
  constructor(t, e) {
1954
2020
  this._auth = t, this._gatewayUrl = e;
1955
2021
  }
@@ -1958,7 +2024,7 @@ class Hs {
1958
2024
  /** Lists the DMS providers this project can sync from. */
1959
2025
  async listSupportedProviders() {
1960
2026
  const t = await this._auth.authenticatedFetch(
1961
- `${this._gatewayUrl}${ys}`,
2027
+ `${this._gatewayUrl}${Es}`,
1962
2028
  { headers: { "Content-Type": "application/json" } }
1963
2029
  );
1964
2030
  if (!t.ok)
@@ -1972,7 +2038,7 @@ class Hs {
1972
2038
  */
1973
2039
  async previewSync(t, e, o) {
1974
2040
  const r = await this._auth.authenticatedFetch(
1975
- `${this._gatewayUrl}${bs(t)}`,
2041
+ `${this._gatewayUrl}${Ts(t)}`,
1976
2042
  {
1977
2043
  method: "POST",
1978
2044
  headers: {
@@ -1993,7 +2059,7 @@ class Hs {
1993
2059
  */
1994
2060
  async confirmSync(t, e, o) {
1995
2061
  const r = await this._auth.authenticatedFetch(
1996
- `${this._gatewayUrl}${_s(t)}`,
2062
+ `${this._gatewayUrl}${Ss(t)}`,
1997
2063
  {
1998
2064
  method: "POST",
1999
2065
  headers: {
@@ -2009,8 +2075,8 @@ class Hs {
2009
2075
  return r.json();
2010
2076
  }
2011
2077
  }
2012
- const Ws = "/llm-tools/wrangling-schema/generate", Vs = "/llm-tools/wrangling-schema/refine", Xs = "/llm-tools/entity-category-suggestion/suggest", Js = "/llm-tools/entity-category-suggestion/suggest-batch", Ys = "/llm-tools/schema-suggestion/from-prose", Qs = "/llm-tools/schema-suggestion/from-images", Ks = "/llm-tools/schema-suggestion/parse-coding-scheme", Zs = "/llm-tools/schema-suggestion/from-coding-scheme", ta = "/llm-tools/schema-suggestion/from-columns", ea = "/llm-tools/schema-suggestion/prompt", oa = "/llm-tools/schema-suggestion/translate";
2013
- class ra {
2078
+ const Qs = "/llm-tools/wrangling-schema/generate", Ks = "/llm-tools/wrangling-schema/refine", Zs = "/llm-tools/entity-category-suggestion/suggest", ta = "/llm-tools/entity-category-suggestion/suggest-batch", ea = "/llm-tools/schema-suggestion/from-prose", oa = "/llm-tools/schema-suggestion/from-images", ra = "/llm-tools/schema-suggestion/parse-coding-scheme", sa = "/llm-tools/schema-suggestion/from-coding-scheme", aa = "/llm-tools/schema-suggestion/from-columns", ia = "/llm-tools/schema-suggestion/prompt", na = "/llm-tools/schema-suggestion/translate";
2079
+ class ca {
2014
2080
  constructor(t, e) {
2015
2081
  this._auth = t, this._gatewayUrl = e;
2016
2082
  }
@@ -2023,7 +2089,7 @@ class ra {
2023
2089
  */
2024
2090
  async generateWranglingSchema(t) {
2025
2091
  const e = await this._auth.authenticatedFetch(
2026
- `${this._gatewayUrl}${Ws}`,
2092
+ `${this._gatewayUrl}${Qs}`,
2027
2093
  {
2028
2094
  method: "POST",
2029
2095
  headers: {
@@ -2054,7 +2120,7 @@ class ra {
2054
2120
  */
2055
2121
  async refineWranglingSchema(t) {
2056
2122
  const e = await this._auth.authenticatedFetch(
2057
- `${this._gatewayUrl}${Vs}`,
2123
+ `${this._gatewayUrl}${Ks}`,
2058
2124
  {
2059
2125
  method: "POST",
2060
2126
  headers: {
@@ -2088,7 +2154,7 @@ class ra {
2088
2154
  */
2089
2155
  async suggestEntityCategory(t) {
2090
2156
  const e = await this._auth.authenticatedFetch(
2091
- `${this._gatewayUrl}${Xs}`,
2157
+ `${this._gatewayUrl}${Zs}`,
2092
2158
  {
2093
2159
  method: "POST",
2094
2160
  headers: {
@@ -2122,7 +2188,7 @@ class ra {
2122
2188
  */
2123
2189
  async suggestEntityCategoryBatch(t) {
2124
2190
  const e = await this._auth.authenticatedFetch(
2125
- `${this._gatewayUrl}${Js}`,
2191
+ `${this._gatewayUrl}${ta}`,
2126
2192
  {
2127
2193
  method: "POST",
2128
2194
  headers: {
@@ -2151,7 +2217,7 @@ class ra {
2151
2217
  */
2152
2218
  async suggestFromProse(t) {
2153
2219
  const e = await this._auth.authenticatedFetch(
2154
- `${this._gatewayUrl}${Ys}`,
2220
+ `${this._gatewayUrl}${ea}`,
2155
2221
  {
2156
2222
  method: "POST",
2157
2223
  headers: {
@@ -2181,7 +2247,7 @@ class ra {
2181
2247
  */
2182
2248
  async suggestFromImages(t) {
2183
2249
  const e = await this._auth.authenticatedFetch(
2184
- `${this._gatewayUrl}${Qs}`,
2250
+ `${this._gatewayUrl}${oa}`,
2185
2251
  {
2186
2252
  method: "POST",
2187
2253
  headers: {
@@ -2210,7 +2276,7 @@ class ra {
2210
2276
  */
2211
2277
  async parseCodingScheme(t) {
2212
2278
  const e = await this._auth.authenticatedFetch(
2213
- `${this._gatewayUrl}${Ks}`,
2279
+ `${this._gatewayUrl}${ra}`,
2214
2280
  {
2215
2281
  method: "POST",
2216
2282
  headers: {
@@ -2240,7 +2306,7 @@ class ra {
2240
2306
  */
2241
2307
  async suggestFromCodingScheme(t) {
2242
2308
  const e = await this._auth.authenticatedFetch(
2243
- `${this._gatewayUrl}${Zs}`,
2309
+ `${this._gatewayUrl}${sa}`,
2244
2310
  {
2245
2311
  method: "POST",
2246
2312
  headers: {
@@ -2276,7 +2342,7 @@ class ra {
2276
2342
  */
2277
2343
  async suggestFromColumns(t) {
2278
2344
  const e = await this._auth.authenticatedFetch(
2279
- `${this._gatewayUrl}${ta}`,
2345
+ `${this._gatewayUrl}${aa}`,
2280
2346
  {
2281
2347
  method: "POST",
2282
2348
  headers: {
@@ -2307,7 +2373,7 @@ class ra {
2307
2373
  */
2308
2374
  async suggestPrompt(t) {
2309
2375
  const e = await this._auth.authenticatedFetch(
2310
- `${this._gatewayUrl}${ea}`,
2376
+ `${this._gatewayUrl}${ia}`,
2311
2377
  {
2312
2378
  method: "POST",
2313
2379
  headers: {
@@ -2339,7 +2405,7 @@ class ra {
2339
2405
  */
2340
2406
  async translate(t) {
2341
2407
  const e = await this._auth.authenticatedFetch(
2342
- `${this._gatewayUrl}${oa}`,
2408
+ `${this._gatewayUrl}${na}`,
2343
2409
  {
2344
2410
  method: "POST",
2345
2411
  headers: {
@@ -2362,8 +2428,8 @@ class ra {
2362
2428
  return e.json();
2363
2429
  }
2364
2430
  }
2365
- const $ = `${g}/data-sources`, sa = 18e4;
2366
- class aa {
2431
+ const $ = `${u}/data-sources`, pa = 18e4;
2432
+ class la {
2367
2433
  constructor(t, e, o) {
2368
2434
  this._auth = t, this._gatewayUrl = e, this._blob = o;
2369
2435
  }
@@ -2403,7 +2469,7 @@ class aa {
2403
2469
  const r = await this._auth.authenticatedFetch(`${this._gatewayUrl}${$}/${e}`, {
2404
2470
  method: "DELETE",
2405
2471
  headers: { "x-project-id": t, "cue-project-id": t },
2406
- signal: AbortSignal.timeout(sa)
2472
+ signal: AbortSignal.timeout(pa)
2407
2473
  });
2408
2474
  if (!r.ok)
2409
2475
  throw new Error(await this._errorMessage("Delete data source failed", r));
@@ -2527,7 +2593,7 @@ class aa {
2527
2593
  };
2528
2594
  return Promise.all(
2529
2595
  e.map(async (c, p) => {
2530
- const h = typeof c.name == "string" ? c.name : "upload", d = h.lastIndexOf("."), u = d > 0 ? h.slice(d) : "", w = crypto.randomUUID(), f = `${t}/_tmp-uploads/${w}${u}`, y = r.uploadResumable("raw", f, c), b = y.onProgress((m) => {
2596
+ const h = typeof c.name == "string" ? c.name : "upload", d = h.lastIndexOf("."), g = d > 0 ? h.slice(d) : "", w = crypto.randomUUID(), f = `${t}/_tmp-uploads/${w}${g}`, y = r.uploadResumable("raw", f, c), b = y.onProgress((m) => {
2531
2597
  i[p] = m, n();
2532
2598
  });
2533
2599
  try {
@@ -2535,7 +2601,7 @@ class aa {
2535
2601
  } finally {
2536
2602
  b();
2537
2603
  }
2538
- return { tempId: w, suffix: u, originalname: h };
2604
+ return { tempId: w, suffix: g, originalname: h };
2539
2605
  })
2540
2606
  );
2541
2607
  }
@@ -2560,8 +2626,8 @@ class aa {
2560
2626
  const n = t.body.getReader(), c = new TextDecoder();
2561
2627
  let p = "";
2562
2628
  for (; ; ) {
2563
- const { done: d, value: u } = await n.read();
2564
- u && (p += c.decode(u, { stream: !0 }));
2629
+ const { done: d, value: g } = await n.read();
2630
+ g && (p += c.decode(g, { stream: !0 }));
2565
2631
  let w;
2566
2632
  for (; (w = p.indexOf(`
2567
2633
  `)) >= 0; ) {
@@ -2598,15 +2664,15 @@ class aa {
2598
2664
  return `${t}: ${e.status} ${e.statusText}${o ? " — " + o.slice(0, 300) : ""}`;
2599
2665
  }
2600
2666
  }
2601
- const M = `${g}/gis-sources`;
2602
- class ia {
2667
+ const F = `${u}/gis-sources`;
2668
+ class ha {
2603
2669
  constructor(t, e) {
2604
2670
  this._auth = t, this._gatewayUrl = e;
2605
2671
  }
2606
2672
  _auth;
2607
2673
  _gatewayUrl;
2608
2674
  async listGisSources(t) {
2609
- const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${M}`, {
2675
+ const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${F}`, {
2610
2676
  headers: { "x-project-id": t, "cue-project-id": t }
2611
2677
  });
2612
2678
  if (!e.ok)
@@ -2614,7 +2680,7 @@ class ia {
2614
2680
  return e.json();
2615
2681
  }
2616
2682
  async getGisSource(t, e) {
2617
- const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${M}/${e}`, {
2683
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${F}/${e}`, {
2618
2684
  headers: { "x-project-id": t, "cue-project-id": t }
2619
2685
  });
2620
2686
  if (!o.ok)
@@ -2626,7 +2692,7 @@ class ia {
2626
2692
  async createGisSource(t, e, o, r, a = "auto") {
2627
2693
  const i = new FormData();
2628
2694
  i.append("name", e), i.append("crs", a), i.append("file", o, r);
2629
- const n = await this._auth.authenticatedFetch(`${this._gatewayUrl}${M}`, {
2695
+ const n = await this._auth.authenticatedFetch(`${this._gatewayUrl}${F}`, {
2630
2696
  method: "POST",
2631
2697
  // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
2632
2698
  headers: { "x-project-id": t, "cue-project-id": t },
@@ -2640,7 +2706,7 @@ class ia {
2640
2706
  async updateGisSource(t, e, o) {
2641
2707
  const r = new FormData();
2642
2708
  o.name !== void 0 && r.append("name", o.name), o.crs !== void 0 && r.append("crs", o.crs), o.file !== void 0 && r.append("file", o.file, o.filename ?? "upload");
2643
- const a = await this._auth.authenticatedFetch(`${this._gatewayUrl}${M}/${e}`, {
2709
+ const a = await this._auth.authenticatedFetch(`${this._gatewayUrl}${F}/${e}`, {
2644
2710
  method: "PATCH",
2645
2711
  // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
2646
2712
  headers: { "x-project-id": t, "cue-project-id": t },
@@ -2651,7 +2717,7 @@ class ia {
2651
2717
  return a.json();
2652
2718
  }
2653
2719
  async deleteGisSource(t, e) {
2654
- const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${M}/${e}`, {
2720
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${F}/${e}`, {
2655
2721
  method: "DELETE",
2656
2722
  headers: { "x-project-id": t, "cue-project-id": t }
2657
2723
  });
@@ -2663,8 +2729,8 @@ class ia {
2663
2729
  return `${t}: ${e.status} ${e.statusText}${o ? " — " + o.slice(0, 300) : ""}`;
2664
2730
  }
2665
2731
  }
2666
- const na = "/llm-tools/schema-suggestion/from-prose", ca = "/llm-tools/schema-suggestion/catalogs";
2667
- class pa {
2732
+ const da = "/llm-tools/schema-suggestion/from-prose", ua = "/llm-tools/schema-suggestion/catalogs";
2733
+ class ga {
2668
2734
  constructor(t, e) {
2669
2735
  this._auth = t, this._gatewayUrl = e;
2670
2736
  }
@@ -2680,7 +2746,7 @@ class pa {
2680
2746
  */
2681
2747
  async fromProse(t) {
2682
2748
  const e = await this._auth.authenticatedFetch(
2683
- `${this._gatewayUrl}${na}`,
2749
+ `${this._gatewayUrl}${da}`,
2684
2750
  {
2685
2751
  method: "POST",
2686
2752
  headers: {
@@ -2710,7 +2776,7 @@ class pa {
2710
2776
  */
2711
2777
  async catalogs(t) {
2712
2778
  const e = await this._auth.authenticatedFetch(
2713
- `${this._gatewayUrl}${ca}`,
2779
+ `${this._gatewayUrl}${ua}`,
2714
2780
  {
2715
2781
  method: "GET",
2716
2782
  headers: { "x-project-id": t, "cue-project-id": t }
@@ -2725,8 +2791,8 @@ class pa {
2725
2791
  return `${t}: ${e.status} ${e.statusText}${o ? " — " + o.slice(0, 300) : ""}`;
2726
2792
  }
2727
2793
  }
2728
- const Y = `${g}/semantic-template`, la = `${g}/canonical-rename`;
2729
- class ha {
2794
+ const Q = `${u}/semantic-template`, ma = `${u}/canonical-rename`;
2795
+ class wa {
2730
2796
  constructor(t, e) {
2731
2797
  this._auth = t, this._gatewayUrl = e;
2732
2798
  }
@@ -2834,7 +2900,7 @@ class ha {
2834
2900
  // ─── Private helpers ─────────────────────────────────────────────────────
2835
2901
  async _get(t, e) {
2836
2902
  const o = await this._auth.authenticatedFetch(
2837
- `${this._gatewayUrl}${Y}/${e}`,
2903
+ `${this._gatewayUrl}${Q}/${e}`,
2838
2904
  {
2839
2905
  method: "GET",
2840
2906
  headers: { "x-project-id": t, "cue-project-id": t }
@@ -2846,7 +2912,7 @@ class ha {
2846
2912
  }
2847
2913
  async _send(t, e, o, r) {
2848
2914
  const a = await this._auth.authenticatedFetch(
2849
- `${this._gatewayUrl}${Y}/${o}`,
2915
+ `${this._gatewayUrl}${Q}/${o}`,
2850
2916
  {
2851
2917
  method: t,
2852
2918
  headers: { "Content-Type": "application/json", "x-project-id": e, "cue-project-id": e },
@@ -2863,7 +2929,7 @@ class ha {
2863
2929
  * first to see what would move and whether the new value collides.
2864
2930
  */
2865
2931
  async renameCanonical(t, e) {
2866
- const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${la}`, {
2932
+ const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${ma}`, {
2867
2933
  method: "POST",
2868
2934
  headers: { "Content-Type": "application/json", "x-project-id": t, "cue-project-id": t },
2869
2935
  body: JSON.stringify(e)
@@ -2874,7 +2940,7 @@ class ha {
2874
2940
  }
2875
2941
  async _post(t, e, o) {
2876
2942
  const r = await this._auth.authenticatedFetch(
2877
- `${this._gatewayUrl}${Y}/${e}`,
2943
+ `${this._gatewayUrl}${Q}/${e}`,
2878
2944
  {
2879
2945
  method: "POST",
2880
2946
  headers: { "Content-Type": "application/json", "x-project-id": t, "cue-project-id": t },
@@ -2887,7 +2953,7 @@ class ha {
2887
2953
  }
2888
2954
  async _delete(t, e, o) {
2889
2955
  const r = await this._auth.authenticatedFetch(
2890
- `${this._gatewayUrl}${Y}/${e}`,
2956
+ `${this._gatewayUrl}${Q}/${e}`,
2891
2957
  {
2892
2958
  method: "DELETE",
2893
2959
  headers: { "Content-Type": "application/json", "x-project-id": t, "cue-project-id": t },
@@ -2903,7 +2969,7 @@ class ha {
2903
2969
  return `${t}: ${e.status} ${e.statusText}${o ? " — " + o.slice(0, 300) : ""}`;
2904
2970
  }
2905
2971
  }
2906
- class da {
2972
+ class fa {
2907
2973
  constructor(t, e) {
2908
2974
  this._auth = t, this._gatewayUrl = e;
2909
2975
  }
@@ -2919,11 +2985,11 @@ class da {
2919
2985
  }
2920
2986
  /** Creates selectors (the text spans mentions point at) in one batch. */
2921
2987
  createSelectors(t, e, o) {
2922
- return this._send(t, "POST", ms, { items: e, batchComment: o }, "create selectors");
2988
+ return this._send(t, "POST", bs, { items: e, batchComment: o }, "create selectors");
2923
2989
  }
2924
2990
  /** Replaces a document's content categories: `existingValues` out, `newValues` in. */
2925
2991
  changeContentCategory(t, e) {
2926
- return this._send(t, "PATCH", ws, e, "change content category");
2992
+ return this._send(t, "PATCH", _s, e, "change content category");
2927
2993
  }
2928
2994
  async _send(t, e, o, r, a) {
2929
2995
  const i = await this._auth.authenticatedFetch(`${this._gatewayUrl}${o}`, {
@@ -2940,7 +3006,7 @@ class da {
2940
3006
  }
2941
3007
  class se {
2942
3008
  constructor(t, e, o, r, a) {
2943
- this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new $s(t, e), this.extraction = new Rs(t, e), this.contexts = new As(t, e), this.index = new Ds(t, e), this.mcp = new Fs(t, e), this.appData = new qs(t, e), this.apps = new zs(t, e), this.userSettings = new Bs(t, e), this.processing = new Gs(t, e), this.dms = new Hs(t, e), this.llmTools = new ra(t, e), this.dataSources = new aa(t, e, a), this.gisSources = new ia(t, e), this.semanticTemplate = new ha(t, e), this.schemaSuggestion = new pa(t, e), this.edits = new da(t, e);
3009
+ this._auth = t, this._gatewayUrl = e, this.projects = o, this.sync = r, this.tables = new Ds(t, e), this.extraction = new js(t, e), this.contexts = new Ls(t, e), this.index = new Ms(t, e), this.mcp = new Hs(t, e), this.appData = new Ws(t, e), this.apps = new Vs(t, e), this.userSettings = new Xs(t, e), this.processing = new Js(t, e), this.dms = new Ys(t, e), this.llmTools = new ca(t, e), this.dataSources = new la(t, e, a), this.gisSources = new ha(t, e), this.semanticTemplate = new wa(t, e), this.schemaSuggestion = new ga(t, e), this.edits = new fa(t, e);
2944
3010
  }
2945
3011
  _auth;
2946
3012
  _gatewayUrl;
@@ -3004,7 +3070,7 @@ class se {
3004
3070
  */
3005
3071
  async search(t) {
3006
3072
  const e = await this._auth.authenticatedFetch(
3007
- `${this._gatewayUrl}${rs}`,
3073
+ `${this._gatewayUrl}${ns}`,
3008
3074
  {
3009
3075
  method: "POST",
3010
3076
  headers: { "Content-Type": "application/json", "cue-project-id": t.projectId },
@@ -3082,7 +3148,7 @@ class se {
3082
3148
  * Returns a {@link ShaclValidationReport} for JSON-LD, or a Turtle string.
3083
3149
  */
3084
3150
  async shacl(t, e, o) {
3085
- const r = o?.format ?? "json-ld", a = r === "turtle" ? "text/turtle" : "application/ld+json", i = `${this._gatewayUrl}${ps}${o?.verbose ? "?verbose=true" : ""}`, n = new URLSearchParams({ shape: t }), c = await this._auth.authenticatedFetch(i, {
3151
+ const r = o?.format ?? "json-ld", a = r === "turtle" ? "text/turtle" : "application/ld+json", i = `${this._gatewayUrl}${us}${o?.verbose ? "?verbose=true" : ""}`, n = new URLSearchParams({ shape: t }), c = await this._auth.authenticatedFetch(i, {
3086
3152
  method: "POST",
3087
3153
  headers: {
3088
3154
  "Content-Type": "application/x-www-form-urlencoded",
@@ -3110,7 +3176,7 @@ class se {
3110
3176
  }
3111
3177
  async getConsumption(t) {
3112
3178
  const e = await this._auth.authenticatedFetch(
3113
- `${this._gatewayUrl}${Zo}`,
3179
+ `${this._gatewayUrl}${er}`,
3114
3180
  {
3115
3181
  headers: {
3116
3182
  "Content-Type": "application/json",
@@ -3139,7 +3205,7 @@ class se {
3139
3205
  const a = new FormData();
3140
3206
  a.append("location", r.location), a.append("suffix", r.suffix), r.fileContentClasses && a.append("fileContentClasses", JSON.stringify(r.fileContentClasses)), r.processorId && a.append("processorId", r.processorId), r.comment && a.append("comment", r.comment), a.append("file", o, `alt-rep${r.suffix}`);
3141
3207
  const i = await this._auth.authenticatedFetch(
3142
- `${this._gatewayUrl}${fs(e)}`,
3208
+ `${this._gatewayUrl}${vs(e)}`,
3143
3209
  {
3144
3210
  method: "POST",
3145
3211
  // Do NOT set Content-Type; the runtime sets it with the correct multipart boundary.
@@ -3165,7 +3231,7 @@ class se {
3165
3231
  */
3166
3232
  async reprocessDocument(t, e, o = {}) {
3167
3233
  const r = await this._auth.authenticatedFetch(
3168
- `${this._gatewayUrl}${gs(encodeURIComponent(e))}`,
3234
+ `${this._gatewayUrl}${ys(encodeURIComponent(e))}`,
3169
3235
  {
3170
3236
  method: "POST",
3171
3237
  headers: { "Content-Type": "application/json", "x-project-id": t, "cue-project-id": t },
@@ -3197,7 +3263,7 @@ const vt = [
3197
3263
  "railway",
3198
3264
  "natural",
3199
3265
  "manmade"
3200
- ], ua = {
3266
+ ], ya = {
3201
3267
  address: {
3202
3268
  category: "address",
3203
3269
  label: "Address",
@@ -3265,10 +3331,10 @@ const vt = [
3265
3331
  preferredColor: "#0d9488"
3266
3332
  }
3267
3333
  };
3268
- function x(s) {
3269
- return ua[s];
3334
+ function k(s) {
3335
+ return ya[s];
3270
3336
  }
3271
- const ga = {
3337
+ const ba = {
3272
3338
  "land-use-plan": "#f59e0b",
3273
3339
  // amber – primary zoning
3274
3340
  "local-plan": "#ec4899",
@@ -3296,10 +3362,10 @@ const ga = {
3296
3362
  "nature-landscape-plan": "#16a34a"
3297
3363
  // dark-green – Natur- und Landschaftsschutz
3298
3364
  };
3299
- function N(s, t) {
3365
+ function j(s, t) {
3300
3366
  return s[0] < t[2] && s[2] > t[0] && s[1] < t[3] && s[3] > t[1];
3301
3367
  }
3302
- const ma = "https://nominatim.openstreetmap.org", wa = "cue-gis/0.0.1", fa = {
3368
+ const _a = "https://nominatim.openstreetmap.org", va = "cue-gis/0.0.1", Ea = {
3303
3369
  address: "street",
3304
3370
  poi: "shop",
3305
3371
  railway: "station",
@@ -3313,32 +3379,32 @@ const ma = "https://nominatim.openstreetmap.org", wa = "cue-gis/0.0.1", fa = {
3313
3379
  // Never actually probed — 'custom' (user-uploaded GIS sources) isn't in
3314
3380
  // NOMINATIM_FEATURE_CATEGORIES, so this entry only exists to satisfy the Record type.
3315
3381
  custom: "place"
3316
- }, B = "nominatim";
3317
- function Z(s) {
3318
- return `${B}:${s}`;
3382
+ }, G = "nominatim";
3383
+ function et(s) {
3384
+ return `${G}:${s}`;
3319
3385
  }
3320
- function ya(s) {
3321
- const t = x(s);
3386
+ function Ta(s) {
3387
+ const t = k(s);
3322
3388
  return {
3323
- id: Z(s),
3324
- sourceId: B,
3389
+ id: et(s),
3390
+ sourceId: G,
3325
3391
  sourceLayerId: s,
3326
3392
  category: s,
3327
3393
  preferredColor: t.preferredColor,
3328
3394
  tier: "raw",
3329
3395
  label: t.label,
3330
3396
  description: `Nominatim ${s} layer`,
3331
- labelKey: `gis.layer.${B}.${s}.label`,
3332
- descriptionKey: `gis.layer.${B}.${s}.description`
3397
+ labelKey: `gis.layer.${G}.${s}.label`,
3398
+ descriptionKey: `gis.layer.${G}.${s}.description`
3333
3399
  };
3334
3400
  }
3335
- class ba {
3401
+ class Sa {
3336
3402
  baseUrl;
3337
3403
  userAgent;
3338
3404
  email;
3339
3405
  limit;
3340
3406
  constructor(t = {}) {
3341
- this.baseUrl = t.baseUrl ?? ma, this.userAgent = t.userAgent ?? wa, this.email = t.email, this.limit = Math.min(t.limit ?? 40, 40);
3407
+ this.baseUrl = t.baseUrl ?? _a, this.userAgent = t.userAgent ?? va, this.email = t.email, this.limit = Math.min(t.limit ?? 40, 40);
3342
3408
  }
3343
3409
  async listFeatureCategoryDescriptors(t) {
3344
3410
  return (await Promise.allSettled(
@@ -3348,27 +3414,27 @@ class ba {
3348
3414
  })
3349
3415
  )).filter(
3350
3416
  (o) => o.status === "fulfilled" && o.value.hasResults
3351
- ).map((o) => x(o.value.category));
3417
+ ).map((o) => k(o.value.category));
3352
3418
  }
3353
3419
  async listAvailableLayers(t) {
3354
- return (await this.listFeatureCategoryDescriptors(t)).map((o) => ya(o.category));
3420
+ return (await this.listFeatureCategoryDescriptors(t)).map((o) => Ta(o.category));
3355
3421
  }
3356
3422
  async getFeaturesForLayer(t, e) {
3357
- const o = vt.find((r) => Z(r) === e);
3423
+ const o = vt.find((r) => et(r) === e);
3358
3424
  return o ? this.search(t, o) : [];
3359
3425
  }
3360
3426
  async listFeatureCategories(t) {
3361
3427
  return (await this.listFeatureCategoryDescriptors(t)).map((o) => o.category);
3362
3428
  }
3363
3429
  async getFeaturesOfCategory(t, e) {
3364
- return this.getFeaturesForLayer(t, Z(e));
3430
+ return this.getFeaturesForLayer(t, et(e));
3365
3431
  }
3366
3432
  /**
3367
3433
  * Low-level search against the Nominatim API. Uses a per-layer probe query
3368
3434
  * so bounded viewbox searches return meaningful results.
3369
3435
  */
3370
3436
  async search(t, e) {
3371
- const [o, r, a, i] = t, n = e ? fa[e] : "place", c = new URLSearchParams({
3437
+ const [o, r, a, i] = t, n = e ? Ea[e] : "place", c = new URLSearchParams({
3372
3438
  q: n,
3373
3439
  format: "jsonv2",
3374
3440
  viewbox: `${o},${i},${a},${r}`,
@@ -3389,15 +3455,15 @@ class ba {
3389
3455
  throw new Error(
3390
3456
  `Nominatim request failed: ${h.status} ${h.statusText}`
3391
3457
  );
3392
- return (await h.json()).map((u) => this.toGisFeature(u, e));
3458
+ return (await h.json()).map((g) => this.toGisFeature(g, e));
3393
3459
  }
3394
3460
  toGisFeature(t, e) {
3395
- const [o, r, a, i] = t.boundingbox, n = e ?? t.category, c = x(n);
3461
+ const [o, r, a, i] = t.boundingbox, n = e ?? t.category, c = k(n);
3396
3462
  return {
3397
3463
  id: `${t.osm_type}/${t.osm_id}`,
3398
- sourceId: B,
3464
+ sourceId: G,
3399
3465
  sourceFeatureId: `${t.osm_type}/${t.osm_id}`,
3400
- layerId: Z(n),
3466
+ layerId: et(n),
3401
3467
  name: t.name ?? t.display_name.split(",")[0].trim(),
3402
3468
  category: n,
3403
3469
  preferredColor: c.preferredColor,
@@ -3520,7 +3586,7 @@ const ae = {
3520
3586
  1281: "infrastructure",
3521
3587
  1282: "infrastructure",
3522
3588
  9999: "other"
3523
- }, _a = {
3589
+ }, Ia = {
3524
3590
  // Residential
3525
3591
  1110: "residential",
3526
3592
  // Einfamilienhaus
@@ -3582,7 +3648,7 @@ const ae = {
3582
3648
  // Empfangsgebäude Bahn/Bus
3583
3649
  1282: "infrastructure"
3584
3650
  // Parkhaus, Garage
3585
- }, va = [
3651
+ }, Ca = [
3586
3652
  // "Gebäude" is the Swiss AV BoFlaeche land-cover label for a building footprint.
3587
3653
  // It does not encode the actual use type, so map it to 'other' as a safe fallback.
3588
3654
  [/^geb[äa]ude$/i, "other"],
@@ -3595,23 +3661,23 @@ const ae = {
3595
3661
  [/infrastruktur|verkehr|transport|energy|energie|forsyning|teknik|teknisk/i, "infrastructure"],
3596
3662
  [/gemischt|mixed|blandet/i, "mixed"]
3597
3663
  ];
3598
- function q(s) {
3599
- for (const [t, e] of va)
3664
+ function z(s) {
3665
+ for (const [t, e] of Ca)
3600
3666
  if (t.test(s)) return e;
3601
3667
  }
3602
- function Ea(s, t) {
3668
+ function ka(s, t) {
3603
3669
  if (s == null) return;
3604
3670
  const e = String(s).trim();
3605
- return t === "swiss-gwr" ? _a[e] ?? q(e) : t === "danish-matrikel" ? ae[e] ?? q(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? ie[e] ?? q(e) : ie[e] ?? ae[e] ?? q(e);
3671
+ return t === "swiss-gwr" ? Ia[e] ?? z(e) : t === "danish-matrikel" ? ae[e] ?? z(e) : t === "zurich-wfs" || t === "swiss-av-wfs" ? ie[e] ?? z(e) : ie[e] ?? ae[e] ?? z(e);
3606
3672
  }
3607
- function Ta(s, t) {
3673
+ function xa(s, t) {
3608
3674
  if (s != null)
3609
- return q(String(s).trim());
3675
+ return z(String(s).trim());
3610
3676
  }
3611
3677
  function qe(s) {
3612
3678
  return s.trim().toLowerCase().replace(/[\s_\-]/g, "");
3613
3679
  }
3614
- const Sa = {
3680
+ const $a = {
3615
3681
  // Swiss ÖREB rechtsstatus
3616
3682
  inkraft: "in-force",
3617
3683
  laufendeanderung: "amendment-pending",
@@ -3632,7 +3698,7 @@ const Sa = {
3632
3698
  };
3633
3699
  function ze(s) {
3634
3700
  if (s)
3635
- return Sa[qe(s)];
3701
+ return $a[qe(s)];
3636
3702
  }
3637
3703
  const ne = {
3638
3704
  // Swiss Nutzungsplanung (typ_gde_bezeichnung and common variants)
@@ -3688,7 +3754,7 @@ const ne = {
3688
3754
  // Danish plandata.dk
3689
3755
  lokalplan: "local-plan",
3690
3756
  kommuneplanramme: "municipal-plan-framework"
3691
- }, Ia = [
3757
+ }, Oa = [
3692
3758
  [/quartiererhalt/i, "neighbourhood-conservation-plan"],
3693
3759
  [/lärmempfindlich|laermempfindlich/i, "noise-sensitivity-plan"],
3694
3760
  [/gewässerschutz|grundwasserschutz/i, "water-protection-plan"],
@@ -3732,13 +3798,13 @@ function Be(s) {
3732
3798
  if (!s) return;
3733
3799
  const t = qe(s);
3734
3800
  if (t in ne) return ne[t];
3735
- for (const [e, o] of Ia)
3801
+ for (const [e, o] of Oa)
3736
3802
  if (e.test(s)) return o;
3737
3803
  console.warn(
3738
3804
  `[cue-gis] Unknown zone plan type — add "${s}" to classifyZonePlanType: no ZonePlanType mapping found.`
3739
3805
  );
3740
3806
  }
3741
- function st(s, t) {
3807
+ function it(s, t) {
3742
3808
  const e = (t * 3600 - 169028.66) / 1e4, o = (s * 3600 - 26782.5) / 1e4, r = 260007237e-2 + 211455.93 * o - 10938.51 * o * e - 0.36 * o * e ** 2 - 44.54 * o ** 3, a = 120014707e-2 + 308807.95 * e + 3745.25 * o ** 2 + 76.63 * e ** 2 - 194.56 * o ** 2 * e + 119.79 * e ** 3;
3743
3809
  return [Math.round(r), Math.round(a)];
3744
3810
  }
@@ -3746,14 +3812,14 @@ function Tt(s, t) {
3746
3812
  const e = (s - 26e5) / 1e6, o = (t - 12e5) / 1e6, r = 2.6779094 + 4.728982 * e + 0.791484 * e * o + 0.1306 * e * o ** 2 - 0.0436 * e ** 3, a = 16.9023892 + 3.238272 * o - 0.270978 * e ** 2 - 2528e-6 * o ** 2 - 0.0447 * e ** 2 * o - 0.014 * o ** 3;
3747
3813
  return [r * 100 / 36, a * 100 / 36];
3748
3814
  }
3749
- const Ca = "https://maps.zh.ch/wfs/OGDZHWFS", xa = "zurich-wfs", ka = "geometry", $a = [8.35, 47.15, 8.95, 47.7], Oa = [5.9, 45.7, 10.55, 47.85];
3750
- function ut(s) {
3815
+ const Ra = "https://maps.zh.ch/wfs/OGDZHWFS", Aa = "zurich-wfs", Pa = "geometry", Da = [8.35, 47.15, 8.95, 47.7], Na = [5.9, 45.7, 10.55, 47.85];
3816
+ function gt(s) {
3751
3817
  return typeof s == "string" ? s : s.typeName;
3752
3818
  }
3753
- function gt(s) {
3819
+ function mt(s) {
3754
3820
  return typeof s == "string" ? void 0 : s.cqlFilter;
3755
3821
  }
3756
- function Ra(s) {
3822
+ function ja(s) {
3757
3823
  if (!s) return [0, 0];
3758
3824
  const t = s.coordinates;
3759
3825
  switch (s.type) {
@@ -3774,23 +3840,23 @@ function Ra(s) {
3774
3840
  function Ge(s, t) {
3775
3841
  return Array.isArray(s) && typeof s[0] == "number" ? t(s[0], s[1]) : s.map((e) => Ge(e, t));
3776
3842
  }
3777
- function Aa(s) {
3843
+ function La(s) {
3778
3844
  return s && { ...s, coordinates: Ge(s.coordinates, Tt) };
3779
3845
  }
3780
- function Pa(s, t) {
3846
+ function Ua(s, t) {
3781
3847
  if (!s) return t;
3782
3848
  for (const e of ["plannavn", "bezeichnung", "name", "strassenname", "objektname", "title", "label"])
3783
3849
  if (typeof s[e] == "string" && s[e]) return s[e];
3784
3850
  return t;
3785
3851
  }
3786
- function Da(s, t, e) {
3852
+ function Ma(s, t, e) {
3787
3853
  return e ? `${s}:${t}[${e}]` : `${s}:${t}`;
3788
3854
  }
3789
- const Na = /* @__PURE__ */ new Set(["building", "cadastre", "greenspace", "paved", "zone"]);
3790
- function mt(s, t, e, o) {
3791
- const r = e.replace(/^ms:/, ""), a = x(t), i = Na.has(t) ? "priority" : "raw";
3855
+ const Fa = /* @__PURE__ */ new Set(["building", "cadastre", "greenspace", "paved", "zone"]);
3856
+ function wt(s, t, e, o) {
3857
+ const r = e.replace(/^ms:/, ""), a = k(t), i = Fa.has(t) ? "priority" : "raw";
3792
3858
  return {
3793
- id: Da(s, e, o),
3859
+ id: Ma(s, e, o),
3794
3860
  sourceId: s,
3795
3861
  sourceLayerId: e,
3796
3862
  category: t,
@@ -3802,32 +3868,32 @@ function mt(s, t, e, o) {
3802
3868
  descriptionKey: `gis.layer.${s}.${r}.description`
3803
3869
  };
3804
3870
  }
3805
- function ja(s, t) {
3871
+ function qa(s, t) {
3806
3872
  if (!s) return { featureType: "building" };
3807
3873
  const e = s.grundflaeche ?? s.gbf ?? s.gebaeudegrundrissflaeche ?? s.flaeche ?? void 0, o = s.vollgeschosse ?? s.geschossanzahl ?? s.anzahl_geschosse ?? void 0, r = s.gebaeudefunktion ?? s.gfkode ?? s.art ?? s.objektart ?? void 0, a = s.baujahr ?? s.bauperiode ?? void 0, i = String(s.egid ?? s.gwr_egid ?? s.egris_egid ?? "").trim() || void 0;
3808
3874
  return {
3809
3875
  featureType: "building",
3810
3876
  areaM2: typeof e == "number" ? e : void 0,
3811
3877
  buildingUse: r ? String(r) : void 0,
3812
- buildingUseGeneric: Ea(r, t),
3878
+ buildingUseGeneric: ka(r, t),
3813
3879
  floors: typeof o == "number" ? o : void 0,
3814
3880
  yearBuilt: typeof a == "number" ? a : void 0,
3815
3881
  registryId: i
3816
3882
  };
3817
3883
  }
3818
- function La(s, t) {
3884
+ function za(s, t) {
3819
3885
  if (!s) return { featureType: "plot" };
3820
3886
  const e = s.egris_egrid ?? s.egrid ?? void 0, o = s.nummer ?? void 0, r = s.nbident ?? void 0, a = o && r ? `${o}, ${r}` : o ?? void 0, i = s.flaechenmass ?? s.flaeche ?? void 0, n = s.art ?? s.nutzungsart ?? void 0;
3821
3887
  return {
3822
3888
  featureType: "plot",
3823
3889
  areaM2: typeof i == "number" ? i : void 0,
3824
3890
  plotUse: n ? String(n) : void 0,
3825
- plotUseGeneric: Ta(n),
3891
+ plotUseGeneric: xa(n),
3826
3892
  plotId: a,
3827
3893
  registryId: e
3828
3894
  };
3829
3895
  }
3830
- function Ua(s) {
3896
+ function Ba(s) {
3831
3897
  if (!s) return { featureType: "greenspace" };
3832
3898
  const t = s.flaeche ?? void 0, e = s.art ?? void 0;
3833
3899
  return {
@@ -3836,7 +3902,7 @@ function Ua(s) {
3836
3902
  surfaceType: e ? String(e) : void 0
3837
3903
  };
3838
3904
  }
3839
- function Ma(s) {
3905
+ function Ga(s) {
3840
3906
  if (!s) return { featureType: "paved" };
3841
3907
  const t = s.flaeche ?? void 0, e = s.art ?? void 0;
3842
3908
  return {
@@ -3845,9 +3911,9 @@ function Ma(s) {
3845
3911
  surfaceType: e ? String(e) : void 0
3846
3912
  };
3847
3913
  }
3848
- function Fa(s) {
3914
+ function Ha(s) {
3849
3915
  if (!s) return { featureType: "zone" };
3850
- const t = s.plannavn ?? s.bezeichnung ?? s.typ_bezeichnung ?? s.art ?? void 0, e = s.planid ?? s.plannummer ?? void 0, o = s.artcode ?? s.typ_code ?? s.abkuerzung ?? e ?? void 0, r = s.rechtsstatus ?? s.status ?? void 0, a = ze(r), i = s.typ_gde_bezeichnung ?? void 0, n = Be(i), c = s.dagsordenpunkt_url ?? s.dokument_url ?? s.link ?? void 0, p = s.auflagedatum ?? void 0, h = s.festsetzungsdatum ?? void 0, d = s.genehmigungsdatum ?? void 0, u = s.inkraftsetzungsdatum ?? void 0, w = s.flaeche ?? s.flaeche_m2 ?? void 0;
3916
+ const t = s.plannavn ?? s.bezeichnung ?? s.typ_bezeichnung ?? s.art ?? void 0, e = s.planid ?? s.plannummer ?? void 0, o = s.artcode ?? s.typ_code ?? s.abkuerzung ?? e ?? void 0, r = s.rechtsstatus ?? s.status ?? void 0, a = ze(r), i = s.typ_gde_bezeichnung ?? void 0, n = Be(i), c = s.dagsordenpunkt_url ?? s.dokument_url ?? s.link ?? void 0, p = s.auflagedatum ?? void 0, h = s.festsetzungsdatum ?? void 0, d = s.genehmigungsdatum ?? void 0, g = s.inkraftsetzungsdatum ?? void 0, w = s.flaeche ?? s.flaeche_m2 ?? void 0;
3851
3917
  return {
3852
3918
  featureType: "zone",
3853
3919
  zoneType: t ? String(t) : void 0,
@@ -3859,11 +3925,11 @@ function Fa(s) {
3859
3925
  publicationDate: p ?? void 0,
3860
3926
  fixingDate: h ?? void 0,
3861
3927
  approvalDate: d ?? void 0,
3862
- effectiveFrom: u ?? void 0,
3928
+ effectiveFrom: g ?? void 0,
3863
3929
  areaM2: typeof w == "number" ? w : void 0
3864
3930
  };
3865
3931
  }
3866
- function qa(s) {
3932
+ function Wa(s) {
3867
3933
  const t = s.match(/^(\w+)\s*=\s*'([^']+)'$/);
3868
3934
  if (t) {
3869
3935
  const [, o, r] = t;
@@ -3878,13 +3944,13 @@ function qa(s) {
3878
3944
  }
3879
3945
  return () => !0;
3880
3946
  }
3881
- function za(s) {
3947
+ function Va(s) {
3882
3948
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
3883
3949
  }
3884
3950
  function ce(s, t) {
3885
- return `<fes:PropertyIsEqualTo><fes:ValueReference>${s}</fes:ValueReference><fes:Literal>${za(t)}</fes:Literal></fes:PropertyIsEqualTo>`;
3951
+ return `<fes:PropertyIsEqualTo><fes:ValueReference>${s}</fes:ValueReference><fes:Literal>${Va(t)}</fes:Literal></fes:PropertyIsEqualTo>`;
3886
3952
  }
3887
- function Ba(s) {
3953
+ function Xa(s) {
3888
3954
  const t = s.match(/^(\w+)\s*=\s*'([^']+)'$/);
3889
3955
  if (t) {
3890
3956
  const [, o, r] = t;
@@ -3897,49 +3963,49 @@ function Ba(s) {
3897
3963
  }
3898
3964
  throw new Error(`Unsupported CQL filter pattern for FES translation: ${s}`);
3899
3965
  }
3900
- function Ga(s, t) {
3966
+ function Ja(s, t) {
3901
3967
  const [e, o, r, a] = s, [i, n, c] = t === "EPSG:2056" ? (() => {
3902
- const [p, h] = st(e, o), [d, u] = st(r, a);
3903
- return ["urn:ogc:def:crs:EPSG::2056", `${p} ${h}`, `${d} ${u}`];
3968
+ const [p, h] = it(e, o), [d, g] = it(r, a);
3969
+ return ["urn:ogc:def:crs:EPSG::2056", `${p} ${h}`, `${d} ${g}`];
3904
3970
  })() : ["urn:ogc:def:crs:EPSG::4326", `${o} ${e}`, `${a} ${r}`];
3905
- return `<fes:BBOX><fes:ValueReference>${ka}</fes:ValueReference><gml:Envelope srsName="${i}"><gml:lowerCorner>${n}</gml:lowerCorner><gml:upperCorner>${c}</gml:upperCorner></gml:Envelope></fes:BBOX>`;
3971
+ return `<fes:BBOX><fes:ValueReference>${Pa}</fes:ValueReference><gml:Envelope srsName="${i}"><gml:lowerCorner>${n}</gml:lowerCorner><gml:upperCorner>${c}</gml:upperCorner></gml:Envelope></fes:BBOX>`;
3906
3972
  }
3907
- function Ha(s, t, e) {
3908
- const o = Ga(s, t);
3909
- return `<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2">${e ? `<fes:And>${Ba(e)}${o}</fes:And>` : o}</fes:Filter>`;
3973
+ function Ya(s, t, e) {
3974
+ const o = Ja(s, t);
3975
+ return `<fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2">${e ? `<fes:And>${Xa(e)}${o}</fes:And>` : o}</fes:Filter>`;
3910
3976
  }
3911
- class wt {
3977
+ class ft {
3912
3978
  categoryMap;
3913
3979
  baseUrl;
3914
3980
  sourceId;
3915
3981
  outputFormat;
3916
3982
  nativeCrs;
3917
3983
  constructor(t) {
3918
- this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Ca, this.sourceId = t.sourceId ?? xa, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson", this.nativeCrs = t.nativeCrs;
3984
+ this.categoryMap = t.categoryMap, this.baseUrl = t.baseUrl ?? Ra, this.sourceId = t.sourceId ?? Aa, this.outputFormat = t.outputFormat ?? "application/json; subtype=geojson", this.nativeCrs = t.nativeCrs;
3919
3985
  }
3920
3986
  async listFeatureCategoryDescriptors(t) {
3921
3987
  const e = await this.listAvailableLayers(t);
3922
- return [...new Map(e.map((o) => [o.category, x(o.category)])).values()];
3988
+ return [...new Map(e.map((o) => [o.category, k(o.category)])).values()];
3923
3989
  }
3924
3990
  async listAvailableLayers(t) {
3925
3991
  const e = Object.entries(this.categoryMap);
3926
3992
  return (await Promise.allSettled(
3927
3993
  e.flatMap(
3928
3994
  ([r, a]) => a.map(async (i) => {
3929
- const n = ut(i), c = gt(i), p = await this._fetchFeatures(t, n, 1, c);
3995
+ const n = gt(i), c = mt(i), p = await this._fetchFeatures(t, n, 1, c);
3930
3996
  return { category: r, typeName: n, cqlFilter: c, hasResults: p.features.length > 0 };
3931
3997
  })
3932
3998
  )
3933
3999
  )).filter(
3934
4000
  (r) => r.status === "fulfilled" && r.value.hasResults
3935
- ).map((r) => mt(this.sourceId, r.value.category, r.value.typeName, r.value.cqlFilter));
4001
+ ).map((r) => wt(this.sourceId, r.value.category, r.value.typeName, r.value.cqlFilter));
3936
4002
  }
3937
4003
  async getFeaturesForLayer(t, e) {
3938
4004
  const o = this._findLayerById(e);
3939
4005
  return o ? this._fetchAndConvert(t, o.descriptor, o.cqlFilter) : [];
3940
4006
  }
3941
4007
  async _fetchAndConvert(t, e, o) {
3942
- const r = await this._fetchFeatures(t, e.sourceLayerId, void 0, o), a = o ? qa(o) : void 0;
4008
+ const r = await this._fetchFeatures(t, e.sourceLayerId, void 0, o), a = o ? Wa(o) : void 0;
3943
4009
  return (a ? r.features.filter((n) => a(n.properties)) : r.features).map((n, c) => this.toGisFeature(n, e, c));
3944
4010
  }
3945
4011
  /**
@@ -3954,7 +4020,7 @@ class wt {
3954
4020
  const o = this.categoryMap[e] ?? [];
3955
4021
  return (await Promise.allSettled(
3956
4022
  o.map((a) => {
3957
- const i = ut(a), n = gt(a), c = mt(this.sourceId, e, i);
4023
+ const i = gt(a), n = mt(a), c = wt(this.sourceId, e, i);
3958
4024
  return this._fetchAndConvert(t, c, n);
3959
4025
  })
3960
4026
  )).flatMap((a) => a.status === "fulfilled" ? a.value : (console.warn(`[ZurichMapsAdapter] "${e}" layer failed (${this.sourceId}):`, a.reason), []));
@@ -3964,7 +4030,7 @@ class wt {
3964
4030
  const e = Object.entries(this.categoryMap);
3965
4031
  for (const [o, r] of e)
3966
4032
  for (const a of r) {
3967
- const i = ut(a), n = gt(a), c = mt(this.sourceId, o, i, n);
4033
+ const i = gt(a), n = mt(a), c = wt(this.sourceId, o, i, n);
3968
4034
  if (c.id === t)
3969
4035
  return { descriptor: c, cqlFilter: n };
3970
4036
  }
@@ -3979,13 +4045,13 @@ class wt {
3979
4045
  outputFormat: this.outputFormat
3980
4046
  });
3981
4047
  if (o !== void 0 && a.set("count", String(o)), r !== void 0)
3982
- a.set("filter", Ha(t, this.nativeCrs, r));
4048
+ a.set("filter", Ya(t, this.nativeCrs, r));
3983
4049
  else {
3984
- const [c, p, h, d] = t, u = this.nativeCrs === "EPSG:2056" ? (() => {
3985
- const [w, f] = st(c, p), [y, b] = st(h, d);
4050
+ const [c, p, h, d] = t, g = this.nativeCrs === "EPSG:2056" ? (() => {
4051
+ const [w, f] = it(c, p), [y, b] = it(h, d);
3986
4052
  return `${w},${f},${y},${b},urn:ogc:def:crs:EPSG::2056`;
3987
4053
  })() : `${p},${c},${d},${h},urn:ogc:def:crs:EPSG::4326`;
3988
- a.set("bbox", u);
4054
+ a.set("bbox", g);
3989
4055
  }
3990
4056
  const i = `${this.baseUrl}?${a.toString()}`, n = await fetch(i);
3991
4057
  if (!n.ok)
@@ -3995,7 +4061,7 @@ class wt {
3995
4061
  return n.json();
3996
4062
  }
3997
4063
  toGisFeature(t, e, o) {
3998
- const r = this.nativeCrs === "EPSG:2056" ? Aa(t.geometry) : t.geometry, [a, i] = Ra(r), n = Pa(t.properties, `${e.sourceLayerId}[${o}]`), c = t.bbox ? this.nativeCrs === "EPSG:2056" ? [...Tt(t.bbox[0], t.bbox[1]), ...Tt(t.bbox[2], t.bbox[3])] : [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, p = e.tier, h = p === "priority" ? this._extractNormalisedProperties(t, e) : void 0;
4064
+ const r = this.nativeCrs === "EPSG:2056" ? La(t.geometry) : t.geometry, [a, i] = ja(r), n = Ua(t.properties, `${e.sourceLayerId}[${o}]`), c = t.bbox ? this.nativeCrs === "EPSG:2056" ? [...Tt(t.bbox[0], t.bbox[1]), ...Tt(t.bbox[2], t.bbox[3])] : [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, p = e.tier, h = p === "priority" ? this._extractNormalisedProperties(t, e) : void 0;
3999
4065
  return {
4000
4066
  id: t.id ?? `${e.sourceLayerId}/${o}`,
4001
4067
  preferredColor: e.preferredColor,
@@ -4016,7 +4082,7 @@ class wt {
4016
4082
  };
4017
4083
  }
4018
4084
  _extractNormalisedProperties(t, e) {
4019
- return e.category === "building" ? ja(t.properties, this.sourceId) : e.category === "greenspace" ? Ua(t.properties) : e.category === "paved" ? Ma(t.properties) : e.category === "zone" ? Fa(t.properties) : La(t.properties, this.sourceId);
4085
+ return e.category === "building" ? qa(t.properties, this.sourceId) : e.category === "greenspace" ? Ba(t.properties) : e.category === "paved" ? Ga(t.properties) : e.category === "zone" ? Ha(t.properties) : za(t.properties, this.sourceId);
4020
4086
  }
4021
4087
  }
4022
4088
  const He = [8, 54.5, 15.2, 57.8], We = {
@@ -4031,7 +4097,7 @@ const He = [8, 54.5, 15.2, 57.8], We = {
4031
4097
  { source: "danish-matrikel", typename: "mat_v001:samletfastejendom_current" }
4032
4098
  ]
4033
4099
  };
4034
- function Wa(s) {
4100
+ function Qa(s) {
4035
4101
  if (!s) return [0, 0];
4036
4102
  const t = s.coordinates;
4037
4103
  switch (s.type) {
@@ -4049,7 +4115,7 @@ function Wa(s) {
4049
4115
  return [0, 0];
4050
4116
  }
4051
4117
  }
4052
- function Va(s, t) {
4118
+ function Ka(s, t) {
4053
4119
  if (!s) return t;
4054
4120
  for (const e of [
4055
4121
  "mat:matrikelnummer",
@@ -4065,14 +4131,14 @@ function Va(s, t) {
4065
4131
  if (typeof s[e] == "string" && s[e]) return s[e];
4066
4132
  return t;
4067
4133
  }
4068
- function Xa(s, t, e) {
4134
+ function Za(s, t, e) {
4069
4135
  return `${s}:${t}:${e}`;
4070
4136
  }
4071
- const Ja = /* @__PURE__ */ new Set(["building", "cadastre", "zone"]);
4072
- function ft(s, t, e) {
4073
- const o = e.typename.replace(/^[^:]+:/, ""), r = x(t), a = Ja.has(t) ? "priority" : "raw";
4137
+ const ti = /* @__PURE__ */ new Set(["building", "cadastre", "zone"]);
4138
+ function yt(s, t, e) {
4139
+ const o = e.typename.replace(/^[^:]+:/, ""), r = k(t), a = ti.has(t) ? "priority" : "raw";
4074
4140
  return {
4075
- id: Xa(s, e.source, e.typename),
4141
+ id: Za(s, e.source, e.typename),
4076
4142
  sourceId: s,
4077
4143
  sourceLayerId: e.typename,
4078
4144
  category: t,
@@ -4084,7 +4150,7 @@ function ft(s, t, e) {
4084
4150
  descriptionKey: `gis.layer.${s}.${e.source}.${o}.description`
4085
4151
  };
4086
4152
  }
4087
- function Ya(s, t) {
4153
+ function ei(s, t) {
4088
4154
  if (t === "building") {
4089
4155
  const i = s?.byg041BebyggetAreal ?? s?.byg038SamletBygningsareal, n = s?.byg021BygningensAnvendelse, c = s?.id_lokalId, p = s?.byg026Opførelsesår;
4090
4156
  return {
@@ -4120,7 +4186,7 @@ function Ya(s, t) {
4120
4186
  registryId: a ?? void 0
4121
4187
  };
4122
4188
  }
4123
- class Qa {
4189
+ class oi {
4124
4190
  categoryMap;
4125
4191
  dataViewsBaseUrl;
4126
4192
  getHeaders;
@@ -4132,7 +4198,7 @@ class Qa {
4132
4198
  const e = await this.listAvailableLayers(t);
4133
4199
  return [
4134
4200
  ...new Map(
4135
- e.map((o) => [o.category, x(o.category)])
4201
+ e.map((o) => [o.category, k(o.category)])
4136
4202
  ).values()
4137
4203
  ];
4138
4204
  }
@@ -4147,7 +4213,7 @@ class Qa {
4147
4213
  )
4148
4214
  )).filter(
4149
4215
  (r) => r.status === "fulfilled" && r.value.hasResults
4150
- ).map((r) => ft(this.sourceId, r.value.category, r.value.entry));
4216
+ ).map((r) => yt(this.sourceId, r.value.category, r.value.entry));
4151
4217
  }
4152
4218
  async getFeaturesForLayer(t, e) {
4153
4219
  const o = this._findLayerById(e);
@@ -4161,7 +4227,7 @@ class Qa {
4161
4227
  const o = this.categoryMap[e] ?? [];
4162
4228
  return (await Promise.allSettled(
4163
4229
  o.map((a) => {
4164
- const i = ft(this.sourceId, e, a);
4230
+ const i = yt(this.sourceId, e, a);
4165
4231
  return this.getFeaturesForLayer(t, i.id);
4166
4232
  })
4167
4233
  )).flatMap((a, i) => a.status === "fulfilled" ? a.value : (console.warn(
@@ -4173,7 +4239,7 @@ class Qa {
4173
4239
  _findLayerById(t) {
4174
4240
  for (const [e, o] of Object.entries(this.categoryMap))
4175
4241
  for (const r of o) {
4176
- const a = ft(this.sourceId, e, r);
4242
+ const a = yt(this.sourceId, e, r);
4177
4243
  if (a.id === t) return { entry: r, descriptor: a };
4178
4244
  }
4179
4245
  }
@@ -4192,7 +4258,7 @@ class Qa {
4192
4258
  return d.json();
4193
4259
  }
4194
4260
  _toGisFeature(t, e, o) {
4195
- const [r, a] = Wa(t.geometry), i = t.id ?? `${e.sourceLayerId}/${o}`, n = Va(t.properties, i), c = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, p = e.tier, h = p === "priority" ? Ya(t.properties, e.category) : void 0;
4261
+ const [r, a] = Qa(t.geometry), i = t.id ?? `${e.sourceLayerId}/${o}`, n = Ka(t.properties, i), c = t.bbox ? [t.bbox[0], t.bbox[1], t.bbox[2], t.bbox[3]] : void 0, p = e.tier, h = p === "priority" ? ei(t.properties, e.category) : void 0;
4196
4262
  return {
4197
4263
  id: i,
4198
4264
  sourceId: this.sourceId,
@@ -4225,20 +4291,20 @@ function $t(s, t) {
4225
4291
  function Ot(s) {
4226
4292
  return s ? s.type === "GeometryCollection" ? (s.geometries ?? []).flatMap((t) => Ot(t)) : [s.coordinates] : [];
4227
4293
  }
4228
- function Ka(s) {
4294
+ function ri(s) {
4229
4295
  let t = 1 / 0, e = 1 / 0, o = -1 / 0, r = -1 / 0;
4230
4296
  const a = (i) => {
4231
4297
  i[0] < t && (t = i[0]), i[1] < e && (e = i[1]), i[0] > o && (o = i[0]), i[1] > r && (r = i[1]);
4232
4298
  };
4233
4299
  return Ot(s).forEach((i) => $t(i, a)), t === 1 / 0 ? null : [t, e, o, r];
4234
4300
  }
4235
- function Za(s) {
4301
+ function si(s) {
4236
4302
  let t = null;
4237
4303
  for (const e of Ot(s))
4238
4304
  if ($t(e, (o) => t ??= o), t) break;
4239
4305
  return t ?? [0, 0];
4240
4306
  }
4241
- function ti(s, t) {
4307
+ function ai(s, t) {
4242
4308
  if (s) {
4243
4309
  for (const e of ["name", "Name", "title", "Title", "label", "Label"])
4244
4310
  if (typeof s[e] == "string" && s[e]) return s[e];
@@ -4255,19 +4321,19 @@ class Rt {
4255
4321
  this.dataViewsBaseUrl = t.dataViewsBaseUrl.replace(/\/$/, ""), this.getHeaders = t.getHeaders, this.sourceId = t.sourceId ?? "cue-gis-sources";
4256
4322
  }
4257
4323
  async listFeatureCategoryDescriptors(t) {
4258
- return (await this.listAvailableLayers(t)).length > 0 ? [x("custom")] : [];
4324
+ return (await this.listAvailableLayers(t)).length > 0 ? [k("custom")] : [];
4259
4325
  }
4260
4326
  async listFeatureCategories(t) {
4261
4327
  return (await this.listAvailableLayers(t)).length > 0 ? ["custom"] : [];
4262
4328
  }
4263
4329
  async listAvailableLayers(t) {
4264
- return (await this._listSources()).filter((o) => o.bbox !== null && N(o.bbox, t)).map((o) => this._toLayerDescriptor(o));
4330
+ return (await this._listSources()).filter((o) => o.bbox !== null && j(o.bbox, t)).map((o) => this._toLayerDescriptor(o));
4265
4331
  }
4266
4332
  async getFeaturesForLayer(t, e) {
4267
4333
  const o = this._idFromLayerId(e);
4268
4334
  if (!o) return [];
4269
4335
  const r = await this._getSource(o);
4270
- return r ? r.featureCollection.features.map((a, i) => ({ feature: a, index: i, bbox: Ka(a.geometry) })).filter((a) => a.bbox !== null && N(a.bbox, t)).map((a) => this._toGisFeature(a.feature, r, a.index)) : [];
4336
+ return r ? r.featureCollection.features.map((a, i) => ({ feature: a, index: i, bbox: ri(a.geometry) })).filter((a) => a.bbox !== null && j(a.bbox, t)).map((a) => this._toGisFeature(a.feature, r, a.index)) : [];
4271
4337
  }
4272
4338
  async getFeaturesOfCategory(t, e) {
4273
4339
  if (e !== "custom") return [];
@@ -4276,7 +4342,7 @@ class Rt {
4276
4342
  }
4277
4343
  // ─── Private helpers ────────────────────────────────────────────────────────
4278
4344
  _toLayerDescriptor(t) {
4279
- const e = x("custom");
4345
+ const e = k("custom");
4280
4346
  return {
4281
4347
  id: `${this.sourceId}:${t.id}`,
4282
4348
  sourceId: this.sourceId,
@@ -4293,7 +4359,7 @@ class Rt {
4293
4359
  return t.startsWith(e) ? t.slice(e.length) : null;
4294
4360
  }
4295
4361
  _toGisFeature(t, e, o) {
4296
- const [r, a] = Za(t.geometry), i = t.id !== void 0 ? String(t.id) : `${e.id}/${o}`, n = t.properties ?? {}, c = ti(n, `${e.name} #${o + 1}`);
4362
+ const [r, a] = si(t.geometry), i = t.id !== void 0 ? String(t.id) : `${e.id}/${o}`, n = t.properties ?? {}, c = ai(n, `${e.name} #${o + 1}`);
4297
4363
  return {
4298
4364
  id: `${this.sourceId}:${e.id}:${i}`,
4299
4365
  sourceId: this.sourceId,
@@ -4301,7 +4367,7 @@ class Rt {
4301
4367
  layerId: `${this.sourceId}:${e.id}`,
4302
4368
  name: c,
4303
4369
  category: "custom",
4304
- preferredColor: x("custom").preferredColor,
4370
+ preferredColor: k("custom").preferredColor,
4305
4371
  type: "custom",
4306
4372
  lat: a,
4307
4373
  lon: r,
@@ -4331,7 +4397,7 @@ class Rt {
4331
4397
  return await r.json();
4332
4398
  }
4333
4399
  }
4334
- const ei = {
4400
+ const ii = {
4335
4401
  address: [
4336
4402
  "ms:ogd-0406_arv_basis_avzh_hausnummer_pos_p",
4337
4403
  "ms:ogd-0571_afv_gv_strat_strassennetz_l"
@@ -4382,22 +4448,22 @@ const ei = {
4382
4448
  }, Ve = [
4383
4449
  {
4384
4450
  name: "Canton of Zürich",
4385
- coverageBBox: $a,
4451
+ coverageBBox: Da,
4386
4452
  supportedCategories: ["address", "poi", "railway", "natural", "manmade", "building", "cadastre", "greenspace", "paved", "zone"],
4387
4453
  priority: 10,
4388
- adapter: new wt({
4389
- categoryMap: ei,
4454
+ adapter: new ft({
4455
+ categoryMap: ii,
4390
4456
  // maps.zh.ch (MapServer) ignores srsName and always operates in LV95.
4391
4457
  nativeCrs: "EPSG:2056"
4392
4458
  })
4393
4459
  },
4394
4460
  {
4395
4461
  name: "Switzerland (national AV cadastre)",
4396
- coverageBBox: Oa,
4462
+ coverageBBox: Na,
4397
4463
  supportedCategories: ["cadastre"],
4398
4464
  priority: 5,
4399
4465
  // Lower priority than canton-specific adapters. For ZH, the canton adapter (priority 10) wins.
4400
- adapter: new wt({
4466
+ adapter: new ft({
4401
4467
  sourceId: "swiss-av-wfs",
4402
4468
  baseUrl: "https://wfs.geodienste.ch/av_0/deu",
4403
4469
  categoryMap: {
@@ -4424,7 +4490,7 @@ const ei = {
4424
4490
  coverageBBox: He,
4425
4491
  supportedCategories: ["zone"],
4426
4492
  priority: 10,
4427
- adapter: new wt({
4493
+ adapter: new ft({
4428
4494
  sourceId: "danish-plandata",
4429
4495
  baseUrl: "https://wfs.plandata.dk/geoserver/pdk/wfs",
4430
4496
  outputFormat: "application/json",
@@ -4444,7 +4510,7 @@ function pe(s) {
4444
4510
  (t, e) => vt.indexOf(t.category) - vt.indexOf(e.category)
4445
4511
  );
4446
4512
  }
4447
- class oi {
4513
+ class ni {
4448
4514
  nominatim;
4449
4515
  regions;
4450
4516
  /**
@@ -4459,9 +4525,9 @@ class oi {
4459
4525
  zonePlanTypeColors: r,
4460
4526
  ...a
4461
4527
  } = t;
4462
- this.nominatim = new ba(a);
4528
+ this.nominatim = new Sa(a);
4463
4529
  const i = o ? Ve : [];
4464
- this.regions = e ?? i, this.zonePlanTypeColors = { ...ga, ...r };
4530
+ this.regions = e ?? i, this.zonePlanTypeColors = { ...ba, ...r };
4465
4531
  }
4466
4532
  /**
4467
4533
  * Return the available feature categories together with UI metadata such as
@@ -4474,14 +4540,14 @@ class oi {
4474
4540
  * @param bbox [west, south, east, north] in WGS-84 decimal degrees
4475
4541
  */
4476
4542
  async listFeatureCategoryDescriptors(t) {
4477
- const e = this.regions.filter((r) => N(r.coverageBBox, t) && r.supportedCategories).sort((r, a) => (a.priority ?? 0) - (r.priority ?? 0));
4543
+ const e = this.regions.filter((r) => j(r.coverageBBox, t) && r.supportedCategories).sort((r, a) => (a.priority ?? 0) - (r.priority ?? 0));
4478
4544
  if (e.length > 0) {
4479
4545
  const r = /* @__PURE__ */ new Set(), a = [];
4480
4546
  for (const i of e)
4481
4547
  for (const n of i.supportedCategories ?? [])
4482
- r.has(n) || (r.add(n), a.push(x(n)));
4548
+ r.has(n) || (r.add(n), a.push(k(n)));
4483
4549
  for (const i of Et)
4484
- r.has(i) || a.push(x(i));
4550
+ r.has(i) || a.push(k(i));
4485
4551
  return pe(a);
4486
4552
  }
4487
4553
  const o = await this._adapterFor(t).listFeatureCategoryDescriptors(t);
@@ -4535,7 +4601,7 @@ class oi {
4535
4601
  console.log(" • Nominatim (OSM) bbox=[global] priority=-1");
4536
4602
  const r = [
4537
4603
  ...this.regions.filter(
4538
- (n) => N(n.coverageBBox, t) && (!n.supportedCategories || n.supportedCategories.includes(e))
4604
+ (n) => j(n.coverageBBox, t) && (!n.supportedCategories || n.supportedCategories.includes(e))
4539
4605
  ).map((n) => ({
4540
4606
  name: n.name,
4541
4607
  adapter: n.adapter,
@@ -4558,8 +4624,8 @@ class oi {
4558
4624
  const { features: n, idx: c } = await Promise.race(i.values());
4559
4625
  i.delete(c);
4560
4626
  for (const p of n) {
4561
- const h = le(p), d = at(p), u = a.get(h);
4562
- (u === void 0 || d > u) && (a.set(h, d), yield p);
4627
+ const h = le(p), d = nt(p), g = a.get(h);
4628
+ (g === void 0 || d > g) && (a.set(h, d), yield p);
4563
4629
  }
4564
4630
  }
4565
4631
  }
@@ -4579,23 +4645,23 @@ class oi {
4579
4645
  async getFeaturesOfCategory(t, e) {
4580
4646
  const r = [
4581
4647
  ...this.regions.filter(
4582
- (d) => N(d.coverageBBox, t) && (!d.supportedCategories || d.supportedCategories.includes(e))
4648
+ (d) => j(d.coverageBBox, t) && (!d.supportedCategories || d.supportedCategories.includes(e))
4583
4649
  ).map((d) => ({ name: d.name, adapter: d.adapter, isNominatim: !1 })),
4584
4650
  { name: "Nominatim (OSM)", adapter: this.nominatim, isNominatim: !0 }
4585
4651
  ], a = await Promise.allSettled(
4586
4652
  r.map(
4587
- (d) => d.adapter.getFeaturesOfCategory(t, e).then((u) => ({
4588
- features: u,
4653
+ (d) => d.adapter.getFeaturesOfCategory(t, e).then((g) => ({
4654
+ features: g,
4589
4655
  isNominatim: d.isNominatim
4590
- })).catch((u) => (console.warn(`[GisGateway] Source "${d.name}" failed:`, u), { features: [], isNominatim: d.isNominatim }))
4656
+ })).catch((g) => (console.warn(`[GisGateway] Source "${d.name}" failed:`, g), { features: [], isNominatim: d.isNominatim }))
4591
4657
  )
4592
4658
  ), i = [], n = [];
4593
4659
  for (const d of a)
4594
4660
  d.status === "fulfilled" && (d.value.isNominatim ? n.push(...d.value.features) : i.push(...d.value.features));
4595
- const c = ai(i, n), p = /* @__PURE__ */ new Map(), h = [];
4661
+ const c = li(i, n), p = /* @__PURE__ */ new Map(), h = [];
4596
4662
  for (const d of c) {
4597
- const u = le(d), w = at(d), f = p.get(u);
4598
- (f === void 0 || w > f) && (p.set(u, w), h.push(d));
4663
+ const g = le(d), w = nt(d), f = p.get(g);
4664
+ (f === void 0 || w > f) && (p.set(g, w), h.push(d));
4599
4665
  }
4600
4666
  return h;
4601
4667
  }
@@ -4605,10 +4671,10 @@ class oi {
4605
4671
  }
4606
4672
  /** Resolve the best adapter for a query bbox (legacy single-adapter routing). */
4607
4673
  _adapterFor(t) {
4608
- return this.regions.filter((o) => N(o.coverageBBox, t)).sort((o, r) => (r.priority ?? 0) - (o.priority ?? 0))[0]?.adapter ?? this.nominatim;
4674
+ return this.regions.filter((o) => j(o.coverageBBox, t)).sort((o, r) => (r.priority ?? 0) - (o.priority ?? 0))[0]?.adapter ?? this.nominatim;
4609
4675
  }
4610
4676
  }
4611
- function at(s) {
4677
+ function nt(s) {
4612
4678
  const t = s.geometry?.type;
4613
4679
  return t === "Polygon" || t === "MultiPolygon" ? 3 : t === "LineString" || t === "MultiLineString" ? 2 : 1;
4614
4680
  }
@@ -4616,18 +4682,18 @@ function le(s) {
4616
4682
  const t = Math.round(s.lat * 1e3) / 1e3, e = Math.round(s.lon * 1e3) / 1e3;
4617
4683
  return `${(s.name ?? s.id ?? "").toLowerCase().trim()}|${t}|${e}`;
4618
4684
  }
4619
- const ri = 1e-3;
4620
- function si(s, t) {
4685
+ const ci = 1e-3;
4686
+ function pi(s, t) {
4621
4687
  const e = s.lat - t.lat, o = s.lon - t.lon;
4622
4688
  return Math.sqrt(e * e + o * o);
4623
4689
  }
4624
- function ai(s, t) {
4690
+ function li(s, t) {
4625
4691
  if (t.length === 0) return s;
4626
- const e = s.filter((i) => at(i) === 3), o = s.filter((i) => at(i) !== 3), r = e.map((i) => ({ feature: { ...i, originalData: { ...i.originalData } }, matched: !1 })), a = [];
4692
+ const e = s.filter((i) => nt(i) === 3), o = s.filter((i) => nt(i) !== 3), r = e.map((i) => ({ feature: { ...i, originalData: { ...i.originalData } }, matched: !1 })), a = [];
4627
4693
  for (const i of t) {
4628
- let n = -1, c = ri;
4694
+ let n = -1, c = ci;
4629
4695
  for (let p = 0; p < r.length; p++) {
4630
- const h = si(i, r[p].feature);
4696
+ const h = pi(i, r[p].feature);
4631
4697
  h < c && (c = h, n = p);
4632
4698
  }
4633
4699
  n >= 0 ? (r[n].feature.originalData = {
@@ -4641,8 +4707,8 @@ function ai(s, t) {
4641
4707
  ...a
4642
4708
  ];
4643
4709
  }
4644
- const ii = 1500, ni = [-180, -90, 180, 90];
4645
- class ci {
4710
+ const hi = 1500, di = [-180, -90, 180, 90];
4711
+ class ui {
4646
4712
  // undefined = not yet built
4647
4713
  /** @internal — construct via `cue.gis`, not directly. */
4648
4714
  constructor(t, e) {
@@ -4725,7 +4791,7 @@ class ci {
4725
4791
  }
4726
4792
  // ── Private ───────────────────────────────────────────────────────────────
4727
4793
  _scheduleDebouncedQuery() {
4728
- this._debounceTimer !== null && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => this._queryLayers(), ii);
4794
+ this._debounceTimer !== null && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => this._queryLayers(), hi);
4729
4795
  }
4730
4796
  _getGateway() {
4731
4797
  if (this._gatewayCache !== null && this._gatewayProjectId === this._projectId)
@@ -4742,24 +4808,24 @@ class ci {
4742
4808
  coverageBBox: He,
4743
4809
  supportedCategories: Object.keys(We),
4744
4810
  priority: 10,
4745
- adapter: new Qa({
4746
- dataViewsBaseUrl: `${this._gatewayUrl}${g}`,
4811
+ adapter: new oi({
4812
+ dataViewsBaseUrl: `${this._gatewayUrl}${u}`,
4747
4813
  getHeaders: o
4748
4814
  })
4749
4815
  },
4750
4816
  {
4751
4817
  name: "Cue SDK (GIS sources)",
4752
- coverageBBox: ni,
4818
+ coverageBBox: di,
4753
4819
  supportedCategories: ["custom"],
4754
4820
  priority: 10,
4755
4821
  adapter: new Rt({
4756
- dataViewsBaseUrl: `${this._gatewayUrl}${g}`,
4822
+ dataViewsBaseUrl: `${this._gatewayUrl}${u}`,
4757
4823
  getHeaders: o
4758
4824
  })
4759
4825
  }
4760
4826
  );
4761
4827
  }
4762
- return this._gatewayCache = new oi({ regions: e }), this._gatewayProjectId = t, this._gatewayCache;
4828
+ return this._gatewayCache = new ni({ regions: e }), this._gatewayProjectId = t, this._gatewayCache;
4763
4829
  }
4764
4830
  async _queryLayers() {
4765
4831
  const t = this._bbox;
@@ -4821,7 +4887,7 @@ class he {
4821
4887
  * Throws if a project with the given ID already exists.
4822
4888
  */
4823
4889
  async createProject(t) {
4824
- const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Xr}`, {
4890
+ const e = await this._auth.authenticatedFetch(`${this._gatewayUrl}${Kr}`, {
4825
4891
  method: "POST",
4826
4892
  headers: { "Content-Type": "application/json" },
4827
4893
  body: JSON.stringify(t)
@@ -4872,7 +4938,7 @@ class he {
4872
4938
  */
4873
4939
  async inviteUserToProject(t, e, o) {
4874
4940
  const r = await this._auth.authenticatedFetch(
4875
- `${this._gatewayUrl}${Kr(e)}`,
4941
+ `${this._gatewayUrl}${os(e)}`,
4876
4942
  {
4877
4943
  method: "POST",
4878
4944
  headers: { "Content-Type": "application/json" },
@@ -4891,7 +4957,7 @@ class he {
4891
4957
  /** Change an existing member's role on a project. */
4892
4958
  async changeUserRoleOnProject(t, e, o) {
4893
4959
  const r = await this._auth.authenticatedFetch(
4894
- `${this._gatewayUrl}${Zr(e, t)}`,
4960
+ `${this._gatewayUrl}${rs(e, t)}`,
4895
4961
  {
4896
4962
  method: "PUT",
4897
4963
  headers: { "Content-Type": "application/json" },
@@ -4906,7 +4972,7 @@ class he {
4906
4972
  /** Remove a member from a project. */
4907
4973
  async removeUserFromProject(t, e) {
4908
4974
  const o = await this._auth.authenticatedFetch(
4909
- `${this._gatewayUrl}${ts(e, t)}`,
4975
+ `${this._gatewayUrl}${ss(e, t)}`,
4910
4976
  { method: "DELETE" }
4911
4977
  );
4912
4978
  if (!o.ok) {
@@ -4922,7 +4988,7 @@ class he {
4922
4988
  */
4923
4989
  async deleteProject(t, e = !1) {
4924
4990
  const o = e ? "?hard=true" : "", r = await this._auth.authenticatedFetch(
4925
- `${this._gatewayUrl}${Jr(t)}${o}`,
4991
+ `${this._gatewayUrl}${Zr(t)}${o}`,
4926
4992
  { method: "DELETE" }
4927
4993
  );
4928
4994
  if (!r.ok) {
@@ -4936,7 +5002,7 @@ class he {
4936
5002
  */
4937
5003
  async restoreProject(t) {
4938
5004
  const e = await this._auth.authenticatedFetch(
4939
- `${this._gatewayUrl}${Qr(t)}`,
5005
+ `${this._gatewayUrl}${es(t)}`,
4940
5006
  { method: "POST" }
4941
5007
  );
4942
5008
  if (!e.ok) {
@@ -4953,7 +5019,7 @@ class he {
4953
5019
  */
4954
5020
  async getProjectMetadata(t) {
4955
5021
  const e = await this._auth.authenticatedFetch(
4956
- `${this._gatewayUrl}${es(t)}`
5022
+ `${this._gatewayUrl}${as(t)}`
4957
5023
  );
4958
5024
  if (!e.ok) {
4959
5025
  const o = await e.text().catch(() => "");
@@ -4976,7 +5042,7 @@ class he {
4976
5042
  */
4977
5043
  async updateProject(t, e) {
4978
5044
  const o = await this._auth.authenticatedFetch(
4979
- `${this._gatewayUrl}${Yr(t)}`,
5045
+ `${this._gatewayUrl}${ts(t)}`,
4980
5046
  {
4981
5047
  method: "PUT",
4982
5048
  headers: { "Content-Type": "application/json" },
@@ -4992,7 +5058,7 @@ class he {
4992
5058
  /** Sets a project's portal-only metadata. Omit a field to leave it untouched, `null` to clear it. */
4993
5059
  async setProjectMetadata(t, e) {
4994
5060
  const o = await this._auth.authenticatedFetch(
4995
- `${this._gatewayUrl}${os(t)}`,
5061
+ `${this._gatewayUrl}${is(t)}`,
4996
5062
  {
4997
5063
  method: "PUT",
4998
5064
  headers: { "Content-Type": "application/json" },
@@ -5041,7 +5107,7 @@ class de {
5041
5107
  async getSignInMethods() {
5042
5108
  const t = this._auth.currentUser;
5043
5109
  if (!t?.email) throw new Error("User has no e-mail");
5044
- return _o(this._auth.firebaseAuth, t.email);
5110
+ return To(this._auth.firebaseAuth, t.email);
5045
5111
  }
5046
5112
  /** Builds a human-readable label from a Firebase UserInfo provider entry. */
5047
5113
  buildProviderLabel(t) {
@@ -5054,38 +5120,38 @@ class de {
5054
5120
  }
5055
5121
  /** Links a Google or Microsoft provider to the current account via popup. Returns the new provider label. */
5056
5122
  async linkProvider(t) {
5057
- const e = this._requireUser(), o = t === "google.com" ? new bt() : new _t(t), a = (await vo(e, o)).user.providerData.find(
5123
+ const e = this._requireUser(), o = t === "google.com" ? new tt() : new _t(t), a = (await So(e, o)).user.providerData.find(
5058
5124
  (i) => i.providerId === t
5059
5125
  );
5060
5126
  return a ? this.buildProviderLabel(a) : "-";
5061
5127
  }
5062
5128
  /** Unlinks a provider from the current account. */
5063
5129
  async unlinkProvider(t) {
5064
- await Eo(this._requireUser(), t);
5130
+ await Io(this._requireUser(), t);
5065
5131
  }
5066
5132
  /** Changes the password. Reauthenticates first. */
5067
5133
  async updatePassword(t, e) {
5068
5134
  const o = this._requireUser();
5069
5135
  if (!o.email) throw new Error("User has no e-mail");
5070
- await Ut(
5136
+ await Co(
5071
5137
  o,
5072
- pt.credential(o.email, t)
5073
- ), await To(o, e);
5138
+ Ut.credential(o.email, t)
5139
+ ), await ko(o, e);
5074
5140
  }
5075
5141
  /** Adds (sets) a password for an account that currently only uses SSO. */
5076
5142
  async addPassword(t) {
5077
5143
  const e = this._requireUser();
5078
5144
  if (!e.email) throw new Error("User has no e-mail");
5079
- await So(e, pt.credential(e.email, t));
5145
+ await xo(e, Ut.credential(e.email, t));
5080
5146
  }
5081
- /** Requests an e-mail change. Sends a verification e-mail to the new address. */
5147
+ /**
5148
+ * Requests an e-mail change. The backend checks `password` and sends a
5149
+ * confirmation link to the new address; the change happens when it's
5150
+ * followed. Throws `CueRequestError` with `code` 'wrongPassword' |
5151
+ * 'emailExists' | 'sameEmail' | 'noEmail' | 'tooManyAttempts'.
5152
+ */
5082
5153
  async updateEmail(t, e) {
5083
- const o = this._requireUser();
5084
- if (!o.email) throw new Error("User e-mail not available");
5085
- await Ut(
5086
- o,
5087
- pt.credential(o.email, e)
5088
- ), await Io(o, t), await Co(o);
5154
+ await this._fetchCoded(ir, { newEmail: t, password: e });
5089
5155
  }
5090
5156
  /** Creates a new API key for the current user. */
5091
5157
  async createAPIKey(t) {
@@ -5112,7 +5178,7 @@ class de {
5112
5178
  }
5113
5179
  /** Returns organizations the current user is a member of. */
5114
5180
  async listOrganizations() {
5115
- return this._fetch(tr);
5181
+ return this._fetch(or);
5116
5182
  }
5117
5183
  /**
5118
5184
  * Creates an organisation with the current user as its admin — for a user
@@ -5122,7 +5188,7 @@ class de {
5122
5188
  * 'alreadyInOrganisation' when the user already belongs to one.
5123
5189
  */
5124
5190
  async createOwnOrganization(t, e) {
5125
- return this._fetchCoded(wr, { orgName: t, plan: e });
5191
+ return this._fetchCoded(_r, { orgName: t, plan: e });
5126
5192
  }
5127
5193
  /**
5128
5194
  * Asks to join the organisation owning `domain` (e.g. `qaecy.com`); its
@@ -5131,7 +5197,7 @@ class de {
5131
5197
  * with `code` 'emailNotVerified' | 'invalidDomain'.
5132
5198
  */
5133
5199
  async requestToJoinOrganization(t) {
5134
- await this._fetchCoded(fr, { domain: t });
5200
+ await this._fetchCoded(vr, { domain: t });
5135
5201
  }
5136
5202
  /**
5137
5203
  * Joins the organisation owning the current user's email domain — only once
@@ -5140,7 +5206,7 @@ class de {
5140
5206
  * email is unverified or no organisation owns the domain.
5141
5207
  */
5142
5208
  async joinOrganizationByEmailDomain() {
5143
- return this._fetchCoded(yr, {});
5209
+ return this._fetchCoded(Er, {});
5144
5210
  }
5145
5211
  /** POSTs JSON and surfaces the backend's error `code`, for calls whose failures a UI maps. */
5146
5212
  async _fetchCoded(t, e) {
@@ -5151,7 +5217,7 @@ class de {
5151
5217
  });
5152
5218
  if (!o.ok) {
5153
5219
  const a = await o.json().catch(() => ({}));
5154
- throw new kt(
5220
+ throw new xt(
5155
5221
  a?.message ?? `Profile API error ${o.status}: ${o.statusText}`,
5156
5222
  o.status,
5157
5223
  a?.code
@@ -5162,15 +5228,15 @@ class de {
5162
5228
  }
5163
5229
  /** Returns all members of the given organisation. Caller must be an org admin or superadmin. */
5164
5230
  async getOrgMembers(t) {
5165
- return this._fetch(ar(t));
5231
+ return this._fetch(cr(t));
5166
5232
  }
5167
5233
  /** Returns just the given organisation's admins. Caller must be a member (or admin/superadmin). */
5168
5234
  async getOrgAdmins(t) {
5169
- return this._fetch(ir(t));
5235
+ return this._fetch(pr(t));
5170
5236
  }
5171
5237
  /** Adds a new member to the organisation. Caller must be an org admin or superadmin. */
5172
5238
  async addOrgMember(t, e) {
5173
- await this._fetch(Tr(t), {
5239
+ await this._fetch(kr(t), {
5174
5240
  method: "POST",
5175
5241
  headers: { "Content-Type": "application/json" },
5176
5242
  body: JSON.stringify(e)
@@ -5178,7 +5244,7 @@ class de {
5178
5244
  }
5179
5245
  /** Changes an existing member's role within the organisation. Caller must be an org admin or superadmin. */
5180
5246
  async setOrgUserRole(t, e, o) {
5181
- await this._fetch(Sr(t, e), {
5247
+ await this._fetch(xr(t, e), {
5182
5248
  method: "PUT",
5183
5249
  headers: { "Content-Type": "application/json" },
5184
5250
  body: JSON.stringify({ role: o })
@@ -5186,7 +5252,7 @@ class de {
5186
5252
  }
5187
5253
  /** Removes a member from the organisation, optionally also removing them from every project they belong to. Caller must be an org admin or superadmin. */
5188
5254
  async removeOrgMember(t, e, o) {
5189
- await this._fetch(Ir(t, e), {
5255
+ await this._fetch($r(t, e), {
5190
5256
  method: "DELETE",
5191
5257
  headers: { "Content-Type": "application/json" },
5192
5258
  body: JSON.stringify({ removeFromProjects: o })
@@ -5212,7 +5278,7 @@ class de {
5212
5278
  * or superadmin.
5213
5279
  */
5214
5280
  async getOrgConsumptionReport(t) {
5215
- return this._fetch(nr(t));
5281
+ return this._fetch(lr(t));
5216
5282
  }
5217
5283
  /**
5218
5284
  * Per-file-extension credit/unit breakdown for one project within `[from, to)` (UTC ISO 8601,
@@ -5225,7 +5291,7 @@ class de {
5225
5291
  async getProjectFileTypeBreakdown(t, e, o, r) {
5226
5292
  const a = new URLSearchParams({ from: o, to: r });
5227
5293
  return this._fetch(
5228
- `${cr(t, e)}?${a}`
5294
+ `${hr(t, e)}?${a}`
5229
5295
  );
5230
5296
  }
5231
5297
  /**
@@ -5238,7 +5304,7 @@ class de {
5238
5304
  */
5239
5305
  async getProjectTrafficReport(t, e, o, r) {
5240
5306
  return this._fetch(
5241
- `${pr(t, e)}${this._rangeQuery(o, r)}`
5307
+ `${dr(t, e)}${this._rangeQuery(o, r)}`
5242
5308
  );
5243
5309
  }
5244
5310
  /**
@@ -5248,7 +5314,7 @@ class de {
5248
5314
  */
5249
5315
  async getProjectUsageReport(t, e, o, r) {
5250
5316
  return this._fetch(
5251
- `${lr(t, e)}${this._rangeQuery(o, r)}`
5317
+ `${ur(t, e)}${this._rangeQuery(o, r)}`
5252
5318
  );
5253
5319
  }
5254
5320
  /** `?from=…&to=…`, or `''` when unbounded — the backend treats missing bounds as "everything". */
@@ -5260,7 +5326,7 @@ class de {
5260
5326
  }
5261
5327
  /** Manual/support credit grant to an organisation's shared pool. Superadmins only — org admins self-serve via `startOrgCheckout`. */
5262
5328
  async topUpOrgCredits(t, e) {
5263
- await this._fetch(br(t), {
5329
+ await this._fetch(Tr(t), {
5264
5330
  method: "POST",
5265
5331
  headers: { "Content-Type": "application/json" },
5266
5332
  body: JSON.stringify({ amount: e })
@@ -5276,7 +5342,7 @@ class de {
5276
5342
  * granted by the backend webhook once payment completes.
5277
5343
  */
5278
5344
  async startOrgCheckout(t, e) {
5279
- return this._fetch(vr(t), {
5345
+ return this._fetch(Ir(t), {
5280
5346
  method: "POST",
5281
5347
  headers: { "Content-Type": "application/json" },
5282
5348
  body: JSON.stringify({ credits: e })
@@ -5288,7 +5354,7 @@ class de {
5288
5354
  * an org admin; requires the org to have a Stripe customer.
5289
5355
  */
5290
5356
  async startOrgBillingPortal(t) {
5291
- return this._fetch(Er(t), { method: "POST" });
5357
+ return this._fetch(Cr(t), { method: "POST" });
5292
5358
  }
5293
5359
  /**
5294
5360
  * Change an organisation's plan — freemium → custom (first paid plan), or
@@ -5301,7 +5367,7 @@ class de {
5301
5367
  * {@link startOrgBillingPortal} instead — this throws if called on one.
5302
5368
  */
5303
5369
  async changeOrgPlan(t, e) {
5304
- return this._fetch(_r(t), {
5370
+ return this._fetch(Sr(t), {
5305
5371
  method: "POST",
5306
5372
  headers: { "Content-Type": "application/json" },
5307
5373
  body: JSON.stringify(e)
@@ -5314,7 +5380,7 @@ class de {
5314
5380
  }
5315
5381
  /** Record that the current user has accepted the terms of service. Sets a `terms` custom claim on the token. */
5316
5382
  async acceptTerms(t) {
5317
- await this._fetch(er, {
5383
+ await this._fetch(rr, {
5318
5384
  method: "POST",
5319
5385
  headers: { "Content-Type": "application/json" },
5320
5386
  body: JSON.stringify({ version: t })
@@ -5328,7 +5394,7 @@ class de {
5328
5394
  */
5329
5395
  async latestTermsAccepted() {
5330
5396
  const t = this._auth.currentUser;
5331
- return t ? (await ot(t)).claims.terms ?? null : null;
5397
+ return t ? (await st(t)).claims.terms ?? null : null;
5332
5398
  }
5333
5399
  /**
5334
5400
  * Record that the current user has been shown (and dismissed) the usage-analytics
@@ -5336,7 +5402,7 @@ class de {
5336
5402
  * `terms`, since this is a lightweight acknowledgement, not a blocking agreement.
5337
5403
  */
5338
5404
  async acceptAnalyticsNotice(t) {
5339
- await this._fetch(rr, {
5405
+ await this._fetch(ar, {
5340
5406
  method: "POST",
5341
5407
  headers: { "Content-Type": "application/json" },
5342
5408
  body: JSON.stringify({ version: t })
@@ -5351,7 +5417,7 @@ class de {
5351
5417
  */
5352
5418
  async latestAnalyticsNoticeAccepted() {
5353
5419
  const t = this._auth.currentUser;
5354
- return t ? (await ot(t)).claims.analyticsNotice ?? null : null;
5420
+ return t ? (await st(t)).claims.analyticsNotice ?? null : null;
5355
5421
  }
5356
5422
  }
5357
5423
  class ue {
@@ -5367,7 +5433,7 @@ class ue {
5367
5433
  * break navigation; failures are only logged.
5368
5434
  */
5369
5435
  recordView(t, e) {
5370
- this._auth.authenticatedFetch(`${this._gatewayUrl}${sr}`, {
5436
+ this._auth.authenticatedFetch(`${this._gatewayUrl}${nr}`, {
5371
5437
  method: "POST",
5372
5438
  headers: { "Content-Type": "application/json" },
5373
5439
  body: JSON.stringify({ view: t, projectId: e })
@@ -5383,7 +5449,7 @@ class ge {
5383
5449
  async _fetch(t, e) {
5384
5450
  const o = await this._auth.authenticatedFetch(`${this._gatewayUrl}${t}`, e);
5385
5451
  if (!o.ok)
5386
- throw new kt(`Admin API error ${o.status}: ${o.statusText}`, o.status);
5452
+ throw new xt(`Admin API error ${o.status}: ${o.statusText}`, o.status);
5387
5453
  const r = await o.text();
5388
5454
  return r ? JSON.parse(r) : null;
5389
5455
  }
@@ -5393,11 +5459,11 @@ class ge {
5393
5459
  }
5394
5460
  /** Matches organisations on name, id or any alternative id. */
5395
5461
  searchOrganizations(t) {
5396
- return this._search(xr, t);
5462
+ return this._search(Rr, t);
5397
5463
  }
5398
5464
  /** Matches users on display name, e-mail, or an exact uid. */
5399
5465
  searchUsers(t) {
5400
- return this._search(Or, t);
5466
+ return this._search(Dr, t);
5401
5467
  }
5402
5468
  /**
5403
5469
  * Matches projects on name, id or any alternative id, across every organisation.
@@ -5405,18 +5471,18 @@ class ge {
5405
5471
  */
5406
5472
  searchProjects(t, e = !1) {
5407
5473
  return this._search(
5408
- $r,
5474
+ Pr,
5409
5475
  t,
5410
5476
  e ? { includeDeleted: "true" } : void 0
5411
5477
  );
5412
5478
  }
5413
5479
  /** Full profile for one user: auth record, orgs and projects they belong to. */
5414
5480
  getUserDetail(t) {
5415
- return this._fetch(Rr(t));
5481
+ return this._fetch(Nr(t));
5416
5482
  }
5417
5483
  /** Every organisation on the platform. Unpaginated — prefer `searchOrganizations`. */
5418
5484
  listOrganizations() {
5419
- return this._fetch(Cr);
5485
+ return this._fetch(Or);
5420
5486
  }
5421
5487
  /**
5422
5488
  * Every project owned by `orgId`, regardless of the caller's membership.
@@ -5424,11 +5490,11 @@ class ge {
5424
5490
  * membership) this is what lets a superadmin open a foreign org's projects.
5425
5491
  */
5426
5492
  listOrgProjects(t) {
5427
- return this._fetch(kr(t));
5493
+ return this._fetch(Ar(t));
5428
5494
  }
5429
5495
  /** Every user holding the `superadmin` custom claim. */
5430
5496
  listSuperadmins() {
5431
- return this._fetch(Ar);
5497
+ return this._fetch(jr);
5432
5498
  }
5433
5499
  /**
5434
5500
  * Deletes the Auth account and profile doc, and scrubs every org/project
@@ -5457,7 +5523,7 @@ class ge {
5457
5523
  * when the project no longer belongs to `expectedCurrentOrganizationID`.
5458
5524
  */
5459
5525
  transferProject(t, e) {
5460
- return this._fetch(Fr(t), {
5526
+ return this._fetch(Gr(t), {
5461
5527
  method: "PUT",
5462
5528
  headers: { "Content-Type": "application/json" },
5463
5529
  body: JSON.stringify(e)
@@ -5468,15 +5534,15 @@ class ge {
5468
5534
  * and re-grants the recorded org/project roles where those still exist.
5469
5535
  */
5470
5536
  restoreUser(t) {
5471
- return this._fetch(Dr(t), { method: "POST" });
5537
+ return this._fetch(Ur(t), { method: "POST" });
5472
5538
  }
5473
5539
  /** Every archived deletion, restored or not — newest first. */
5474
5540
  listDeletedUsers() {
5475
- return this._fetch(Pr);
5541
+ return this._fetch(Lr);
5476
5542
  }
5477
5543
  /** Creates a Firebase Auth account with no organisation — for picking as a new org's initial admin. */
5478
5544
  createAdminUser(t) {
5479
- return this._fetch(Nr, {
5545
+ return this._fetch(Mr, {
5480
5546
  method: "POST",
5481
5547
  headers: { "Content-Type": "application/json" },
5482
5548
  body: JSON.stringify(t)
@@ -5492,7 +5558,7 @@ class ge {
5492
5558
  }
5493
5559
  /** Creates a new organisation with `adminUserId` as its sole admin/member. */
5494
5560
  createOrganization(t) {
5495
- return this._fetch(jr, {
5561
+ return this._fetch(Fr, {
5496
5562
  method: "POST",
5497
5563
  headers: { "Content-Type": "application/json" },
5498
5564
  body: JSON.stringify(t)
@@ -5500,7 +5566,7 @@ class ge {
5500
5566
  }
5501
5567
  /** Sets an organisation's allowed email domains for auto-join sign-up. */
5502
5568
  setOrgDomains(t, e) {
5503
- return this._fetch(Mr(t), {
5569
+ return this._fetch(Br(t), {
5504
5570
  method: "PUT",
5505
5571
  headers: { "Content-Type": "application/json" },
5506
5572
  body: JSON.stringify({ domains: e })
@@ -5514,39 +5580,39 @@ class ge {
5514
5580
  * snapshot, same as a direct `deleteUser`).
5515
5581
  */
5516
5582
  deleteOrganization(t) {
5517
- return this._fetch(Lr(t), { method: "DELETE" });
5583
+ return this._fetch(qr(t), { method: "DELETE" });
5518
5584
  }
5519
5585
  /** Undoes `deleteOrganization`: restores cascaded projects/users where they still can be, then un-flags the org. */
5520
5586
  restoreOrganization(t) {
5521
- return this._fetch(Ur(t), { method: "POST" });
5587
+ return this._fetch(zr(t), { method: "POST" });
5522
5588
  }
5523
5589
  /** Every soft-deleted organisation, restored or not — newest first. */
5524
5590
  listDeletedOrganizations() {
5525
- return this._fetch(qr);
5591
+ return this._fetch(Hr);
5526
5592
  }
5527
5593
  /** Users belonging to no organisation — a data-health diagnostic, not paginated. */
5528
5594
  listUsersWithoutOrg() {
5529
- return this._fetch(zr);
5595
+ return this._fetch(Wr);
5530
5596
  }
5531
5597
  /** Users belonging to no project — a data-health diagnostic, not paginated. */
5532
5598
  listUsersWithoutProject() {
5533
- return this._fetch(Br);
5599
+ return this._fetch(Vr);
5534
5600
  }
5535
5601
  /** Projects with no members, syncers, or admins — a data-health diagnostic. */
5536
5602
  listProjectsWithoutUsers() {
5537
- return this._fetch(Gr);
5603
+ return this._fetch(Xr);
5538
5604
  }
5539
5605
  /** Projects with no admin (may still have members/syncers) — a data-health diagnostic. */
5540
5606
  listProjectsWithoutAdmins() {
5541
- return this._fetch(Hr);
5607
+ return this._fetch(Jr);
5542
5608
  }
5543
5609
  /** Organisations with no members — a data-health diagnostic. */
5544
5610
  listOrgsWithoutUsers() {
5545
- return this._fetch(Wr);
5611
+ return this._fetch(Yr);
5546
5612
  }
5547
5613
  /** Organisations with no admin (may still have members) — a data-health diagnostic. */
5548
5614
  listOrgsWithoutAdmins() {
5549
- return this._fetch(Vr);
5615
+ return this._fetch(Qr);
5550
5616
  }
5551
5617
  }
5552
5618
  const me = ["superadmin", "admin", "syncer", "member"], we = {
@@ -5574,7 +5640,7 @@ const me = ["superadmin", "admin", "syncer", "member"], we = {
5574
5640
  viewUsageStats: "superadmin",
5575
5641
  viewEntities: "member"
5576
5642
  };
5577
- function pi() {
5643
+ function gi() {
5578
5644
  return {
5579
5645
  changeContentCategories: !1,
5580
5646
  createEntities: !1,
@@ -5604,7 +5670,7 @@ function pi() {
5604
5670
  }
5605
5671
  class fe {
5606
5672
  constructor(t) {
5607
- this._isSuperAdmin = t, this._projectRoles = new T([]), this._orgRole = new T(null), this.privileges = xt(
5673
+ this._isSuperAdmin = t, this._projectRoles = new T([]), this._orgRole = new T(null), this.privileges = kt(
5608
5674
  [this._projectRoles, this._orgRole, t],
5609
5675
  () => this._compute()
5610
5676
  );
@@ -5645,7 +5711,7 @@ class fe {
5645
5711
  return e === -1 ? [] : Array.from(me.slice(e));
5646
5712
  }
5647
5713
  _compute() {
5648
- const t = this._projectRoles.get(), e = this._isSuperAdmin.get(), o = pi();
5714
+ const t = this._projectRoles.get(), e = this._isSuperAdmin.get(), o = gi();
5649
5715
  for (const r of Object.keys(we))
5650
5716
  o[r] = t.includes(we[r]);
5651
5717
  return o.createProject = e || this._orgRole.get() === "admin", o;
@@ -5692,9 +5758,9 @@ class ye {
5692
5758
  for (; !p.done; )
5693
5759
  c.push(p.value), p = await n.read();
5694
5760
  const h = c.reduce((w, f) => w + f.length, 0), d = new Uint8Array(h);
5695
- let u = 0;
5761
+ let g = 0;
5696
5762
  for (const w of c)
5697
- d.set(w, u), u += w.length;
5763
+ d.set(w, g), g += w.length;
5698
5764
  return JSON.parse(new TextDecoder().decode(d));
5699
5765
  }
5700
5766
  async _set(t, e, o) {
@@ -5705,9 +5771,9 @@ class ye {
5705
5771
  for (; !p.done; )
5706
5772
  c.push(p.value), p = await n.read();
5707
5773
  const h = c.reduce((w, f) => w + f.length, 0), d = new Uint8Array(h);
5708
- let u = 0;
5774
+ let g = 0;
5709
5775
  for (const w of c)
5710
- d.set(w, u), u += w.length;
5776
+ d.set(w, g), g += w.length;
5711
5777
  await this._blob.uploadBytes(
5712
5778
  "persistence",
5713
5779
  `${t}/${e}.json.gz`,
@@ -5717,7 +5783,7 @@ class ye {
5717
5783
  );
5718
5784
  }
5719
5785
  }
5720
- const Bi = ["CHF", "DKK", "EUR"], Gi = "CHF", li = 3600 * 1e3, hi = "https://api.frankfurter.dev/v1/latest?from=CHF&to=DKK,EUR";
5786
+ const Xi = ["CHF", "DKK", "EUR"], Ji = "CHF", mi = 3600 * 1e3, wi = "https://api.frankfurter.dev/v1/latest?from=CHF&to=DKK,EUR";
5721
5787
  class be {
5722
5788
  _cached = null;
5723
5789
  _pending = null;
@@ -5728,7 +5794,7 @@ class be {
5728
5794
  * throwing — a transient network blip shouldn't break the pricing UI.
5729
5795
  */
5730
5796
  async getRates(t = !1) {
5731
- return !t && this._cached && Date.now() - this._cached.fetchedAt < li ? this._cached : this._pending ? this._pending : (this._pending = this._fetchRates().then((e) => (this._cached = e, e)).catch((e) => {
5797
+ return !t && this._cached && Date.now() - this._cached.fetchedAt < mi ? this._cached : this._pending ? this._pending : (this._pending = this._fetchRates().then((e) => (this._cached = e, e)).catch((e) => {
5732
5798
  if (this._cached) return this._cached;
5733
5799
  throw e;
5734
5800
  }).finally(() => {
@@ -5736,7 +5802,7 @@ class be {
5736
5802
  }), this._pending);
5737
5803
  }
5738
5804
  async _fetchRates() {
5739
- const t = await fetch(hi);
5805
+ const t = await fetch(wi);
5740
5806
  if (!t.ok)
5741
5807
  throw new Error(`Failed to fetch exchange rates: ${t.status} ${t.statusText}`);
5742
5808
  const e = await t.json();
@@ -5776,7 +5842,7 @@ const _ = {
5776
5842
  dicu: "https://w3id.org/digitalconstruction/0.5/Units#",
5777
5843
  diclvl: "https://w3id.org/digitalconstruction/0.5/Levels#",
5778
5844
  dicstg: "https://w3id.org/digitalconstruction/0.5/Stages#"
5779
- }, R = {
5845
+ }, A = {
5780
5846
  madsrdf: "http://www.loc.gov/mads/rdf/v1#",
5781
5847
  bflc: "http://id.loc.gov/ontologies/bflc/",
5782
5848
  foaf: "http://xmlns.com/foaf/0.1/",
@@ -9004,12 +9070,12 @@ const _ = {
9004
9070
  fbsp: "http://purl.obolibrary.org/obo/FBSP_",
9005
9071
  rex: "http://purl.obolibrary.org/obo/REX_"
9006
9072
  };
9007
- class j {
9073
+ class L {
9008
9074
  static _instance;
9009
9075
  // Opposite map is built once
9010
9076
  _nsMap;
9011
9077
  static getInstance() {
9012
- return this._instance ? this._instance : (this._instance = new j(), this._instance);
9078
+ return this._instance ? this._instance : (this._instance = new L(), this._instance);
9013
9079
  }
9014
9080
  compactIRI(t) {
9015
9081
  let e = this._nsMap;
@@ -9025,17 +9091,17 @@ class j {
9025
9091
  return r === void 0 ? t : t.replace(o, `${r}:`);
9026
9092
  }
9027
9093
  expandIRI(t) {
9028
- const e = t.split(":")[0], o = R[e] ?? _[e];
9094
+ const e = t.split(":")[0], o = A[e] ?? _[e];
9029
9095
  return t.replace(`${e}:`, o);
9030
9096
  }
9031
9097
  _buildNSMap() {
9032
9098
  const t = {};
9033
- return Object.keys(R).forEach((e) => t[R[e]] = e), Object.keys(_).forEach(
9099
+ return Object.keys(A).forEach((e) => t[A[e]] = e), Object.keys(_).forEach(
9034
9100
  (e) => t[_[e]] = e
9035
9101
  ), this._nsMap = t, t;
9036
9102
  }
9037
9103
  }
9038
- const _e = `${_.qcy}ContentCategory`, ve = `${_.qcy}EntityCategory`, Ee = `${_.qcy}relatedEntity`, di = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9104
+ const _e = `${_.qcy}ContentCategory`, ve = `${_.qcy}EntityCategory`, Ee = `${_.qcy}relatedEntity`, fi = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
9039
9105
  SELECT ?iri ?type ?parent ?deprecated ?label ?definition
9040
9106
  WHERE {
9041
9107
  SERVICE view:schemas {
@@ -9047,7 +9113,7 @@ WHERE {
9047
9113
  view:column-definition ?definition .
9048
9114
  }
9049
9115
  }`;
9050
- class ui {
9116
+ class yi {
9051
9117
  constructor(t, e, o, r, a) {
9052
9118
  this._api = t, this._projectId = e, this._graphType = r, this._verbose = a ?? !1, this._currentLang = o, this._api.setLanguage(o), this._contentCategories = new T([]), this._entityCategories = new T([]), this._relationships = new T([]), this.availableContentCategories = this._contentCategories.asReadonly(), this.availableEntityCategories = this._entityCategories.asReadonly(), this.availableEntityRelationships = this._relationships.asReadonly(), this.ready = this._load().catch(
9053
9119
  (i) => console.error("[CueProjectSchema] Initial load failed:", i)
@@ -9140,9 +9206,9 @@ class ui {
9140
9206
  _appendCreated(t, e, o, r, a) {
9141
9207
  if (!a.success || !a.iri) return null;
9142
9208
  const i = r.label ? { ...r.label } : {};
9143
- Q(i);
9209
+ K(i);
9144
9210
  const n = r.definition ? { ...r.definition } : r.description ? { default: r.description } : {};
9145
- Q(n);
9211
+ K(n);
9146
9212
  const c = {
9147
9213
  iri: a.iri,
9148
9214
  type: o,
@@ -9179,7 +9245,7 @@ class ui {
9179
9245
  */
9180
9246
  async _fetchSnapshot() {
9181
9247
  if (this._graphType !== "fuseki") {
9182
- const e = await this._runSchemaQuery(di);
9248
+ const e = await this._runSchemaQuery(fi);
9183
9249
  if (e.contentCategories.length + e.entityCategories.length + e.relationships.length > 0) return e;
9184
9250
  console.warn(
9185
9251
  `[CueProjectSchema] Materialized view "schemas" returned no rows for project ${this._projectId} — falling back to the live schema query.`
@@ -9217,9 +9283,9 @@ class ui {
9217
9283
  */
9218
9284
  _buildSchemaQuery() {
9219
9285
  return `PREFIX qcy: <${_.qcy}>
9220
- PREFIX skos: <${R.skos}>
9221
- PREFIX rdfs: <${R.rdfs}>
9222
- PREFIX owl: <${R.owl}>
9286
+ PREFIX skos: <${A.skos}>
9287
+ PREFIX rdfs: <${A.rdfs}>
9288
+ PREFIX owl: <${A.owl}>
9223
9289
  SELECT ?iri ?type ?parent ?deprecated ?label ?definition
9224
9290
  WHERE {
9225
9291
  {
@@ -9262,7 +9328,7 @@ WHERE {
9262
9328
  relationships: []
9263
9329
  };
9264
9330
  for (const a of o.values())
9265
- Q(a.labels), Q(a.definitions), a.type === _e ? r.contentCategories.push(a) : a.type === ve ? r.entityCategories.push(a) : a.type === Ee && r.relationships.push(a);
9331
+ K(a.labels), K(a.definitions), a.type === _e ? r.contentCategories.push(a) : a.type === ve ? r.entityCategories.push(a) : a.type === Ee && r.relationships.push(a);
9266
9332
  return r;
9267
9333
  }
9268
9334
  }
@@ -9271,7 +9337,7 @@ function Te(s, t) {
9271
9337
  const e = t["xml:lang"], o = e && e.length > 0 ? e : "default";
9272
9338
  s[o] === void 0 && (s[o] = t.value);
9273
9339
  }
9274
- function Q(s) {
9340
+ function K(s) {
9275
9341
  if (s.en !== void 0) {
9276
9342
  s.default = s.en;
9277
9343
  return;
@@ -9283,7 +9349,7 @@ function Q(s) {
9283
9349
  function Se(s, t) {
9284
9350
  return s[t] ?? s.default;
9285
9351
  }
9286
- const gi = "https://qlever.dev/api/osm-planet";
9352
+ const bi = "https://qlever.dev/api/osm-planet";
9287
9353
  class Xe {
9288
9354
  constructor(t, e, o = Ct, r, a = !1) {
9289
9355
  this._api = t, this._projectId = e, this._graphType = r, this._verbose = a, this.baseURL = `${o}${e}/`, this.entityInfoMap = this._entityInfoMapComputed, this.entityGraph = this._entityGraph.asReadonly(), this._entityOSMMap.subscribe(() => this._checkPendingOSMFetches()), this._fetchEntityGraph().catch(
@@ -9323,7 +9389,7 @@ class Xe {
9323
9389
  */
9324
9390
  _categoryCountsCache;
9325
9391
  // ── Derived signals ────────────────────────────────────────────────────────
9326
- _entityInfoMapComputed = xt(
9392
+ _entityInfoMapComputed = kt(
9327
9393
  [
9328
9394
  this._entityDetails,
9329
9395
  this._entityDocuments,
@@ -9458,8 +9524,8 @@ WHERE {
9458
9524
  ), n = { ...this._entityOSMMap.get() };
9459
9525
  i.results.bindings.forEach((c) => {
9460
9526
  if (!c.id || !c.osm) return;
9461
- const p = c.id.value, h = c.osm.value, d = c.direct?.value === "true", u = c.rels?.value?.split(";").filter(Boolean) ?? [], w = c.entityUUID?.value, f = n[p] ?? { direct: [], indirect: [] };
9462
- d ? f.direct.push(h) : w && f.indirect.push({ osm: h, viaRels: u, entityUUID: w }), n[p] = f;
9527
+ const p = c.id.value, h = c.osm.value, d = c.direct?.value === "true", g = c.rels?.value?.split(";").filter(Boolean) ?? [], w = c.entityUUID?.value, f = n[p] ?? { direct: [], indirect: [] };
9528
+ d ? f.direct.push(h) : w && f.indirect.push({ osm: h, viaRels: g, entityUUID: w }), n[p] = f;
9463
9529
  }), this._entityOSMMap.set(n), this._log(`entityOSMMap: ${Object.keys(n).length} with OSM / ${this._seenIds.size} seen (cumulative)`);
9464
9530
  }
9465
9531
  /**
@@ -9516,7 +9582,7 @@ WHERE {
9516
9582
  */
9517
9583
  async contentCategoriesInProject(t = !0) {
9518
9584
  const e = this._api.language, o = `PREFIX qcy: <${_.qcy}>
9519
- PREFIX skos: <${R.skos}>
9585
+ PREFIX skos: <${A.skos}>
9520
9586
  SELECT ?iri (SAMPLE(?l) AS ?label) ?count
9521
9587
  WHERE {
9522
9588
  ?iri a qcy:EntityCategory .
@@ -9541,7 +9607,7 @@ ORDER BY ${t ? "DESC(?count)" : "ASC(?label)"}`;
9541
9607
  }
9542
9608
  async entitiesByCategory(t, e = !1) {
9543
9609
  if (t.length === 0) return [];
9544
- const o = j.getInstance(), r = (c) => c.startsWith("http://") || c.startsWith("https://") ? c : o.expandIRI(c), a = t.map((c) => `<${r(c)}>`).join(" "), i = e ? `PREFIX qcy: <${_.qcy}>
9610
+ const o = L.getInstance(), r = (c) => c.startsWith("http://") || c.startsWith("https://") ? c : o.expandIRI(c), a = t.map((c) => `<${r(c)}>`).join(" "), i = e ? `PREFIX qcy: <${_.qcy}>
9545
9611
  SELECT ?id (SAMPLE(?val) AS ?value) (GROUP_CONCAT(DISTINCT STR(?allCat); SEPARATOR=";") AS ?categories)
9546
9612
  WHERE {
9547
9613
  VALUES ?filterCat { ${a} }
@@ -9595,7 +9661,7 @@ WHERE {
9595
9661
  */
9596
9662
  async prototypeCategories() {
9597
9663
  const t = this._api.language, e = `PREFIX qcy: <${_.qcy}>
9598
- PREFIX skos: <${R.skos}>
9664
+ PREFIX skos: <${A.skos}>
9599
9665
  SELECT ?iri ?count (SAMPLE(?l) AS ?label)
9600
9666
  WHERE {
9601
9667
  { SELECT ?iri (COUNT(DISTINCT ?prototype) AS ?count)
@@ -9629,7 +9695,7 @@ ORDER BY DESC(?count)`;
9629
9695
  * Accepts both a full HTTP IRI and a prefixed form (`qcy-e:Door`).
9630
9696
  */
9631
9697
  async prototypesByCategory(t) {
9632
- const e = j.getInstance(), o = t.includes("://") ? t : e.expandIRI(t), r = `PREFIX qcy: <${_.qcy}>
9698
+ const e = L.getInstance(), o = t.includes("://") ? t : e.expandIRI(t), r = `PREFIX qcy: <${_.qcy}>
9633
9699
  SELECT ?iri (SAMPLE(?val) AS ?value) (COUNT(DISTINCT ?occurrence) AS ?instanceCount)
9634
9700
  WHERE {
9635
9701
  ?iri a qcy:EntityPrototype ;
@@ -9882,7 +9948,7 @@ LIMIT 1`, a = (await this._api.sparql(
9882
9948
  * ```
9883
9949
  */
9884
9950
  async categoryExpressIds(t) {
9885
- const e = j.getInstance(), o = t.includes("://") ? t : e.expandIRI(t), r = `PREFIX qcy: <${_.qcy}>
9951
+ const e = L.getInstance(), o = t.includes("://") ? t : e.expandIRI(t), r = `PREFIX qcy: <${_.qcy}>
9886
9952
  SELECT DISTINCT ?prototype ?entity ?model ?expressId
9887
9953
  WHERE {
9888
9954
  ?prototype a qcy:EntityPrototype ;
@@ -9901,8 +9967,8 @@ WHERE {
9901
9967
  const c = n.prototype?.value, p = n.model?.value, h = this._parseExpressId(n.expressId?.value);
9902
9968
  if (c === void 0 || p === void 0 || h === void 0)
9903
9969
  continue;
9904
- const d = `${c} ${p}`, u = i.get(d) ?? /* @__PURE__ */ new Set();
9905
- u.add(h), i.set(d, u);
9970
+ const d = `${c} ${p}`, g = i.get(d) ?? /* @__PURE__ */ new Set();
9971
+ g.add(h), i.set(d, g);
9906
9972
  }
9907
9973
  return Array.from(i.entries()).map(([n, c]) => {
9908
9974
  const [p, h] = n.split(" ");
@@ -9910,12 +9976,12 @@ WHERE {
9910
9976
  prototypeIri: p,
9911
9977
  modelIri: h,
9912
9978
  modelUuid: h.split("/").at(-1) ?? h,
9913
- expressIds: Array.from(c).sort((d, u) => d - u)
9979
+ expressIds: Array.from(c).sort((d, g) => d - g)
9914
9980
  };
9915
9981
  }).sort((n, c) => c.expressIds.length - n.expressIds.length);
9916
9982
  }
9917
9983
  async buildSummaryGraph(t, e, o) {
9918
- const r = j.getInstance(), a = e ? e.includes("://") ? e : r.expandIRI(e) : void 0, i = a ? ` FILTER(?sourceCat = <${a}> || ?targetCat = <${a}>)` : "", n = ` ?s a qcy:CanonicalEntity ;
9984
+ const r = L.getInstance(), a = e ? e.includes("://") ? e : r.expandIRI(e) : void 0, i = a ? ` FILTER(?sourceCat = <${a}> || ?targetCat = <${a}>)` : "", n = ` ?s a qcy:CanonicalEntity ;
9919
9985
  qcy:hasEntityCategory ?sourceCat .
9920
9986
  ?o a qcy:CanonicalEntity ;
9921
9987
  qcy:hasEntityCategory ?targetCat .
@@ -9943,14 +10009,14 @@ GROUP BY ?sourceCat ?relation ?targetCat
9943
10009
  ORDER BY DESC(?weight)`, p = `${a ?? ""}|${o ?? ""}`;
9944
10010
  let h = this._summaryGraphCache.get(p);
9945
10011
  h || (h = o ? this._api.sparql(c, this._projectId, this._graphType) : this._fetchSummaryData(c, i), this._summaryGraphCache.set(p, h), h.catch(() => this._summaryGraphCache.delete(p)));
9946
- const d = await h, u = d.results.bindings.filter(
10012
+ const d = await h, g = d.results.bindings.filter(
9947
10013
  (w) => w.sourceCat && w.predicate && w.targetCat
9948
10014
  );
9949
10015
  if (t === "graph") {
9950
10016
  const w = /* @__PURE__ */ new Set(), f = [];
9951
- for (const b of u) {
9952
- const m = b.sourceCat.value, E = b.predicate.value, I = b.targetCat.value, v = parseInt(b.weight.value, 10);
9953
- w.add(m), w.add(I), f.push({ sourceID: m, predicate: E, targetID: I, weight: v });
10017
+ for (const b of g) {
10018
+ const m = b.sourceCat.value, v = b.predicate.value, I = b.targetCat.value, E = parseInt(b.weight.value, 10);
10019
+ w.add(m), w.add(I), f.push({ sourceID: m, predicate: v, targetID: I, weight: E });
9954
10020
  }
9955
10021
  let y;
9956
10022
  if (!o)
@@ -9968,7 +10034,7 @@ ORDER BY DESC(?weight)`, p = `${a ?? ""}|${o ?? ""}`;
9968
10034
  };
9969
10035
  }
9970
10036
  if (t === "md") {
9971
- const w = u.map((m) => ({
10037
+ const w = g.map((m) => ({
9972
10038
  src: r.compactIRI(m.sourceCat.value),
9973
10039
  pred: r.compactIRI(m.predicate.value),
9974
10040
  tgt: r.compactIRI(m.targetCat.value),
@@ -10100,7 +10166,7 @@ ORDER BY DESC(?weight)`;
10100
10166
  ]), n = {};
10101
10167
  for (const c of i) {
10102
10168
  const p = t[c], h = r[c];
10103
- let d, u;
10169
+ let d, g;
10104
10170
  if (h) {
10105
10171
  const w = /* @__PURE__ */ new Set();
10106
10172
  d = h.direct.filter(
@@ -10108,14 +10174,14 @@ ORDER BY DESC(?weight)`;
10108
10174
  ).map((y) => ({ osmIRI: y, wkt: a[y] }));
10109
10175
  const f = /* @__PURE__ */ new Map();
10110
10176
  for (const { osm: y, viaRels: b, entityUUID: m } of h.indirect) {
10111
- const E = a[y];
10112
- if (E)
10177
+ const v = a[y];
10178
+ if (v)
10113
10179
  for (const I of b) {
10114
- const v = `${I}:${m}`, C = f.get(v) ?? { geometries: [], entityUUID: m };
10115
- C.geometries.some((L) => L.osmIRI === y) || (C.geometries.push({ osmIRI: y, wkt: E }), f.set(v, C));
10180
+ const E = `${I}:${m}`, C = f.get(E) ?? { geometries: [], entityUUID: m };
10181
+ C.geometries.some((U) => U.osmIRI === y) || (C.geometries.push({ osmIRI: y, wkt: v }), f.set(E, C));
10116
10182
  }
10117
10183
  }
10118
- f.size > 0 && (u = Array.from(f.entries()).map(
10184
+ f.size > 0 && (g = Array.from(f.entries()).map(
10119
10185
  ([y, { geometries: b, entityUUID: m }]) => ({
10120
10186
  rel: y.split(":")[0],
10121
10187
  geometries: b,
@@ -10130,7 +10196,7 @@ ORDER BY DESC(?weight)`;
10130
10196
  documentRefs: e[c],
10131
10197
  relationshipData: o[c],
10132
10198
  directMapGeometries: d,
10133
- indirectMapGeometries: u
10199
+ indirectMapGeometries: g
10134
10200
  };
10135
10201
  }
10136
10202
  return n;
@@ -10256,10 +10322,10 @@ GROUP BY ?e1Cat ?e2Cat`, e = await this._api.sparql(
10256
10322
  async _fetchOSMLocations(t) {
10257
10323
  const e = t.filter((n) => !n.includes("/relation/"));
10258
10324
  if (e.length === 0) return;
10259
- const o = e.map((n) => `<${n}>`).join(" "), r = `PREFIX geo: <${R.geo}>
10325
+ const o = e.map((n) => `<${n}>`).join(" "), r = `PREFIX geo: <${A.geo}>
10260
10326
  SELECT * WHERE {
10261
10327
  VALUES ?s { ${o} }
10262
- SERVICE <${gi}> {
10328
+ SERVICE <${bi}> {
10263
10329
  ?s geo:hasGeometry/geo:asWKT ?wkt
10264
10330
  }
10265
10331
  }`, a = await this._api.sparql(
@@ -11134,15 +11200,15 @@ const St = {
11134
11200
  }
11135
11201
  };
11136
11202
  l.AUDIO + "", l.VIDEO + "", l.IMAGE + "", l.TEXT + "", l.MARKUP + "", l.SCRIPT + "", l.DATA + "", l.ARCHIVE + "", l.INSTALLER + "", l.BINARY + "", l.BACKUP + "", l.AUTOMATION + "", l.PRESENTATION + "", l.SPREADSHEET + "", l.FONT + "", l.GEOSPATIAL + "", l.THREE_D + "", l.CAD + "", l.BIM + "", l.PLANNING + "", l.EMAIL + "", l.MULTIMEDIA + "", l.UNKNOWN + "";
11137
- var mi = /* @__PURE__ */ ((s) => (s.ENTITY = "e", s.CONTENT = "c", s.RELATION = "p", s.MIME = "m", s))(mi || {}), wi = /* @__PURE__ */ ((s) => (s.ENTITY = "entity", s.CONTENT = "content", s.RELATION = "relation", s.MIME = "mime", s))(wi || {}), fi = /* @__PURE__ */ ((s) => (s.CATALOG = "catalog", s.PARSER = "parser", s.PROJECT = "project", s.CODING_SCHEME = "coding_scheme", s.SUGGESTED = "suggested", s))(fi || {}), yi = /* @__PURE__ */ ((s) => (s.OPEN = "open", s.SEEDED = "seeded", s.CLOSED = "closed", s))(yi || {}), bi = /* @__PURE__ */ ((s) => (s.VALUE_TYPED = "value_typed", s.NAME_TYPED = "name_typed", s.EXPLICIT_ONLY = "explicit_only", s))(bi || {}), _i = /* @__PURE__ */ ((s) => (s.IDENTIFIER = "identifier", s.ATTRIBUTE = "attribute", s.IGNORE = "ignore", s))(_i || {}), vi = /* @__PURE__ */ ((s) => (s.VALUE = "value", s.VALUE_AND_CONTEXT = "value_and_context", s.CONTEXT = "context", s))(vi || {});
11138
- const At = "https://cue.qaecy.com/", Ei = {
11203
+ var _i = /* @__PURE__ */ ((s) => (s.ENTITY = "e", s.CONTENT = "c", s.RELATION = "p", s.MIME = "m", s))(_i || {}), vi = /* @__PURE__ */ ((s) => (s.ENTITY = "entity", s.CONTENT = "content", s.RELATION = "relation", s.MIME = "mime", s))(vi || {}), Ei = /* @__PURE__ */ ((s) => (s.CATALOG = "catalog", s.PARSER = "parser", s.PROJECT = "project", s.CODING_SCHEME = "coding_scheme", s.SUGGESTED = "suggested", s))(Ei || {}), Ti = /* @__PURE__ */ ((s) => (s.OPEN = "open", s.SEEDED = "seeded", s.CLOSED = "closed", s))(Ti || {}), Si = /* @__PURE__ */ ((s) => (s.VALUE_TYPED = "value_typed", s.NAME_TYPED = "name_typed", s.EXPLICIT_ONLY = "explicit_only", s))(Si || {}), Ii = /* @__PURE__ */ ((s) => (s.IDENTIFIER = "identifier", s.ATTRIBUTE = "attribute", s.IGNORE = "ignore", s))(Ii || {}), Ci = /* @__PURE__ */ ((s) => (s.VALUE = "value", s.VALUE_AND_CONTEXT = "value_and_context", s.CONTEXT = "context", s))(Ci || {});
11204
+ const At = "https://cue.qaecy.com/", ki = {
11139
11205
  qcy: "https://dev.qaecy.com/ont#",
11140
11206
  "qcy-e": "https://dev.qaecy.com/enum#"
11141
- }, Ti = (s) => s.includes(":"), Je = (s, t, e, o = At) => `${o}${t}/${e}/${s}`, Si = (s) => {
11142
- const t = s.indexOf(":"), e = Ei[s.slice(0, t)];
11207
+ }, xi = (s) => s.includes(":"), Je = (s, t, e, o = At) => `${o}${t}/${e}/${s}`, $i = (s) => {
11208
+ const t = s.indexOf(":"), e = ki[s.slice(0, t)];
11143
11209
  if (!e) throw new Error(`\`${s}\` is not a reference into a core prefix`);
11144
11210
  return `${e}${s.slice(t + 1)}`;
11145
- }, Hi = (s, t, e, o = At) => Ti(s) ? Si(s) : Je(s, t, e, o), Wi = (s, t, e, o = At) => s.iri ?? Je(s.key, t, e, o), Ii = (s) => `${s.base}r/`, Vi = (s) => `${Ii(s)}${s.projectId}/schema`, Ci = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
11211
+ }, Yi = (s, t, e, o = At) => xi(s) ? $i(s) : Je(s, t, e, o), Qi = (s, t, e, o = At) => s.iri ?? Je(s.key, t, e, o), Oi = (s) => `${s.base}r/`, Ki = (s) => `${Oi(s)}${s.projectId}/schema`, Ri = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
11146
11212
  SELECT ?ext ?totalSize ?docCount
11147
11213
  WHERE {
11148
11214
  SERVICE view:docs-by-suffix {
@@ -11150,7 +11216,7 @@ WHERE {
11150
11216
  view:column-totalSize ?totalSize ;
11151
11217
  view:column-docCount ?docCount .
11152
11218
  }
11153
- }`, xi = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
11219
+ }`, Ai = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
11154
11220
  SELECT ?cat ?totalSize ?docCount
11155
11221
  WHERE {
11156
11222
  SERVICE view:docs-by-category {
@@ -11158,7 +11224,7 @@ WHERE {
11158
11224
  view:column-totalSize ?totalSize ;
11159
11225
  view:column-docCount ?docCount .
11160
11226
  }
11161
- }`, ki = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
11227
+ }`, Pi = `PREFIX view: <https://qlever.cs.uni-freiburg.de/materializedView/>
11162
11228
  SELECT ?count
11163
11229
  WHERE {
11164
11230
  SERVICE view:doc-duplicates {
@@ -11509,7 +11575,7 @@ GROUP BY ?id ?suffix ?size`, r = await this._api.sparql(o, this._projectId, this
11509
11575
  }
11510
11576
  async _fetchDocumentsBySuffix() {
11511
11577
  if (this._graphType !== "fuseki") {
11512
- const e = await this._runDocumentsBySuffixQuery(Ci);
11578
+ const e = await this._runDocumentsBySuffixQuery(Ri);
11513
11579
  if (Object.keys(e).length > 0) return e;
11514
11580
  console.warn(`[CueProjectDocuments] Materialized view "docs-by-suffix" returned no rows for project ${this._projectId} — falling back to live query.`);
11515
11581
  }
@@ -11543,7 +11609,7 @@ ORDER BY DESC(?docCount)`;
11543
11609
  }
11544
11610
  async _fetchDocumentsByContentCategory() {
11545
11611
  if (this._graphType !== "fuseki") {
11546
- const e = await this._runDocumentsByContentCategoryQuery(xi);
11612
+ const e = await this._runDocumentsByContentCategoryQuery(Ai);
11547
11613
  if (Object.keys(e).length > 0) return e;
11548
11614
  console.warn(`[CueProjectDocuments] Materialized view "docs-by-category" returned no rows for project ${this._projectId} — falling back to live query.`);
11549
11615
  }
@@ -11577,7 +11643,7 @@ ORDER BY DESC(?docCount)`;
11577
11643
  }
11578
11644
  async _fetchDuplicateCount() {
11579
11645
  if (this._graphType !== "fuseki") {
11580
- const e = await this._api.sparql(ki, this._projectId, this._graphType);
11646
+ const e = await this._api.sparql(Pi, this._projectId, this._graphType);
11581
11647
  if (e.results.bindings.length > 0) {
11582
11648
  const o = e.results.bindings[0];
11583
11649
  return o?.count ? parseInt(o.count.value, 10) : 0;
@@ -11605,9 +11671,9 @@ WHERE {
11605
11671
  return o?.count ? parseInt(o.count.value, 10) : 0;
11606
11672
  }
11607
11673
  }
11608
- class $i {
11674
+ class Di {
11609
11675
  constructor(t, e, { language: o, rdfBase: r = Ct, graphType: a, verbose: i }) {
11610
- this._api = t, this._projectId = e, this.schema = new ui(t, e, o, a, i), this.entities = new Xe(t, e, r, a, i), this.documents = new It(t, e, o, r, a, i), this.availableContentCategories = this.schema.availableContentCategories, this.availableEntityCategories = this.schema.availableEntityCategories, this.availableEntityRelationships = this.schema.availableEntityRelationships, this.schemaReady = this.schema.ready, this.entityInfoMap = this.entities.entityInfoMap, this.entityGraph = this.entities.entityGraph, this.documentInfoMap = this.documents.documentInfoMap, this.projectDocumentsData = this.documents.projectDocumentsData, this.searchResults = this._searchResults.asReadonly(), this.documents.fetchOverview().catch((n) => console.error("[CueProjectView] fetchOverview failed:", n));
11676
+ this._api = t, this._projectId = e, this.schema = new yi(t, e, o, a, i), this.entities = new Xe(t, e, r, a, i), this.documents = new It(t, e, o, r, a, i), this.availableContentCategories = this.schema.availableContentCategories, this.availableEntityCategories = this.schema.availableEntityCategories, this.availableEntityRelationships = this.schema.availableEntityRelationships, this.schemaReady = this.schema.ready, this.entityInfoMap = this.entities.entityInfoMap, this.entityGraph = this.entities.entityGraph, this.documentInfoMap = this.documents.documentInfoMap, this.projectDocumentsData = this.documents.projectDocumentsData, this.searchResults = this._searchResults.asReadonly(), this.documents.fetchOverview().catch((n) => console.error("[CueProjectView] fetchOverview failed:", n));
11611
11677
  }
11612
11678
  _api;
11613
11679
  _projectId;
@@ -11747,17 +11813,19 @@ function Ie(s, t) {
11747
11813
  for (const m of t)
11748
11814
  a.has(m.contentUUID) || a.set(m.contentUUID, []), a.get(m.contentUUID)?.push(m), m.locationUUID && i.set(m.locationUUID, m);
11749
11815
  const n = [], c = [];
11750
- for (const m of s)
11751
- a.has(m.contentUUID) ? (a.get(m.contentUUID) || []).some((v) => v.locationUUID === m.locationUUID) || c.push(m) : n.push(m);
11816
+ for (const m of s) {
11817
+ const v = n.some((I) => I.contentUUID === m.contentUUID);
11818
+ !a.has(m.contentUUID) && !v ? n.push(m) : v ? c.push(m) : (a.get(m.contentUUID) || []).some((C) => C.locationUUID === m.locationUUID) || c.push(m);
11819
+ }
11752
11820
  const p = [], h = [];
11753
11821
  for (const m of t) {
11754
- const E = o.get(m.contentUUID);
11755
- E ? E.some((v) => v.locationUUID === m.locationUUID) || h.push(m) : p.push(m);
11822
+ const v = o.get(m.contentUUID);
11823
+ v ? v.some((E) => E.locationUUID === m.locationUUID) || h.push(m) : p.push(m);
11756
11824
  }
11757
- const d = s.length - n.length - c.length, u = s.length, w = u > 0 ? d / u : 1;
11825
+ const d = s.length - n.length - c.length, g = s.length, w = g > 0 ? d / g : 1;
11758
11826
  let f = 0, y = 0;
11759
11827
  for (const m of s)
11760
- y += m.size || 0, (a.get(m.contentUUID) || []).some((v) => v.locationUUID === m.locationUUID) && (f += m.size || 0);
11828
+ y += m.size || 0, (a.get(m.contentUUID) || []).some((E) => E.locationUUID === m.locationUUID) && (f += m.size || 0);
11761
11829
  const b = y > 0 ? f / y : 1;
11762
11830
  e({
11763
11831
  localNotOnRemote: n,
@@ -11765,7 +11833,7 @@ function Ie(s, t) {
11765
11833
  remoteNotOnLocal: p,
11766
11834
  remoteNotOnLocalPathOnly: h,
11767
11835
  syncCount: d,
11768
- totalCount: u,
11836
+ totalCount: g,
11769
11837
  syncSize: f,
11770
11838
  totalSize: y,
11771
11839
  synctPctSize: b,
@@ -11809,25 +11877,25 @@ const Ce = {
11809
11877
  };
11810
11878
  function Ye(s, t = !1) {
11811
11879
  const e = "daca0510-72b5-48ba-9091-b918ca18136b";
11812
- return s = Oi(s, t), xo(s, e);
11880
+ return s = Ni(s, t), $o(s, e);
11813
11881
  }
11814
- function Oi(s, t = !1) {
11882
+ function Ni(s, t = !1) {
11815
11883
  let e = s;
11816
11884
  for (const o in Ce)
11817
11885
  e = e.replace(new RegExp(o, "g"), Ce[o]);
11818
11886
  return t && e !== s && console.info(`${s} -> ${e}`), e;
11819
11887
  }
11820
- function Ri(s, t = "") {
11888
+ function ji(s, t = "") {
11821
11889
  return Ye(`${t}${s}`);
11822
11890
  }
11823
- function Ai(s) {
11891
+ function Li(s) {
11824
11892
  const t = s.split(".");
11825
11893
  return t.length > 1 ? "." + t.pop()?.toLowerCase() : "";
11826
11894
  }
11827
- function xe(s, t, e, o, r, a, i, n = !1, c = !1) {
11828
- const p = Ai(s), h = Ye(o), d = `${t}/${h}${p}`;
11895
+ function ke(s, t, e, o, r, a, i, n = !1, c = !1) {
11896
+ const p = Li(s), h = Ye(o), d = `${t}/${h}${p}`;
11829
11897
  i === void 0 && (i = St[p]?.mime ?? "application/octet-stream");
11830
- const u = Ri(s, r);
11898
+ const g = ji(s, r);
11831
11899
  return {
11832
11900
  name: s,
11833
11901
  blob_name: d,
@@ -11843,51 +11911,51 @@ function xe(s, t, e, o, r, a, i, n = !1, c = !1) {
11843
11911
  additional_metadata: "",
11844
11912
  last_seen_as: JSON.stringify({
11845
11913
  hostId: r ?? "",
11846
- fileUUID: u
11914
+ fileUUID: g
11847
11915
  })
11848
11916
  };
11849
11917
  }
11850
- async function H() {
11918
+ async function W() {
11851
11919
  return import(
11852
11920
  /* webpackIgnore: true */
11853
11921
  "fs/promises"
11854
11922
  );
11855
11923
  }
11856
- async function ke(s) {
11924
+ async function xe(s) {
11857
11925
  if (typeof window < "u")
11858
11926
  throw new Error(
11859
11927
  `Cannot read file from path "${s}" in a browser environment. Provide file.data (Uint8Array) instead.`
11860
11928
  );
11861
- const { readFile: t } = await H();
11929
+ const { readFile: t } = await W();
11862
11930
  return t(s);
11863
11931
  }
11864
- let G = null, tt = null, et = null;
11865
- function Xi(s) {
11866
- et = s, tt = null, G = null;
11932
+ let H = null, ot = null, rt = null;
11933
+ function Zi(s) {
11934
+ rt = s, ot = null, H = null;
11867
11935
  }
11868
- async function Pi() {
11936
+ async function Ui() {
11869
11937
  if (typeof window < "u") {
11870
- if (!et)
11938
+ if (!rt)
11871
11939
  throw new Error(
11872
11940
  "WASM scanner is not configured for browser use. Call configureScanWasm(baseUrl) during app initialisation."
11873
11941
  );
11874
- const s = await fetch(`${et}/dir_scanner_wasm_bg.wasm`);
11942
+ const s = await fetch(`${rt}/dir_scanner_wasm_bg.wasm`);
11875
11943
  if (!s.ok)
11876
11944
  throw new Error(`Failed to fetch WASM binary: ${s.status} ${s.statusText}`);
11877
- const t = new Uint8Array(await s.arrayBuffer()), o = await import(`${et}/dir_scanner_wasm.mjs`);
11878
- await o.default({ module_or_path: t }), G = o.scan;
11945
+ const t = new Uint8Array(await s.arrayBuffer()), o = await import(`${rt}/dir_scanner_wasm.mjs`);
11946
+ await o.default({ module_or_path: t }), H = o.scan;
11879
11947
  } else {
11880
- const { readFile: s } = await H(), { join: t } = await import(
11948
+ const { readFile: s } = await W(), { join: t } = await import(
11881
11949
  /* webpackIgnore: true */
11882
11950
  "path"
11883
11951
  ), { pathToFileURL: e } = await import(
11884
11952
  /* webpackIgnore: true */
11885
11953
  "url"
11886
11954
  ), o = t(__dirname, "assets", "wasm"), r = await s(t(o, "dir_scanner_wasm_bg.wasm")), i = await import(e(t(o, "dir_scanner_wasm.mjs")).href);
11887
- await i.default({ module_or_path: r }), G = i.scan;
11955
+ await i.default({ module_or_path: r }), H = i.scan;
11888
11956
  }
11889
11957
  }
11890
- const Di = "qlever", K = 1e3, Pt = "cue:pending:";
11958
+ const Mi = "qlever", Z = 1e3, Pt = "cue:pending:";
11891
11959
  async function Dt(s) {
11892
11960
  const { tmpdir: t } = await import(
11893
11961
  /* webpackIgnore: true */
@@ -11904,7 +11972,7 @@ async function $e(s) {
11904
11972
  return t ? JSON.parse(t) : null;
11905
11973
  }
11906
11974
  try {
11907
- const t = await (await H()).readFile(await Dt(s), "utf-8");
11975
+ const t = await (await W()).readFile(await Dt(s), "utf-8");
11908
11976
  return JSON.parse(t);
11909
11977
  } catch {
11910
11978
  return null;
@@ -11916,15 +11984,15 @@ async function Oe(s) {
11916
11984
  window.localStorage.setItem(`${Pt}${s.spaceId}`, t);
11917
11985
  return;
11918
11986
  }
11919
- await (await H()).writeFile(await Dt(s.spaceId), t, "utf-8");
11987
+ await (await W()).writeFile(await Dt(s.spaceId), t, "utf-8");
11920
11988
  }
11921
- async function Ni(s) {
11989
+ async function Fi(s) {
11922
11990
  if (typeof window < "u") {
11923
11991
  window.localStorage.removeItem(`${Pt}${s}`);
11924
11992
  return;
11925
11993
  }
11926
11994
  try {
11927
- await (await H()).unlink(await Dt(s));
11995
+ await (await W()).unlink(await Dt(s));
11928
11996
  } catch {
11929
11997
  }
11930
11998
  }
@@ -12003,8 +12071,8 @@ class Re {
12003
12071
  providerId: e.providerId,
12004
12072
  fileContentExists: !1
12005
12073
  }));
12006
- for (let r = 0; r < o.length; r += K)
12007
- await this._postFssBatch(o.slice(r, r + K), e.spaceId);
12074
+ for (let r = 0; r < o.length; r += Z)
12075
+ await this._postFssBatch(o.slice(r, r + Z), e.spaceId);
12008
12076
  e.verbose && console.info(`Pushed metadata for ${o.length} file(s) ✅`);
12009
12077
  }
12010
12078
  /**
@@ -12032,19 +12100,19 @@ class Re {
12032
12100
  async previewSync(t, e) {
12033
12101
  const { spaceId: o, providerId: r, verbose: a } = e, i = await this._auth.getToken();
12034
12102
  if (!i) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
12035
- const n = await this._getOrCreateGraph(o, i), c = await this._projects.getProject(o), p = c?.projectSettings?.tier ?? "l", [h, d, u, w] = await Promise.all([
12103
+ const n = await this._getOrCreateGraph(o, i), c = await this._projects.getProject(o), p = c?.projectSettings?.tier ?? "l", [h, d, g, w] = await Promise.all([
12036
12104
  this._listRemoteFiles(n, o, r, a),
12037
12105
  this._getAvailableCredits(c?.organizationID),
12038
12106
  this._fetchUnitCreditMap(a),
12039
12107
  this._fetchTierNames()
12040
12108
  ]), f = await Ie(t, h), y = f.localNotOnRemote ?? [], b = y.length > 0 ? await this.scanCost(y) : [];
12041
- let m = 0, E = 0;
12042
- for (const v of b) {
12043
- m += v.units;
12044
- const C = u[p], L = C?.[v.ext] ?? 1;
12045
- a && C && !(v.ext in C) && console.info(` Unknown format: .${v.ext} (using default rate of 1 credit/unit)`);
12046
- const S = v.units * L;
12047
- E += S, v.credits = Math.round(S);
12109
+ let m = 0, v = 0;
12110
+ for (const E of b) {
12111
+ m += E.units;
12112
+ const C = g[p], U = C?.[E.ext] ?? 1;
12113
+ a && C && !(E.ext in C) && console.info(` Unknown format: .${E.ext} (using default rate of 1 credit/unit)`);
12114
+ const S = E.units * U;
12115
+ v += S, E.credits = Math.round(S);
12048
12116
  }
12049
12117
  const I = w[p] ?? p;
12050
12118
  return {
@@ -12052,7 +12120,7 @@ class Re {
12052
12120
  tier: p,
12053
12121
  tierName: I,
12054
12122
  unitsToConsume: m,
12055
- creditsToConsume: Math.round(E),
12123
+ creditsToConsume: Math.round(v),
12056
12124
  creditsAvailable: d.creditsAvailable,
12057
12125
  unitsAvailable: d.unitsAvailable,
12058
12126
  filesToUpload: y.length,
@@ -12065,7 +12133,7 @@ class Re {
12065
12133
  this._legacy = c ?? !1;
12066
12134
  const p = await this._auth.getToken();
12067
12135
  if (!p) throw new Error("Not authenticated. Call cue.auth.signIn() first.");
12068
- const h = await this._getOrCreateGraph(o, p), d = await this._projects.getProject(o), u = d?.projectSettings?.gzipEnabled ?? !0;
12136
+ const h = await this._getOrCreateGraph(o, p), d = await this._projects.getProject(o), g = d?.projectSettings?.gzipEnabled ?? !0;
12069
12137
  i && console.info("Listing remote files ⏳");
12070
12138
  const [w, f] = await Promise.all([
12071
12139
  this._listRemoteFiles(h, o, r, i),
@@ -12074,44 +12142,44 @@ class Re {
12074
12142
  i && (console.info(`Total local files: ${t.length}`), console.info(`Total remote files: ${w.length}`), console.info(
12075
12143
  `Total files to sync: ${(b.localNotOnRemote?.length ?? 0) + b.localNotOnRemotePathOnly.length}`
12076
12144
  ));
12077
- let m = b.syncCount, E = b.syncSize, I = 0, v = !1;
12145
+ let m = b.syncCount, v = b.syncSize, I = 0, E = !1;
12078
12146
  const C = b.localNotOnRemote ?? [];
12079
12147
  if (C.length > 0) {
12080
- const A = (await this.scanCost(C)).reduce((it, Ze) => it + Ze.units, 0);
12081
- if (A > y)
12148
+ const P = (await this.scanCost(C)).reduce((ct, Ze) => ct + Ze.units, 0);
12149
+ if (P > y)
12082
12150
  throw new Error(
12083
- `Insufficient units: ${A} units required but only ${y} available.`
12151
+ `Insufficient units: ${P} units required but only ${y} available.`
12084
12152
  );
12085
12153
  }
12086
12154
  await this._initPendingBatch(o, i), i && C.length && console.info("Syncing missing files ⏳");
12087
12155
  for (const S of C)
12088
12156
  try {
12089
- const A = xe(
12157
+ const P = ke(
12090
12158
  S.relativePath,
12091
12159
  o,
12092
12160
  a,
12093
12161
  S.md5,
12094
12162
  r
12095
12163
  );
12096
- if (!A.blob_name) throw new Error(`blob_name missing for ${S.relativePath}`);
12097
- const it = S.data ?? new Uint8Array(await ke(S.fullPath));
12164
+ if (!P.blob_name) throw new Error(`blob_name missing for ${S.relativePath}`);
12165
+ const ct = S.data ?? new Uint8Array(await xe(S.fullPath));
12098
12166
  await this._blob.uploadRaw(
12099
- A.blob_name,
12100
- it,
12101
- A,
12167
+ P.blob_name,
12168
+ ct,
12169
+ P,
12102
12170
  3,
12103
12171
  void 0,
12104
12172
  void 0,
12105
- u
12173
+ g
12106
12174
  ), await this._queueFileLocation({
12107
12175
  relativePath: S.relativePath,
12108
12176
  md5: S.md5,
12109
12177
  size: S.size,
12110
12178
  providerId: r,
12111
12179
  fileContentExists: !1
12112
- }), v = !0, m += 1, E += S.size || 0, this._logProgress(m, b.totalCount, E, b.totalSize, n);
12113
- } catch (A) {
12114
- I += 1, console.error(`[CueSyncApi] Failed to upload file: ${S.fullPath}`), i && console.error("[CueSyncApi] Upload error details:", A);
12180
+ }), E = !0, m += 1, v += S.size || 0, this._logProgress(m, b.totalCount, v, b.totalSize, n);
12181
+ } catch (P) {
12182
+ I += 1, console.error(`[CueSyncApi] Failed to upload file: ${S.fullPath}`), i && console.error("[CueSyncApi] Upload error details:", P);
12115
12183
  }
12116
12184
  i && b.localNotOnRemotePathOnly.length && console.info(`Syncing missing file locations (on provider "${r}") ⏳`);
12117
12185
  for (const S of b.localNotOnRemotePathOnly)
@@ -12121,26 +12189,26 @@ class Re {
12121
12189
  size: S.size,
12122
12190
  providerId: r,
12123
12191
  fileContentExists: !0
12124
- }), v = !0, m += 1, E += S.size || 0, this._logProgress(m, b.totalCount, E, b.totalSize, n);
12192
+ }), E = !0, m += 1, v += S.size || 0, this._logProgress(m, b.totalCount, v, b.totalSize, n);
12125
12193
  await this._drainPending(i), this._stopFlushTimer();
12126
- const L = await this._getAvailableCredits(d?.organizationID);
12194
+ const U = await this._getAvailableCredits(d?.organizationID);
12127
12195
  return {
12128
12196
  syncCount: m,
12129
- syncSize: E,
12197
+ syncSize: v,
12130
12198
  failedUploads: I,
12131
12199
  totalCount: b.totalCount,
12132
12200
  totalSize: b.totalSize,
12133
- rdfWritten: v,
12134
- creditsAvailable: L.creditsAvailable
12201
+ rdfWritten: E,
12202
+ creditsAvailable: U.creditsAvailable
12135
12203
  };
12136
12204
  }
12137
12205
  async _getOrCreateGraph(t, e) {
12138
12206
  const o = this._graphMap.get(t);
12139
12207
  if (o) return o;
12140
- const r = new Do({
12141
- graphType: Di,
12208
+ const r = new jo({
12209
+ graphType: Mi,
12142
12210
  queryEndpoint: `${this._gatewayUrl}${Le}`,
12143
- updateEndpoint: `${this._gatewayUrl}${cs}`,
12211
+ updateEndpoint: `${this._gatewayUrl}${ds}`,
12144
12212
  originalHeaders: {
12145
12213
  "x-project-id": t,
12146
12214
  authorization: `Bearer ${e}`
@@ -12166,12 +12234,12 @@ class Re {
12166
12234
  if (d.length === 0)
12167
12235
  r && console.warn(`No location data found for contentUUID: ${h}`), c.push({ contentUUID: h });
12168
12236
  else
12169
- for (const u of d)
12237
+ for (const g of d)
12170
12238
  c.push({
12171
12239
  contentUUID: h,
12172
- locationUUID: u.locationUUID,
12173
- created: u.created,
12174
- size: u.size
12240
+ locationUUID: g.locationUUID,
12241
+ created: g.created,
12242
+ size: g.size
12175
12243
  });
12176
12244
  }
12177
12245
  return c;
@@ -12249,10 +12317,10 @@ WHERE {
12249
12317
  }
12250
12318
  async _flushBatch(t, e, o) {
12251
12319
  const r = [...t];
12252
- this._pendingSpaceId === e && (this._pendingItems = []), await Ni(e);
12320
+ this._pendingSpaceId === e && (this._pendingItems = []), await Fi(e);
12253
12321
  try {
12254
- for (let a = 0; a < r.length; a += K)
12255
- await this._postFssBatch(r.slice(a, a + K), e);
12322
+ for (let a = 0; a < r.length; a += Z)
12323
+ await this._postFssBatch(r.slice(a, a + Z), e);
12256
12324
  o && console.info(`Wrote ${r.length} file location(s) to commands API ✅`);
12257
12325
  } catch (a) {
12258
12326
  const i = [...r, ...this._pendingItems];
@@ -12290,16 +12358,16 @@ WHERE {
12290
12358
  * shown to the user before or after calling {@link sync}.
12291
12359
  */
12292
12360
  async scanCost(t) {
12293
- if (tt || (tt = Pi()), await tt, !G) throw new Error("WASM scan function not initialised");
12361
+ if (ot || (ot = Ui()), await ot, !H) throw new Error("WASM scan function not initialised");
12294
12362
  const e = 200, o = /* @__PURE__ */ new Map();
12295
12363
  for (let r = 0; r < t.length; r += e) {
12296
12364
  const a = t.slice(r, r + e), i = await Promise.all(
12297
12365
  a.map(async (c) => ({
12298
12366
  originalPath: c.relativePath,
12299
12367
  // Use pre-loaded data if available (browser), otherwise read from disk (Node.js).
12300
- data: c.data ?? new Uint8Array(await ke(c.fullPath))
12368
+ data: c.data ?? new Uint8Array(await xe(c.fullPath))
12301
12369
  }))
12302
- ), n = G(i);
12370
+ ), n = H(i);
12303
12371
  for (const c of n) {
12304
12372
  const p = o.get(c.ext);
12305
12373
  p ? (p.count += c.count, p.units += c.units, p.sizeMb += c.sizeMb) : o.set(c.ext, { ...c });
@@ -12321,16 +12389,16 @@ WHERE {
12321
12389
  async computeCredits(t, e) {
12322
12390
  const o = await this._projects.getProject(e), r = o?.projectSettings?.tier ?? "l";
12323
12391
  console.info(`Computing credit cost for ${t.length} file(s) using tier "${r}"...`);
12324
- const a = this._getAvailableCredits(o?.organizationID).then((u) => (console.info("[computeCredits] getOrgCredits resolved:", u), u)).catch((u) => (console.warn("[computeCredits] getOrgCredits failed, defaulting to 0:", u?.message ?? u), { creditsAvailable: 0, unitsAvailable: 0 })), i = this._fetchUnitCreditMap().then((u) => (console.info("[computeCredits] creditMap resolved, keys:", Object.keys(u)), u)).catch((u) => (console.warn("[computeCredits] fetchUnitCreditMap failed, using default rates:", u?.message ?? u), {})), n = t.length > 0 ? (console.info(`[computeCredits] starting WASM scan of ${t.length} file(s)...`), this.scanCost(t).then((u) => (console.info(`[computeCredits] WASM scan done: ${u.length} ext(s)`), u))) : Promise.resolve([]), [c, p, h] = await Promise.all([
12392
+ const a = this._getAvailableCredits(o?.organizationID).then((g) => (console.info("[computeCredits] getOrgCredits resolved:", g), g)).catch((g) => (console.warn("[computeCredits] getOrgCredits failed, defaulting to 0:", g?.message ?? g), { creditsAvailable: 0, unitsAvailable: 0 })), i = this._fetchUnitCreditMap().then((g) => (console.info("[computeCredits] creditMap resolved, keys:", Object.keys(g)), g)).catch((g) => (console.warn("[computeCredits] fetchUnitCreditMap failed, using default rates:", g?.message ?? g), {})), n = t.length > 0 ? (console.info(`[computeCredits] starting WASM scan of ${t.length} file(s)...`), this.scanCost(t).then((g) => (console.info(`[computeCredits] WASM scan done: ${g.length} ext(s)`), g))) : Promise.resolve([]), [c, p, h] = await Promise.all([
12325
12393
  n,
12326
12394
  i,
12327
12395
  a
12328
12396
  ]);
12329
12397
  console.info(`[computeCredits] all resolved — ${c.length} ext(s), creditsAvailable: ${h.creditsAvailable}`);
12330
12398
  let d = 0;
12331
- for (const u of c) {
12332
- const f = p[r]?.[u.ext] ?? 1, y = u.units * f;
12333
- d += y, u.credits = Math.round(y);
12399
+ for (const g of c) {
12400
+ const f = p[r]?.[g.ext] ?? 1, y = g.units * f;
12401
+ d += y, g.credits = Math.round(y);
12334
12402
  }
12335
12403
  return {
12336
12404
  costRecords: c,
@@ -12362,7 +12430,7 @@ WHERE {
12362
12430
  const { spaceId: o, providerId: r, userId: a, signal: i, onProgress: n, skipProcessing: c = !1 } = e;
12363
12431
  if (!t.data)
12364
12432
  throw new Error("syncBrowserFile requires file.data (Uint8Array). Read the file with File.arrayBuffer() first.");
12365
- const p = xe(
12433
+ const p = ke(
12366
12434
  t.relativePath,
12367
12435
  o,
12368
12436
  a,
@@ -12483,7 +12551,7 @@ class Qe {
12483
12551
  * ```
12484
12552
  */
12485
12553
  get gis() {
12486
- return this._gis || (this._gis = new ci(
12554
+ return this._gis || (this._gis = new ui(
12487
12555
  () => this.api.getAuthHeaders(),
12488
12556
  this._endpoints.gatewayUrl
12489
12557
  )), this._gis;
@@ -12492,16 +12560,16 @@ class Qe {
12492
12560
  !t.apiKey && !t.appId && !t.measurementId && console.warn(
12493
12561
  "Using default SDK app settings. Contact QAECY for your own configuration for any production code."
12494
12562
  );
12495
- const o = t.apiKey ?? ht.apiKey, r = t.appId ?? ht.appId, a = t.measurementId ?? ht.measurementId, i = t.environment ?? "production";
12563
+ const o = t.apiKey ?? dt.apiKey, r = t.appId ?? dt.appId, a = t.measurementId ?? dt.measurementId, i = t.environment ?? "production";
12496
12564
  this._endpoints = { ...Ae[i], ...t.endpoints }, this._isEmulator = i === "emulator", this._verbose = t.verbose ?? !1;
12497
12565
  const n = i === "production" ? "[DEFAULT]" : `cue-${i}`;
12498
12566
  this._app = to().find((p) => p.name === n) ?? eo({
12499
12567
  apiKey: o,
12500
12568
  appId: r,
12501
12569
  measurementId: a,
12502
- authDomain: `${Mt}.firebaseapp.com`,
12570
+ authDomain: t.authDomain ?? `${Mt}.firebaseapp.com`,
12503
12571
  projectId: Mt,
12504
- messagingSenderId: Ho
12572
+ messagingSenderId: Vo
12505
12573
  }, n), this.auth = new Zt(this._app, this._isEmulator, this._endpoints), this.signup = new te(this._endpoints.gatewayUrl), this.projects = new he(this.auth, this._endpoints);
12506
12574
  const c = Kt(this._app, this.auth, this._endpoints, t.storage, this._isEmulator);
12507
12575
  this.blob = c, this.api = this._buildApi(this.projects, c), this.storage = new ee(this.auth, this._endpoints.gatewayUrl), this.profile = new de(this.auth, this._endpoints.gatewayUrl), this.usageStats = new ue(this.auth, this._endpoints.gatewayUrl), this.api.sync?._bindProfile(this.profile), this.admin = new ge(this.auth, this._endpoints.gatewayUrl), this.privileges = new fe(this.auth.isSuperAdmin), this.cache = new ye(c);
@@ -12527,7 +12595,7 @@ class Qe {
12527
12595
  p._bindApi(h);
12528
12596
  const d = new de(a, r.gatewayUrl);
12529
12597
  p._bindProfile(d);
12530
- const u = new ue(a, r.gatewayUrl), w = new ge(a, r.gatewayUrl), f = Object.create(Qe.prototype), y = new fe(a.isSuperAdmin), b = new ye(c), m = new ee(a, r.gatewayUrl), E = new be();
12598
+ const g = new ue(a, r.gatewayUrl), w = new ge(a, r.gatewayUrl), f = Object.create(Qe.prototype), y = new fe(a.isSuperAdmin), b = new ye(c), m = new ee(a, r.gatewayUrl), v = new be();
12531
12599
  return Object.assign(f, {
12532
12600
  _app: t,
12533
12601
  _endpoints: r,
@@ -12538,12 +12606,12 @@ class Qe {
12538
12606
  api: h,
12539
12607
  projects: n,
12540
12608
  profile: d,
12541
- usageStats: u,
12609
+ usageStats: g,
12542
12610
  admin: w,
12543
12611
  privileges: y,
12544
12612
  cache: b,
12545
12613
  storage: m,
12546
- currency: E
12614
+ currency: v
12547
12615
  }), f;
12548
12616
  }
12549
12617
  _buildApi(t, e) {
@@ -12569,7 +12637,7 @@ class Qe {
12569
12637
  * ```
12570
12638
  */
12571
12639
  createProjectView(t, e) {
12572
- return new $i(this.api, t, { verbose: this._verbose, ...e });
12640
+ return new Di(this.api, t, { verbose: this._verbose, ...e });
12573
12641
  }
12574
12642
  /**
12575
12643
  * Creates a `CueProjectEntities` instance for the given project, bound to the
@@ -12630,8 +12698,8 @@ class Qe {
12630
12698
  );
12631
12699
  }
12632
12700
  }
12633
- const yt = "https://qlever.cs.uni-freiburg.de/materializedView/", F = _.qcy;
12634
- class Ji {
12701
+ const bt = "https://qlever.cs.uni-freiburg.de/materializedView/", q = _.qcy;
12702
+ class tn {
12635
12703
  constructor(t, e, o) {
12636
12704
  this._api = t, this._projectId = e, this._graphType = o;
12637
12705
  }
@@ -12681,7 +12749,7 @@ class Ji {
12681
12749
  */
12682
12750
  async availableEntities(t, e) {
12683
12751
  const r = Pe(e ?? {}).join(`
12684
- `), a = `PREFIX qcy: <${F}>
12752
+ `), a = `PREFIX qcy: <${q}>
12685
12753
  SELECT DISTINCT ?entity ?val
12686
12754
  WHERE {
12687
12755
  {
@@ -12724,16 +12792,16 @@ ORDER BY ?val`, i = await this._api.sparql(a, this._projectId, this._graphType),
12724
12792
  // ── Private query builders ──────────────────────────────────────────────────
12725
12793
  /** Single-dimension available-filters query using the dimension-specific views. */
12726
12794
  _buildViewDimQuery(t, e) {
12727
- const o = t === "mime" ? "doc-mime-cats" : t === "content" ? "doc-content-cats" : "doc-entity-cats", r = t === "mime" ? "?mimeCat" : t === "content" ? "?contentCat" : "?entityCat", a = ji(e);
12728
- return a.length === 0 ? `PREFIX view: <${yt}>
12795
+ const o = t === "mime" ? "doc-mime-cats" : t === "content" ? "doc-content-cats" : "doc-entity-cats", r = t === "mime" ? "?mimeCat" : t === "content" ? "?contentCat" : "?entityCat", a = qi(e);
12796
+ return a.length === 0 ? `PREFIX view: <${bt}>
12729
12797
  SELECT DISTINCT ${r}
12730
12798
  WHERE {
12731
12799
  SERVICE view:${o} {
12732
12800
  _:cfg view:column-doc ?doc ;
12733
12801
  view:column-cat ${r} .
12734
12802
  }
12735
- }` : `PREFIX view: <${yt}>
12736
- PREFIX qcy: <${F}>
12803
+ }` : `PREFIX view: <${bt}>
12804
+ PREFIX qcy: <${q}>
12737
12805
  SELECT DISTINCT ${r}
12738
12806
  WHERE {
12739
12807
  {
@@ -12752,7 +12820,7 @@ WHERE {
12752
12820
  _buildLiveDimQuery(t, e) {
12753
12821
  const r = Pe(e).join(`
12754
12822
  `);
12755
- return `PREFIX qcy: <${F}>
12823
+ return `PREFIX qcy: <${q}>
12756
12824
  SELECT DISTINCT ${t === "mime" ? "?mimeCat" : t === "content" ? "?contentCat" : "?entityCat"}
12757
12825
  WHERE {
12758
12826
  {
@@ -12788,8 +12856,8 @@ WHERE {
12788
12856
  o.type === "entity" ? e.push(`FILTER NOT EXISTS { ?doc qcy:about ?excE . ?excE qcy:hasEntityCategory <${i}> }`) : o.type === "mime" ? e.push(`FILTER NOT EXISTS { ?doc qcy:hasMimeCategory <${i}> }`) : e.push(`FILTER NOT EXISTS { ?doc qcy:hasContentCategory <${i}> }`);
12789
12857
  }
12790
12858
  if (e.length === 0) throw new Error("no view filter clauses");
12791
- return `PREFIX view: <${yt}>
12792
- PREFIX qcy: <${F}>
12859
+ return `PREFIX view: <${bt}>
12860
+ PREFIX qcy: <${q}>
12793
12861
  SELECT DISTINCT ?id
12794
12862
  WHERE {
12795
12863
  ${e.join(`
@@ -12841,7 +12909,7 @@ WHERE {
12841
12909
  e.push(`FILTER NOT EXISTS { ?doc qcy:hasContentCategory <${r}> }`);
12842
12910
  }
12843
12911
  }
12844
- return `PREFIX qcy: <${F}>
12912
+ return `PREFIX qcy: <${q}>
12845
12913
  SELECT DISTINCT ?id
12846
12914
  WHERE {
12847
12915
  ?doc a qcy:FileContent .
@@ -12852,7 +12920,7 @@ WHERE {
12852
12920
  }`;
12853
12921
  }
12854
12922
  }
12855
- function ji(s) {
12923
+ function qi(s) {
12856
12924
  const t = [];
12857
12925
  for (const e of s.entities ?? [])
12858
12926
  t.push(`?doc qcy:about <${e}> .`);
@@ -12915,67 +12983,67 @@ function De(s, t, e) {
12915
12983
  entityCategories: o(e.results.bindings, "entityCat")
12916
12984
  };
12917
12985
  }
12918
- const Yi = (s) => s.dryRun === !0;
12986
+ const en = (s) => s.dryRun === !0;
12919
12987
  export {
12920
12988
  Je as $,
12921
12989
  Xe as A,
12922
- Gi as B,
12923
- Ei as C,
12924
- ui as D,
12925
- $i as E,
12990
+ Ji as B,
12991
+ ki as C,
12992
+ yi as D,
12993
+ Di as E,
12926
12994
  he as F,
12927
- kt as G,
12928
- pa as H,
12929
- ha as I,
12995
+ xt as G,
12996
+ ga as H,
12997
+ wa as I,
12930
12998
  te as J,
12931
12999
  T as K,
12932
13000
  ee as L,
12933
13001
  Re as M,
12934
- $s as N,
12935
- Bs as O,
13002
+ Ds as N,
13003
+ Xs as O,
12936
13004
  At as P,
12937
- ca as Q,
12938
- na as R,
12939
- vi as S,
12940
- _i as T,
12941
- fi as U,
13005
+ ua as Q,
13006
+ da as R,
13007
+ Ci as S,
13008
+ Ii as T,
13009
+ Ei as U,
12942
13010
  we as V,
12943
- bi as W,
12944
- Bi as X,
12945
- mi as Y,
12946
- Xi as Z,
12947
- xt as _,
12948
- yi as a,
12949
- Si as a0,
12950
- Ti as a1,
12951
- Yi as a2,
12952
- Ii as a3,
12953
- Wi as a4,
12954
- Hi as a5,
12955
- Vi as a6,
12956
- wi as b,
13011
+ Si as W,
13012
+ Xi as X,
13013
+ _i as Y,
13014
+ Zi as Z,
13015
+ kt as _,
13016
+ Ti as a,
13017
+ $i as a0,
13018
+ xi as a1,
13019
+ en as a2,
13020
+ Oi as a3,
13021
+ Qi as a4,
13022
+ Yi as a5,
13023
+ Ki as a6,
13024
+ vi as b,
12957
13025
  Qe as c,
12958
13026
  ge as d,
12959
13027
  se as e,
12960
- qs as f,
12961
- zs as g,
13028
+ Ws as f,
13029
+ Vs as g,
12962
13030
  Zt as h,
12963
- z as i,
13031
+ B as i,
12964
13032
  ye as j,
12965
- As as k,
13033
+ Ls as k,
12966
13034
  be as l,
12967
- aa as m,
12968
- Hs as n,
12969
- Ji as o,
12970
- da as p,
12971
- Rs as q,
12972
- ci as r,
12973
- ia as s,
12974
- Ds as t,
12975
- ra as u,
12976
- Fs as v,
13035
+ la as m,
13036
+ Ys as n,
13037
+ tn as o,
13038
+ fa as p,
13039
+ js as q,
13040
+ ui as r,
13041
+ ha as s,
13042
+ Ms as t,
13043
+ ca as u,
13044
+ Hs as v,
12977
13045
  fe as w,
12978
- Gs as x,
13046
+ Js as x,
12979
13047
  de as y,
12980
13048
  It as z
12981
13049
  };