kaabalah 4.5.1 → 4.7.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.
- package/dist/{chunk-35GIQ624.mjs → chunk-72YKYKCA.mjs} +3 -3
- package/dist/{chunk-35GIQ624.mjs.map → chunk-72YKYKCA.mjs.map} +1 -1
- package/dist/{chunk-F2EUKWX6.js → chunk-FI7E5IS6.js} +4 -4
- package/dist/{chunk-F2EUKWX6.js.map → chunk-FI7E5IS6.js.map} +1 -1
- package/dist/{chunk-R6AU54TJ.js → chunk-JOYHXU24.js} +569 -2
- package/dist/chunk-JOYHXU24.js.map +1 -0
- package/dist/{chunk-7DBEXADC.mjs → chunk-VBO5EFEQ.mjs} +569 -3
- package/dist/chunk-VBO5EFEQ.mjs.map +1 -0
- package/dist/gematria/index.d.mts +43 -2
- package/dist/gematria/index.d.ts +43 -2
- package/dist/gematria/index.js +7 -3
- package/dist/gematria/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -19
- package/dist/index.mjs +2 -2
- package/dist/numerology/index.js +17 -17
- package/dist/numerology/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-7DBEXADC.mjs.map +0 -1
- package/dist/chunk-R6AU54TJ.js.map +0 -1
|
@@ -237,6 +237,572 @@ function getMissingGematriaValues(tree, includedGematriaValues) {
|
|
|
237
237
|
missingGematriaValues.sort((a, b) => a.value - b.value);
|
|
238
238
|
return missingGematriaValues;
|
|
239
239
|
}
|
|
240
|
+
function buildLetterInfo(tree, letter, isStarting) {
|
|
241
|
+
const latinLetterId = id("latinLetter" /* LATIN_LETTER */, letter);
|
|
242
|
+
const latinLetterNode = tree.getNode(latinLetterId);
|
|
243
|
+
if (!latinLetterNode?.data) return void 0;
|
|
244
|
+
const mapping = getLetterMapping({ tree, letterId: latinLetterId, isStarting });
|
|
245
|
+
if (!mapping?.data) return void 0;
|
|
246
|
+
return {
|
|
247
|
+
letter,
|
|
248
|
+
normalValue: mapping.data.gematriaValue,
|
|
249
|
+
endingValue: mapping.data.gematriaValueWhenEnding,
|
|
250
|
+
isVowel: latinLetterNode.data.isVowel,
|
|
251
|
+
isDigraph: DIGRAPHS.has(letter),
|
|
252
|
+
hebrewLetterId: mapping.id,
|
|
253
|
+
hebrewCharacter: mapping.data.character,
|
|
254
|
+
hebrewCharacterWhenEnding: mapping.data.characterWhenEnding
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function getAvailableLetters(tree, includeDigraphs) {
|
|
258
|
+
const singleLetters = [
|
|
259
|
+
"A",
|
|
260
|
+
"B",
|
|
261
|
+
"C",
|
|
262
|
+
"D",
|
|
263
|
+
"E",
|
|
264
|
+
"F",
|
|
265
|
+
"G",
|
|
266
|
+
"H",
|
|
267
|
+
"I",
|
|
268
|
+
"J",
|
|
269
|
+
"K",
|
|
270
|
+
"L",
|
|
271
|
+
"M",
|
|
272
|
+
"N",
|
|
273
|
+
"O",
|
|
274
|
+
"P",
|
|
275
|
+
"Q",
|
|
276
|
+
"R",
|
|
277
|
+
"S",
|
|
278
|
+
"T",
|
|
279
|
+
"U",
|
|
280
|
+
"V",
|
|
281
|
+
"W",
|
|
282
|
+
"X",
|
|
283
|
+
"Y",
|
|
284
|
+
"Z"
|
|
285
|
+
];
|
|
286
|
+
const digraphs = includeDigraphs ? Array.from(DIGRAPHS) : [];
|
|
287
|
+
return [...singleLetters, ...digraphs];
|
|
288
|
+
}
|
|
289
|
+
function parseSuggestionToLetterUnits(text) {
|
|
290
|
+
const upper = text.toUpperCase();
|
|
291
|
+
const units = [];
|
|
292
|
+
let i = 0;
|
|
293
|
+
while (i < upper.length) {
|
|
294
|
+
const char = upper[i];
|
|
295
|
+
if (i + 1 < upper.length) {
|
|
296
|
+
const twoChar = char + upper[i + 1].toLowerCase();
|
|
297
|
+
if (DIGRAPHS.has(twoChar)) {
|
|
298
|
+
units.push(twoChar);
|
|
299
|
+
i += 2;
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
units.push(char);
|
|
304
|
+
i += 1;
|
|
305
|
+
}
|
|
306
|
+
return units;
|
|
307
|
+
}
|
|
308
|
+
function countLetterUnits(units) {
|
|
309
|
+
const counts = /* @__PURE__ */ new Map();
|
|
310
|
+
for (const unit of units) {
|
|
311
|
+
counts.set(unit, (counts.get(unit) || 0) + 1);
|
|
312
|
+
}
|
|
313
|
+
return counts;
|
|
314
|
+
}
|
|
315
|
+
var reverseGematria = (options, tree) => {
|
|
316
|
+
const {
|
|
317
|
+
targetVowels,
|
|
318
|
+
targetConsonants,
|
|
319
|
+
targetSynthesis,
|
|
320
|
+
minLength = 1,
|
|
321
|
+
maxLength = 8,
|
|
322
|
+
maxResults = 100,
|
|
323
|
+
includeDigraphs = true,
|
|
324
|
+
maxLetterRepeat,
|
|
325
|
+
suggestionText,
|
|
326
|
+
suggestionMode = "subsequence"
|
|
327
|
+
} = options;
|
|
328
|
+
if (targetVowels === void 0 && targetConsonants === void 0 && targetSynthesis === void 0) {
|
|
329
|
+
return { results: [], hasMore: false, totalFound: 0 };
|
|
330
|
+
}
|
|
331
|
+
if (!tree) {
|
|
332
|
+
tree = createTree({ system: SYSTEM, parts: [] });
|
|
333
|
+
}
|
|
334
|
+
if (suggestionText !== void 0) {
|
|
335
|
+
if (suggestionMode === "subsequence") {
|
|
336
|
+
return reverseGematriaFromSubsequence(options, tree);
|
|
337
|
+
} else {
|
|
338
|
+
return reverseGematriaAnagram(options, tree);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const results = [];
|
|
342
|
+
let totalFound = 0;
|
|
343
|
+
let hasMore = false;
|
|
344
|
+
const availableLetters = getAvailableLetters(tree, includeDigraphs);
|
|
345
|
+
const letterInfoCache = /* @__PURE__ */ new Map();
|
|
346
|
+
const getLetterInfoCached = (letter, isStarting) => {
|
|
347
|
+
const cacheKey = `${letter}-${isStarting}`;
|
|
348
|
+
if (!letterInfoCache.has(cacheKey)) {
|
|
349
|
+
letterInfoCache.set(cacheKey, buildLetterInfo(tree, letter, isStarting));
|
|
350
|
+
}
|
|
351
|
+
return letterInfoCache.get(cacheKey);
|
|
352
|
+
};
|
|
353
|
+
const backtrack = (currentLetters, currentInfos, runningVowelsSum, runningConsonantsSum, letterCounts) => {
|
|
354
|
+
if (results.length >= maxResults) {
|
|
355
|
+
hasMore = true;
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const currentLength = currentLetters.length;
|
|
359
|
+
if (currentLength >= minLength && currentLength <= maxLength) {
|
|
360
|
+
let actualVowelsSum = runningVowelsSum;
|
|
361
|
+
let actualConsonantsSum = runningConsonantsSum;
|
|
362
|
+
if (currentLength > 1) {
|
|
363
|
+
const lastInfo = currentInfos[currentLength - 1];
|
|
364
|
+
if (lastInfo.endingValue !== void 0) {
|
|
365
|
+
const diff = lastInfo.endingValue - lastInfo.normalValue;
|
|
366
|
+
if (lastInfo.isVowel) {
|
|
367
|
+
actualVowelsSum += diff;
|
|
368
|
+
} else {
|
|
369
|
+
actualConsonantsSum += diff;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const actualSynthesisSum = actualVowelsSum + actualConsonantsSum;
|
|
374
|
+
const matchesVowels = targetVowels === void 0 || actualVowelsSum === targetVowels;
|
|
375
|
+
const matchesConsonants = targetConsonants === void 0 || actualConsonantsSum === targetConsonants;
|
|
376
|
+
const matchesSynthesis = targetSynthesis === void 0 || actualSynthesisSum === targetSynthesis;
|
|
377
|
+
if (matchesVowels && matchesConsonants && matchesSynthesis) {
|
|
378
|
+
totalFound++;
|
|
379
|
+
if (results.length < maxResults) {
|
|
380
|
+
const letterDetails = currentInfos.map((info, idx) => {
|
|
381
|
+
const isEnding = idx === currentLength - 1 && currentLength > 1;
|
|
382
|
+
const useEndingValue = isEnding && info.endingValue !== void 0;
|
|
383
|
+
return {
|
|
384
|
+
latinLetterId: id("latinLetter" /* LATIN_LETTER */, info.letter),
|
|
385
|
+
value: useEndingValue ? info.endingValue : info.normalValue,
|
|
386
|
+
hebrewLetterId: info.hebrewLetterId,
|
|
387
|
+
hebrewCharacter: useEndingValue && info.hebrewCharacterWhenEnding ? info.hebrewCharacterWhenEnding : info.hebrewCharacter,
|
|
388
|
+
isVowel: info.isVowel
|
|
389
|
+
};
|
|
390
|
+
});
|
|
391
|
+
results.push({
|
|
392
|
+
letters: currentLetters.join("").toUpperCase(),
|
|
393
|
+
letterDetails,
|
|
394
|
+
vowelsSum: actualVowelsSum,
|
|
395
|
+
consonantsSum: actualConsonantsSum,
|
|
396
|
+
synthesisSum: actualSynthesisSum
|
|
397
|
+
});
|
|
398
|
+
} else {
|
|
399
|
+
hasMore = true;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (currentLength >= maxLength) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
if (targetVowels !== void 0 && runningVowelsSum > targetVowels) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (targetConsonants !== void 0 && runningConsonantsSum > targetConsonants) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (targetSynthesis !== void 0 && runningVowelsSum + runningConsonantsSum > targetSynthesis) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
for (const letter of availableLetters) {
|
|
416
|
+
const isStarting = currentLength === 0;
|
|
417
|
+
const letterInfo = getLetterInfoCached(letter, isStarting);
|
|
418
|
+
if (!letterInfo) continue;
|
|
419
|
+
if (maxLetterRepeat !== void 0) {
|
|
420
|
+
const currentCount = letterCounts.get(letter) || 0;
|
|
421
|
+
if (currentCount >= maxLetterRepeat) {
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
const value = letterInfo.normalValue;
|
|
426
|
+
const newVowelsSum = runningVowelsSum + (letterInfo.isVowel ? value : 0);
|
|
427
|
+
const newConsonantsSum = runningConsonantsSum + (letterInfo.isVowel ? 0 : value);
|
|
428
|
+
if (targetVowels !== void 0 && newVowelsSum > targetVowels) {
|
|
429
|
+
continue;
|
|
430
|
+
}
|
|
431
|
+
if (targetConsonants !== void 0 && newConsonantsSum > targetConsonants) {
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (targetSynthesis !== void 0 && newVowelsSum + newConsonantsSum > targetSynthesis) {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
currentLetters.push(letter);
|
|
438
|
+
currentInfos.push(letterInfo);
|
|
439
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
440
|
+
backtrack(currentLetters, currentInfos, newVowelsSum, newConsonantsSum, letterCounts);
|
|
441
|
+
currentLetters.pop();
|
|
442
|
+
currentInfos.pop();
|
|
443
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
444
|
+
if (results.length >= maxResults) {
|
|
445
|
+
hasMore = true;
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
backtrack([], [], 0, 0, /* @__PURE__ */ new Map());
|
|
451
|
+
return {
|
|
452
|
+
results,
|
|
453
|
+
hasMore,
|
|
454
|
+
totalFound
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
function reverseGematriaAnagram(options, tree) {
|
|
458
|
+
const {
|
|
459
|
+
targetVowels,
|
|
460
|
+
targetConsonants,
|
|
461
|
+
targetSynthesis,
|
|
462
|
+
minLength = 1,
|
|
463
|
+
maxLength = 8,
|
|
464
|
+
maxResults = 100,
|
|
465
|
+
maxLetterRepeat,
|
|
466
|
+
suggestionText = ""
|
|
467
|
+
} = options;
|
|
468
|
+
const results = [];
|
|
469
|
+
let totalFound = 0;
|
|
470
|
+
let hasMore = false;
|
|
471
|
+
const suggestionUnits = parseSuggestionToLetterUnits(suggestionText);
|
|
472
|
+
const letterUnits = suggestionUnits.filter((u) => u !== " ");
|
|
473
|
+
const maxSpaces = suggestionUnits.filter((u) => u === " ").length;
|
|
474
|
+
const availablePool = countLetterUnits(letterUnits);
|
|
475
|
+
const availableLetters = Array.from(availablePool.keys());
|
|
476
|
+
const letterInfoCache = /* @__PURE__ */ new Map();
|
|
477
|
+
const getLetterInfoCached = (letter, isStarting) => {
|
|
478
|
+
const cacheKey = `${letter}-${isStarting}`;
|
|
479
|
+
if (!letterInfoCache.has(cacheKey)) {
|
|
480
|
+
letterInfoCache.set(cacheKey, buildLetterInfo(tree, letter, isStarting));
|
|
481
|
+
}
|
|
482
|
+
return letterInfoCache.get(cacheKey);
|
|
483
|
+
};
|
|
484
|
+
const seenResults = /* @__PURE__ */ new Set();
|
|
485
|
+
const backtrack = (currentLetters, currentInfos, runningVowelsSum, runningConsonantsSum, letterCounts, usedFromPool, spacesUsed) => {
|
|
486
|
+
if (results.length >= maxResults) {
|
|
487
|
+
hasMore = true;
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
const letterOnlyLength = currentLetters.filter((l) => l !== " ").length;
|
|
491
|
+
if (letterOnlyLength >= minLength && letterOnlyLength <= maxLength) {
|
|
492
|
+
let actualVowelsSum = runningVowelsSum;
|
|
493
|
+
let actualConsonantsSum = runningConsonantsSum;
|
|
494
|
+
if (currentInfos.length > 1) {
|
|
495
|
+
const lastInfo = currentInfos[currentInfos.length - 1];
|
|
496
|
+
if (lastInfo.endingValue !== void 0) {
|
|
497
|
+
const diff = lastInfo.endingValue - lastInfo.normalValue;
|
|
498
|
+
if (lastInfo.isVowel) {
|
|
499
|
+
actualVowelsSum += diff;
|
|
500
|
+
} else {
|
|
501
|
+
actualConsonantsSum += diff;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
const actualSynthesisSum = actualVowelsSum + actualConsonantsSum;
|
|
506
|
+
const matchesVowels = targetVowels === void 0 || actualVowelsSum === targetVowels;
|
|
507
|
+
const matchesConsonants = targetConsonants === void 0 || actualConsonantsSum === targetConsonants;
|
|
508
|
+
const matchesSynthesis = targetSynthesis === void 0 || actualSynthesisSum === targetSynthesis;
|
|
509
|
+
if (matchesVowels && matchesConsonants && matchesSynthesis) {
|
|
510
|
+
const lettersStr = currentLetters.join("").toUpperCase();
|
|
511
|
+
if (!seenResults.has(lettersStr)) {
|
|
512
|
+
seenResults.add(lettersStr);
|
|
513
|
+
totalFound++;
|
|
514
|
+
if (results.length < maxResults) {
|
|
515
|
+
const letterDetails = currentInfos.map((info, idx) => {
|
|
516
|
+
const isEnding = idx === currentInfos.length - 1 && currentInfos.length > 1;
|
|
517
|
+
const useEndingValue = isEnding && info.endingValue !== void 0;
|
|
518
|
+
return {
|
|
519
|
+
latinLetterId: id("latinLetter" /* LATIN_LETTER */, info.letter),
|
|
520
|
+
value: useEndingValue ? info.endingValue : info.normalValue,
|
|
521
|
+
hebrewLetterId: info.hebrewLetterId,
|
|
522
|
+
hebrewCharacter: useEndingValue && info.hebrewCharacterWhenEnding ? info.hebrewCharacterWhenEnding : info.hebrewCharacter,
|
|
523
|
+
isVowel: info.isVowel
|
|
524
|
+
};
|
|
525
|
+
});
|
|
526
|
+
results.push({
|
|
527
|
+
letters: lettersStr,
|
|
528
|
+
letterDetails,
|
|
529
|
+
vowelsSum: actualVowelsSum,
|
|
530
|
+
consonantsSum: actualConsonantsSum,
|
|
531
|
+
synthesisSum: actualSynthesisSum
|
|
532
|
+
});
|
|
533
|
+
} else {
|
|
534
|
+
hasMore = true;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (letterOnlyLength >= maxLength) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (targetVowels !== void 0 && runningVowelsSum > targetVowels) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
if (targetConsonants !== void 0 && runningConsonantsSum > targetConsonants) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
if (targetSynthesis !== void 0 && runningVowelsSum + runningConsonantsSum > targetSynthesis) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (spacesUsed < maxSpaces && currentLetters.length > 0 && currentLetters[currentLetters.length - 1] !== " ") {
|
|
552
|
+
currentLetters.push(" ");
|
|
553
|
+
backtrack(
|
|
554
|
+
currentLetters,
|
|
555
|
+
currentInfos,
|
|
556
|
+
runningVowelsSum,
|
|
557
|
+
runningConsonantsSum,
|
|
558
|
+
letterCounts,
|
|
559
|
+
usedFromPool,
|
|
560
|
+
spacesUsed + 1
|
|
561
|
+
);
|
|
562
|
+
currentLetters.pop();
|
|
563
|
+
if (results.length >= maxResults) {
|
|
564
|
+
hasMore = true;
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
for (const letter of availableLetters) {
|
|
569
|
+
const poolLimit = availablePool.get(letter) || 0;
|
|
570
|
+
const usedCount = usedFromPool.get(letter) || 0;
|
|
571
|
+
if (usedCount >= poolLimit) {
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
if (maxLetterRepeat !== void 0) {
|
|
575
|
+
const currentCount = letterCounts.get(letter) || 0;
|
|
576
|
+
if (currentCount >= maxLetterRepeat) {
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const isStarting = currentInfos.length === 0;
|
|
581
|
+
const letterInfo = getLetterInfoCached(letter, isStarting);
|
|
582
|
+
if (!letterInfo) continue;
|
|
583
|
+
const value = letterInfo.normalValue;
|
|
584
|
+
const newVowelsSum = runningVowelsSum + (letterInfo.isVowel ? value : 0);
|
|
585
|
+
const newConsonantsSum = runningConsonantsSum + (letterInfo.isVowel ? 0 : value);
|
|
586
|
+
if (targetVowels !== void 0 && newVowelsSum > targetVowels) {
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
if (targetConsonants !== void 0 && newConsonantsSum > targetConsonants) {
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
if (targetSynthesis !== void 0 && newVowelsSum + newConsonantsSum > targetSynthesis) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
currentLetters.push(letter);
|
|
596
|
+
currentInfos.push(letterInfo);
|
|
597
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
598
|
+
usedFromPool.set(letter, usedCount + 1);
|
|
599
|
+
backtrack(
|
|
600
|
+
currentLetters,
|
|
601
|
+
currentInfos,
|
|
602
|
+
newVowelsSum,
|
|
603
|
+
newConsonantsSum,
|
|
604
|
+
letterCounts,
|
|
605
|
+
usedFromPool,
|
|
606
|
+
spacesUsed
|
|
607
|
+
);
|
|
608
|
+
currentLetters.pop();
|
|
609
|
+
currentInfos.pop();
|
|
610
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
611
|
+
usedFromPool.set(letter, usedCount);
|
|
612
|
+
if (results.length >= maxResults) {
|
|
613
|
+
hasMore = true;
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
backtrack([], [], 0, 0, /* @__PURE__ */ new Map(), /* @__PURE__ */ new Map(), 0);
|
|
619
|
+
return {
|
|
620
|
+
results,
|
|
621
|
+
hasMore,
|
|
622
|
+
totalFound
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
function reverseGematriaFromSubsequence(options, tree) {
|
|
626
|
+
const {
|
|
627
|
+
targetVowels,
|
|
628
|
+
targetConsonants,
|
|
629
|
+
targetSynthesis,
|
|
630
|
+
minLength = 1,
|
|
631
|
+
maxLength = 8,
|
|
632
|
+
maxResults = 100,
|
|
633
|
+
maxLetterRepeat,
|
|
634
|
+
suggestionText = ""
|
|
635
|
+
} = options;
|
|
636
|
+
const results = [];
|
|
637
|
+
let totalFound = 0;
|
|
638
|
+
let hasMore = false;
|
|
639
|
+
const suggestionUnits = parseSuggestionToLetterUnits(suggestionText);
|
|
640
|
+
const letterUnitsWithPositions = [];
|
|
641
|
+
for (let i = 0; i < suggestionUnits.length; i++) {
|
|
642
|
+
letterUnitsWithPositions.push({
|
|
643
|
+
unit: suggestionUnits[i],
|
|
644
|
+
isSpace: suggestionUnits[i] === " ",
|
|
645
|
+
originalIndex: i
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
const letterOnlyUnits = letterUnitsWithPositions.filter((u) => !u.isSpace);
|
|
649
|
+
const maxSpaces = letterUnitsWithPositions.filter((u) => u.isSpace).length;
|
|
650
|
+
const letterInfoCache = /* @__PURE__ */ new Map();
|
|
651
|
+
const getLetterInfoCached = (letter, isStarting) => {
|
|
652
|
+
const cacheKey = `${letter}-${isStarting}`;
|
|
653
|
+
if (!letterInfoCache.has(cacheKey)) {
|
|
654
|
+
letterInfoCache.set(cacheKey, buildLetterInfo(tree, letter, isStarting));
|
|
655
|
+
}
|
|
656
|
+
return letterInfoCache.get(cacheKey);
|
|
657
|
+
};
|
|
658
|
+
const seenResults = /* @__PURE__ */ new Set();
|
|
659
|
+
const generateSubsequences = (index, currentLetters, currentInfos, runningVowelsSum, runningConsonantsSum, letterCounts, spacesUsed) => {
|
|
660
|
+
if (results.length >= maxResults) {
|
|
661
|
+
hasMore = true;
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
const letterOnlyLength = currentLetters.filter((l) => l !== " ").length;
|
|
665
|
+
if (letterOnlyLength >= minLength && letterOnlyLength <= maxLength) {
|
|
666
|
+
let actualVowelsSum = runningVowelsSum;
|
|
667
|
+
let actualConsonantsSum = runningConsonantsSum;
|
|
668
|
+
if (currentInfos.length > 1) {
|
|
669
|
+
const lastInfo = currentInfos[currentInfos.length - 1];
|
|
670
|
+
if (lastInfo.endingValue !== void 0) {
|
|
671
|
+
const diff = lastInfo.endingValue - lastInfo.normalValue;
|
|
672
|
+
if (lastInfo.isVowel) {
|
|
673
|
+
actualVowelsSum += diff;
|
|
674
|
+
} else {
|
|
675
|
+
actualConsonantsSum += diff;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const actualSynthesisSum = actualVowelsSum + actualConsonantsSum;
|
|
680
|
+
const matchesVowels = targetVowels === void 0 || actualVowelsSum === targetVowels;
|
|
681
|
+
const matchesConsonants = targetConsonants === void 0 || actualConsonantsSum === targetConsonants;
|
|
682
|
+
const matchesSynthesis = targetSynthesis === void 0 || actualSynthesisSum === targetSynthesis;
|
|
683
|
+
if (matchesVowels && matchesConsonants && matchesSynthesis) {
|
|
684
|
+
const lettersStr = currentLetters.join("").toUpperCase();
|
|
685
|
+
if (!seenResults.has(lettersStr)) {
|
|
686
|
+
seenResults.add(lettersStr);
|
|
687
|
+
totalFound++;
|
|
688
|
+
if (results.length < maxResults) {
|
|
689
|
+
const letterDetails = currentInfos.map((info, idx) => {
|
|
690
|
+
const isEnding = idx === currentInfos.length - 1 && currentInfos.length > 1;
|
|
691
|
+
const useEndingValue = isEnding && info.endingValue !== void 0;
|
|
692
|
+
return {
|
|
693
|
+
latinLetterId: id("latinLetter" /* LATIN_LETTER */, info.letter),
|
|
694
|
+
value: useEndingValue ? info.endingValue : info.normalValue,
|
|
695
|
+
hebrewLetterId: info.hebrewLetterId,
|
|
696
|
+
hebrewCharacter: useEndingValue && info.hebrewCharacterWhenEnding ? info.hebrewCharacterWhenEnding : info.hebrewCharacter,
|
|
697
|
+
isVowel: info.isVowel
|
|
698
|
+
};
|
|
699
|
+
});
|
|
700
|
+
results.push({
|
|
701
|
+
letters: lettersStr,
|
|
702
|
+
letterDetails,
|
|
703
|
+
vowelsSum: actualVowelsSum,
|
|
704
|
+
consonantsSum: actualConsonantsSum,
|
|
705
|
+
synthesisSum: actualSynthesisSum
|
|
706
|
+
});
|
|
707
|
+
} else {
|
|
708
|
+
hasMore = true;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
if (index >= letterOnlyUnits.length || letterOnlyLength >= maxLength) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
if (targetVowels !== void 0 && runningVowelsSum > targetVowels) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (targetConsonants !== void 0 && runningConsonantsSum > targetConsonants) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
if (targetSynthesis !== void 0 && runningVowelsSum + runningConsonantsSum > targetSynthesis) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
generateSubsequences(
|
|
726
|
+
index + 1,
|
|
727
|
+
currentLetters,
|
|
728
|
+
currentInfos,
|
|
729
|
+
runningVowelsSum,
|
|
730
|
+
runningConsonantsSum,
|
|
731
|
+
letterCounts,
|
|
732
|
+
spacesUsed
|
|
733
|
+
);
|
|
734
|
+
if (results.length >= maxResults) {
|
|
735
|
+
hasMore = true;
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
const letter = letterOnlyUnits[index].unit;
|
|
739
|
+
if (maxLetterRepeat !== void 0) {
|
|
740
|
+
const currentCount = letterCounts.get(letter) || 0;
|
|
741
|
+
if (currentCount >= maxLetterRepeat) {
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
const isStarting = currentInfos.length === 0;
|
|
746
|
+
const letterInfo = getLetterInfoCached(letter, isStarting);
|
|
747
|
+
if (!letterInfo) return;
|
|
748
|
+
const value = letterInfo.normalValue;
|
|
749
|
+
const newVowelsSum = runningVowelsSum + (letterInfo.isVowel ? value : 0);
|
|
750
|
+
const newConsonantsSum = runningConsonantsSum + (letterInfo.isVowel ? 0 : value);
|
|
751
|
+
if (targetVowels !== void 0 && newVowelsSum > targetVowels) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
if (targetConsonants !== void 0 && newConsonantsSum > targetConsonants) {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (targetSynthesis !== void 0 && newVowelsSum + newConsonantsSum > targetSynthesis) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
currentLetters.push(letter);
|
|
761
|
+
currentInfos.push(letterInfo);
|
|
762
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
763
|
+
generateSubsequences(
|
|
764
|
+
index + 1,
|
|
765
|
+
currentLetters,
|
|
766
|
+
currentInfos,
|
|
767
|
+
newVowelsSum,
|
|
768
|
+
newConsonantsSum,
|
|
769
|
+
letterCounts,
|
|
770
|
+
spacesUsed
|
|
771
|
+
);
|
|
772
|
+
currentLetters.pop();
|
|
773
|
+
currentInfos.pop();
|
|
774
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
775
|
+
if (results.length >= maxResults) {
|
|
776
|
+
hasMore = true;
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (spacesUsed < maxSpaces && currentLetters.length > 0 && currentLetters[currentLetters.length - 1] !== " ") {
|
|
780
|
+
currentLetters.push(" ");
|
|
781
|
+
currentLetters.push(letter);
|
|
782
|
+
currentInfos.push(letterInfo);
|
|
783
|
+
letterCounts.set(letter, (letterCounts.get(letter) || 0) + 1);
|
|
784
|
+
generateSubsequences(
|
|
785
|
+
index + 1,
|
|
786
|
+
currentLetters,
|
|
787
|
+
currentInfos,
|
|
788
|
+
newVowelsSum,
|
|
789
|
+
newConsonantsSum,
|
|
790
|
+
letterCounts,
|
|
791
|
+
spacesUsed + 1
|
|
792
|
+
);
|
|
793
|
+
currentLetters.pop();
|
|
794
|
+
currentLetters.pop();
|
|
795
|
+
currentInfos.pop();
|
|
796
|
+
letterCounts.set(letter, letterCounts.get(letter) - 1);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
generateSubsequences(0, [], [], 0, 0, /* @__PURE__ */ new Map(), 0);
|
|
800
|
+
return {
|
|
801
|
+
results,
|
|
802
|
+
hasMore,
|
|
803
|
+
totalFound
|
|
804
|
+
};
|
|
805
|
+
}
|
|
240
806
|
var calculateGematria = (phrase, options = {
|
|
241
807
|
missing: false,
|
|
242
808
|
percentages: false
|
|
@@ -303,6 +869,6 @@ var calculateGematria = (phrase, options = {
|
|
|
303
869
|
};
|
|
304
870
|
};
|
|
305
871
|
|
|
306
|
-
export { calculateGematria, data_exports };
|
|
307
|
-
//# sourceMappingURL=chunk-
|
|
308
|
-
//# sourceMappingURL=chunk-
|
|
872
|
+
export { calculateGematria, data_exports, reverseGematria };
|
|
873
|
+
//# sourceMappingURL=chunk-VBO5EFEQ.mjs.map
|
|
874
|
+
//# sourceMappingURL=chunk-VBO5EFEQ.mjs.map
|