@wirecat/hubspot-cli 0.0.0-stage → 0.1.0

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 (269) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +204 -0
  3. package/README.md +256 -2
  4. package/contracts/wirecat.json +1965 -0
  5. package/dist/bin/hubspot.d.ts +3 -0
  6. package/dist/bin/hubspot.d.ts.map +1 -0
  7. package/dist/bin/hubspot.js +40 -0
  8. package/dist/bin/hubspot.js.map +1 -0
  9. package/dist/bundle/all-profiles-64JAUYW4.js +279 -0
  10. package/dist/bundle/anthropic-VJOS4OUM.js +91 -0
  11. package/dist/bundle/app-server-422MCA7S.js +245 -0
  12. package/dist/bundle/bun-M3J2QTR3.js +169 -0
  13. package/dist/bundle/bun-sqlite-IX3XYA5F.js +76 -0
  14. package/dist/bundle/chunk-24ERVFJP.js +73 -0
  15. package/dist/bundle/chunk-2QZK5BEP.js +392 -0
  16. package/dist/bundle/chunk-2TWQIWWG.js +1328 -0
  17. package/dist/bundle/chunk-2VGD63G6.js +604 -0
  18. package/dist/bundle/chunk-2VGZRYEH.js +334 -0
  19. package/dist/bundle/chunk-36ITRDYY.js +63116 -0
  20. package/dist/bundle/chunk-43EKCUBJ.js +72 -0
  21. package/dist/bundle/chunk-4W6BMH45.js +731 -0
  22. package/dist/bundle/chunk-5A6ZYNAQ.js +2003 -0
  23. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  24. package/dist/bundle/chunk-5GBUCHRU.js +274 -0
  25. package/dist/bundle/chunk-5K7QLJMM.js +4072 -0
  26. package/dist/bundle/chunk-65TWQ7BV.js +54 -0
  27. package/dist/bundle/chunk-7ELMWE3P.js +12066 -0
  28. package/dist/bundle/chunk-ADLS6FVG.js +24600 -0
  29. package/dist/bundle/chunk-B3MANLNK.js +602 -0
  30. package/dist/bundle/chunk-BKXDHU3G.js +1395 -0
  31. package/dist/bundle/chunk-C32AKHTY.js +2310 -0
  32. package/dist/bundle/chunk-CLAN3FES.js +1246 -0
  33. package/dist/bundle/chunk-CWXOXIWS.js +46 -0
  34. package/dist/bundle/chunk-D72URWJE.js +532 -0
  35. package/dist/bundle/chunk-DB2XKHI4.js +72 -0
  36. package/dist/bundle/chunk-DBEQI5YM.js +100 -0
  37. package/dist/bundle/chunk-DFCHHR5M.js +38 -0
  38. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  39. package/dist/bundle/chunk-DRWWJLI6.js +188 -0
  40. package/dist/bundle/chunk-DSP36YHQ.js +29 -0
  41. package/dist/bundle/chunk-E52JAS35.js +1028 -0
  42. package/dist/bundle/chunk-E5WLE7BM.js +78 -0
  43. package/dist/bundle/chunk-ECEZOLOD.js +230 -0
  44. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  45. package/dist/bundle/chunk-FBCCBCFH.js +288 -0
  46. package/dist/bundle/chunk-FKA7DOCK.js +53 -0
  47. package/dist/bundle/chunk-FOZYMDRL.js +259 -0
  48. package/dist/bundle/chunk-FPUGMDJV.js +7 -0
  49. package/dist/bundle/chunk-FTFV3HFW.js +721 -0
  50. package/dist/bundle/chunk-H3TNVEQX.js +782 -0
  51. package/dist/bundle/chunk-HC5ZWE5X.js +193 -0
  52. package/dist/bundle/chunk-HCAZV5NP.js +95 -0
  53. package/dist/bundle/chunk-HTAN663T.js +4045 -0
  54. package/dist/bundle/chunk-HZRQLAHO.js +16 -0
  55. package/dist/bundle/chunk-IMJQRPLN.js +92 -0
  56. package/dist/bundle/chunk-JLDBMEKZ.js +106 -0
  57. package/dist/bundle/chunk-JRCPCVPI.js +9393 -0
  58. package/dist/bundle/chunk-LNV33FDC.js +786 -0
  59. package/dist/bundle/chunk-LOBVOGOE.js +66 -0
  60. package/dist/bundle/chunk-MVA5HVKL.js +1392 -0
  61. package/dist/bundle/chunk-N2XADGL4.js +76 -0
  62. package/dist/bundle/chunk-NHHJHXMQ.js +58 -0
  63. package/dist/bundle/chunk-NUU4WZVL.js +52 -0
  64. package/dist/bundle/chunk-NWHEHV3K.js +133 -0
  65. package/dist/bundle/chunk-NXERIDPJ.js +319 -0
  66. package/dist/bundle/chunk-O3DYRCIT.js +23 -0
  67. package/dist/bundle/chunk-O55RWNSH.js +161 -0
  68. package/dist/bundle/chunk-P5BHKKBI.js +206 -0
  69. package/dist/bundle/chunk-PPHBRESD.js +82 -0
  70. package/dist/bundle/chunk-PVKF24ZW.js +364 -0
  71. package/dist/bundle/chunk-QGFX5MXL.js +460 -0
  72. package/dist/bundle/chunk-QJW35N5V.js +761 -0
  73. package/dist/bundle/chunk-QU25DA5N.js +360 -0
  74. package/dist/bundle/chunk-RMIYKDUL.js +1068 -0
  75. package/dist/bundle/chunk-RR5MX5TM.js +142 -0
  76. package/dist/bundle/chunk-SAKK2YRU.js +218 -0
  77. package/dist/bundle/chunk-SDQGB4KB.js +185 -0
  78. package/dist/bundle/chunk-TBJYLC5K.js +2788 -0
  79. package/dist/bundle/chunk-TI46WQXQ.js +1197 -0
  80. package/dist/bundle/chunk-TKVL2C3B.js +170 -0
  81. package/dist/bundle/chunk-TOSCB4SO.js +1227 -0
  82. package/dist/bundle/chunk-TP7GDWVF.js +6848 -0
  83. package/dist/bundle/chunk-UUMUL4L3.js +72 -0
  84. package/dist/bundle/chunk-VIEYMDBR.js +41 -0
  85. package/dist/bundle/chunk-W53EJOFQ.js +63 -0
  86. package/dist/bundle/chunk-W7HM2VGO.js +24 -0
  87. package/dist/bundle/chunk-WE4UFASG.js +88 -0
  88. package/dist/bundle/chunk-WQBX7XYP.js +26174 -0
  89. package/dist/bundle/chunk-X2M6NIQG.js +18 -0
  90. package/dist/bundle/chunk-X7XUX7A4.js +1846 -0
  91. package/dist/bundle/chunk-XRREFEIW.js +372 -0
  92. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  93. package/dist/bundle/chunk-ZBDSHFG4.js +40933 -0
  94. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  95. package/dist/bundle/command-contract-C6CBFXZF.js +40 -0
  96. package/dist/bundle/command-server-entry-DJKVVZCQ.js +169 -0
  97. package/dist/bundle/decode-FC65Y4IV.js +297 -0
  98. package/dist/bundle/definitions-MVPICAWV.js +2991 -0
  99. package/dist/bundle/dispatch-KOISQ5QJ.js +411 -0
  100. package/dist/bundle/dist-MYZZKZJ7.js +7577 -0
  101. package/dist/bundle/echarts-FVTUDXDU.js +42501 -0
  102. package/dist/bundle/embed-VNBZFPYH.js +38 -0
  103. package/dist/bundle/embedder-6U4NOFRO.js +111 -0
  104. package/dist/bundle/failure-FZ6VYKEQ.js +25 -0
  105. package/dist/bundle/first-run-RPIJZEDT.js +29 -0
  106. package/dist/bundle/first-screen-RTVMGHAE.js +40 -0
  107. package/dist/bundle/hubspot.js +198 -0
  108. package/dist/bundle/instructions-HET7BCYK.js +11 -0
  109. package/dist/bundle/mcp-RGNRW77S.js +167 -0
  110. package/dist/bundle/meeting-combined-L5AGBPYX.js +25 -0
  111. package/dist/bundle/meeting-model-NTB4RK3F.js +25 -0
  112. package/dist/bundle/meeting-semantic-JY3OGCBS.js +22 -0
  113. package/dist/bundle/node-CXZIFHZC.js +176 -0
  114. package/dist/bundle/node-P4E63KXA.js +2340 -0
  115. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  116. package/dist/bundle/node-sqlite-P3O7XN7Q.js +74 -0
  117. package/dist/bundle/oauth-HNCY4B2S.js +20 -0
  118. package/dist/bundle/open-F4P6YV54.js +23 -0
  119. package/dist/bundle/openai-4AICLIK3.js +238 -0
  120. package/dist/bundle/process-5RUXWGYS.js +91 -0
  121. package/dist/bundle/program-POG5GHUQ.js +9241 -0
  122. package/dist/bundle/prompt-NFMDVBZ4.js +17 -0
  123. package/dist/bundle/recognize-DKN3RY4V.js +26 -0
  124. package/dist/bundle/remote-6QHAGQWY.js +31 -0
  125. package/dist/bundle/rerank-M4KHEHUZ.js +52 -0
  126. package/dist/bundle/schemas-JRL3DLMP.js +952 -0
  127. package/dist/bundle/serve-DNU43ND6.js +199 -0
  128. package/dist/bundle/server-C3ZHA7AZ.js +77 -0
  129. package/dist/bundle/server-XJSNF3K5.js +207 -0
  130. package/dist/bundle/source-A3SBLHC4.js +934 -0
  131. package/dist/bundle/sqlite-runtime-EMQAC63N.js +20 -0
  132. package/dist/bundle/state-T45CX7VY.js +36 -0
  133. package/dist/bundle/store-6LCEVBAZ.js +176 -0
  134. package/dist/bundle/store-6TZ2FCVA.js +295 -0
  135. package/dist/bundle/store-CCDNUB6A.js +32 -0
  136. package/dist/bundle/store-maintenance-command-BRCG6MNA.js +68 -0
  137. package/dist/commands/account.d.ts +3 -0
  138. package/dist/commands/account.d.ts.map +1 -0
  139. package/dist/commands/account.js +87 -0
  140. package/dist/commands/account.js.map +1 -0
  141. package/dist/commands/api.d.ts +9 -0
  142. package/dist/commands/api.d.ts.map +1 -0
  143. package/dist/commands/api.js +65 -0
  144. package/dist/commands/api.js.map +1 -0
  145. package/dist/commands/comments.d.ts +3 -0
  146. package/dist/commands/comments.d.ts.map +1 -0
  147. package/dist/commands/comments.js +114 -0
  148. package/dist/commands/comments.js.map +1 -0
  149. package/dist/commands/crm-shared.d.ts +8 -0
  150. package/dist/commands/crm-shared.d.ts.map +1 -0
  151. package/dist/commands/crm-shared.js +93 -0
  152. package/dist/commands/crm-shared.js.map +1 -0
  153. package/dist/commands/schedule.d.ts +3 -0
  154. package/dist/commands/schedule.d.ts.map +1 -0
  155. package/dist/commands/schedule.js +9 -0
  156. package/dist/commands/schedule.js.map +1 -0
  157. package/dist/commands/session.d.ts +14 -0
  158. package/dist/commands/session.d.ts.map +1 -0
  159. package/dist/commands/session.js +164 -0
  160. package/dist/commands/session.js.map +1 -0
  161. package/dist/config.d.ts +22 -0
  162. package/dist/config.d.ts.map +1 -0
  163. package/dist/config.js +28 -0
  164. package/dist/config.js.map +1 -0
  165. package/dist/context.d.ts +88 -0
  166. package/dist/context.d.ts.map +1 -0
  167. package/dist/context.js +137 -0
  168. package/dist/context.js.map +1 -0
  169. package/dist/crm/activities.d.ts +24 -0
  170. package/dist/crm/activities.d.ts.map +1 -0
  171. package/dist/crm/activities.js +214 -0
  172. package/dist/crm/activities.js.map +1 -0
  173. package/dist/crm/associations.d.ts +20 -0
  174. package/dist/crm/associations.d.ts.map +1 -0
  175. package/dist/crm/associations.js +47 -0
  176. package/dist/crm/associations.js.map +1 -0
  177. package/dist/crm/records.d.ts +63 -0
  178. package/dist/crm/records.d.ts.map +1 -0
  179. package/dist/crm/records.js +333 -0
  180. package/dist/crm/records.js.map +1 -0
  181. package/dist/crm/search.d.ts +57 -0
  182. package/dist/crm/search.d.ts.map +1 -0
  183. package/dist/crm/search.js +47 -0
  184. package/dist/crm/search.js.map +1 -0
  185. package/dist/crm/source.d.ts +32 -0
  186. package/dist/crm/source.d.ts.map +1 -0
  187. package/dist/crm/source.js +369 -0
  188. package/dist/crm/source.js.map +1 -0
  189. package/dist/generated/definitions.d.ts +3 -0
  190. package/dist/generated/definitions.d.ts.map +1 -0
  191. package/dist/generated/definitions.js +2987 -0
  192. package/dist/generated/definitions.js.map +1 -0
  193. package/dist/generated/manifest.d.ts +6 -0
  194. package/dist/generated/manifest.d.ts.map +1 -0
  195. package/dist/generated/manifest.js +6499 -0
  196. package/dist/generated/manifest.js.map +1 -0
  197. package/dist/generated/schemas.d.ts +205 -0
  198. package/dist/generated/schemas.d.ts.map +1 -0
  199. package/dist/generated/schemas.js +810 -0
  200. package/dist/generated/schemas.js.map +1 -0
  201. package/dist/generated/types.d.ts +1114 -0
  202. package/dist/generated/types.d.ts.map +1 -0
  203. package/dist/generated/types.js +5 -0
  204. package/dist/generated/types.js.map +1 -0
  205. package/dist/hubspot/account.d.ts +12 -0
  206. package/dist/hubspot/account.d.ts.map +1 -0
  207. package/dist/hubspot/account.js +23 -0
  208. package/dist/hubspot/account.js.map +1 -0
  209. package/dist/hubspot/transport.d.ts +76 -0
  210. package/dist/hubspot/transport.d.ts.map +1 -0
  211. package/dist/hubspot/transport.js +346 -0
  212. package/dist/hubspot/transport.js.map +1 -0
  213. package/dist/identity.d.ts +7 -0
  214. package/dist/identity.d.ts.map +1 -0
  215. package/dist/identity.js +32 -0
  216. package/dist/identity.js.map +1 -0
  217. package/dist/index.d.ts +3 -0
  218. package/dist/index.d.ts.map +1 -0
  219. package/dist/index.js +3 -0
  220. package/dist/index.js.map +1 -0
  221. package/dist/program.d.ts +6 -0
  222. package/dist/program.d.ts.map +1 -0
  223. package/dist/program.js +77 -0
  224. package/dist/program.js.map +1 -0
  225. package/dist/reasons.d.ts +10 -0
  226. package/dist/reasons.d.ts.map +1 -0
  227. package/dist/reasons.js +33 -0
  228. package/dist/reasons.js.map +1 -0
  229. package/dist/sample/comments.d.ts +61 -0
  230. package/dist/sample/comments.d.ts.map +1 -0
  231. package/dist/sample/comments.js +39 -0
  232. package/dist/sample/comments.js.map +1 -0
  233. package/dist/sample/records.d.ts +16 -0
  234. package/dist/sample/records.d.ts.map +1 -0
  235. package/dist/sample/records.js +22 -0
  236. package/dist/sample/records.js.map +1 -0
  237. package/dist/sample/transport.d.ts +42 -0
  238. package/dist/sample/transport.d.ts.map +1 -0
  239. package/dist/sample/transport.js +153 -0
  240. package/dist/sample/transport.js.map +1 -0
  241. package/dist/setup/flow.d.ts +2 -0
  242. package/dist/setup/flow.d.ts.map +1 -0
  243. package/dist/setup/flow.js +97 -0
  244. package/dist/setup/flow.js.map +1 -0
  245. package/dist/setup/texts.en.json +19 -0
  246. package/dist/setup/texts.es.json +19 -0
  247. package/dist/setup/texts.ru.json +19 -0
  248. package/dist/store.d.ts +16 -0
  249. package/dist/store.d.ts.map +1 -0
  250. package/dist/store.js +34 -0
  251. package/dist/store.js.map +1 -0
  252. package/dist/version.d.ts +2 -0
  253. package/dist/version.d.ts.map +1 -0
  254. package/dist/version.js +2 -0
  255. package/dist/version.js.map +1 -0
  256. package/dist/wcat.d.ts +3 -0
  257. package/dist/wcat.d.ts.map +1 -0
  258. package/dist/wcat.js +4 -0
  259. package/dist/wcat.js.map +1 -0
  260. package/dist/whoami.d.ts +19 -0
  261. package/dist/whoami.d.ts.map +1 -0
  262. package/dist/whoami.js +15 -0
  263. package/dist/whoami.js.map +1 -0
  264. package/package.json +98 -4
  265. package/skills/hubspot-cli/SKILL.md +97 -0
  266. package/skills/hubspot-cli/references/api/api-basic.md +462 -0
  267. package/skills/hubspot-cli/references/api/api-batch.md +149 -0
  268. package/skills/hubspot-cli/references/api/api-search.md +147 -0
  269. package/skills/hubspot-cli/references/api.md +15 -0
@@ -0,0 +1,721 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ MESSAGE_PARSING,
5
+ MOST_WORDS_APART,
6
+ QUERY_LIMITS,
7
+ SEARCH_QUERY,
8
+ searchError
9
+ } from "./chunk-43EKCUBJ.js";
10
+ import {
11
+ tagOf
12
+ } from "./chunk-DSP36YHQ.js";
13
+ import {
14
+ parseLucene,
15
+ queryAstSchema,
16
+ validateQuery,
17
+ walkQuery
18
+ } from "./chunk-5K7QLJMM.js";
19
+ import {
20
+ safeParse
21
+ } from "./chunk-MVA5HVKL.js";
22
+ import {
23
+ CliError,
24
+ isCliError
25
+ } from "./chunk-DB2XKHI4.js";
26
+ import {
27
+ __name
28
+ } from "./chunk-ZVVMGPBJ.js";
29
+
30
+ // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/search/fusion.js
31
+ var RRF_K = 60;
32
+ var fuseRanked = /* @__PURE__ */ __name((lists, facts) => {
33
+ const rows = lists.flatMap((list) => list.map((item, rank) => ({ item, vote: 1 / (RRF_K + rank + 1), ...facts(item) })));
34
+ const ranking = rows.some(({ ranked }) => ranked);
35
+ return rows.sort((a, b) => Number(b.exact === true) - Number(a.exact === true) || (ranking ? Number(b.ranked) - Number(a.ranked) || b.vote - a.vote : 0) || b.at - a.at).map(({ item }) => item);
36
+ }, "fuseRanked");
37
+
38
+ // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/search/lucene/registry.js
39
+ var FIELD_VERSION = 2;
40
+ var UNITS = {
41
+ "": 1,
42
+ b: 1,
43
+ k: 1024,
44
+ kb: 1024,
45
+ m: 1024 ** 2,
46
+ mb: 1024 ** 2,
47
+ g: 1024 ** 3,
48
+ gb: 1024 ** 3
49
+ };
50
+ var parseBytes = /* @__PURE__ */ __name((value, span) => {
51
+ const [, amount, unit] = /^(\d+(?:\.\d+)?)\s*([a-z]*)$/iu.exec(value.trim()) ?? [];
52
+ const scale = UNITS[unit?.toLowerCase() ?? ""];
53
+ if (amount === void 0 || scale === void 0)
54
+ searchError("query.invalid-size", span, "use bytes or KB/MB/GB, e.g. 10MB");
55
+ return Math.round(Number(amount) * scale);
56
+ }, "parseBytes");
57
+ var filled = /* @__PURE__ */ __name((node) => {
58
+ if (node.value === "")
59
+ searchError("query.missing-value", node.span);
60
+ }, "filled");
61
+ var validateSize = /* @__PURE__ */ __name((node) => {
62
+ for (const bound of node.operator === "range" ? [node.value, node.upper] : [node.value])
63
+ if (bound !== void 0 && bound !== "*")
64
+ parseBytes(bound, node.span);
65
+ }, "validateSize");
66
+ var validateTag = /* @__PURE__ */ __name((node) => {
67
+ if (node.operator === "wildcard" ? !/^[a-z0-9*?-]{1,32}$/iu.test(node.value) : tagOf(node.value) === void 0)
68
+ searchError("query.invalid-tag", node.span, "a tag is 1-32 letters a-z, digits and hyphens");
69
+ }, "validateTag");
70
+ var validateMentioned = /* @__PURE__ */ __name((node) => {
71
+ if (!/^(?:person|organization|document):[1-9]\d*$/u.test(node.value))
72
+ searchError("query.invalid-reference", node.span, "use person:<uid>, organization:<id> or document:<id>, quoted");
73
+ }, "validateMentioned");
74
+ var validateTopic = /* @__PURE__ */ __name((node) => {
75
+ if (!/^\d+$/u.test(node.value))
76
+ searchError("query.invalid-topic", node.span, "use a thread id in one chat");
77
+ }, "validateTopic");
78
+ var terms = ["term", "phrase"];
79
+ var names = [...terms, "wildcard"];
80
+ var NAMES = "account-scoped: an id or contact: reference as is; with * or ? a pattern over alias, name, @username (up to 50); else a name";
81
+ var QUERY_FIELDS = [
82
+ {
83
+ name: "text",
84
+ example: "invoice",
85
+ index: "message_stems \u222A message_words; wildcard and regex: message_words",
86
+ aliases: [],
87
+ type: "txt",
88
+ operators: ["term", "phrase", "wildcard", "regex"],
89
+ normalization: "Snowball 3.1.1 by script (Cyrillic, Latin; the store's search_stemmers), then v1",
90
+ support: "A1"
91
+ },
92
+ {
93
+ name: "exact",
94
+ example: "exact:invoice",
95
+ index: "message_words",
96
+ aliases: [],
97
+ type: "txt",
98
+ operators: ["term", "phrase", "wildcard", "regex"],
99
+ normalization: "NFKD/marks/NFC/lowercase v1",
100
+ support: "A1"
101
+ },
102
+ {
103
+ name: "body",
104
+ example: "body:/.*invoice.*/",
105
+ index: "messages.text / bounded postfilter",
106
+ aliases: [],
107
+ type: "txt",
108
+ operators: ["term", "phrase", "wildcard", "regex"],
109
+ normalization: "raw, case-sensitive",
110
+ support: "A1"
111
+ },
112
+ {
113
+ name: "from",
114
+ example: "from:Alice*",
115
+ index: "identities / sender index",
116
+ aliases: ["sender"],
117
+ type: "kw",
118
+ operators: names,
119
+ normalization: NAMES,
120
+ support: "A1"
121
+ },
122
+ ...["to", "cc", "bcc"].map((name) => ({
123
+ name,
124
+ example: `${name}:"Alice Synthetic"`,
125
+ index: "email_recipients",
126
+ aliases: [],
127
+ type: "kw",
128
+ operators: names,
129
+ normalization: `${NAMES}; mail only`,
130
+ support: "A1"
131
+ })),
132
+ {
133
+ name: "subject",
134
+ example: 'subject:"quarterly planning"',
135
+ index: "email_words, then the subject",
136
+ aliases: [],
137
+ type: "txt",
138
+ operators: [...terms, "wildcard"],
139
+ normalization: "every word, folded as text is; mail only",
140
+ support: "A1",
141
+ validate: filled
142
+ },
143
+ {
144
+ name: "mailbox",
145
+ example: 'mailbox:INBOX OR mailbox:"[Gmail]/Sent Mail"',
146
+ index: "email_mailboxes",
147
+ aliases: [],
148
+ type: "kw",
149
+ operators: [...terms, "wildcard"],
150
+ normalization: "a folder or label by its id (ASCII case folded) or name (case folded in any script); mail only",
151
+ support: "A1"
152
+ },
153
+ {
154
+ name: "label",
155
+ example: "label:Projects",
156
+ index: "email_mailboxes",
157
+ aliases: [],
158
+ type: "kw",
159
+ operators: [...terms, "wildcard"],
160
+ normalization: "the same as mailbox:; mail only",
161
+ support: "A1"
162
+ },
163
+ {
164
+ name: "list",
165
+ example: "list:github.com",
166
+ index: "emails.headers list-id",
167
+ aliases: [],
168
+ type: "kw",
169
+ operators: terms,
170
+ normalization: "the List-Id of a mailing list, lower case; a domain matches every list under it; mail only",
171
+ support: "A1",
172
+ validate: filled
173
+ },
174
+ {
175
+ name: "is",
176
+ example: "is:unread",
177
+ index: "emails.read / emails.flagged / messages.starred",
178
+ aliases: [],
179
+ type: "enum",
180
+ operators: terms,
181
+ normalization: "lowercase; read and unread are mail only; starred is a flagged email or a message the owner starred; an unknown state matches neither read nor unread",
182
+ support: "A1",
183
+ values: ["unread", "read", "starred"]
184
+ },
185
+ {
186
+ name: "chat",
187
+ example: "chat:*fixture*",
188
+ index: "chats / message time index",
189
+ aliases: [],
190
+ type: "kw",
191
+ operators: names,
192
+ normalization: "account-scoped: an id or chat: reference as is; with * or ? a pattern over title, @username (up to 50); else a title",
193
+ support: "A1"
194
+ },
195
+ {
196
+ name: "date",
197
+ example: "date:[2026-01-01 TO 2026-02-01}",
198
+ index: "messages.sent_at",
199
+ aliases: [],
200
+ type: "time",
201
+ operators: [...terms, "range"],
202
+ normalization: "ISO/calendar timezone; today, yesterday, 30m/2h/7d ago",
203
+ support: "A1"
204
+ },
205
+ {
206
+ name: "source",
207
+ example: "source:internal",
208
+ index: "notes (internal) / documents (file)",
209
+ aliases: [],
210
+ type: "enum",
211
+ operators: terms,
212
+ normalization: "lowercase; notes only: internal is written in memo, file is from a notes folder",
213
+ support: "A1",
214
+ values: ["internal", "file"]
215
+ },
216
+ {
217
+ name: "kind",
218
+ example: "kind:private",
219
+ index: "chats.kind / peerKind metadata",
220
+ aliases: [],
221
+ type: "enum",
222
+ operators: terms,
223
+ normalization: "lowercase",
224
+ support: "A1",
225
+ values: ["private", "saved", "bot", "service", "group", "channel", "unknown"]
226
+ },
227
+ {
228
+ name: "muted",
229
+ example: "muted:false",
230
+ index: "chats.muted / chats.muted_until",
231
+ aliases: [],
232
+ type: "enum",
233
+ operators: terms,
234
+ normalization: "lowercase; true is a chat the owner muted, until the mute runs out; false is every other chat",
235
+ support: "A1",
236
+ values: ["true", "false"]
237
+ },
238
+ {
239
+ name: "participants_count",
240
+ example: "participants_count<10",
241
+ index: "chats.participants_count",
242
+ aliases: [],
243
+ type: "num",
244
+ operators: [...terms, "range"],
245
+ normalization: "a whole number; a chat whose size the messenger never told matches no value",
246
+ support: "A1"
247
+ },
248
+ {
249
+ name: "has",
250
+ example: "has:file",
251
+ index: "attachments / messages_fts links / message_transcripts",
252
+ aliases: [],
253
+ type: "enum",
254
+ operators: terms,
255
+ normalization: "lowercase",
256
+ support: "A1",
257
+ values: [
258
+ "text",
259
+ "attachment",
260
+ "link",
261
+ "file",
262
+ "photo",
263
+ "image",
264
+ "video",
265
+ "audio",
266
+ "voice",
267
+ "sticker",
268
+ "contact",
269
+ "location",
270
+ "poll",
271
+ "transcript"
272
+ ]
273
+ },
274
+ {
275
+ name: "topic",
276
+ example: "chat:7 AND topic:42",
277
+ index: "messages.thread_native_id",
278
+ aliases: [],
279
+ type: "kw",
280
+ operators: terms,
281
+ normalization: "string id, one chat required",
282
+ support: "A1",
283
+ validate: validateTopic
284
+ },
285
+ {
286
+ name: "in",
287
+ example: "in:bots",
288
+ index: "accounts.provider",
289
+ aliases: [],
290
+ type: "kw",
291
+ operators: terms,
292
+ normalization: "lowercase provider/account class",
293
+ support: "A1"
294
+ },
295
+ {
296
+ name: "preset",
297
+ example: "preset:secret",
298
+ index: "bounded local candidate detector",
299
+ aliases: [],
300
+ type: "enum",
301
+ operators: terms,
302
+ normalization: "versioned candidate detector",
303
+ support: "A1",
304
+ values: [
305
+ "password",
306
+ "code",
307
+ "api-key",
308
+ "secret",
309
+ "card",
310
+ "bank",
311
+ "passport",
312
+ "phone",
313
+ "email",
314
+ "telegram-link",
315
+ "url",
316
+ "contact",
317
+ "location"
318
+ ]
319
+ },
320
+ {
321
+ name: "filename",
322
+ example: "filename:*.pdf",
323
+ index: "attachments.name / bounded postfilter",
324
+ aliases: [],
325
+ type: "kw",
326
+ operators: [...terms, "wildcard", "regex"],
327
+ normalization: "NFKD/marks/NFC/lowercase v1, whole name",
328
+ support: "A2"
329
+ },
330
+ {
331
+ name: "mime",
332
+ example: 'mime:"application/pdf" OR mime:image',
333
+ index: "attachments.mime / bounded postfilter",
334
+ aliases: [],
335
+ type: "kw",
336
+ operators: [...terms, "wildcard"],
337
+ normalization: "lowercase; a value without / matches the first part; only where the messenger reports a type",
338
+ support: "A2"
339
+ },
340
+ {
341
+ name: "size",
342
+ example: "size>10MB",
343
+ index: "attachments.size",
344
+ aliases: [],
345
+ type: "kw",
346
+ operators: [...terms, "range"],
347
+ normalization: "bytes; KB/MB/GB are 1024-based",
348
+ support: "A2",
349
+ validate: validateSize
350
+ },
351
+ {
352
+ name: "content",
353
+ example: "content:invoice",
354
+ index: "attachment_words",
355
+ aliases: [],
356
+ type: "txt",
357
+ operators: [...terms, "wildcard"],
358
+ normalization: "NFKD/marks/NFC/lowercase v1; the text of files attachments extract read or an agent wrote",
359
+ support: "A2",
360
+ validate: filled
361
+ },
362
+ {
363
+ name: "transcript",
364
+ example: "transcript:invoice",
365
+ index: "attachment_words \u222A transcript_stems; garbled spellings from transcript_words_vocab",
366
+ aliases: [],
367
+ type: "txt",
368
+ operators: [...terms, "wildcard"],
369
+ normalization: "any form of the word (Snowball), widened to spellings speech recognition garbles; what a voice message said",
370
+ support: "A2",
371
+ validate: filled
372
+ },
373
+ ...[
374
+ [
375
+ "title",
376
+ 'title:"quarterly report"',
377
+ "documents.metadata, then the title column; chats.title_folded; email_words, then the subject",
378
+ "every word, folded as text is: of a note's or a file's title, inside a chat's title, of a mail's subject (as subject:)",
379
+ "txt"
380
+ ],
381
+ [
382
+ "site",
383
+ "site:wikipedia",
384
+ "documents.metadata (og:site_name)",
385
+ "contained, folded as text is; notes and files only",
386
+ "kw"
387
+ ],
388
+ [
389
+ "lang",
390
+ "lang:ru",
391
+ "documents.metadata (html lang)",
392
+ "language tag or its prefix, lowercase; notes and files only",
393
+ "kw"
394
+ ],
395
+ [
396
+ "author",
397
+ "author:ivanov",
398
+ "documents.metadata (meta author, JSON-LD)",
399
+ "contained, folded as text is; notes and files only",
400
+ "kw"
401
+ ],
402
+ [
403
+ "keyword",
404
+ "keyword:invoices",
405
+ "documents.metadata (meta keywords)",
406
+ "whole keyword, folded as text is; notes and files only",
407
+ "kw"
408
+ ]
409
+ ].map(([name, example, index, normalization, type]) => ({
410
+ name,
411
+ example,
412
+ index,
413
+ aliases: [],
414
+ type,
415
+ operators: terms,
416
+ normalization,
417
+ support: "A2",
418
+ validate: filled
419
+ })),
420
+ ...[
421
+ [
422
+ "phone",
423
+ 'phone:"8 900 000-00-01"',
424
+ "a phone found in the text, written any way; a number without + is read in phone_countries"
425
+ ],
426
+ ["email", "email:ana@example.com", "an address found in the text, lower-cased"],
427
+ ["url", 'url:"https://example.com/a"', "a link found in the text, without utm_*, fbclid and the fragment"],
428
+ ["domain", "domain:google.com", "the site of a link or an address in the text; docs.google.com means google.com"],
429
+ [
430
+ "link",
431
+ 'link:"click?id=1"',
432
+ "a part of a link, quoted; Latin letters in any case; in mail also the body of a letter with a tracking link"
433
+ ]
434
+ ].map(([name, example, normalization]) => ({
435
+ name,
436
+ example,
437
+ index: "mentions (kind, value) / (domain); in mail a tracking link is kept as its site",
438
+ aliases: [],
439
+ type: "kw",
440
+ operators: terms,
441
+ normalization,
442
+ support: "A2",
443
+ validate: filled
444
+ })),
445
+ {
446
+ name: "mentions",
447
+ example: 'mentions:"person:12"',
448
+ index: "mentions (target_type, target_id)",
449
+ aliases: [],
450
+ type: "kw",
451
+ operators: terms,
452
+ normalization: "a person (by name, phone or address), an organization or a document, linked; quoted",
453
+ support: "A2",
454
+ validate: validateMentioned
455
+ },
456
+ {
457
+ name: "tag",
458
+ example: "tag:work",
459
+ index: "tags: the message, its chat or its sender",
460
+ aliases: [],
461
+ type: "kw",
462
+ operators: [...terms, "wildcard"],
463
+ normalization: "lowercase a-z, 0-9 and -, 1-32 characters",
464
+ support: "A2",
465
+ validate: validateTag
466
+ }
467
+ ];
468
+ var MESSAGES = { entity: "message", backend: "sql", fields: QUERY_FIELDS };
469
+ var NEAR_FIELDS = /* @__PURE__ */ new Set(["text", "exact", "transcript", "content"]);
470
+ var CANONICAL = new Map(QUERY_FIELDS.flatMap(({ name, aliases }) => aliases.map((alias) => [alias, name])));
471
+ var isPresence = /* @__PURE__ */ __name((node) => node.operator === "wildcard" && node.value === "*", "isPresence");
472
+ var PRESENCE = /* @__PURE__ */ new Set(["from", "to", "cc", "bcc", "subject", "title", "topic", "participants_count"]);
473
+ var ALWAYS = /* @__PURE__ */ new Set(["chat", "date"]);
474
+ var EVERY_DATE = { operator: "range", value: "*", upper: "*", lower_inclusive: true, upper_inclusive: true };
475
+ var PRESENCE_INSTEAD = {
476
+ text: "has:text",
477
+ exact: "has:text",
478
+ body: "has:text",
479
+ content: "has:file",
480
+ transcript: "has:transcript",
481
+ size: "has:attachment",
482
+ url: "has:link",
483
+ link: "has:link",
484
+ domain: "has:link"
485
+ };
486
+ var CONTAINED = /* @__PURE__ */ new Set(["title", "site", "author"]);
487
+ var notPresent = /* @__PURE__ */ __name((node) => searchError("query.unsupported-operator", node.span, `${node.field}:* asks whether ${node.field} has a value, which search answers for ${[...PRESENCE, ...ALWAYS].join(", ")}${PRESENCE_INSTEAD[node.field] ? `; write ${PRESENCE_INSTEAD[node.field]}` : ""}`), "notPresent");
488
+ var canonical = /* @__PURE__ */ __name((node) => {
489
+ if (node.kind === "boolean") {
490
+ const clauses = node.clauses.map((clause) => {
491
+ const inner = canonical(clause.node);
492
+ return inner === clause.node ? clause : { ...clause, node: inner };
493
+ });
494
+ return clauses.every((clause, at) => clause === node.clauses[at]) ? node : { ...node, clauses };
495
+ }
496
+ const field = CANONICAL.get(node.field);
497
+ if (node.field !== "_exists_")
498
+ return field ? { ...node, field } : node;
499
+ const { implicit: _, ...rest } = node;
500
+ return { ...rest, field: CANONICAL.get(node.value) ?? node.value, operator: "wildcard", value: "*" };
501
+ }, "canonical");
502
+ var everyDate = /* @__PURE__ */ __name((node) => node.kind === "boolean" ? { ...node, clauses: node.clauses.map((clause) => ({ ...clause, node: everyDate(clause.node) })) } : isPresence(node) && ALWAYS.has(node.field) ? { kind: "predicate", field: "date", ...EVERY_DATE, span: node.span } : node, "everyDate");
503
+ var validateFields = /* @__PURE__ */ __name((written, { presence = false } = {}) => {
504
+ const root = canonical(written.root);
505
+ const ast = root === written.root ? written : { ...written, root };
506
+ for (const node of walkQuery(ast.root)) {
507
+ if (presence && isPresence(node)) {
508
+ if (PRESENCE.has(node.field) || ALWAYS.has(node.field))
509
+ continue;
510
+ const known = QUERY_FIELDS.find(({ name }) => name === node.field);
511
+ if (known && (!known.operators.includes("wildcard") || PRESENCE_INSTEAD[node.field]))
512
+ notPresent(node);
513
+ }
514
+ const field = QUERY_FIELDS.find(({ name }) => name === node.field);
515
+ if (!field && ["after", "before"].includes(node.field)) {
516
+ const plain = ["term", "phrase"].includes(node.operator) && /^[\w:.+-]+$/u.test(node.value);
517
+ searchError("query.legacy-date-field", node.span, plain ? `use date${node.field === "after" ? ">=" : "<"}${node.value}` : "use date>=YYYY-MM-DD or date:[a TO b]");
518
+ }
519
+ if (node.slop !== void 0 && !NEAR_FIELDS.has(node.field))
520
+ searchError("query.unsupported-operator", node.span, `"a b"~N takes words: ${[...NEAR_FIELDS].join(", ")}`);
521
+ if (node.slop !== void 0 && node.slop > MOST_WORDS_APART)
522
+ searchError("query.invalid-number", node.span, `words at most ${MOST_WORDS_APART} apart: "a b"~${MOST_WORDS_APART}`);
523
+ if (field && node.operator === "wildcard" && !field.operators.includes("wildcard")) {
524
+ const part = node.value.replace(/[*?]/gu, "");
525
+ searchError("query.unsupported-operator", node.span, `${field.name} takes ${field.operators.join(", ")}` + (CONTAINED.has(field.name) && part ? `; ${field.name}:${part} already finds it inside a word` : ""));
526
+ }
527
+ }
528
+ const valid = validateQuery(ast, MESSAGES, SEARCH_QUERY);
529
+ return presence ? { ...valid, root: everyDate(valid.root) } : valid;
530
+ }, "validateFields");
531
+ var record = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "record");
532
+ var validSpan = /* @__PURE__ */ __name((value) => record(value) && Number.isInteger(value.start) && Number.isInteger(value.end) && Number(value.start) >= 0 && Number(value.end) >= Number(value.start) && Number(value.end) <= QUERY_LIMITS.bytes, "validSpan");
533
+ var validateAst = /* @__PURE__ */ __name((input, options = {}) => {
534
+ const failure = { start: 0, end: 0 };
535
+ if (!record(input) || input.version !== 1 || input.language !== "lucene-v1")
536
+ searchError("query.unsupported-version", failure);
537
+ let count = 0;
538
+ let bytes = 0;
539
+ const measure = /* @__PURE__ */ __name((value, depth) => {
540
+ if (++count > QUERY_LIMITS.nodes || depth > QUERY_LIMITS.depth)
541
+ searchError("query.too-large", failure);
542
+ if (!record(value) || !validSpan(value.span))
543
+ searchError("query.invalid-ast", failure);
544
+ if (Array.isArray(value.clauses)) {
545
+ if (value.clauses.length === 0)
546
+ searchError("query.invalid-ast", value.span);
547
+ for (const clause of value.clauses)
548
+ measure(record(clause) ? clause.node : void 0, depth + 1);
549
+ return;
550
+ }
551
+ for (const text of [value.field, value.value, value.upper])
552
+ if (typeof text === "string")
553
+ bytes += new TextEncoder().encode(text).length;
554
+ if (bytes > QUERY_LIMITS.bytes)
555
+ searchError("query.too-large", value.span);
556
+ }, "measure");
557
+ measure(input.root, 1);
558
+ const parsed = safeParse(queryAstSchema, input);
559
+ if (!parsed.success)
560
+ searchError("query.invalid-ast", failure);
561
+ const open = walkQuery(parsed.output.root).find((node) => node.operator === "range" && (node.upper === void 0 || node.lower_inclusive === void 0 || node.upper_inclusive === void 0));
562
+ if (open)
563
+ searchError("query.invalid-ast", open.span);
564
+ return validateFields(parsed.output, options);
565
+ }, "validateAst");
566
+
567
+ // node_modules/.pnpm/@wirecat+cli-core@0.687.0_@wirecat+cli-base@0.109.0_commander@15.0.0_esbuild@0.28.2_typ_3e6248e31e5b79d53006284373ddef70/node_modules/@wirecat/cli-core/dist/search/lucene/plain.js
568
+ var REPAIRED = /* @__PURE__ */ new Set([
569
+ "query.invalid-syntax",
570
+ "query.unclosed-literal",
571
+ "query.unsupported-operator",
572
+ "query.invalid-escape"
573
+ ]);
574
+ var SEARCH_FIELDS = /* @__PURE__ */ new Set([
575
+ ...QUERY_FIELDS.flatMap(({ name, aliases }) => [name, ...aliases]),
576
+ "after",
577
+ "before",
578
+ "_exists_"
579
+ ]);
580
+ var FIELD_PREFIX = /^[+-]?([\p{L}\p{N}_.]+)(?:[:=]|[<>]=?)/u;
581
+ var FIELD_NAME = /^[a-z][a-z_]{2,}$/u;
582
+ var LISTED_BY = "this search has no such field; a list filters by it:";
583
+ var ELSEWHERE = {
584
+ status: `${LISTED_BY} tasks list status:open, deals list status:won`,
585
+ stage: `${LISTED_BY} deals list stage:<value>`,
586
+ pipeline: `${LISTED_BY} deals list pipeline:<value>`,
587
+ priority: `${LISTED_BY} tasks list priority:<value>`,
588
+ assignee: `${LISTED_BY} tasks list assignee:<value>`,
589
+ project: `${LISTED_BY} tasks list project:<value>`,
590
+ due: `${LISTED_BY} tasks list due:<value>`,
591
+ name: "a person's name is from: (who wrote) or mentions: here"
592
+ };
593
+ var unknownField = /* @__PURE__ */ __name((field, written, span, fields) => searchError("query.unknown-field", span, `${ELSEWHERE[field] ?? `fields here: ${[...fields].filter((one) => FIELD_NAME.test(one)).join(", ")}`}; to find the words as written, quote them: "${written}"`), "unknownField");
594
+ var space = /* @__PURE__ */ __name((c) => c !== void 0 && /[ \t\n\r\u3000]/u.test(c), "space");
595
+ var quoted = /* @__PURE__ */ __name((text) => {
596
+ let out = "";
597
+ for (let at = 0; at < text.length; at++) {
598
+ const c = text[at];
599
+ if (c === "\\" && at + 1 < text.length && (text[at + 1] !== "u" || /^u[0-9a-fA-F]{4}/u.test(text.slice(at + 1)))) {
600
+ out += c + text[at + 1];
601
+ at++;
602
+ } else
603
+ out += c === '"' || c === "\\" ? `\\${c}` : c;
604
+ }
605
+ return `"${out}"`;
606
+ }, "quoted");
607
+ var literal = /* @__PURE__ */ __name((word, keepParens, fields) => {
608
+ const prefix = FIELD_PREFIX.exec(word);
609
+ const field = prefix && fields.has(prefix[1] ?? "") ? prefix[0] : "";
610
+ const rest = word.slice(field.length);
611
+ const opening = keepParens ? /^[(+-]*/u.exec(rest)?.[0] ?? "" : "";
612
+ const closing = keepParens ? /\)*$/u.exec(rest.slice(opening.length))?.[0] ?? "" : "";
613
+ const body = rest.slice(opening.length, rest.length - closing.length);
614
+ if (!body)
615
+ return keepParens ? literal(word, false, fields) : `${field}${quoted(rest)}`;
616
+ return `${field}${opening}${quoted(body)}${closing}`;
617
+ }, "literal");
618
+ var wordAround = /* @__PURE__ */ __name((text, at) => {
619
+ let start = at;
620
+ while (start > 0 && !space(text[start - 1]))
621
+ start--;
622
+ let end = at;
623
+ while (end < text.length && !space(text[end]))
624
+ end++;
625
+ return { start, end };
626
+ }, "wordAround");
627
+ var everyWordLiteral = /* @__PURE__ */ __name((text, fields) => text.replace(/[^ \t\n\r\u3000]+/gu, (word) => literal(word, false, fields)), "everyWordLiteral");
628
+ var refusal = /* @__PURE__ */ __name((refuse) => {
629
+ try {
630
+ return refuse();
631
+ } catch (error) {
632
+ return { refused: error };
633
+ }
634
+ }, "refusal");
635
+ var read = /* @__PURE__ */ __name((text, fields) => {
636
+ try {
637
+ const leaves = walkQuery(parseLucene(text, MESSAGE_PARSING).root);
638
+ const unknown = leaves.find(({ field }) => !fields.has(field));
639
+ if (unknown && FIELD_NAME.test(unknown.field) && unknown.value && !unknown.value.startsWith("/"))
640
+ return refusal(() => unknownField(unknown.field, text.slice(unknown.span.start, unknown.span.end), unknown.span, fields));
641
+ if (unknown)
642
+ return { at: text.lastIndexOf(unknown.field, unknown.span.start) };
643
+ const questions = leaves.flatMap(({ implicit, operator, value, span }) => {
644
+ const mark = /^[^*?]*[^*?\\]\?+$/u.test(value) && implicit && operator === "wildcard" ? /\?+$/u.exec(value) : null;
645
+ return mark ? [span.end - mark[0].length] : [];
646
+ });
647
+ if (questions.length)
648
+ return { questions };
649
+ const wordless = leaves.filter(({ implicit, operator, value }) => implicit && (operator === "term" || operator === "phrase") && !/[\p{L}\p{N}]/u.test(value));
650
+ const words = wordless.length < leaves.length;
651
+ return { wordless: words ? wordless : [], words };
652
+ } catch (error) {
653
+ const details = isCliError(error) ? error.details : void 0;
654
+ if (!details?.span || !REPAIRED.has(details.reason ?? ""))
655
+ throw error;
656
+ if (/^~\d/u.test(text.slice(details.span.start)))
657
+ throw error;
658
+ const at = details.span.start;
659
+ const boost = /^\^\d+(?:\.\d+)?/u.exec(text.slice(at))?.[0];
660
+ if (boost && at > 0 && !space(text[at - 1])) {
661
+ const { start } = wordAround(text, at);
662
+ const written = text.slice(start, at + boost.length);
663
+ return refusal(() => searchError("query.unsupported-operator", { start, end: at + boost.length }, `boost ${boost} is not supported \u2014 drop it: ${text.slice(start, at)}, or quote the text to find it as written: ${quoted(written)}`));
664
+ }
665
+ return { at };
666
+ }
667
+ }, "read");
668
+ var without = /* @__PURE__ */ __name((text, leaves) => [...leaves].sort((a, b) => b.span.start - a.span.start).reduce((left, { span }) => left.slice(0, span.start) + left.slice(span.end), text).trim(), "without");
669
+ var plainQuery = /* @__PURE__ */ __name((text, fields = SEARCH_FIELDS) => {
670
+ if (text.trim() && !/[\p{L}\p{N}*]/u.test(text))
671
+ throw new CliError("validation_error", `search needs a letter or a digit to look for; ${JSON.stringify(text)} has none`);
672
+ let current = text;
673
+ let whole = false;
674
+ for (let tries = 0; tries <= 64; tries++) {
675
+ let reading;
676
+ try {
677
+ reading = read(current, fields);
678
+ } catch {
679
+ return text;
680
+ }
681
+ if ("refused" in reading)
682
+ throw reading.refused;
683
+ if ("questions" in reading) {
684
+ current = reading.questions.sort((a, b) => b - a).reduce((left, at) => left.slice(0, at) + left.slice(at).replace(/^\?+/u, (marks) => "\\?".repeat(marks.length)), current);
685
+ continue;
686
+ }
687
+ if ("wordless" in reading) {
688
+ if (!reading.words && current !== text)
689
+ return text;
690
+ if (!reading.wordless.length)
691
+ return current;
692
+ current = without(current, reading.wordless);
693
+ continue;
694
+ }
695
+ const word = reading.at < 0 || reading.at >= current.length ? void 0 : wordAround(current, reading.at);
696
+ const paren = "()".includes(current[reading.at] ?? "");
697
+ const repaired = word ? current.slice(0, word.start) + literal(current.slice(word.start, word.end), !paren, fields) + current.slice(word.end) : current;
698
+ if (repaired !== current) {
699
+ current = repaired;
700
+ continue;
701
+ }
702
+ if (whole)
703
+ return text;
704
+ whole = true;
705
+ current = everyWordLiteral(text, fields);
706
+ }
707
+ return text;
708
+ }, "plainQuery");
709
+
710
+ export {
711
+ FIELD_VERSION,
712
+ parseBytes,
713
+ QUERY_FIELDS,
714
+ isPresence,
715
+ PRESENCE,
716
+ validateFields,
717
+ validateAst,
718
+ plainQuery,
719
+ RRF_K,
720
+ fuseRanked
721
+ };