@fayz-ai/core 0.8.2 → 0.8.3

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.
Files changed (54) hide show
  1. package/dist/{chunk-SO3VUKGZ.cjs → chunk-CATASHPK.cjs} +117 -4
  2. package/dist/chunk-CATASHPK.cjs.map +1 -0
  3. package/dist/{chunk-JHGXROKV.js → chunk-DZALZ6Q6.js} +117 -4
  4. package/dist/chunk-DZALZ6Q6.js.map +1 -0
  5. package/dist/{chunk-CYAWDW44.cjs → chunk-KSI2L3E4.cjs} +6 -4
  6. package/dist/chunk-KSI2L3E4.cjs.map +1 -0
  7. package/dist/{chunk-XJKW2JRW.js → chunk-TYPVSWLG.js} +6 -4
  8. package/dist/chunk-TYPVSWLG.js.map +1 -0
  9. package/dist/data/archetype.d.ts.map +1 -1
  10. package/dist/data/index.cjs +12 -12
  11. package/dist/data/index.js +1 -1
  12. package/dist/data/refresh.d.ts +36 -0
  13. package/dist/data/refresh.d.ts.map +1 -0
  14. package/dist/data/supabase.d.ts.map +1 -1
  15. package/dist/data/types.d.ts +6 -0
  16. package/dist/data/types.d.ts.map +1 -1
  17. package/dist/i18n/index.cjs +10 -10
  18. package/dist/i18n/index.js +1 -1
  19. package/dist/i18n/shell-translations.d.ts.map +1 -1
  20. package/dist/index.cjs +697 -88
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +5 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +652 -59
  25. package/dist/index.js.map +1 -1
  26. package/dist/search/engine.d.ts +12 -0
  27. package/dist/search/engine.d.ts.map +1 -0
  28. package/dist/search/index.d.ts +5 -0
  29. package/dist/search/index.d.ts.map +1 -0
  30. package/dist/search/text.d.ts +37 -0
  31. package/dist/search/text.d.ts.map +1 -0
  32. package/dist/search/types.d.ts +72 -0
  33. package/dist/search/types.d.ts.map +1 -0
  34. package/dist/types/org.d.ts +28 -0
  35. package/dist/types/org.d.ts.map +1 -1
  36. package/dist/types/plugins.d.ts +4 -0
  37. package/dist/types/plugins.d.ts.map +1 -1
  38. package/package.json +2 -2
  39. package/src/data/archetype.ts +4 -2
  40. package/src/data/refresh.ts +105 -0
  41. package/src/data/supabase.ts +3 -1
  42. package/src/data/types.ts +6 -0
  43. package/src/i18n/shell-translations.ts +115 -2
  44. package/src/index.ts +19 -1
  45. package/src/search/engine.ts +551 -0
  46. package/src/search/index.ts +25 -0
  47. package/src/search/text.ts +206 -0
  48. package/src/search/types.ts +75 -0
  49. package/src/types/org.ts +29 -0
  50. package/src/types/plugins.ts +4 -0
  51. package/dist/chunk-CYAWDW44.cjs.map +0 -1
  52. package/dist/chunk-JHGXROKV.js.map +0 -1
  53. package/dist/chunk-SO3VUKGZ.cjs.map +0 -1
  54. package/dist/chunk-XJKW2JRW.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  var chunk56GH3WC2_cjs = require('./chunk-56GH3WC2.cjs');
4
4
  var chunkP5OJUH25_cjs = require('./chunk-P5OJUH25.cjs');
5
- var chunkCYAWDW44_cjs = require('./chunk-CYAWDW44.cjs');
5
+ var chunkKSI2L3E4_cjs = require('./chunk-KSI2L3E4.cjs');
6
6
  var chunkUKU4RIWM_cjs = require('./chunk-UKU4RIWM.cjs');
7
7
  var chunkZOPJB5FN_cjs = require('./chunk-ZOPJB5FN.cjs');
8
- var chunkSO3VUKGZ_cjs = require('./chunk-SO3VUKGZ.cjs');
8
+ var chunkCATASHPK_cjs = require('./chunk-CATASHPK.cjs');
9
9
  var chunkAXTWKF5X_cjs = require('./chunk-AXTWKF5X.cjs');
10
10
  var chunk5TKIZVVJ_cjs = require('./chunk-5TKIZVVJ.cjs');
11
- var React2 = require('react');
11
+ var React3 = require('react');
12
12
  var zustand = require('zustand');
13
13
 
14
14
  function _interopNamespace(e) {
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
29
29
  return Object.freeze(n);
30
30
  }
31
31
 
32
- var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
32
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
33
33
 
34
34
  // src/types/plugins.ts
35
35
  var WidgetZone = {
@@ -43,13 +43,104 @@ var WidgetZone = {
43
43
  SETTINGS_AFTER: "settings.after",
44
44
  FLOATING: "shell.floating"
45
45
  };
46
+ function createEventBus() {
47
+ const handlers = /* @__PURE__ */ new Map();
48
+ const bus = {
49
+ emit(event, payload) {
50
+ const set = handlers.get(event);
51
+ if (!set) return;
52
+ for (const handler of Array.from(set)) {
53
+ try {
54
+ handler(payload);
55
+ } catch (err) {
56
+ console.error(`[fayz] event handler for "${event}" threw:`, err);
57
+ }
58
+ }
59
+ },
60
+ on(event, handler) {
61
+ let set = handlers.get(event);
62
+ if (!set) {
63
+ set = /* @__PURE__ */ new Set();
64
+ handlers.set(event, set);
65
+ }
66
+ set.add(handler);
67
+ return () => bus.off(event, handler);
68
+ },
69
+ once(event, handler) {
70
+ const wrapped = (payload) => {
71
+ bus.off(event, wrapped);
72
+ handler(payload);
73
+ };
74
+ return bus.on(event, wrapped);
75
+ },
76
+ off(event, handler) {
77
+ handlers.get(event)?.delete(handler);
78
+ },
79
+ clear(event) {
80
+ if (event) handlers.delete(event);
81
+ else handlers.clear();
82
+ }
83
+ };
84
+ return bus;
85
+ }
86
+ var eventBus = createEventBus();
87
+ function useOnEvent(event, handler, deps = []) {
88
+ const ref = React3__namespace.useRef(handler);
89
+ ref.current = handler;
90
+ React3__namespace.useEffect(
91
+ () => eventBus.on(event, (payload) => ref.current(payload)),
92
+ // eslint-disable-next-line react-hooks/exhaustive-deps
93
+ [event, ...deps]
94
+ );
95
+ }
96
+
97
+ // src/data/refresh.ts
98
+ var DATA_CHANGED_EVENT = "data:changed";
99
+ function matchesDataChange(match, payload) {
100
+ const attributed = payload.table ?? payload.entityKey ?? payload.archetype;
101
+ if (!attributed) return true;
102
+ if (match.table && payload.table && match.table === payload.table) return true;
103
+ if (match.entityKey && payload.entityKey && match.entityKey === payload.entityKey) return true;
104
+ if (match.archetype && payload.archetype && match.archetype === payload.archetype) return true;
105
+ return !match.table && !match.entityKey && !match.archetype;
106
+ }
107
+ var pending = [];
108
+ var flushTimer = null;
109
+ function flush() {
110
+ const batch = pending;
111
+ pending = [];
112
+ flushTimer = null;
113
+ for (const payload of batch) eventBus.emit(DATA_CHANGED_EVENT, payload);
114
+ }
115
+ function emitDataChanged(payload = {}) {
116
+ if (payload.table) {
117
+ chunkKSI2L3E4_cjs.globalCache.invalidate(`${chunkKSI2L3E4_cjs.getActiveTenantId() ?? "_"}:${payload.table}`);
118
+ } else {
119
+ chunkKSI2L3E4_cjs.globalCache.clear();
120
+ }
121
+ pending.push({ op: "unknown", source: "agent", ...payload });
122
+ if (flushTimer) return;
123
+ flushTimer = setTimeout(flush, 120);
124
+ }
125
+ function useDataChanged(match, handler, deps = []) {
126
+ const handlerRef = React3__namespace.useRef(handler);
127
+ handlerRef.current = handler;
128
+ const { table, entityKey, archetype } = match;
129
+ React3__namespace.useEffect(
130
+ () => eventBus.on(DATA_CHANGED_EVENT, (payload) => {
131
+ if (matchesDataChange({ table, entityKey, archetype }, payload)) handlerRef.current(payload);
132
+ }),
133
+ // eslint-disable-next-line react-hooks/exhaustive-deps
134
+ [table, entityKey, archetype, ...deps]
135
+ );
136
+ }
46
137
 
47
138
  // src/plugin/createSafeDataProvider.ts
48
139
  function createSafeDataProvider(makeSupabase, makeMock) {
49
140
  let resolved = null;
50
141
  const get = () => {
51
142
  if (!resolved) {
52
- resolved = chunkCYAWDW44_cjs.getSupabaseClientOptional() ? makeSupabase() : makeMock();
143
+ resolved = chunkKSI2L3E4_cjs.getSupabaseClientOptional() ? makeSupabase() : makeMock();
53
144
  }
54
145
  return resolved;
55
146
  };
@@ -246,7 +337,7 @@ function applySeo(config) {
246
337
  }
247
338
  function useSeo(config) {
248
339
  const key = JSON.stringify(config);
249
- React2.useEffect(() => {
340
+ React3.useEffect(() => {
250
341
  applySeo(config);
251
342
  return () => clearManaged();
252
343
  }, [key]);
@@ -282,7 +373,7 @@ function setDefaultCurrency(code) {
282
373
  }
283
374
  function getActiveLocale() {
284
375
  try {
285
- return chunkSO3VUKGZ_cjs.getCurrentLocale() || "en";
376
+ return chunkCATASHPK_cjs.getCurrentLocale() || "en";
286
377
  } catch {
287
378
  return "en";
288
379
  }
@@ -349,58 +440,560 @@ function downloadCSV(csv, filename) {
349
440
  function exportCSV(columns, rows, filename) {
350
441
  downloadCSV(buildCSV(columns, rows), filename);
351
442
  }
352
- function createEventBus() {
353
- const handlers = /* @__PURE__ */ new Map();
354
- const bus = {
355
- emit(event, payload) {
356
- const set = handlers.get(event);
357
- if (!set) return;
358
- for (const handler of Array.from(set)) {
359
- try {
360
- handler(payload);
361
- } catch (err) {
362
- console.error(`[fayz] event handler for "${event}" threw:`, err);
363
- }
443
+
444
+ // src/search/text.ts
445
+ var COMBINING_MARKS = /[\u0300-\u036f]/g;
446
+ function foldText(value) {
447
+ if (typeof value !== "string" || value === "") return "";
448
+ return value.normalize("NFD").replace(COMBINING_MARKS, "").toLowerCase().replace(/[^a-z0-9]+/g, " ").trim();
449
+ }
450
+ function foldWithMap(value) {
451
+ const out = [];
452
+ const map = [];
453
+ let pendingSpace = false;
454
+ for (let i = 0; i < value.length; i++) {
455
+ const ch = value[i];
456
+ const folded = ch.normalize("NFD").replace(COMBINING_MARKS, "").toLowerCase();
457
+ for (const f of folded) {
458
+ const alnum = f >= "a" && f <= "z" || f >= "0" && f <= "9";
459
+ if (!alnum) {
460
+ pendingSpace = out.length > 0;
461
+ continue;
364
462
  }
365
- },
366
- on(event, handler) {
367
- let set = handlers.get(event);
368
- if (!set) {
369
- set = /* @__PURE__ */ new Set();
370
- handlers.set(event, set);
463
+ if (pendingSpace) {
464
+ out.push(" ");
465
+ map.push(i);
466
+ pendingSpace = false;
371
467
  }
372
- set.add(handler);
373
- return () => bus.off(event, handler);
374
- },
375
- once(event, handler) {
376
- const wrapped = (payload) => {
377
- bus.off(event, wrapped);
378
- handler(payload);
379
- };
380
- return bus.on(event, wrapped);
381
- },
382
- off(event, handler) {
383
- handlers.get(event)?.delete(handler);
384
- },
385
- clear(event) {
386
- if (event) handlers.delete(event);
387
- else handlers.clear();
468
+ out.push(f);
469
+ map.push(i);
388
470
  }
471
+ }
472
+ return { folded: out.join(""), map };
473
+ }
474
+ function digitsOf(value) {
475
+ return typeof value === "string" ? value.replace(/\D+/g, "") : "";
476
+ }
477
+ var MIN_DIGIT_QUERY = 4;
478
+ function normalizeQuery(raw) {
479
+ const folded = foldText(raw);
480
+ const tokens = folded ? folded.split(" ").filter(Boolean) : [];
481
+ const digits = raw.replace(/\D+/g, "");
482
+ let anchor = "";
483
+ for (const token of tokens) if (token.length > anchor.length) anchor = token;
484
+ return {
485
+ raw,
486
+ folded,
487
+ tokens,
488
+ digits: digits.length >= MIN_DIGIT_QUERY ? digits : "",
489
+ anchor
389
490
  };
390
- return bus;
391
491
  }
392
- var eventBus = createEventBus();
393
- function useOnEvent(event, handler, deps = []) {
394
- const ref = React2__namespace.useRef(handler);
395
- ref.current = handler;
396
- React2__namespace.useEffect(
397
- () => eventBus.on(event, (payload) => ref.current(payload)),
398
- // eslint-disable-next-line react-hooks/exhaustive-deps
399
- [event, ...deps]
400
- );
492
+ function bigrams(value) {
493
+ if (value.length < 2) return value ? [value] : [];
494
+ const out = [];
495
+ for (let i = 0; i < value.length - 1; i++) out.push(value.slice(i, i + 2));
496
+ return out;
497
+ }
498
+ function similarity(a, b) {
499
+ if (!a || !b) return 0;
500
+ if (a === b) return 1;
501
+ const left = bigrams(a);
502
+ const right = bigrams(b);
503
+ if (left.length === 0 || right.length === 0) return 0;
504
+ const pool = /* @__PURE__ */ new Map();
505
+ for (const g of left) pool.set(g, (pool.get(g) ?? 0) + 1);
506
+ let shared = 0;
507
+ for (const g of right) {
508
+ const count = pool.get(g);
509
+ if (count) {
510
+ shared++;
511
+ pool.set(g, count - 1);
512
+ }
513
+ }
514
+ return 2 * shared / (left.length + right.length);
515
+ }
516
+ function wordSimilarity(text, token) {
517
+ let best = similarity(text, token);
518
+ for (const word of text.split(" ")) {
519
+ if (!word) continue;
520
+ const s = similarity(word, token);
521
+ if (s > best) best = s;
522
+ }
523
+ return best;
524
+ }
525
+ var FUZZY_FLOOR = 0.62;
526
+ function scoreCandidate(query, candidate) {
527
+ const { folded, tokens } = query;
528
+ if (!folded || tokens.length === 0) return 0;
529
+ const title = candidate.title;
530
+ const haystack = candidate.haystack || title;
531
+ let phrase = 0;
532
+ if (title === folded) phrase = 1;
533
+ else if (title.startsWith(folded)) phrase = 0.94;
534
+ else if (title.includes(" " + folded)) phrase = 0.88;
535
+ else if (title.includes(folded)) phrase = 0.76;
536
+ else if (haystack.startsWith(folded) || haystack.includes(" " + folded)) phrase = 0.7;
537
+ else if (haystack.includes(folded)) phrase = 0.62;
538
+ let tokenTotal = 0;
539
+ let fuzzyUsed = false;
540
+ for (const token of tokens) {
541
+ let best = 0;
542
+ if (title.startsWith(token)) best = 0.95;
543
+ else if (title.includes(" " + token)) best = 0.85;
544
+ else if (title.includes(token)) best = 0.7;
545
+ else if (haystack.startsWith(token) || haystack.includes(" " + token)) best = 0.6;
546
+ else if (haystack.includes(token)) best = 0.5;
547
+ else {
548
+ const sim = wordSimilarity(title, token);
549
+ if (sim >= FUZZY_FLOOR) {
550
+ best = 0.45 * sim;
551
+ fuzzyUsed = true;
552
+ }
553
+ }
554
+ if (best === 0) return phrase > 0 ? phrase : 0;
555
+ tokenTotal += best;
556
+ }
557
+ let tokenScore = tokenTotal / tokens.length;
558
+ if (fuzzyUsed) tokenScore *= 0.8;
559
+ let score = Math.max(phrase, tokenScore);
560
+ if (query.digits && candidate.digits && candidate.digits.includes(query.digits)) {
561
+ score = Math.max(score, 0.72 + Math.min(0.2, query.digits.length / 50));
562
+ }
563
+ if (score === 0) return 0;
564
+ const brevity = 1 / (1 + Math.max(0, title.length - folded.length) / 40);
565
+ return score * 0.97 + brevity * 0.03;
566
+ }
567
+ function highlightRanges(text, query) {
568
+ if (!text || query.tokens.length === 0) return [];
569
+ const { folded, map } = foldWithMap(text);
570
+ if (!folded) return [];
571
+ const spans = [];
572
+ const needles = query.tokens.length > 1 ? [query.folded, ...query.tokens] : [query.folded];
573
+ for (const needle of needles) {
574
+ if (!needle) continue;
575
+ let from = 0;
576
+ for (; ; ) {
577
+ const at = folded.indexOf(needle, from);
578
+ if (at === -1) break;
579
+ const start = map[at];
580
+ const endChar = map[at + needle.length - 1];
581
+ if (start !== void 0 && endChar !== void 0) spans.push([start, endChar + 1]);
582
+ from = at + needle.length;
583
+ }
584
+ }
585
+ if (spans.length === 0) return [];
586
+ spans.sort((a, b) => a[0] - b[0]);
587
+ const merged = [spans[0]];
588
+ for (const span of spans.slice(1)) {
589
+ const last = merged[merged.length - 1];
590
+ if (span[0] <= last[1]) last[1] = Math.max(last[1], span[1]);
591
+ else merged.push(span);
592
+ }
593
+ return merged;
594
+ }
595
+
596
+ // src/search/engine.ts
597
+ var MIN_QUERY_LENGTH = 2;
598
+ var DEFAULT_LIMIT = 30;
599
+ var DEFAULT_PER_TARGET = 5;
600
+ var SCAN_CONCURRENCY = 16;
601
+ var TARGET_TIMEOUT_MS = 3e3;
602
+ var CACHE_TTL_MS = 3e4;
603
+ var CACHE_MAX_ENTRIES = 40;
604
+ var RPC_NAME = "fayz_global_search";
605
+ var indexAvailable = null;
606
+ function setSearchIndexAvailable(value) {
607
+ indexAvailable = value;
608
+ }
609
+ function isSearchIndexAvailable() {
610
+ return indexAvailable;
611
+ }
612
+ function camelOf(key) {
613
+ return key.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
614
+ }
615
+ function snakeOf(key) {
616
+ return key.replace(/[A-Z]/g, (c) => "_" + c.toLowerCase());
617
+ }
618
+ function readField(row, key) {
619
+ if (key in row) return row[key];
620
+ const camel = camelOf(key);
621
+ if (camel in row) return row[camel];
622
+ const snake = snakeOf(key);
623
+ if (snake in row) return row[snake];
624
+ return void 0;
625
+ }
626
+ function asText(value) {
627
+ if (typeof value === "string") return value;
628
+ if (typeof value === "number") return String(value);
629
+ if (Array.isArray(value)) return value.filter((v) => typeof v === "string").join(" ");
630
+ return "";
631
+ }
632
+ function searchableKeys(entity) {
633
+ const declared = entity.data?.searchColumns ?? entity.fields.filter((f) => f.searchable).map((f) => f.key);
634
+ const keys = [...declared];
635
+ const display = entity.displayField ?? "name";
636
+ if (!keys.includes(display)) keys.unshift(display);
637
+ const subtitle = entity.subtitleField;
638
+ if (subtitle && !keys.includes(subtitle)) keys.push(subtitle);
639
+ return keys;
640
+ }
641
+ var DIGIT_FIELD_TYPES = /* @__PURE__ */ new Set(["phone", "number"]);
642
+ function digitKeys(entity) {
643
+ const keys = entity.fields.filter((f) => DIGIT_FIELD_TYPES.has(f.type) || /phone|document|cpf|cnpj|zip|postal|sku|code|reference/i.test(f.key)).map((f) => f.key);
644
+ for (const extra of ["phone", "document_number", "sku", "reference_number", "postal_code"]) {
645
+ if (!keys.includes(extra)) keys.push(extra);
646
+ }
647
+ return keys;
648
+ }
649
+ function titleOf(entity, row) {
650
+ const display = entity.displayField ?? "name";
651
+ const primary = asText(readField(row, display));
652
+ if (primary) return primary;
653
+ for (const field of entity.fields) {
654
+ if (field.type === "text" || field.type === "email") {
655
+ const value = asText(readField(row, field.key));
656
+ if (value) return value;
657
+ }
658
+ }
659
+ return asText(row.id) || "\u2014";
660
+ }
661
+ function subtitleOf(entity, row, title) {
662
+ const distinct = (value) => {
663
+ if (!value || foldText(value) === foldText(title)) return void 0;
664
+ return value.length > 90 ? value.slice(0, 89) + "\u2026" : value;
665
+ };
666
+ const declared = entity.subtitleField;
667
+ if (declared) {
668
+ const value = distinct(asText(readField(row, declared)));
669
+ if (value) return value;
670
+ }
671
+ for (const key of ["email", "phone", "sku", "reference_number", "document_number", "description"]) {
672
+ const value = distinct(asText(readField(row, key)));
673
+ if (value) return value;
674
+ }
675
+ return void 0;
676
+ }
677
+ function hitFromRow(target, row, query) {
678
+ const id = asText(row.id);
679
+ if (!id) return null;
680
+ const entity = target.entity;
681
+ const title = titleOf(entity, row);
682
+ const parts = [title];
683
+ for (const key of searchableKeys(entity)) {
684
+ const value = asText(readField(row, key));
685
+ if (value) parts.push(value);
686
+ }
687
+ let digits = "";
688
+ for (const key of digitKeys(entity)) {
689
+ const value = readField(row, key);
690
+ if (typeof value === "string" || typeof value === "number") digits += digitsOf(String(value));
691
+ }
692
+ const score = scoreCandidate(query, {
693
+ title: foldText(title),
694
+ haystack: foldText(parts.join(" ")),
695
+ digits
696
+ });
697
+ if (score === 0) return null;
698
+ return {
699
+ uid: `${target.key}:${id}`,
700
+ id,
701
+ key: target.key,
702
+ group: target.label,
703
+ icon: target.icon ?? entity.icon,
704
+ title,
705
+ subtitle: subtitleOf(entity, row, title),
706
+ score: score * (target.boost ?? 1),
707
+ archetype: entity.data?.archetype,
708
+ archetypeKind: entity.data?.archetypeKind,
709
+ table: entity.data?.table,
710
+ record: row
711
+ };
712
+ }
713
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
714
+ function recordIdentity(hit) {
715
+ if (UUID.test(hit.id)) return hit.id;
716
+ return `${hit.table ?? hit.key}#${hit.id}`;
717
+ }
718
+ function assemble(query, hits, targets, opts) {
719
+ const seen = /* @__PURE__ */ new Set();
720
+ const unique = [];
721
+ for (const hit of hits.slice().sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))) {
722
+ const identity = recordIdentity(hit);
723
+ if (seen.has(identity)) continue;
724
+ seen.add(identity);
725
+ unique.push(hit);
726
+ }
727
+ const byKey = /* @__PURE__ */ new Map();
728
+ const kept = [];
729
+ const capped = /* @__PURE__ */ new Set();
730
+ for (const hit of unique) {
731
+ const bucket = byKey.get(hit.key) ?? [];
732
+ if (bucket.length >= opts.perTarget) {
733
+ capped.add(hit.key);
734
+ continue;
735
+ }
736
+ bucket.push(hit);
737
+ byKey.set(hit.key, bucket);
738
+ kept.push(hit);
739
+ }
740
+ const limited = kept.slice(0, opts.limit);
741
+ const order = new Map(targets.map((t, i) => [t.key, i]));
742
+ const groups = [];
743
+ for (const hit of limited) {
744
+ let group = groups.find((g) => g.key === hit.key);
745
+ if (!group) {
746
+ group = { key: hit.key, label: hit.group, icon: hit.icon, hits: [], hasMore: capped.has(hit.key) };
747
+ groups.push(group);
748
+ }
749
+ group.hits.push(hit);
750
+ }
751
+ groups.sort((a, b) => (b.hits[0]?.score ?? 0) - (a.hits[0]?.score ?? 0) || (order.get(a.key) ?? 99) - (order.get(b.key) ?? 99));
752
+ return {
753
+ query,
754
+ hits: limited,
755
+ groups,
756
+ via: opts.via,
757
+ failed: opts.failed,
758
+ elapsedMs: opts.elapsedMs,
759
+ partial: opts.partial ?? false
760
+ };
761
+ }
762
+ var cache = [];
763
+ function scopeKey(targets) {
764
+ return `${chunkKSI2L3E4_cjs.getActiveTenantId() ?? "_"}|${targets.map((t) => t.key).sort().join(",")}`;
765
+ }
766
+ function cacheGet(scope, folded) {
767
+ const now = Date.now();
768
+ return cache.find((e) => e.scope === scope && e.folded === folded && now - e.at < CACHE_TTL_MS);
769
+ }
770
+ function cachePrefix(scope, folded) {
771
+ const now = Date.now();
772
+ let best;
773
+ for (const entry of cache) {
774
+ if (entry.scope !== scope || !entry.complete) continue;
775
+ if (now - entry.at >= CACHE_TTL_MS) continue;
776
+ if (!folded.startsWith(entry.folded)) continue;
777
+ if (!best || entry.folded.length > best.folded.length) best = entry;
778
+ }
779
+ return best;
780
+ }
781
+ function cacheSet(entry) {
782
+ const at = cache.findIndex((e) => e.scope === entry.scope && e.folded === entry.folded);
783
+ if (at >= 0) cache.splice(at, 1);
784
+ cache.unshift(entry);
785
+ if (cache.length > CACHE_MAX_ENTRIES) cache.length = CACHE_MAX_ENTRIES;
786
+ }
787
+ function clearSearchCache() {
788
+ cache.length = 0;
789
+ }
790
+ function isMissingFunction(error) {
791
+ if (!error) return false;
792
+ if (error.code === "PGRST202") return true;
793
+ const message = (error.message ?? "").toLowerCase();
794
+ return message.includes(RPC_NAME) && (message.includes("does not exist") || message.includes("not find"));
795
+ }
796
+ async function searchViaIndex(query, targets, perTarget, limit) {
797
+ const client = chunkKSI2L3E4_cjs.getSupabaseClientOptional();
798
+ const tenantId = chunkKSI2L3E4_cjs.getActiveTenantId();
799
+ if (!client || !tenantId) return { hits: [], ok: false };
800
+ const byKey = new Map(targets.map((t) => [t.key, t]));
801
+ const { data, error } = await client.rpc(RPC_NAME, {
802
+ p_query: query.raw,
803
+ p_tenant_id: tenantId,
804
+ p_entity_keys: targets.map((t) => t.key),
805
+ p_per_source: perTarget * 3,
806
+ p_limit: limit * 3
807
+ });
808
+ if (error) {
809
+ if (isMissingFunction(error)) {
810
+ indexAvailable = false;
811
+ return { hits: [], ok: false };
812
+ }
813
+ throw error;
814
+ }
815
+ indexAvailable = true;
816
+ const rows = Array.isArray(data) ? data : [];
817
+ const hits = [];
818
+ for (const row of rows) {
819
+ const target = byKey.get(row.entity_key);
820
+ if (!target || !row.record_id) continue;
821
+ const title = row.title ?? "";
822
+ const local = scoreCandidate(query, {
823
+ title: foldText(title),
824
+ haystack: foldText(`${title} ${row.subtitle ?? ""}`),
825
+ digits: digitsOf(row.subtitle ?? "") + digitsOf(title)
826
+ });
827
+ const score = local > 0 ? local : Math.min(0.55, row.score ?? 0.4);
828
+ hits.push({
829
+ uid: `${target.key}:${row.record_id}`,
830
+ id: row.record_id,
831
+ key: target.key,
832
+ group: target.label,
833
+ icon: target.icon ?? target.entity.icon,
834
+ title: title || "\u2014",
835
+ subtitle: row.subtitle ?? void 0,
836
+ score: score * (target.boost ?? 1),
837
+ archetype: target.entity.data?.archetype,
838
+ archetypeKind: target.entity.data?.archetypeKind,
839
+ table: target.entity.data?.table
840
+ });
841
+ }
842
+ return { hits, ok: true };
843
+ }
844
+ async function withTimeout(promise, ms) {
845
+ let timer;
846
+ try {
847
+ return await Promise.race([
848
+ promise,
849
+ new Promise((_, reject) => {
850
+ timer = setTimeout(() => reject(new Error("search target timed out")), ms);
851
+ })
852
+ ]);
853
+ } finally {
854
+ if (timer) clearTimeout(timer);
855
+ }
856
+ }
857
+ async function mapLimited(items, limit, fn) {
858
+ const results = new Array(items.length);
859
+ let cursor = 0;
860
+ const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
861
+ for (; ; ) {
862
+ const index = cursor++;
863
+ if (index >= items.length) return;
864
+ const item = items[index];
865
+ try {
866
+ results[index] = { ok: true, value: await fn(item) };
867
+ } catch {
868
+ results[index] = { ok: false, item };
869
+ }
870
+ }
871
+ });
872
+ await Promise.all(workers);
873
+ return results;
874
+ }
875
+ async function searchViaScan(query, targets, perTarget, onProgress) {
876
+ const multiWord = query.tokens.length > 1;
877
+ const phrase = query.folded;
878
+ const token = query.anchor.length >= MIN_QUERY_LENGTH ? query.anchor : phrase;
879
+ const pageSize = Math.min(perTarget * 3, 24);
880
+ const widePageSize = Math.min(perTarget * 6, 40);
881
+ const searchable = targets.filter((t) => searchableKeys(t.entity).length > 0);
882
+ const running = [];
883
+ const round = (search, size) => mapLimited(searchable, SCAN_CONCURRENCY, async (target) => {
884
+ const provider = chunkKSI2L3E4_cjs.resolveDataProvider(target.entity, target.mockData);
885
+ const result = await withTimeout(
886
+ provider.list({ search, pageSize: size, countMode: "none" }),
887
+ TARGET_TIMEOUT_MS
888
+ );
889
+ const rows = result.data;
890
+ const hits = rows.map((row) => hitFromRow(target, row, query)).filter((h) => h !== null);
891
+ if (hits.length && onProgress) {
892
+ running.push(...hits);
893
+ onProgress(running.slice());
894
+ }
895
+ return { target, hits };
896
+ });
897
+ const collect = (settled) => {
898
+ const hits = [];
899
+ const failed = [];
900
+ for (const outcome of settled) {
901
+ if (outcome.ok) hits.push(...outcome.value.hits);
902
+ else failed.push(outcome.item.key);
903
+ }
904
+ return { hits, failed };
905
+ };
906
+ const first = collect(await round(phrase, pageSize));
907
+ if (first.hits.length > 0 || !multiWord || token === phrase) return first;
908
+ const second = collect(await round(token, widePageSize));
909
+ return { hits: second.hits, failed: [.../* @__PURE__ */ new Set([...first.failed, ...second.failed])] };
910
+ }
911
+ async function searchEverything(rawQuery, options) {
912
+ const started = Date.now();
913
+ const query = normalizeQuery(rawQuery);
914
+ const targets = options.targets;
915
+ const limit = options.limit ?? DEFAULT_LIMIT;
916
+ const perTarget = options.perTarget ?? DEFAULT_PER_TARGET;
917
+ const empty = (via2) => assemble(rawQuery, [], targets, { via: via2, failed: [], elapsedMs: Date.now() - started, perTarget, limit });
918
+ if (query.folded.length < MIN_QUERY_LENGTH || targets.length === 0) return empty("cache");
919
+ const scope = scopeKey(targets);
920
+ const exact = cacheGet(scope, query.folded);
921
+ if (exact) {
922
+ return assemble(rawQuery, exact.hits, targets, {
923
+ via: "cache",
924
+ failed: [],
925
+ elapsedMs: Date.now() - started,
926
+ perTarget,
927
+ limit
928
+ });
929
+ }
930
+ if (options.onPartial) {
931
+ const prefix = cachePrefix(scope, query.folded);
932
+ if (prefix) {
933
+ const rescored = prefix.hits.map((hit) => {
934
+ const score = scoreCandidate(query, {
935
+ title: foldText(hit.title),
936
+ haystack: foldText(`${hit.title} ${hit.subtitle ?? ""}`),
937
+ digits: digitsOf(hit.subtitle ?? "")
938
+ });
939
+ return score > 0 ? { ...hit, score } : null;
940
+ }).filter((h) => h !== null);
941
+ options.onPartial(assemble(rawQuery, rescored, targets, {
942
+ via: "cache",
943
+ failed: [],
944
+ elapsedMs: Date.now() - started,
945
+ perTarget,
946
+ limit,
947
+ partial: true
948
+ }));
949
+ }
950
+ }
951
+ let hits = [];
952
+ let failed = [];
953
+ let via = "scan";
954
+ if (!options.forceScan && indexAvailable !== false) {
955
+ try {
956
+ const indexed = await searchViaIndex(query, targets, perTarget, limit);
957
+ if (indexed.ok) {
958
+ hits = indexed.hits;
959
+ via = "index";
960
+ }
961
+ } catch {
962
+ }
963
+ }
964
+ if (via !== "index") {
965
+ const emit = options.onPartial;
966
+ const scanned = await searchViaScan(query, targets, perTarget, emit ? (running) => emit(assemble(rawQuery, running, targets, {
967
+ via: "scan",
968
+ failed: [],
969
+ elapsedMs: Date.now() - started,
970
+ perTarget,
971
+ limit,
972
+ partial: true
973
+ })) : void 0);
974
+ hits = scanned.hits;
975
+ failed = scanned.failed;
976
+ }
977
+ if (options.signal?.aborted) return empty(via);
978
+ const result = assemble(rawQuery, hits, targets, {
979
+ via,
980
+ failed,
981
+ elapsedMs: Date.now() - started,
982
+ perTarget,
983
+ limit
984
+ });
985
+ cacheSet({
986
+ scope,
987
+ folded: query.folded,
988
+ at: Date.now(),
989
+ // Only an uncapped answer is a sound superset for longer queries.
990
+ complete: failed.length === 0 && !result.groups.some((g) => g.hasMore),
991
+ hits
992
+ });
993
+ return result;
401
994
  }
402
995
  function UnknownBlock({ type }) {
403
- return React2__namespace.createElement(
996
+ return React3__namespace.createElement(
404
997
  "div",
405
998
  {
406
999
  style: {
@@ -417,14 +1010,14 @@ function UnknownBlock({ type }) {
417
1010
  function BlockRenderer({ node }) {
418
1011
  const Comp = chunkZOPJB5FN_cjs.getBlock(node.type);
419
1012
  const childEls = node.children?.length ? node.children.map(
420
- (child, i) => React2__namespace.createElement(BlockRenderer, { key: child.id ?? `${child.type}-${i}`, node: child })
1013
+ (child, i) => React3__namespace.createElement(BlockRenderer, { key: child.id ?? `${child.type}-${i}`, node: child })
421
1014
  ) : null;
422
- if (!Comp) return React2__namespace.createElement(UnknownBlock, { type: node.type });
423
- return React2__namespace.createElement(Comp, { ...node.props ?? {}, node }, childEls);
1015
+ if (!Comp) return React3__namespace.createElement(UnknownBlock, { type: node.type });
1016
+ return React3__namespace.createElement(Comp, { ...node.props ?? {}, node }, childEls);
424
1017
  }
425
1018
  function renderBlocks(nodes) {
426
1019
  return nodes.map(
427
- (node, i) => React2__namespace.createElement(BlockRenderer, { key: node.id ?? `${node.type}-${i}`, node })
1020
+ (node, i) => React3__namespace.createElement(BlockRenderer, { key: node.id ?? `${node.type}-${i}`, node })
428
1021
  );
429
1022
  }
430
1023
  function BlockChildren({ node }) {
@@ -1404,9 +1997,9 @@ var app_manifest_schema_default = {
1404
1997
  }
1405
1998
  }
1406
1999
  };
1407
- var ManifestContext = React2__namespace.createContext(null);
2000
+ var ManifestContext = React3__namespace.createContext(null);
1408
2001
  function useManifest() {
1409
- return React2__namespace.useContext(ManifestContext);
2002
+ return React3__namespace.useContext(ManifestContext);
1410
2003
  }
1411
2004
  function defineApp(manifest) {
1412
2005
  const full = {
@@ -1438,10 +2031,10 @@ function renderApp(input, opts = {}) {
1438
2031
  `Scaffold "${surface.scaffold}" is not registered. Import the package that provides it (e.g. @fayz-ai/saas or @fayz-ai/shop) before calling renderApp.`
1439
2032
  );
1440
2033
  }
1441
- return React2__namespace.createElement(
2034
+ return React3__namespace.createElement(
1442
2035
  ManifestContext.Provider,
1443
2036
  { value: manifest },
1444
- React2__namespace.createElement(Scaffold, { manifest, surface: surfaceName })
2037
+ React3__namespace.createElement(Scaffold, { manifest, surface: surfaceName })
1445
2038
  );
1446
2039
  }
1447
2040
  var MAX_ENTRIES = 20;
@@ -1502,79 +2095,79 @@ Object.defineProperty(exports, "assertPluginManifestContract", {
1502
2095
  });
1503
2096
  Object.defineProperty(exports, "FAYZ_CLOUD_PUBLISHABLE_KEY", {
1504
2097
  enumerable: true,
1505
- get: function () { return chunkCYAWDW44_cjs.FAYZ_CLOUD_PUBLISHABLE_KEY; }
2098
+ get: function () { return chunkKSI2L3E4_cjs.FAYZ_CLOUD_PUBLISHABLE_KEY; }
1506
2099
  });
1507
2100
  Object.defineProperty(exports, "FAYZ_CLOUD_URL", {
1508
2101
  enumerable: true,
1509
- get: function () { return chunkCYAWDW44_cjs.FAYZ_CLOUD_URL; }
2102
+ get: function () { return chunkKSI2L3E4_cjs.FAYZ_CLOUD_URL; }
1510
2103
  });
1511
2104
  Object.defineProperty(exports, "clearGlobalCache", {
1512
2105
  enumerable: true,
1513
- get: function () { return chunkCYAWDW44_cjs.clearGlobalCache; }
2106
+ get: function () { return chunkKSI2L3E4_cjs.clearGlobalCache; }
1514
2107
  });
1515
2108
  Object.defineProperty(exports, "countByTenant", {
1516
2109
  enumerable: true,
1517
- get: function () { return chunkCYAWDW44_cjs.countByTenant; }
2110
+ get: function () { return chunkKSI2L3E4_cjs.countByTenant; }
1518
2111
  });
1519
2112
  Object.defineProperty(exports, "createArchetypeProvider", {
1520
2113
  enumerable: true,
1521
- get: function () { return chunkCYAWDW44_cjs.createArchetypeProvider; }
2114
+ get: function () { return chunkKSI2L3E4_cjs.createArchetypeProvider; }
1522
2115
  });
1523
2116
  Object.defineProperty(exports, "createCacheStore", {
1524
2117
  enumerable: true,
1525
- get: function () { return chunkCYAWDW44_cjs.createCacheStore; }
2118
+ get: function () { return chunkKSI2L3E4_cjs.createCacheStore; }
1526
2119
  });
1527
2120
  Object.defineProperty(exports, "createFayzApiProvider", {
1528
2121
  enumerable: true,
1529
- get: function () { return chunkCYAWDW44_cjs.createFayzApiProvider; }
2122
+ get: function () { return chunkKSI2L3E4_cjs.createFayzApiProvider; }
1530
2123
  });
1531
2124
  Object.defineProperty(exports, "createMockProvider", {
1532
2125
  enumerable: true,
1533
- get: function () { return chunkCYAWDW44_cjs.createMockProvider; }
2126
+ get: function () { return chunkKSI2L3E4_cjs.createMockProvider; }
1534
2127
  });
1535
2128
  Object.defineProperty(exports, "createSupabaseProvider", {
1536
2129
  enumerable: true,
1537
- get: function () { return chunkCYAWDW44_cjs.createSupabaseProvider; }
2130
+ get: function () { return chunkKSI2L3E4_cjs.createSupabaseProvider; }
1538
2131
  });
1539
2132
  Object.defineProperty(exports, "getActiveTenantId", {
1540
2133
  enumerable: true,
1541
- get: function () { return chunkCYAWDW44_cjs.getActiveTenantId; }
2134
+ get: function () { return chunkKSI2L3E4_cjs.getActiveTenantId; }
1542
2135
  });
1543
2136
  Object.defineProperty(exports, "getFayzCloudClient", {
1544
2137
  enumerable: true,
1545
- get: function () { return chunkCYAWDW44_cjs.getFayzCloudClient; }
2138
+ get: function () { return chunkKSI2L3E4_cjs.getFayzCloudClient; }
1546
2139
  });
1547
2140
  Object.defineProperty(exports, "getSupabaseClientOptional", {
1548
2141
  enumerable: true,
1549
- get: function () { return chunkCYAWDW44_cjs.getSupabaseClientOptional; }
2142
+ get: function () { return chunkKSI2L3E4_cjs.getSupabaseClientOptional; }
1550
2143
  });
1551
2144
  Object.defineProperty(exports, "globalCache", {
1552
2145
  enumerable: true,
1553
- get: function () { return chunkCYAWDW44_cjs.globalCache; }
2146
+ get: function () { return chunkKSI2L3E4_cjs.globalCache; }
1554
2147
  });
1555
2148
  Object.defineProperty(exports, "invalidateCount", {
1556
2149
  enumerable: true,
1557
- get: function () { return chunkCYAWDW44_cjs.invalidateCount; }
2150
+ get: function () { return chunkKSI2L3E4_cjs.invalidateCount; }
1558
2151
  });
1559
2152
  Object.defineProperty(exports, "resolveDataProvider", {
1560
2153
  enumerable: true,
1561
- get: function () { return chunkCYAWDW44_cjs.resolveDataProvider; }
2154
+ get: function () { return chunkKSI2L3E4_cjs.resolveDataProvider; }
1562
2155
  });
1563
2156
  Object.defineProperty(exports, "setActiveTenantId", {
1564
2157
  enumerable: true,
1565
- get: function () { return chunkCYAWDW44_cjs.setActiveTenantId; }
2158
+ get: function () { return chunkKSI2L3E4_cjs.setActiveTenantId; }
1566
2159
  });
1567
2160
  Object.defineProperty(exports, "setGlobalSupabaseClient", {
1568
2161
  enumerable: true,
1569
- get: function () { return chunkCYAWDW44_cjs.setGlobalSupabaseClient; }
2162
+ get: function () { return chunkKSI2L3E4_cjs.setGlobalSupabaseClient; }
1570
2163
  });
1571
2164
  Object.defineProperty(exports, "stableKey", {
1572
2165
  enumerable: true,
1573
- get: function () { return chunkCYAWDW44_cjs.stableKey; }
2166
+ get: function () { return chunkKSI2L3E4_cjs.stableKey; }
1574
2167
  });
1575
2168
  Object.defineProperty(exports, "withCache", {
1576
2169
  enumerable: true,
1577
- get: function () { return chunkCYAWDW44_cjs.withCache; }
2170
+ get: function () { return chunkKSI2L3E4_cjs.withCache; }
1578
2171
  });
1579
2172
  Object.defineProperty(exports, "clearEntityRegistry", {
1580
2173
  enumerable: true,
@@ -1746,39 +2339,39 @@ Object.defineProperty(exports, "usePluginRuntimeOptional", {
1746
2339
  });
1747
2340
  Object.defineProperty(exports, "I18nProvider", {
1748
2341
  enumerable: true,
1749
- get: function () { return chunkSO3VUKGZ_cjs.I18nProvider; }
2342
+ get: function () { return chunkCATASHPK_cjs.I18nProvider; }
1750
2343
  });
1751
2344
  Object.defineProperty(exports, "coreTranslations", {
1752
2345
  enumerable: true,
1753
- get: function () { return chunkSO3VUKGZ_cjs.coreTranslations; }
2346
+ get: function () { return chunkCATASHPK_cjs.coreTranslations; }
1754
2347
  });
1755
2348
  Object.defineProperty(exports, "getCurrentLocale", {
1756
2349
  enumerable: true,
1757
- get: function () { return chunkSO3VUKGZ_cjs.getCurrentLocale; }
2350
+ get: function () { return chunkCATASHPK_cjs.getCurrentLocale; }
1758
2351
  });
1759
2352
  Object.defineProperty(exports, "mergeTranslations", {
1760
2353
  enumerable: true,
1761
- get: function () { return chunkSO3VUKGZ_cjs.mergeTranslations; }
2354
+ get: function () { return chunkCATASHPK_cjs.mergeTranslations; }
1762
2355
  });
1763
2356
  Object.defineProperty(exports, "registerTranslations", {
1764
2357
  enumerable: true,
1765
- get: function () { return chunkSO3VUKGZ_cjs.registerTranslations; }
2358
+ get: function () { return chunkCATASHPK_cjs.registerTranslations; }
1766
2359
  });
1767
2360
  Object.defineProperty(exports, "setCurrentLocale", {
1768
2361
  enumerable: true,
1769
- get: function () { return chunkSO3VUKGZ_cjs.setCurrentLocale; }
2362
+ get: function () { return chunkCATASHPK_cjs.setCurrentLocale; }
1770
2363
  });
1771
2364
  Object.defineProperty(exports, "setLocaleStore", {
1772
2365
  enumerable: true,
1773
- get: function () { return chunkSO3VUKGZ_cjs.setLocaleStore; }
2366
+ get: function () { return chunkCATASHPK_cjs.setLocaleStore; }
1774
2367
  });
1775
2368
  Object.defineProperty(exports, "useI18nConfig", {
1776
2369
  enumerable: true,
1777
- get: function () { return chunkSO3VUKGZ_cjs.useI18nConfig; }
2370
+ get: function () { return chunkCATASHPK_cjs.useI18nConfig; }
1778
2371
  });
1779
2372
  Object.defineProperty(exports, "useTranslation", {
1780
2373
  enumerable: true,
1781
- get: function () { return chunkSO3VUKGZ_cjs.useTranslation; }
2374
+ get: function () { return chunkCATASHPK_cjs.useTranslation; }
1782
2375
  });
1783
2376
  Object.defineProperty(exports, "hashRouterAdapter", {
1784
2377
  enumerable: true,
@@ -1800,7 +2393,9 @@ exports.BlockChildren = BlockChildren;
1800
2393
  exports.BlockRenderer = BlockRenderer;
1801
2394
  exports.COUNTRIES = COUNTRIES;
1802
2395
  exports.CURRENT_MANIFEST_VERSION = CURRENT_MANIFEST_VERSION;
2396
+ exports.DATA_CHANGED_EVENT = DATA_CHANGED_EVENT;
1803
2397
  exports.DEFAULT_COUNTRY = DEFAULT_COUNTRY;
2398
+ exports.MIN_QUERY_LENGTH = MIN_QUERY_LENGTH;
1804
2399
  exports.WidgetZone = WidgetZone;
1805
2400
  exports.absoluteUrl = absoluteUrl;
1806
2401
  exports.appManifestSchema = app_manifest_schema_default;
@@ -1808,14 +2403,19 @@ exports.applySeo = applySeo;
1808
2403
  exports.breadcrumbJsonLd = breadcrumbJsonLd;
1809
2404
  exports.buildCSV = buildCSV;
1810
2405
  exports.clearPostalCache = clearPostalCache;
2406
+ exports.clearSearchCache = clearSearchCache;
1811
2407
  exports.computeContractHash = computeContractHash;
1812
2408
  exports.createEventBus = createEventBus;
1813
2409
  exports.createSafeDataProvider = createSafeDataProvider;
1814
2410
  exports.createViaCepProvider = createViaCepProvider;
1815
2411
  exports.defineApp = defineApp;
2412
+ exports.digitsOf = digitsOf;
1816
2413
  exports.downloadCSV = downloadCSV;
2414
+ exports.emitDataChanged = emitDataChanged;
1817
2415
  exports.eventBus = eventBus;
1818
2416
  exports.exportCSV = exportCSV;
2417
+ exports.foldText = foldText;
2418
+ exports.foldWithMap = foldWithMap;
1819
2419
  exports.formatCurrency = formatCurrency;
1820
2420
  exports.formatDate = formatDate;
1821
2421
  exports.formatDateTime = formatDateTime;
@@ -1824,25 +2424,34 @@ exports.getActiveLocale = getActiveLocale;
1824
2424
  exports.getCountry = getCountry;
1825
2425
  exports.getDefaultCurrency = getDefaultCurrency;
1826
2426
  exports.getPostalLookupProvider = getPostalLookupProvider;
2427
+ exports.highlightRanges = highlightRanges;
2428
+ exports.isSearchIndexAvailable = isSearchIndexAvailable;
1827
2429
  exports.isValidPostalCode = isValidPostalCode;
1828
2430
  exports.lookupPostalCode = lookupPostalCode;
1829
2431
  exports.maskDigitCount = maskDigitCount;
1830
2432
  exports.maskPhone = maskPhone;
2433
+ exports.matchesDataChange = matchesDataChange;
1831
2434
  exports.migrateManifest = migrateManifest;
1832
2435
  exports.navHistoryBack = navHistoryBack;
1833
2436
  exports.normalizePostalCode = normalizePostalCode;
2437
+ exports.normalizeQuery = normalizeQuery;
1834
2438
  exports.organizationJsonLd = organizationJsonLd;
1835
2439
  exports.recordNavigation = recordNavigation;
1836
2440
  exports.registerManifestMigration = registerManifestMigration;
1837
2441
  exports.renderApp = renderApp;
1838
2442
  exports.renderBlocks = renderBlocks;
1839
2443
  exports.routeModule = routeModule;
2444
+ exports.scoreCandidate = scoreCandidate;
2445
+ exports.searchEverything = searchEverything;
1840
2446
  exports.seoOrigin = seoOrigin;
1841
2447
  exports.serializeManifest = serializeManifest;
1842
2448
  exports.serializeManifestWithHash = serializeManifestWithHash;
1843
2449
  exports.setDefaultCurrency = setDefaultCurrency;
1844
2450
  exports.setPostalLookupProvider = setPostalLookupProvider;
2451
+ exports.setSearchIndexAvailable = setSearchIndexAvailable;
2452
+ exports.similarity = similarity;
1845
2453
  exports.unmaskPhone = unmaskPhone;
2454
+ exports.useDataChanged = useDataChanged;
1846
2455
  exports.useManifest = useManifest;
1847
2456
  exports.useNavHistoryStore = useNavHistoryStore;
1848
2457
  exports.useNavReferrer = useNavReferrer;