@flesh-and-blood/search 5.0.22 → 5.0.24
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/filterMappings.d.ts +0 -7
- package/dist/filterMappings.js +7 -11
- package/dist/filterResolvers.d.ts +1 -3
- package/dist/filterResolvers.js +96 -85
- package/dist/index.cjs +1 -1
- package/dist/metaFilters.js +3 -4
- package/dist/queryParse.js +6 -4
- package/dist/search.js +8 -3
- package/package.json +4 -4
- package/dist/lookups.d.ts +0 -21
- package/dist/lookups.js +0 -14
package/dist/filterMappings.d.ts
CHANGED
|
@@ -807,13 +807,6 @@ export declare const filtersToCardPropertyMappings: {
|
|
|
807
807
|
partialMatch: true;
|
|
808
808
|
};
|
|
809
809
|
};
|
|
810
|
-
/**
|
|
811
|
-
* The same mappings, read by a key a query wrote. Filter keys are typed by the
|
|
812
|
-
* searcher, so an unrecognised key is a miss to skip rather than a type error.
|
|
813
|
-
*/
|
|
814
|
-
export declare const filtersToCardPropertyMappingsByKey: {
|
|
815
|
-
[key: string]: FilterToPropertyMapping | undefined;
|
|
816
|
-
};
|
|
817
810
|
/**
|
|
818
811
|
* The filter a key names, however it was capitalised, and nothing where the
|
|
819
812
|
* key names none.
|
package/dist/filterMappings.js
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
Type
|
|
19
19
|
} from "@flesh-and-blood/types";
|
|
20
20
|
import { getNormalizedFilterValue } from "./helpers.js";
|
|
21
|
-
import { getLookupWithoutInheritedKeys } from "./lookups.js";
|
|
22
21
|
const FilterCategory = {
|
|
23
22
|
Arcane: "arcane",
|
|
24
23
|
Artist: "artist",
|
|
@@ -425,8 +424,8 @@ const filtersToCardPropertyMappings = {
|
|
|
425
424
|
typetext: typeTextFilter,
|
|
426
425
|
year: yearFilter
|
|
427
426
|
};
|
|
428
|
-
const filtersToCardPropertyMappingsByKey =
|
|
429
|
-
const getFilterMapping = (key) => filtersToCardPropertyMappingsByKey
|
|
427
|
+
const filtersToCardPropertyMappingsByKey = new Map(Object.entries(filtersToCardPropertyMappings));
|
|
428
|
+
const getFilterMapping = (key) => filtersToCardPropertyMappingsByKey.get(key.toLowerCase());
|
|
430
429
|
const getFilterCategory = (key) => getFilterMapping(key)?.category;
|
|
431
430
|
const getAliasesByFilterCategory = () => {
|
|
432
431
|
const aliasesByCategory = /* @__PURE__ */ Object.create(null);
|
|
@@ -444,7 +443,7 @@ const getAliasesByFilterCategory = () => {
|
|
|
444
443
|
};
|
|
445
444
|
const aliasesByFilterCategory = getAliasesByFilterCategory();
|
|
446
445
|
const getFilterMappingsByVocabularyValue = () => {
|
|
447
|
-
const mappingsByVocabularyValue = /* @__PURE__ */
|
|
446
|
+
const mappingsByVocabularyValue = /* @__PURE__ */ new Map();
|
|
448
447
|
const walkedMappings = /* @__PURE__ */ new Set();
|
|
449
448
|
const mappings = Object.values(
|
|
450
449
|
filtersToCardPropertyMappings
|
|
@@ -455,11 +454,11 @@ const getFilterMappingsByVocabularyValue = () => {
|
|
|
455
454
|
walkedMappings.add(mapping);
|
|
456
455
|
for (const vocabularyValue of vocabulary) {
|
|
457
456
|
const normalizedValue = getNormalizedFilterValue(vocabularyValue);
|
|
458
|
-
const mappingsHoldingValue = mappingsByVocabularyValue
|
|
457
|
+
const mappingsHoldingValue = mappingsByVocabularyValue.get(normalizedValue);
|
|
459
458
|
if (mappingsHoldingValue) {
|
|
460
459
|
mappingsHoldingValue.push(mapping);
|
|
461
460
|
} else {
|
|
462
|
-
mappingsByVocabularyValue
|
|
461
|
+
mappingsByVocabularyValue.set(normalizedValue, [mapping]);
|
|
463
462
|
}
|
|
464
463
|
}
|
|
465
464
|
}
|
|
@@ -467,14 +466,12 @@ const getFilterMappingsByVocabularyValue = () => {
|
|
|
467
466
|
return mappingsByVocabularyValue;
|
|
468
467
|
};
|
|
469
468
|
const filterMappingsByVocabularyValue = getFilterMappingsByVocabularyValue();
|
|
470
|
-
const getIsValueInFilterVocabulary = (category, value) => !!filterMappingsByVocabularyValue
|
|
471
|
-
(mapping) => mapping.category === category
|
|
472
|
-
);
|
|
469
|
+
const getIsValueInFilterVocabulary = (category, value) => !!filterMappingsByVocabularyValue.get(getNormalizedFilterValue(value))?.some((mapping) => mapping.category === category);
|
|
473
470
|
const getFilterMappingsHoldingValues = (category, values) => {
|
|
474
471
|
let mappingsHoldingValues = [];
|
|
475
472
|
let isFirstValue = true;
|
|
476
473
|
for (const value of values) {
|
|
477
|
-
const mappingsHoldingValue = (filterMappingsByVocabularyValue
|
|
474
|
+
const mappingsHoldingValue = (filterMappingsByVocabularyValue.get(getNormalizedFilterValue(value)) || []).filter((mapping) => mapping.category !== category);
|
|
478
475
|
mappingsHoldingValues = isFirstValue ? mappingsHoldingValue : mappingsHoldingValues.filter(
|
|
479
476
|
(mapping) => mappingsHoldingValue.includes(mapping)
|
|
480
477
|
);
|
|
@@ -498,7 +495,6 @@ export {
|
|
|
498
495
|
availableExclusions,
|
|
499
496
|
availableModifiers,
|
|
500
497
|
filtersToCardPropertyMappings,
|
|
501
|
-
filtersToCardPropertyMappingsByKey,
|
|
502
498
|
getFilterCategory,
|
|
503
499
|
getFilterMapping,
|
|
504
500
|
getIsValueInFilterVocabulary,
|
|
@@ -42,8 +42,6 @@ export interface FilterResolution {
|
|
|
42
42
|
/** The values naming nothing the filter reads, as they were written. */
|
|
43
43
|
unresolvedValues: string[];
|
|
44
44
|
}
|
|
45
|
-
export declare const RARITY_VALUES_MAPPING:
|
|
46
|
-
[key: string]: Rarity;
|
|
47
|
-
};
|
|
45
|
+
export declare const RARITY_VALUES_MAPPING: Map<string, Rarity>;
|
|
48
46
|
/** What one filter term asks for, whichever filter it names. */
|
|
49
47
|
export declare const getFilterResolution: (term: FilterTerm, context: FilterResolverContext) => FilterResolution;
|
package/dist/filterResolvers.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Meta,
|
|
4
4
|
Rarity,
|
|
5
5
|
Release,
|
|
6
|
+
setIdentifierToSetMappings,
|
|
6
7
|
Treatment,
|
|
7
8
|
Type
|
|
8
9
|
} from "@flesh-and-blood/types";
|
|
@@ -13,10 +14,6 @@ import {
|
|
|
13
14
|
getIsValueInFilterVocabulary
|
|
14
15
|
} from "./filterMappings.js";
|
|
15
16
|
import { getNormalizedFilterValue, getTextWithoutMarkup } from "./helpers.js";
|
|
16
|
-
import {
|
|
17
|
-
getLookupWithoutInheritedKeys,
|
|
18
|
-
releasesBySetIdentifier
|
|
19
|
-
} from "./lookups.js";
|
|
20
17
|
import { getMetaFilterResolution } from "./metaFilters.js";
|
|
21
18
|
import {
|
|
22
19
|
getCardsByName,
|
|
@@ -112,18 +109,20 @@ const getVocabularyResolution = (term, attributeKey, getVocabularyValues) => {
|
|
|
112
109
|
unresolvedValues
|
|
113
110
|
};
|
|
114
111
|
};
|
|
115
|
-
const pitchValuesMapping =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
const pitchValuesMapping = new Map(
|
|
113
|
+
Object.entries({
|
|
114
|
+
purple: 4,
|
|
115
|
+
blue: 3,
|
|
116
|
+
yellow: 2,
|
|
117
|
+
red: 1,
|
|
118
|
+
white: 0
|
|
119
|
+
})
|
|
120
|
+
);
|
|
122
121
|
const getPitchResolution = (term) => {
|
|
123
122
|
const filterValues = [];
|
|
124
123
|
const canonicalValues = [];
|
|
125
124
|
for (const { modifier, value } of term.filterValues) {
|
|
126
|
-
const pitchValue = pitchValuesMapping
|
|
125
|
+
const pitchValue = pitchValuesMapping.get(value);
|
|
127
126
|
const canonicalValue = pitchValue === void 0 ? value : `${pitchValue}`;
|
|
128
127
|
filterValues.push({ modifier, value: canonicalValue });
|
|
129
128
|
canonicalValues.push(canonicalValue);
|
|
@@ -134,18 +133,26 @@ const getPitchResolution = (term) => {
|
|
|
134
133
|
unresolvedValues: []
|
|
135
134
|
};
|
|
136
135
|
};
|
|
136
|
+
const releasesByName = /* @__PURE__ */ new Map();
|
|
137
|
+
for (const release of Object.values(Release)) {
|
|
138
|
+
const name = getNormalizedFilterValue(release);
|
|
139
|
+
const releaseWithSameName = releasesByName.get(name);
|
|
140
|
+
if (releaseWithSameName === void 0) {
|
|
141
|
+
releasesByName.set(name, release);
|
|
142
|
+
} else {
|
|
143
|
+
throw new Error(
|
|
144
|
+
`${releaseWithSameName} and ${release} are one name as a filter reads it, so a set filter naming it could reach either`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const getReleasesFromLookup = (lookup, value) => {
|
|
149
|
+
const release = lookup.get(value);
|
|
150
|
+
return release ? [release] : [];
|
|
151
|
+
};
|
|
137
152
|
const getMatchingReleasesFromValue = (value, additionalSets) => {
|
|
138
153
|
const rungs = [
|
|
139
|
-
() =>
|
|
140
|
-
|
|
141
|
-
(release) => getNormalizedFilterValue(release) === value
|
|
142
|
-
);
|
|
143
|
-
return setFromValue ? [setFromValue] : [];
|
|
144
|
-
},
|
|
145
|
-
() => {
|
|
146
|
-
const setFromSetIdentifier = releasesBySetIdentifier[value];
|
|
147
|
-
return setFromSetIdentifier ? [setFromSetIdentifier] : [];
|
|
148
|
-
},
|
|
154
|
+
() => getReleasesFromLookup(releasesByName, value),
|
|
155
|
+
() => getReleasesFromLookup(setIdentifierToSetMappings, value),
|
|
149
156
|
() => Object.values(Release).filter(
|
|
150
157
|
(release) => release.toLowerCase().includes(value)
|
|
151
158
|
),
|
|
@@ -169,31 +176,26 @@ const getSetResolution = (term, { additionalSets }) => getVocabularyResolution(
|
|
|
169
176
|
"releases",
|
|
170
177
|
(value) => getMatchingReleasesFromValue(value, additionalSets)
|
|
171
178
|
);
|
|
172
|
-
const foilingValuesMapping =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
const foilingValuesMapping = new Map(
|
|
180
|
+
Object.entries({
|
|
181
|
+
r: Foiling.Rainbow,
|
|
182
|
+
rf: Foiling.Rainbow,
|
|
183
|
+
rainbow: Foiling.Rainbow,
|
|
184
|
+
c: Foiling.Cold,
|
|
185
|
+
cf: Foiling.Cold,
|
|
186
|
+
cold: Foiling.Cold,
|
|
187
|
+
g: Foiling.Gold,
|
|
188
|
+
gf: Foiling.Gold,
|
|
189
|
+
gold: Foiling.Gold
|
|
190
|
+
})
|
|
191
|
+
);
|
|
183
192
|
const getFoilingsFromValue = (value) => {
|
|
184
|
-
const foiling = foilingValuesMapping
|
|
193
|
+
const foiling = foilingValuesMapping.get(value);
|
|
185
194
|
return foiling ? [foiling] : [];
|
|
186
195
|
};
|
|
187
196
|
const getFoilingResolution = (term) => getVocabularyResolution(term, "foilings", getFoilingsFromValue);
|
|
188
|
-
const treatmentValuesMapping =
|
|
189
|
-
|
|
190
|
-
(treatmentsByLowercasedName, treatment) => {
|
|
191
|
-
treatmentsByLowercasedName[treatment.toLowerCase()] = treatment;
|
|
192
|
-
return treatmentsByLowercasedName;
|
|
193
|
-
},
|
|
194
|
-
{}
|
|
195
|
-
),
|
|
196
|
-
...{
|
|
197
|
+
const treatmentValuesMapping = new Map(
|
|
198
|
+
Object.entries({
|
|
197
199
|
aa: Treatment.AA,
|
|
198
200
|
alt: Treatment.AA,
|
|
199
201
|
"alt art": Treatment.AA,
|
|
@@ -207,27 +209,34 @@ const treatmentValuesMapping = getLookupWithoutInheritedKeys({
|
|
|
207
209
|
fa: Treatment.FA,
|
|
208
210
|
full: Treatment.FA,
|
|
209
211
|
"full art": Treatment.FA
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
for (const treatment of Object.values(Treatment)) {
|
|
215
|
+
treatmentValuesMapping.set(treatment.toLowerCase(), treatment);
|
|
216
|
+
}
|
|
217
|
+
const treatmentsByAbbreviation = new Map(
|
|
218
|
+
Object.entries(Treatment)
|
|
219
|
+
);
|
|
213
220
|
const getTreatmentsFromValue = (value) => {
|
|
214
|
-
const treatment = treatmentValuesMapping
|
|
221
|
+
const treatment = treatmentValuesMapping.get(value) || treatmentsByAbbreviation.get(value.toUpperCase());
|
|
215
222
|
return treatment ? [treatment] : [];
|
|
216
223
|
};
|
|
217
224
|
const getTreatmentResolution = (term) => getVocabularyResolution(term, "treatments", getTreatmentsFromValue);
|
|
218
|
-
const RARITY_VALUES_MAPPING =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
225
|
+
const RARITY_VALUES_MAPPING = new Map(
|
|
226
|
+
Object.entries({
|
|
227
|
+
b: Rarity.Basic,
|
|
228
|
+
c: Rarity.Common,
|
|
229
|
+
f: Rarity.Fabled,
|
|
230
|
+
l: Rarity.Legendary,
|
|
231
|
+
m: Rarity.Majestic,
|
|
232
|
+
p: Rarity.Promo,
|
|
233
|
+
r: Rarity.Rare,
|
|
234
|
+
s: Rarity.SuperRare,
|
|
235
|
+
t: Rarity.Token,
|
|
236
|
+
v: Rarity.Marvel
|
|
237
|
+
})
|
|
238
|
+
);
|
|
239
|
+
const getRarityFromValue = (value) => RARITY_VALUES_MAPPING.get(value) || Object.values(Rarity).find((rarity) => rarity.toLowerCase() === value);
|
|
231
240
|
const getRarityResolution = (term, { additionalHeroes }) => {
|
|
232
241
|
const rarities = [];
|
|
233
242
|
const canonicalValues = [];
|
|
@@ -274,19 +283,21 @@ const previewFilter = {
|
|
|
274
283
|
property: "firstReleaseDate",
|
|
275
284
|
isDate: true
|
|
276
285
|
};
|
|
277
|
-
const metaValuesMapping =
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
const metaValuesMapping = new Map(
|
|
287
|
+
Object.entries({
|
|
288
|
+
dual: Meta.DualClass,
|
|
289
|
+
exp: Meta.Expansion,
|
|
290
|
+
expansion: Meta.Expansion,
|
|
291
|
+
rainbow: Meta.Rainbow,
|
|
292
|
+
reprint: Meta.Reprint,
|
|
293
|
+
reprints: Meta.Reprint
|
|
294
|
+
})
|
|
295
|
+
);
|
|
285
296
|
const getMetaValuesFromWrittenValues = (writtenValues) => {
|
|
286
297
|
const values = [];
|
|
287
298
|
const unnamedValues = [];
|
|
288
299
|
for (const writtenValue of writtenValues) {
|
|
289
|
-
const meta = metaValuesMapping
|
|
300
|
+
const meta = metaValuesMapping.get(writtenValue);
|
|
290
301
|
if (meta) {
|
|
291
302
|
values.push(meta);
|
|
292
303
|
} else {
|
|
@@ -511,22 +522,22 @@ const getReferencesResolution = (term, { index }) => getRelationResolution(
|
|
|
511
522
|
term,
|
|
512
523
|
(value) => getRelatedCardIdentifiers(index, value, false)
|
|
513
524
|
);
|
|
514
|
-
const resolverByFilterCategory =
|
|
515
|
-
[FilterCategory.Artist
|
|
516
|
-
[FilterCategory.Banned
|
|
517
|
-
[FilterCategory.Chain
|
|
518
|
-
[FilterCategory.Foiling
|
|
519
|
-
[FilterCategory.Is
|
|
520
|
-
[FilterCategory.Legal
|
|
521
|
-
[FilterCategory.Pitch
|
|
522
|
-
[FilterCategory.Print
|
|
523
|
-
[FilterCategory.Rarity
|
|
524
|
-
[FilterCategory.ReferencedBy
|
|
525
|
-
[FilterCategory.References
|
|
526
|
-
[FilterCategory.Set
|
|
527
|
-
[FilterCategory.Treatment
|
|
528
|
-
|
|
529
|
-
const getFilterResolution = (term, context) => (resolverByFilterCategory
|
|
525
|
+
const resolverByFilterCategory = /* @__PURE__ */ new Map([
|
|
526
|
+
[FilterCategory.Artist, getArtistResolution],
|
|
527
|
+
[FilterCategory.Banned, getLegalityResolution],
|
|
528
|
+
[FilterCategory.Chain, getChainResolution],
|
|
529
|
+
[FilterCategory.Foiling, getFoilingResolution],
|
|
530
|
+
[FilterCategory.Is, getMetaResolution],
|
|
531
|
+
[FilterCategory.Legal, getLegalityResolution],
|
|
532
|
+
[FilterCategory.Pitch, getPitchResolution],
|
|
533
|
+
[FilterCategory.Print, getPrintResolution],
|
|
534
|
+
[FilterCategory.Rarity, getRarityResolution],
|
|
535
|
+
[FilterCategory.ReferencedBy, getReferencedByResolution],
|
|
536
|
+
[FilterCategory.References, getReferencesResolution],
|
|
537
|
+
[FilterCategory.Set, getSetResolution],
|
|
538
|
+
[FilterCategory.Treatment, getTreatmentResolution]
|
|
539
|
+
]);
|
|
540
|
+
const getFilterResolution = (term, context) => (resolverByFilterCategory.get(term.category) || getDefaultResolution)(
|
|
530
541
|
term,
|
|
531
542
|
context
|
|
532
543
|
);
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Qt=Object.create;var se=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Ut=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var Wt=(e,t)=>{for(var r in t)se(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jt(t))!Gt.call(e,i)&&i!==r&&se(e,i,{get:()=>t[i],enumerable:!(a=Kt(t,i))||a.enumerable});return e};var _t=(e,t,r)=>(r=e!=null?Qt(Ut(e)):{},$e(t||!e||!e.__esModule?se(r,"default",{value:e,enumerable:!0}):r,e)),zt=e=>$e(se({},"__esModule",{value:!0}),e);var Na={};Wt(Na,{FilterCategory:()=>l,FilterKind:()=>m,FilterProperty:()=>j,MARKUP:()=>ve,NO_CARD_PROPERTY:()=>H,PUNCTUATION:()=>P,RARITY_VALUES_MAPPING:()=>Oe,abbreviations:()=>Ve,aliasesByFilterCategory:()=>Y,availableExclusions:()=>Q,availableModifiers:()=>Se,default:()=>Lt,filterCard:()=>Ot,filtersToCardPropertyMappings:()=>$,filtersToCardPropertyMappingsByKey:()=>ft,getAbbreviation:()=>ge,getAbbreviationByCard:()=>ir,getCardsByName:()=>ye,getCardsByReferencedCardIdentifier:()=>Ea,getCardsReferencedBy:()=>Ce,getCardsReferencing:()=>he,getCatalogueIndex:()=>we,getCleanText:()=>W,getEscapedForRegExp:()=>z,getExcludedMetaFilters:()=>Ie,getFilterCategory:()=>Z,getFilterMapping:()=>ue,getFilterTokenSpansForKey:()=>na,getFilterValue:()=>Qe,getIncompleteFilterToken:()=>He,getIsExcludedToken:()=>oa,getIsValueInFilterVocabulary:()=>ke,getKeywordsAndAppliedFiltersFromText:()=>Va,getMetaFilterResolution:()=>ee,getMetaFilters:()=>pr,getNormalizedFilterValue:()=>V,getNormalizedText:()=>X,getOtherPitches:()=>Ia,getParsedQuery:()=>re,getQueryFilterToken:()=>be,getQueryTokenSpans:()=>me,getQuotedValue:()=>da,getReferencedCards:()=>wa,getResolvedFilterKey:()=>De,getSuggestedFilterKey:()=>Re,getTextWithoutMarkup:()=>_,getTokensReferencedByCards:()=>Ba,getUnquotedValue:()=>Fe,getValuePartsFromFilterValue:()=>wt,getValuesFromFilterValue:()=>Ke,multiWordShorthands:()=>Ue,shorthands:()=>je,singleWordShorthands:()=>Ge});module.exports=zt(Na);var ze=_t(require("fuse.js"),1);var P=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g,ve=/\*/g;var b=require("@flesh-and-blood/types");var W=e=>X(e.toLowerCase().trim().replace(P,"")),X=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),V=e=>e.toLowerCase().replace(P,""),_=e=>e.replace(ve,""),z=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&");var oe=require("@flesh-and-blood/types"),I=e=>Object.assign(Object.create(null),e),ne=I(oe.setIdentifierToSetMappings),Ye=I(oe.setToSetIdentifierMappings);var l={Arcane:"arcane",Artist:"artist",Banned:"banned",Bond:"bond",Chain:"chain",Class:"class",Cost:"cost",Defense:"defense",Flow:"flow",Foiling:"foiling",Fusion:"fusion",Intellect:"intellect",Is:"is",Keyword:"keyword",Legal:"legal",Life:"life",Name:"name",Pitch:"pitch",Power:"power",Print:"print",Rarity:"rarity",ReferencedBy:"referencedby",References:"references",Set:"set",Shorthand:"shorthand",Specialization:"specialization",Subtype:"subtype",Talent:"talent",Text:"text",Trait:"trait",Treatment:"treatment",Type:"type",TypeText:"typetext",Year:"year"},m={Comparator:"comparator",ExactMatch:"exactMatch",PartialMatch:"partialMatch"},Se=[">=",">","<=","<"],Q=["!","-"],H="n/a",gt=[...Object.values(b.Format),...Object.values(b.Hero)],$t={category:l.Arcane,canonicalAlias:"arcane",kind:m.Comparator,property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},Te={category:l.Artist,canonicalAlias:"art",kind:m.PartialMatch,property:"artists",isArray:!0,partialMatch:!0},qe={category:l.Banned,canonicalAlias:"banned",kind:m.ExactMatch,vocabulary:gt,property:H,isMeta:!0},Xe={category:l.Bond,canonicalAlias:"bond",kind:m.ExactMatch,vocabulary:Object.values(b.Bond),property:"bonds",isArray:!0},Yt={category:l.Chain,canonicalAlias:"chain",kind:m.PartialMatch,property:H},Je={category:l.Class,canonicalAlias:"c",kind:m.PartialMatch,vocabulary:Object.values(b.Class),property:"classes",isArray:!0,partialMatch:!0},Ze={category:l.Cost,canonicalAlias:"co",kind:m.Comparator,property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},J={category:l.Defense,canonicalAlias:"d",kind:m.Comparator,property:"defense",specialProperty:"specialDefense",isNumber:!0},et={category:l.Flow,canonicalAlias:"flow",kind:m.ExactMatch,vocabulary:Object.values(b.Flow),property:"flows",isArray:!0},tt={category:l.Foiling,canonicalAlias:"foil",kind:m.ExactMatch,vocabulary:Object.values(b.Foiling),nestedProperty:"foiling",property:"printings",isArray:!0},rt={category:l.Fusion,canonicalAlias:"f",kind:m.ExactMatch,vocabulary:Object.values(b.Fusion),property:"fusions",isArray:!0},at={category:l.Intellect,canonicalAlias:"i",kind:m.Comparator,property:"intellect",isNumber:!0},it={category:l.Keyword,canonicalAlias:"k",kind:m.ExactMatch,vocabulary:Object.values(b.Keyword),property:"keywords",isArray:!0},xe={category:l.Legal,canonicalAlias:"l",kind:m.ExactMatch,vocabulary:gt,property:H,isMeta:!0},st={category:l.Life,canonicalAlias:"li",kind:m.Comparator,property:"life",specialProperty:"specialLife",isNumber:!0},ot={category:l.Is,canonicalAlias:"is",kind:m.ExactMatch,vocabulary:Object.values(b.Meta),property:"meta",isArray:!0},nt={category:l.Name,canonicalAlias:"name",kind:m.PartialMatch,property:"name",isString:!0,partialMatch:!0},Me={category:l.Pitch,canonicalAlias:"p",kind:m.Comparator,property:"pitch",isNumber:!0},le={category:l.Power,canonicalAlias:"pwr",kind:m.Comparator,property:"power",specialProperty:"specialPower",isNumber:!0},de={category:l.Print,canonicalAlias:"print",kind:m.PartialMatch,property:"setIdentifiers",isArray:!0,partialMatch:!0},lt={category:l.Rarity,canonicalAlias:"r",kind:m.ExactMatch,vocabulary:Object.values(b.Rarity),property:H,isMeta:!0},qt={category:l.ReferencedBy,canonicalAlias:"referencedby",kind:m.PartialMatch,property:H},Xt={category:l.References,canonicalAlias:"references",kind:m.PartialMatch,property:H},dt={category:l.Set,canonicalAlias:"s",kind:m.PartialMatch,vocabulary:Object.values(b.Release),property:"sets",isArray:!0,partialMatch:!0},Ae={category:l.Shorthand,canonicalAlias:"short",kind:m.PartialMatch,vocabulary:Object.values(b.Shorthand),property:"shorthands",isArray:!0,partialMatch:!0},ce={category:l.Specialization,canonicalAlias:"sp",kind:m.PartialMatch,vocabulary:Object.values(b.Hero),property:"specializations",isArray:!0,partialMatch:!0},ct={category:l.Subtype,canonicalAlias:"st",kind:m.ExactMatch,vocabulary:Object.values(b.Subtype),property:"subtypes",isArray:!0},pt={category:l.Type,canonicalAlias:"t",kind:m.ExactMatch,vocabulary:Object.values(b.Type),property:"types",isArray:!0},Pe={category:l.Talent,canonicalAlias:"tal",kind:m.ExactMatch,vocabulary:Object.values(b.Talent),property:"talents",isArray:!0},Jt={category:l.Text,canonicalAlias:"text",kind:m.PartialMatch,property:"functionalText",hasMarkup:!0,isString:!0,partialMatch:!0},Zt={category:l.Trait,canonicalAlias:"trait",kind:m.PartialMatch,vocabulary:Object.values(b.Trait),property:"traits",isArray:!0,partialMatch:!0},ut={category:l.TypeText,canonicalAlias:"x",kind:m.PartialMatch,property:"typeText",isString:!0,partialMatch:!0},pe={category:l.Treatment,canonicalAlias:"treatment",kind:m.ExactMatch,vocabulary:Object.values(b.Treatment),nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},er={category:l.Year,canonicalAlias:"year",kind:m.PartialMatch,property:"firstReleaseDate",isString:!0,partialMatch:!0},$={arcane:$t,a:Te,artist:Te,art:Te,attack:le,b:J,block:J,banned:qe,bond:Xe,bonds:Xe,c:Je,class:Je,chain:Yt,co:Ze,cost:Ze,color:Me,d:J,def:J,defense:J,flow:et,flows:et,f:rt,fusion:rt,foil:tt,foiling:tt,i:at,intellect:at,is:ot,k:it,keyword:it,l:xe,legal:xe,hero:xe,li:st,life:st,meta:ot,n:nt,name:nt,p:Me,pitch:Me,pwr:le,pow:le,power:le,print:de,printing:de,printings:de,prints:de,r:lt,rarity:lt,referencedby:qt,references:Xt,rf:qe,s:dt,set:dt,short:Ae,shorthand:Ae,shorthands:Ae,sp:ce,spec:ce,specialization:ce,specializations:ce,st:ct,subtype:ct,t:pt,type:pt,tal:Pe,talent:Pe,talents:Pe,text:Jt,trait:Zt,treat:pe,treatment:pe,var:pe,variation:pe,x:ut,typetext:ut,year:er},ft=I($),ue=e=>ft[e.toLowerCase()],Z=e=>ue(e)?.category,tr=()=>{let e=Object.create(null);for(let[t,{category:r}]of Object.entries($)){let a=e[r];a?a.push(t):e[r]=[t]}return e},Y=tr(),rr=()=>{let e=Object.create(null),t=new Set,r=Object.values($);for(let a of r){let{vocabulary:i}=a;if(i&&!t.has(a)){t.add(a);for(let s of i){let o=V(s),n=e[o];n?n.push(a):e[o]=[a]}}}return e},yt=rr(),ke=(e,t)=>!!yt[V(t)]?.some(r=>r.category===e),ar=(e,t)=>{let r=[],a=!0;for(let i of t){let s=(yt[V(i)]||[]).filter(o=>o.category!==e);r=a?s:r.filter(o=>s.includes(o)),a=!1}return r},Re=(e,t)=>{let r=ar(e,t),[a]=r;return r.length===1?a.canonicalAlias:void 0};var te=require("@flesh-and-blood/types");var ge=e=>Ve.find(({abbreviations:t})=>t.find(r=>r.toLowerCase()===e)),ir=e=>Ve.find(({card:t})=>t.toLowerCase()===e.name.toLowerCase()),Ve=[{abbreviations:["10k"],card:"10,000 Year Reunion"},{abbreviations:["Pajamas","PJs"],card:"Alluvion Constellas"},{abbreviations:["Slippy","Arakni Slipped Through the Cracks","Arakni, Slipped Through the Cracks"],card:"Arakni, 5L!p3d 7hRu 7h3 cR4X"},{abbreviations:["Dullcap"],card:"Arcanite Skullcap"},{abbreviations:["ALS"],card:"Arc Light Sentinel"},{abbreviations:["AoW"],card:"Art of War"},{abbreviations:["BBD"],card:"Barraging Beatdown"},{abbreviations:["BBS"],card:"Big Blue Sky"},{abbreviations:["Starvo"],card:"Bravo, Star of the Show"},{abbreviations:["BEB"],card:"Bull's Eye Bracers"},{abbreviations:["BLW"],card:"Be Like Water"},{abbreviations:["BoJ"],card:"Balance of Justice"},{abbreviations:["BOHH"],card:"Blood on Her Hands"},{abbreviations:["BRB"],card:"Bloodrush Bellow"},{abbreviations:["Breezies"],card:"Breeze Rider Boots"},{abbreviations:["BTA"],card:"Burn Them All"},{abbreviations:["CStrike","C-Strike","C Strike"],card:"Celestial Cataclysm"},{abbreviations:["CBelly"],card:"Cerebellum Processor"},{abbreviations:["CLF"],card:"Channel Lake Frigid"},{abbreviations:["CLV"],card:"Channel Lightning Valley"},{abbreviations:["CMH"],card:"Channel Mount Heroic"},{abbreviations:["CMI"],card:"Channel Mount Isen"},{abbreviations:["CMT"],card:"Channel the Millennium Tree"},{abbreviations:["CnC","C&C"],card:"Command and Conquer"},{abbreviations:["Sea and Sea"],card:"Conqueror of the High Seas"},{abbreviations:["CYB"],card:"Count Your Blessings"},{abbreviations:["Cat","Kitty"],card:"Crouching Tiger"},{abbreviations:["CoD"],card:"Crown of Dominion"},{abbreviations:["CoP"],card:"Crown of Providence"},{abbreviations:["CtW"],card:"Crush the Weak"},{abbreviations:["DD"],card:"Death Dealer"},{abbreviations:["DnD"],card:"Devotion Never Dies"},{abbreviations:["DIO"],card:"Dash I/O"},{abbreviations:["EBTT"],card:"Even Bigger Than That!"},{abbreviations:["NewNigma"],card:"Enigma, New Moon"},{abbreviations:["EPot","E Pot"],card:"Energy Potion"},{abbreviations:["EStrike","E-Strike","E Strike"],card:"Enlightened Strike"},{abbreviations:["FFS"],card:"Fyendal's Fighting Spirit"},{abbreviations:["FoN"],card:"Force of Nature"},{abbreviations:["Frosty","\u{1F976}","\u{1F9CA}","\u2744\uFE0F"],card:"Frostbite"},{abbreviations:["Yum yum"],card:"Fruits of the Forest"},{abbreviations:["GnT"],card:"Give and Take"},{abbreviations:["Habibi"],card:"Hanabi Blaster"},{abbreviations:["HMH"],card:"Hope Merchant's Hood"},{abbreviations:["HoI"],card:"Heart of Ice"},{abbreviations:["Pumpkin"],card:"Jack-o'-lantern"},{abbreviations:["RKO","Cheato"],card:"Kayo, Underhanded Cheat"},{abbreviations:["KKBB"],card:"Knick Knack Bric-a-brac"},{abbreviations:["BStrike"],card:"Levels of Enlightenment"},{abbreviations:["LAG","Twominaris"],card:"Luminaris, Angel's Glow"},{abbreviations:["LCF","Newminaris"],card:"Luminaris, Celestial Fury"},{abbreviations:["LDE"],card:"Last Ditch Effort"},{abbreviations:["LtC"],card:"Lead the Charge"},{abbreviations:["LNW"],card:"Leave No Witnesses"},{abbreviations:["LFaL","L4aL"],card:"Life for a Life"},{abbreviations:["LiT"],card:"Lost in Thought"},{abbreviations:["MMB"],card:"Mage Master Boots"},{abbreviations:["MaxV"],card:"Maximum Velocity"},{abbreviations:["MoM"],card:"Mask of Momentum"},{abbreviations:["MoPL"],card:"Mask of the Pouncing Lynx"},{abbreviations:["MnG"],card:"Meat and Greet"},{abbreviations:["Cake","\u{1F382}"],card:"Ninth Blade of the Blood Oath"},{abbreviations:["PoM"],card:"Peace of Mind"},{abbreviations:["P-Bone"],card:"Performance Bonus"},{abbreviations:["PF","\u{1F525}"],card:"Phoenix Flame"},{abbreviations:["PtW"],card:"Poison the Well"},{abbreviations:["Thanos","Infinity Gauntlet"],card:"Polarity Reversal Script"},{abbreviations:["DPot","D Pot"],card:"Potion of D\xE9j\xE0 Vu"},{abbreviations:["Ponder Run"],card:"Premeditate"},{abbreviations:["Qi Unbound"],card:"Qi Unleashed"},{abbreviations:["RitL"],card:"Red in the Ledger"},{abbreviations:["Cats","Ghost cat","Ghost cats"],card:"Restless Coalescence"},{abbreviations:["Eugene"],card:"Rhinar, Reckless Rampage",isHidden:!0},{abbreviations:["SSGB"],card:"Sandscour Greatbow"},{abbreviations:["SSP"],card:"Sand Sketched Plan"},{abbreviations:["SFaS","S4aS"],card:"Scar for a Scar"},{abbreviations:["Tyler"],card:"Scurv, Stowaway",isHidden:!0},{abbreviations:["SWOMB"],card:"Shifting Winds of the Mystic Beast"},{abbreviations:["Snaps"],card:"Snapdragon Scalers"},{abbreviations:["SWK"],card:"Spinning Wheel Kick"},{abbreviations:["SFTL"],card:"Swing Fist, Think Later"},{abbreviations:["TTT"],card:"Take the Tempo"},{abbreviations:["Ultron"],card:"Teklovossen, the Mechropotent"},{abbreviations:["ToS"],card:"Test of Strength"},{abbreviations:["TAYG"],card:"That All You Got?"},{abbreviations:["TROM"],card:"This Round's on Me"},{abbreviations:["3oak"],card:"Three of a Kind"},{abbreviations:["Pox Malone","Post Malone"],card:"Virulent Touch"},{abbreviations:["Cast Homes"],card:"Visit Goldmane Estate"},{abbreviations:["Frosty Hammer"],card:"Winter's Wail"},{abbreviations:["Wreckless Wing"],card:"War Cry of Bellona"},{abbreviations:["ZTS"],card:"Zero to Sixty"}];var p=require("@flesh-and-blood/types");var k=require("@flesh-and-blood/types");var j={BannedFormats:"bannedFormats",LegalFormats:"legalFormats",LegalHeroes:"legalHeroes"},fe=Array.from(Array(50).keys()).map(e=>`${e}`),sr=[{format:k.Format.ClassicConstructed,nicknames:["cc","classic"]},{format:k.Format.LivingLegend,nicknames:["cc ll","classic constructed ll","ll cc","ll","living legend"]},{format:k.Format.SilverAge,nicknames:["sage"]},{format:k.Format.GoldenAge,nicknames:["gage"]},{format:k.Format.UltimatePitFight,nicknames:["upf"]}],or=Object.values(k.Format).map(e=>{let t=sr.find(({format:a})=>a===e),r=e.toLowerCase().replaceAll(P,"");return t?{...t,format:r}:{format:r}}),nr=[{hero:k.Hero.DataDoll,nicknames:["data","datadoll"]},{hero:k.Hero.Dorinthea,nicknames:["dori"]},{hero:k.Hero.Genis,nicknames:["genis"]},{hero:k.Hero.GravyBones,nicknames:["gravy"]},{hero:k.Hero.Iyslander,nicknames:["islander"]}],lr=Object.values(k.Hero).map(e=>{let t=nr.find(({hero:a})=>a===e),r=e.toLowerCase().replaceAll(P,"");return t?{...t,hero:r}:{hero:r}}),ht=["common","rare","super rare","majestic","legendary","fabled"],dr=({modifier:e,value:t})=>{let r=[],a=e==="<"||e==="<=",i=e===">="||e==="<=",s=a?[...ht].reverse():ht,o=!1;for(let n of s)o?r.push(n):n===t&&(o=!0,i&&r.push(n));return r},cr=(e,t)=>{let r=[];for(let a of e)a.modifier?r.push(...dr(a)):r.push(a.value);return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOr:!0,values:r}},Ct=(e,t,r,a)=>{let i=r.map(d=>({hero:d.toLowerCase().replaceAll(P,"")})),s=[],o=[],n=[],c=[];for(let{value:d}of e){let u=or.find(({format:y,nicknames:h})=>y===d||!!h&&h.includes(d));if(u)o.push(u.format);else{let y=lr.find(({hero:h,nicknames:v})=>h===d||!!v&&v.includes(d))||i.find(({hero:h})=>h===d);y?n.push(y.hero):c.push(d)}}return o.length>0&&s.push({filterToPropertyMapping:{property:a,isArray:!0},values:o,isOr:!0,isExcluded:t}),n.length>0&&s.push({filterToPropertyMapping:{property:j.LegalHeroes,isArray:!0},values:n,isOr:!0,isExcluded:t}),{appliedFilters:s,unresolvedValues:c}},ee=(e,t,{additionalHeroes:r=[],isExcluded:a=!1}={})=>{let i=Z(e),s={appliedFilters:[],unresolvedValues:[]};return i===l.Legal?s=Ct(t,a,r,j.LegalFormats):i===l.Banned?s=Ct(t,a,r,j.BannedFormats):i===l.Rarity&&(s={appliedFilters:[cr(t,a)],unresolvedValues:[]}),s},pr=(e,t,r,a,i,s)=>ee(r,a.map(o=>({modifier:i,value:o})),{additionalHeroes:s,isExcluded:e}).appliedFilters,ur=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"specialCost",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]}],gr=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"specialDefense",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["hero","placeholder","token","weapon"]}],fr=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],yr=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:fe},{filterToPropertyMapping:{property:"specialPower",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token"]}],hr=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(k.Talent).map(e=>e.toLowerCase())}],Cr=[{category:l.Cost,filters:ur},{category:l.Defense,filters:gr},{category:l.Pitch,filters:fr},{category:l.Power,filters:yr},{category:l.Talent,filters:hr}],mr=()=>{let e=I({});for(let{category:t,filters:r}of Cr)for(let a of Y[t])for(let i of Q)e[`${i}${a}`]=r;return e},br=mr(),Ie=e=>{let t=[],r=br[e];return r&&t.push(...r),t};var U=require("@flesh-and-blood/types");var mt=new WeakMap,K=Object.freeze([]),Fr=Number.MAX_SAFE_INTEGER,bt=(e,t)=>{let r=new Map;for(let a of e)for(let i of t(a)||[]){let s=r.get(i);s?s.push(a):r.set(i,[a])}return r},vr=e=>{let t=new Map;for(let r of e){let a=r.types.includes(U.Type.Hero)&&!r.isCardBack,i=a?U.CardRole.Hero:(0,U.getCardRole)(r);if(a||i!==U.CardRole.Hero){let o=t.get(i);o?o.push(r):t.set(i,[r])}}return t},Tr=e=>{let t,r,a,i,s,o=()=>{if(!t){let g=new Map,f=new Map,C=[],T=new Map,x=0;for(let S of e){g.set(S.cardIdentifier,S),f.set(S.cardIdentifier,x),x++;let R=W(S.name),G=T.get(R);G?G.push(S):(T.set(R,[S]),C.push(R))}t={cardByCardIdentifier:g,corpusPositionByCardIdentifier:f,cleanedNames:C,pitchCycleByCleanedName:T}}return t},n=g=>{let{corpusPositionByCardIdentifier:f}=o(),C=({cardIdentifier:T})=>f.get(T)??Fr;return[...g].sort((T,x)=>C(T)-C(x))},c=g=>o().cardByCardIdentifier.get(g),d=g=>{let{cardByCardIdentifier:f}=o(),C=[];for(let T of g||[]){let x=f.get(T);x&&C.push(x)}return n(C)},u=g=>{let f=new Map;return C=>{let T=f.get(C);if(!T){let x=c(C),S=d(x&&g(x)),R=S.length>0;T=R?S:K,R&&f.set(C,T)}return T}},y=g=>{let{pitchCycleByCleanedName:f}=o(),C=c(g);return C?f.get(W(C.name))??K:K},h=g=>{let{cleanedNames:f,pitchCycleByCleanedName:C}=o(),T=W(g),x=C.get(T);if(!x&&T.length>0){let R=f.find(G=>G.includes(T));R&&(x=C.get(R))}return x??K},v=g=>{let{pitchCycleByCleanedName:f}=o();return f.get(W(g))??K},B=()=>{if(!s){let g=new Set;for(let f of e)for(let C of f.artists)g.add(C);s=[...g].sort((f,C)=>f.localeCompare(C,"en",{sensitivity:"base"}))}return s},w=u(({oppositeSideCardIdentifiers:g})=>g),A=u(({referencedCards:g})=>g),E=g=>(r||(r=bt(e,({referencedCards:f})=>f)),r.get(g)??K),O=u(({createdExtras:g})=>g);return{cards:e,getCard:c,getPitchCycle:y,getCardsByName:h,getCardsByExactName:v,getArtists:B,getOppositeSide:w,getReferences:A,getReferencedBy:E,getCreates:O,getCreatedBy:g=>(a||(a=bt(e,({createdExtras:f})=>f)),a.get(g)??K),getCreatedClosure:g=>{let f=new Map,C=new Set,T=[...g];for(let x of T)if(!C.has(x)){C.add(x);for(let R of O(x))f.set(R.cardIdentifier,R),T.push(R.cardIdentifier)}return n([...f.values()])},getByRole:g=>(i||(i=vr(e)),i.get(g)??K),getCardsInCorpusOrder:n}},we=e=>{let t=mt.get(e);return t||(t=Tr(e),mt.set(e,t)),t},Ee=(e,t)=>e.getPitchCycle(t.cardIdentifier),ye=(e,t)=>e.getCardsByName(t),Ft=(e,t)=>{let r=new Map;for(let a of t)for(let i of Ee(e,a))r.set(i.cardIdentifier,i);return e.getCardsInCorpusOrder([...r.values()])},he=(e,t)=>{let r=[];for(let a of Ee(e,t))r.push(...e.getReferencedBy(a.cardIdentifier));return Ft(e,r)},Ce=(e,t)=>{let r=[];for(let a of Ee(e,t))r.push(...e.getReferences(a.cardIdentifier));return Ft(e,r)};var xr=e=>{let[t]=e,r=t?.modifier;return e.every(({modifier:i})=>i===r)?r:void 0},Be=({filterValues:e,isAnd:t,isExcluded:r,mapping:a})=>{let i=[];for(let{value:s}of e)i.push(a.hasMarkup?_(s):s);return{filterToPropertyMapping:a,filterValues:e,isAnd:t,isExcluded:r,isOr:!t&&i.length>1,modifier:xr(e),values:i}},xt=({isAnd:e,isExcluded:t,mapping:r},a)=>({filterToPropertyMapping:r,isAnd:e,isExcluded:t,isOr:!e&&a.length>1,values:a}),Mr=({category:e,filterValues:t,mapping:r})=>{let a=[];if(r.kind===m.ExactMatch&&!!r.vocabulary)for(let{value:s}of t)ke(e,s)||a.push(s);return a},Ar=e=>({appliedFilters:[Be(e)],unresolvedValues:Mr(e)}),Ne=({isExcluded:e},t,r)=>e?void 0:{[t]:r},Mt=(e,t)=>({appliedFilters:[Be(e)],attributes:Ne(e,t,e.filterValues.map(({value:r})=>r)),unresolvedValues:[]}),Pr=e=>Mt(e,"artists"),Sr=e=>Mt(e,"prints"),Le=(e,t,r)=>{let a=[],i=[],s=[];for(let{value:o}of e.filterValues){let n=r(o);if(n.length>0)for(let c of n)a.push(c),i.push(V(c));else s.push(o)}return{appliedFilters:[xt(e,i)],attributes:Ne(e,t,a),canonicalValues:i,unresolvedValues:s}},kr=I({purple:4,blue:3,yellow:2,red:1,white:0}),Rr=e=>{let t=[],r=[];for(let{modifier:a,value:i}of e.filterValues){let s=kr[i],o=s===void 0?i:`${s}`;t.push({modifier:a,value:o}),r.push(o)}return{appliedFilters:[Be({...e,filterValues:t})],canonicalValues:r,unresolvedValues:[]}},Vr=(e,t)=>{let r=[()=>{let i=Object.values(p.Release).find(s=>V(s)===e);return i?[i]:[]},()=>{let i=ne[e];return i?[i]:[]},()=>Object.values(p.Release).filter(i=>i.toLowerCase().includes(e)),()=>{let i=t.find(s=>V(s)===e);return i?[i]:[]}],a=[];for(let i of r)a.length===0&&a.push(...i());return a},Ir=(e,{additionalSets:t})=>Le(e,"releases",r=>Vr(r,t)),wr=I({r:p.Foiling.Rainbow,rf:p.Foiling.Rainbow,rainbow:p.Foiling.Rainbow,c:p.Foiling.Cold,cf:p.Foiling.Cold,cold:p.Foiling.Cold,g:p.Foiling.Gold,gf:p.Foiling.Gold,gold:p.Foiling.Gold}),Er=e=>{let t=wr[e];return t?[t]:[]},Br=e=>Le(e,"foilings",Er),Nr=I({...Object.values(p.Treatment).reduce((e,t)=>(e[t.toLowerCase()]=t,e),{}),aa:p.Treatment.AA,alt:p.Treatment.AA,"alt art":p.Treatment.AA,ab:p.Treatment.AB,"alt border":p.Treatment.AB,at:p.Treatment.AT,"alt text":p.Treatment.AT,ea:p.Treatment.EA,extended:p.Treatment.EA,"extended art":p.Treatment.EA,fa:p.Treatment.FA,full:p.Treatment.FA,"full art":p.Treatment.FA}),Lr=I(p.Treatment),Or=e=>{let t=Nr[e]||Lr[e.toUpperCase()];return t?[t]:[]},Dr=e=>Le(e,"treatments",Or),Oe=I({b:p.Rarity.Basic,c:p.Rarity.Common,f:p.Rarity.Fabled,l:p.Rarity.Legendary,m:p.Rarity.Majestic,p:p.Rarity.Promo,r:p.Rarity.Rare,s:p.Rarity.SuperRare,t:p.Rarity.Token,v:p.Rarity.Marvel}),Hr=e=>Oe[e]||Object.values(p.Rarity).find(t=>t.toLowerCase()===e),Qr=(e,{additionalHeroes:t})=>{let r=[],a=[],i=[],s=[];for(let{modifier:n,value:c}of e.filterValues){let d=Hr(c);d?(r.push(d),a.push(d.toLowerCase()),i.push({modifier:n,value:d.toLowerCase()})):(s.push(c),i.push({modifier:n,value:c}))}let{appliedFilters:o}=ee(e.key,i,{additionalHeroes:t,isExcluded:e.isExcluded});return{appliedFilters:o,attributes:Ne(e,"rarities",r),canonicalValues:a,unresolvedValues:s}},vt=({filterValues:e,isExcluded:t,key:r},{additionalHeroes:a})=>{let{appliedFilters:i,unresolvedValues:s}=ee(r,e,{additionalHeroes:a,isExcluded:t}),o=[];for(let{values:n}of i)o.push(...n);return{appliedFilters:i,canonicalValues:o,unresolvedValues:s}},Kr=["unique"],jr=["preview","spoiler","unreleased"],Ur=["released"],Tt={property:"firstReleaseDate",isDate:!0},Gr=I({dual:p.Meta.DualClass,exp:p.Meta.Expansion,expansion:p.Meta.Expansion,rainbow:p.Meta.Rainbow,reprint:p.Meta.Reprint,reprints:p.Meta.Reprint}),Wr=e=>{let t=[],r=[];for(let i of e){let s=Gr[i];s?t.push(s):r.push(i)}let a=[];if(t.length===0){let i=new Set;for(let s of Object.values(p.Meta)){let o=!1;for(let n of r)s.toLowerCase().includes(n)&&(o=!0,i.add(n));o&&t.push(s)}for(let s of r)i.has(s)||a.push(s)}else a.push(...r);return{unresolvedValues:a,values:t}},_r=(e,{today:t})=>{let{filterValues:r,isAnd:a,isExcluded:i}=e,s=[],o=[],n=[],c=[],d=[];for(let{value:A}of r)Kr.includes(A)?o.push(A):jr.includes(A)?n.push(A):Ur.includes(A)?c.push(A):d.push(A);let u=!a&&r.length>1;o.length>0&&s.push({filterToPropertyMapping:$.is,values:[V(p.Meta.Reprint)],isAnd:a,isOr:u,isExcluded:!i}),n.length>0&&s.push({filterToPropertyMapping:Tt,values:[t],isAnd:a,isOr:u,isExcluded:i}),c.length>0&&s.push({filterToPropertyMapping:Tt,values:[t],isAnd:a,isOr:u,isExcluded:!i});let{unresolvedValues:y,values:h}=Wr(d),v=[...o,...n,...c,...h.map(V)];(d.length>0||s.length===0)&&s.push(xt(e,h.map(V)));let w=h.includes(p.Meta.Expansion)&&!i;return{appliedFilters:s,attributes:w?{isExpansionSlot:w}:void 0,canonicalValues:v,unresolvedValues:y}},zr={property:"cardIdentifier",isString:!0,isNormalized:!0},$r=20,Yr=(e,t)=>{let r=new Set,a=[],i=new Set,s=[],o=d=>{r.add(d.cardIdentifier),i.has(d.name)||(i.add(d.name),a.push(d))},n=d=>{d.types.includes(p.Type.Hero)||o(d)};for(let d of t){let u=ye(e,d);for(let y of u)o(y);u.length===0&&s.push(d)}let c=0;for(;c<a.length&&c<=$r;){let d=a[c];for(let y of Ce(e,d))n(y);if(c===0)for(let y of he(e,d))n(y);c++}return{cardIdentifiers:r,unresolvedValues:s}},At=(e,t,r)=>{let a=new Set;for(let i of ye(e,t)){let s=r?Ce(e,i):he(e,i);for(let o of s)a.add(o.cardIdentifier)}return a},qr=(e,t)=>{let r=new Set,[a=new Set,...i]=e;if(t)for(let s of a)i.every(n=>n.has(s))&&r.add(s);else for(let s of e)for(let o of s)r.add(o);return r},Pt=(e,t)=>({filterToPropertyMapping:zr,values:[...e],valuesSet:e,isExcluded:t,isOr:!0}),St=({filterValues:e,isAnd:t,isExcluded:r},a)=>{let i=[],s=[];for(let{value:o}of e){let n=a(o);i.push(n),n.size===0&&s.push(o)}return{appliedFilters:[Pt(qr(i,t),r)],unresolvedValues:s}},Xr=(e,{index:t})=>{let{cardIdentifiers:r,unresolvedValues:a}=Yr(t,e.filterValues.map(({value:i})=>i));return{appliedFilters:[Pt(r,e.isExcluded)],unresolvedValues:a}},Jr=(e,{index:t})=>St(e,r=>At(t,r,!0)),Zr=(e,{index:t})=>St(e,r=>At(t,r,!1)),ea=I({[l.Artist]:Pr,[l.Banned]:vt,[l.Chain]:Xr,[l.Foiling]:Br,[l.Is]:_r,[l.Legal]:vt,[l.Pitch]:Rr,[l.Print]:Sr,[l.Rarity]:Qr,[l.ReferencedBy]:Jr,[l.References]:Zr,[l.Set]:Ir,[l.Treatment]:Dr}),kt=(e,t)=>(ea[e.category]||Ar)(e,t);var Vt=Q.map(z).join(""),ta=/(?:[^\s"]+|"[^"]*(?:"|$))+/g,ra=new RegExp(`^([${Vt}])?([A-Za-z]+):(.+)$`),aa=new RegExp(`^([${Vt}])?([A-Za-z]+):$`),ia=",",Rt="+",sa='"',It=e=>{let t=[],r=!1,a="",i=!1;for(let s of e)s===sa?(i=!i,a+=s):!i&&(s===ia||s===Rt)?(r=r||s===Rt,a&&t.push(a),a=""):a+=s;return a&&t.push(a),{isAndList:r,parts:t}},me=e=>{let t=[];for(let r of e.matchAll(ta))t.push({end:r.index+r[0].length,start:r.index,token:r[0]});return t},oa=e=>Q.some(t=>e.startsWith(t)),be=e=>{let t=e.match(ra),r;if(t){let[,a,i,s]=t;r={isAndList:It(s).isAndList,isExcluded:!!a,key:i,valueText:s}}return r},He=e=>{let t=e.match(aa),r;return t&&(r={isAndList:!1,isExcluded:!!t[1],key:t[2],valueText:""}),r},Qe=e=>{let t=e.trim(),r=Se.find(a=>t.startsWith(a));return{modifier:r,value:r?t.slice(r.length).trim():t}},De=e=>Z(e)??e.toLowerCase(),na=(e,t)=>{let r=De(t),a=[];for(let{end:i,start:s,token:o}of me(e)){let n=be(o);n&&De(n.key)===r&&a.push({...n,end:i,start:s,token:o})}return a},wt=e=>It(e).parts,Fe=e=>e.replace(/^"|"$/g,""),Ke=e=>{let t=[];for(let r of wt(e)){let a=Fe(r);a&&t.push(a)}return t},la=/[\s,:+"]/,da=e=>{let t=e.replaceAll('"',"");return la.test(e)?`"${t}"`:t};var L=require("@flesh-and-blood/types"),je=[{description:"Attack actions",expanded:["st:attack"],filters:{subtypes:[L.Subtype.Attack]},isCardProperty:!1,shorthands:["AA"]},{description:"Arcane barrier",expanded:['k:"arcane barrier"'],filters:{keywords:[L.Keyword.ArcaneBarrier]},isCardProperty:!1,shorthands:["AB"]},{description:"Attack reactions",expanded:['t:"attack reaction"'],filters:{types:[L.Type.AttackReaction]},isCardProperty:!1,shorthands:["AR"]},{description:"Defense reactions",expanded:['t:"defense reaction"'],filters:{types:[L.Type.DefenseReaction]},isCardProperty:!1,shorthands:["DR"]},{description:"Gain life",expanded:["gain {h}"],filters:{functionalText:"gain {h}"},isCardProperty:!1,shorthands:["Gain life","Gains life"]},{description:"Go again",expanded:['k:"go again"'],filters:{keywords:[L.Keyword.GoAgain]},isCardProperty:!1,shorthands:["GA"]},{description:"Non-attack actions",expanded:["t:action","st:non-attack"],filters:{subtypes:[L.Subtype.NonAttack],types:[L.Type.Action]},isCardProperty:!1,shorthands:["NAA"]},{description:"Plus defense",expanded:["+ {d}"],filters:{functionalText:"+ {d}"},isCardProperty:!1,shorthands:["Pump defense","Pumps defense","Buff defense","Buffs defense"]},{description:"Spellvoid",expanded:['k:"spellvoid"'],filters:{keywords:[L.Keyword.Spellvoid]},isCardProperty:!1,shorthands:["SV"]}],Ue=je.filter(({shorthands:e})=>e.some(t=>t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)})),Ge=je.filter(({shorthands:e})=>e.some(t=>!t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>!t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)}));var ca=["\u201C","\u201D"],pa=[{text:te.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:te.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(P,"")}],We=new Map(Object.entries(te.setToSetIdentifierMappings).map(([e,t])=>[e.toLowerCase(),t])),ua=[...Y[l.Set],...Y[l.Print]],ga=Q.map(z).join(""),fa=[...We.keys()].sort((e,t)=>t.length-e.length).map(z).join("|"),ya=new RegExp(`(?<=^|\\s)([${ga}]?(?:${ua.join("|")}):(?:[^\\s]*[,+])?"?)(${fa})(?="?(?:[,+]|\\s|$))`,"g"),ha=(e,t)=>{let r=e.trim().toLowerCase();for(let s of ca)r=r.replaceAll(s,'"');for(let{expanded:s,shorthands:o}of Ue)for(let n of o)if(r.includes(n)){r=r.replace(n,s.join(" "));break}r=r.replace(ya,(s,o,n)=>{let c=We.get(n);return c?`${o}${c[0]}`:s});let a=We.get(r),i=t.getCardsByExactName(r).length>0;a&&!i&&(r=`set:${a[0]}`);for(let{override:s,text:o}of pa)r.includes(o)&&(r=r.replace(o,s));return{isWholeQueryAbbreviation:!!ge(r)?.card,text:r}},Ca=e=>{let t=Ge.find(({shorthands:a})=>a.includes(e)),r=!!t&&!t.isCardProperty;return{isExpanded:r,tokens:r?t.expanded:[e]}},ma=({isWholeQueryAbbreviation:e,text:t})=>{let r=[],a=e?[{end:t.length,start:0,token:t}]:me(t);for(let{end:i,start:s,token:o}of a){let{isExpanded:n,tokens:c}=Ca(o);for(let d of c)r.push({end:i,isExpanded:n,start:s,token:d})}return r},ba=e=>{let t=[];for(let r of e){let{modifier:a,value:i}=Qe(r),s=V(i);s&&t.push({modifier:a,value:s})}return t},Fa=(e,t,r)=>{let a={key:e,reason:"value",values:r},i=Re(t,r);return i&&(a.suggestedKey=i),a},va=()=>{let e=new Date,t=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${t}-${r}`},re=(e,t,{additionalHeroes:r=[],additionalSets:a=[],today:i=va()}={})=>{let s=ha(e,t),o={additionalHeroes:r,additionalSets:a,index:t,today:i},n=[],c={artists:[],foilings:[],isExpansionSlot:!1,prints:[],rarities:[],releases:[],treatments:[]},d=[],u=[],y=[];for(let h of ma(s)){let v=be(h.token)||He(h.token);if(v){let{isAndList:B,isExcluded:w,key:A,valueText:E}=v,O=ue(A),D=O?.category,F=Ke(E),N=ba(F),g={...h,canonicalValues:N.map(({value:f})=>f),category:D,filterValues:N,isAnd:B,isExcluded:w,isFilter:!0,isResolved:!0,key:A};if(F.length>0)if(O&&D){let f=F;if(N.length>0){let C=kt({category:D,filterValues:N,isAnd:g.isAnd,isExcluded:w,key:A,mapping:O},o);n.push(...C.appliedFilters),C.canonicalValues&&(g.canonicalValues=C.canonicalValues),C.attributes&&Object.assign(c,C.attributes),f=C.unresolvedValues}f.length>0&&(g.isResolved=!1,y.push(Fa(A,D,f)))}else g.isResolved=!1,y.push({key:A,reason:"key",values:[]});u.push(g)}else{let{end:B,start:w,token:A}=h;u.push({end:B,isFilter:!1,start:w,token:A});let E=Fe(h.token),O=ge(E)?.card,D=Ie(E);O?d.push(`"${O.toLowerCase().replace(P,"")}"`):D.length>0?n.push(...D):E&&d.push(E.replace(P,""))}}return{appliedFilters:n,attributes:c,keywords:d,nodes:u,text:s.text,unresolvedFilters:y}};var M=require("@flesh-and-blood/types"),Et={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[M.Class.Generic],defaultImage:"FNG000",firstReleaseDate:"2022-06-02",functionalText:"If Fangs A Lot is put into your banished zone from your graveyard, instead put it into your hand.",legalFormats:[],legalHeroes:[M.Hero.Kayo,M.Hero.Levia,M.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:M.Rarity.Rare,set:M.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${M.Treatment.FA}`,rarity:M.Rarity.Marvel,set:M.Release.Promos,treatment:M.Treatment.FA}],name:"Fangs A Lot",rarities:[M.Rarity.Rare,M.Rarity.Marvel],rarity:M.Rarity.Rare,sets:[M.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[M.Subtype.Attack],types:[M.Type.Action],typeText:"Generic Action - Attack"},Bt=[{keyword:Et.name.toLowerCase(),card:Et}];var Ta={getFn:(e,t)=>{let r=ze.default.config.getFn(e,t),a=r;if(Array.isArray(r))a=r.map(i=>X(i.replace(P,"")));else if(r){let i=X(r).replace(P,"");a=t.includes("functionalText")?_(i):i}return a},ignoreLocation:!0,includeScore:!0,keys:[{name:"name",weight:10},{name:"functionalText",weight:6},{name:"shorthands",weight:4},{name:"setIdentifiers",weight:2},{name:"traits",weight:4},{name:"typeText",weight:6}],threshold:.15,useExtendedSearch:!0},_e=class{constructor(t,r=[],a=[],i=!1){this.getFuse=()=>(this.fuse||(this.fuse=new ze.default(this.cards,Ta)),this.fuse);this.log=(t,...r)=>{this.debug&&console.log(t,...r)};this.search=(t,r)=>{let a,{appliedFilters:i,attributes:s,keywords:o,unresolvedFilters:n}=re(t,this.index,{additionalHeroes:this.additionalHeroes,additionalSets:this.additionalSets}),c=o.join(" "),d=r?Bt.filter(F=>F.keyword===c):[];if(d.length>0?a=d.map(({card:F})=>F):o.length?a=this.getFuse().search(c).map(F=>F.item):a=[...this.cards],i.length&&(a=a.filter(F=>F&&Ot(F,i))),o.length===0){let F="";if(s.releases.length===1){let f=Ye[s.releases[0]];f?.length&&(F=f[0].toUpperCase())}if(!F&&s.prints.length===1){let f=s.prints[0];ne[f]&&(F=f.toUpperCase())}F?a.sort((f,C)=>{let T=f.setIdentifiers.find(S=>S.includes(F))?.replace(F,""),x=C.setIdentifiers.find(S=>S.includes(F))?.replace(F,"");return T&&x?T.localeCompare(x):-1}):a.sort((f,C)=>f.name===C.name?`${f.pitch}`.localeCompare(`${C.pitch}`):f.name.localeCompare(C.name))}else{let F=[],N=[],g=o.map(f=>f.toLowerCase().replace(P,"")).join(" ");for(let f of a)f.name.toLowerCase().replace(P,"")===g?F.push(f):N.push(f);a=[...F,...N]}let u=[],{artists:y,isExpansionSlot:h,foilings:v,prints:B,rarities:w,releases:A,treatments:E}=s;(y.length>0||h||v.length>0||B.length>0||w.length>0||A.length>0||E.length>0)&&(u=a.map(F=>{let N=F.printings.filter(g=>{let f=!!g.image,C=y.length===0||y.some(q=>g.artists.find(Ht=>Ht.replace(P,"").toLowerCase().includes(q))),T=!h||h===g.isExpansionSlot,x=v.length===0||!!g.foiling&&v.includes(g.foiling),S=B.length===0||B.some(q=>g.identifier.includes(q.toUpperCase())),R=w.length===0||w.includes(g.rarity),G=A.length===0||A.includes(g.set),Dt=E.length===0||g.treatments?.some(q=>E.includes(q));return f&&C&&T&&x&&S&&R&&G&&Dt});return{...F,matchingPrintings:N}}));let D=u.length>0?u:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:D,unresolvedFilters:n}};let s=Array.isArray(r)?{additionalHeroes:r,additionalSets:a,debug:i}:r;this.additionalHeroes=s.additionalHeroes||[],this.additionalSets=s.additionalSets||[],this.cards=[...t],this.debug=s.debug||!1,this.index=s.index||we(t)}},Lt=_e,Ot=(e,t)=>{let r=!0;for(let a of t){let{isNumber:i,isString:s,isArray:o,isBoolean:n,isDate:c}=a.filterToPropertyMapping;a.isOptional||(i?r=r&&xa(e,a):s?r=r&&Ma(e,a):o?r=r&&Aa(e,a,t):n?r=r&&Pa(e,a):c&&(r=r&&Sa(e,a)))}return r},Nt=(e,t,r)=>{let a=parseInt(t),i;switch(r){case">=":i=e>=a;break;case">":i=e>a;break;case"<=":i=e<=a;break;case"<":i=e<a;break;default:i=e===a}return i},xa=(e,t)=>{let{filterValues:r,values:a,modifier:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=t,n=!0;if(ie(t,e)){let c=ae(e,t),d;if(c!=null&&!isNaN(c)){let u=parseInt(c);d=r?r.some(({modifier:y,value:h})=>Nt(u,h,y)):a.some(y=>Nt(u,y,i))}else{let u=Ra(e,t)?.toLowerCase();d=o?a.some(y=>!!u?.includes(y)):a.some(y=>u===y)}n=s?!d:d}return n},Ma=(e,t)=>{if(ie(t,e)){let{values:r,valuesSet:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{hasMarkup:o,isNormalized:n,partialMatch:c}}=t,d=ae(e,t),u=n?d:d?.replaceAll(P,"").toLowerCase(),y=o&&u?_(u):u;if(c){let h=i?r?.every(v=>y?.includes(v)):r?.some(v=>y?.includes(v));return s?!h:h}else{let h;return i?h=r?.every(v=>y===v):a?h=a.has(y):h=r?.some(v=>y===v),s?!h:h}}else return!0},Aa=(e,t,r)=>{if(ie(t,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=t,n=ka(e,t,r).map(c=>c?.replaceAll(P,""));if(o){let c=i?a.every(u=>n?.some(y=>y?.toLowerCase().includes(u))):a.some(u=>n?.some(y=>y?.toLowerCase().includes(u))),d=n.length===0;return s?!c||d:c}else{let c=i?a.every(d=>n?.some(u=>u?.toLowerCase()===d)):a.some(d=>n?.some(u=>u?.toLowerCase()===d));return s?!c:c}}else return!0},Pa=(e,t)=>{if(ie(t,e)){let{isExcluded:r}=t,a=ae(e,t);return r?!a:a}else return!0},Sa=(e,t)=>{if(ie(t,e)){let{values:r,isExcluded:a}=t,i=ae(e,t),s=r?.some(o=>i>o);return a?!s:s}else return!0},ae=(e,t)=>{let{filterToPropertyMapping:{property:r}}=t,a;return r!==H&&(a=e[r]),a},ka=(e,t,r)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i}}=t,s=[],o=Object.keys(e.legalOverrides||{}).length>0,n=t.filterToPropertyMapping.property===j.LegalHeroes,c=r.find(({filterToPropertyMapping:u})=>u.property===j.LegalFormats);if(o&&n&&!!c){let u=new Set;for(let{format:y,heroes:h}of e.legalOverrides||[])if(c.values.includes(y.toLowerCase()))for(let v of h)u.add(v);s=Array.from(u)}if(s.length===0)if(i){let u=new Set;for(let y of e.printings){let h=y[i];if(a){if(Array.isArray(h))for(let v of h)u.add(v)}else h&&typeof h=="string"&&u.add(h)}s=Array.from(u)}else{let u=ae(e,t);if(Array.isArray(u))for(let y of u)typeof y=="string"&&s.push(y)}return s},Ra=(e,t)=>{let{filterToPropertyMapping:{specialProperty:r}}=t,a;return r&&(a=e[r]),a},ie=({cardTypes:e},{types:t,subtypes:r})=>!e||e?.some(a=>t.map(i=>i.toLowerCase()).includes(a.toLowerCase())||r.map(i=>i.toLowerCase()).includes(a.toLowerCase()));var Va=(e,t,r=[],a=[],i)=>{let{appliedFilters:s,attributes:o,keywords:n}=re(e,t,{additionalHeroes:r,additionalSets:a,today:i});return{appliedFilters:s,attributes:o,keywords:n}};var Ia=(e,t)=>{let r=[];if(e)for(let a of t){let i=a.name===e.name,s=a.cardIdentifier!==e.cardIdentifier,o=a.pitch!==e.pitch;i&&s&&o&&r.push(a)}return r},wa=(e,t)=>{let r=new Set(e?.referencedCards),a=[];for(let i of t)r.has(i.cardIdentifier)&&a.push(i);return a},Ea=e=>{let t=new Map;for(let r of e)for(let a of r.referencedCards||[]){let i=t.get(a);i?i.push(r):t.set(a,[r])}return t},Ba=(e,t)=>{let r=new Set;for(let i of e)for(let s of i.createdExtras||[])r.add(s);let a=[];for(let i of t)r.has(i.cardIdentifier)&&a.push(i);return a};0&&(module.exports={FilterCategory,FilterKind,FilterProperty,MARKUP,NO_CARD_PROPERTY,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,aliasesByFilterCategory,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,filtersToCardPropertyMappingsByKey,getAbbreviation,getAbbreviationByCard,getCardsByName,getCardsByReferencedCardIdentifier,getCardsReferencedBy,getCardsReferencing,getCatalogueIndex,getCleanText,getEscapedForRegExp,getExcludedMetaFilters,getFilterCategory,getFilterMapping,getFilterTokenSpansForKey,getFilterValue,getIncompleteFilterToken,getIsExcludedToken,getIsValueInFilterVocabulary,getKeywordsAndAppliedFiltersFromText,getMetaFilterResolution,getMetaFilters,getNormalizedFilterValue,getNormalizedText,getOtherPitches,getParsedQuery,getQueryFilterToken,getQueryTokenSpans,getQuotedValue,getReferencedCards,getResolvedFilterKey,getSuggestedFilterKey,getTextWithoutMarkup,getTokensReferencedByCards,getUnquotedValue,getValuePartsFromFilterValue,getValuesFromFilterValue,multiWordShorthands,shorthands,singleWordShorthands});
|
|
1
|
+
"use strict";var Ht=Object.create;var ie=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Kt=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var Gt=(e,t)=>{for(var r in t)ie(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of jt(t))!Ut.call(e,i)&&i!==r&&ie(e,i,{get:()=>t[i],enumerable:!(a=Qt(t,i))||a.enumerable});return e};var Wt=(e,t,r)=>(r=e!=null?Ht(Kt(e)):{},$e(t||!e||!e.__esModule?ie(r,"default",{value:e,enumerable:!0}):r,e)),_t=e=>$e(ie({},"__esModule",{value:!0}),e);var Ba={};Gt(Ba,{FilterCategory:()=>l,FilterKind:()=>m,FilterProperty:()=>j,MARKUP:()=>be,NO_CARD_PROPERTY:()=>D,PUNCTUATION:()=>P,RARITY_VALUES_MAPPING:()=>Le,abbreviations:()=>Re,aliasesByFilterCategory:()=>z,availableExclusions:()=>H,availableModifiers:()=>Ae,default:()=>Nt,filterCard:()=>Lt,filtersToCardPropertyMappings:()=>$,getAbbreviation:()=>ce,getAbbreviationByCard:()=>ir,getCardsByName:()=>ue,getCardsByReferencedCardIdentifier:()=>Ea,getCardsReferencedBy:()=>fe,getCardsReferencing:()=>ge,getCatalogueIndex:()=>we,getCleanText:()=>G,getEscapedForRegExp:()=>_,getExcludedMetaFilters:()=>ke,getFilterCategory:()=>J,getFilterMapping:()=>de,getFilterTokenSpansForKey:()=>oa,getFilterValue:()=>He,getIncompleteFilterToken:()=>De,getIsExcludedToken:()=>sa,getIsValueInFilterVocabulary:()=>Pe,getKeywordsAndAppliedFiltersFromText:()=>ka,getMetaFilterResolution:()=>Z,getMetaFilters:()=>pr,getNormalizedFilterValue:()=>w,getNormalizedText:()=>q,getOtherPitches:()=>wa,getParsedQuery:()=>te,getQueryFilterToken:()=>he,getQueryTokenSpans:()=>ye,getQuotedValue:()=>la,getReferencedCards:()=>Va,getResolvedFilterKey:()=>Oe,getSuggestedFilterKey:()=>Se,getTextWithoutMarkup:()=>W,getTokensReferencedByCards:()=>Ia,getUnquotedValue:()=>Ce,getValuePartsFromFilterValue:()=>Vt,getValuesFromFilterValue:()=>Qe,multiWordShorthands:()=>Ke,shorthands:()=>je,singleWordShorthands:()=>Ue});module.exports=_t(Ba);var me=require("@flesh-and-blood/types"),_e=Wt(require("fuse.js"),1);var P=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g,be=/\*/g;var b=require("@flesh-and-blood/types");var G=e=>q(e.toLowerCase().trim().replace(P,"")),q=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),w=e=>e.toLowerCase().replace(P,""),W=e=>e.replace(be,""),_=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&");var l={Arcane:"arcane",Artist:"artist",Banned:"banned",Bond:"bond",Chain:"chain",Class:"class",Cost:"cost",Defense:"defense",Flow:"flow",Foiling:"foiling",Fusion:"fusion",Intellect:"intellect",Is:"is",Keyword:"keyword",Legal:"legal",Life:"life",Name:"name",Pitch:"pitch",Power:"power",Print:"print",Rarity:"rarity",ReferencedBy:"referencedby",References:"references",Set:"set",Shorthand:"shorthand",Specialization:"specialization",Subtype:"subtype",Talent:"talent",Text:"text",Trait:"trait",Treatment:"treatment",Type:"type",TypeText:"typetext",Year:"year"},m={Comparator:"comparator",ExactMatch:"exactMatch",PartialMatch:"partialMatch"},Ae=[">=",">","<=","<"],H=["!","-"],D="n/a",pt=[...Object.values(b.Format),...Object.values(b.Hero)],$t={category:l.Arcane,canonicalAlias:"arcane",kind:m.Comparator,property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},Fe={category:l.Artist,canonicalAlias:"art",kind:m.PartialMatch,property:"artists",isArray:!0,partialMatch:!0},ze={category:l.Banned,canonicalAlias:"banned",kind:m.ExactMatch,vocabulary:pt,property:D,isMeta:!0},Ye={category:l.Bond,canonicalAlias:"bond",kind:m.ExactMatch,vocabulary:Object.values(b.Bond),property:"bonds",isArray:!0},zt={category:l.Chain,canonicalAlias:"chain",kind:m.PartialMatch,property:D},qe={category:l.Class,canonicalAlias:"c",kind:m.PartialMatch,vocabulary:Object.values(b.Class),property:"classes",isArray:!0,partialMatch:!0},Xe={category:l.Cost,canonicalAlias:"co",kind:m.Comparator,property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},X={category:l.Defense,canonicalAlias:"d",kind:m.Comparator,property:"defense",specialProperty:"specialDefense",isNumber:!0},Je={category:l.Flow,canonicalAlias:"flow",kind:m.ExactMatch,vocabulary:Object.values(b.Flow),property:"flows",isArray:!0},Ze={category:l.Foiling,canonicalAlias:"foil",kind:m.ExactMatch,vocabulary:Object.values(b.Foiling),nestedProperty:"foiling",property:"printings",isArray:!0},et={category:l.Fusion,canonicalAlias:"f",kind:m.ExactMatch,vocabulary:Object.values(b.Fusion),property:"fusions",isArray:!0},tt={category:l.Intellect,canonicalAlias:"i",kind:m.Comparator,property:"intellect",isNumber:!0},rt={category:l.Keyword,canonicalAlias:"k",kind:m.ExactMatch,vocabulary:Object.values(b.Keyword),property:"keywords",isArray:!0},ve={category:l.Legal,canonicalAlias:"l",kind:m.ExactMatch,vocabulary:pt,property:D,isMeta:!0},at={category:l.Life,canonicalAlias:"li",kind:m.Comparator,property:"life",specialProperty:"specialLife",isNumber:!0},it={category:l.Is,canonicalAlias:"is",kind:m.ExactMatch,vocabulary:Object.values(b.Meta),property:"meta",isArray:!0},st={category:l.Name,canonicalAlias:"name",kind:m.PartialMatch,property:"name",isString:!0,partialMatch:!0},Te={category:l.Pitch,canonicalAlias:"p",kind:m.Comparator,property:"pitch",isNumber:!0},se={category:l.Power,canonicalAlias:"pwr",kind:m.Comparator,property:"power",specialProperty:"specialPower",isNumber:!0},oe={category:l.Print,canonicalAlias:"print",kind:m.PartialMatch,property:"setIdentifiers",isArray:!0,partialMatch:!0},ot={category:l.Rarity,canonicalAlias:"r",kind:m.ExactMatch,vocabulary:Object.values(b.Rarity),property:D,isMeta:!0},Yt={category:l.ReferencedBy,canonicalAlias:"referencedby",kind:m.PartialMatch,property:D},qt={category:l.References,canonicalAlias:"references",kind:m.PartialMatch,property:D},nt={category:l.Set,canonicalAlias:"s",kind:m.PartialMatch,vocabulary:Object.values(b.Release),property:"sets",isArray:!0,partialMatch:!0},Me={category:l.Shorthand,canonicalAlias:"short",kind:m.PartialMatch,vocabulary:Object.values(b.Shorthand),property:"shorthands",isArray:!0,partialMatch:!0},ne={category:l.Specialization,canonicalAlias:"sp",kind:m.PartialMatch,vocabulary:Object.values(b.Hero),property:"specializations",isArray:!0,partialMatch:!0},lt={category:l.Subtype,canonicalAlias:"st",kind:m.ExactMatch,vocabulary:Object.values(b.Subtype),property:"subtypes",isArray:!0},dt={category:l.Type,canonicalAlias:"t",kind:m.ExactMatch,vocabulary:Object.values(b.Type),property:"types",isArray:!0},xe={category:l.Talent,canonicalAlias:"tal",kind:m.ExactMatch,vocabulary:Object.values(b.Talent),property:"talents",isArray:!0},Xt={category:l.Text,canonicalAlias:"text",kind:m.PartialMatch,property:"functionalText",hasMarkup:!0,isString:!0,partialMatch:!0},Jt={category:l.Trait,canonicalAlias:"trait",kind:m.PartialMatch,vocabulary:Object.values(b.Trait),property:"traits",isArray:!0,partialMatch:!0},ct={category:l.TypeText,canonicalAlias:"x",kind:m.PartialMatch,property:"typeText",isString:!0,partialMatch:!0},le={category:l.Treatment,canonicalAlias:"treatment",kind:m.ExactMatch,vocabulary:Object.values(b.Treatment),nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},Zt={category:l.Year,canonicalAlias:"year",kind:m.PartialMatch,property:"firstReleaseDate",isString:!0,partialMatch:!0},$={arcane:$t,a:Fe,artist:Fe,art:Fe,attack:se,b:X,block:X,banned:ze,bond:Ye,bonds:Ye,c:qe,class:qe,chain:zt,co:Xe,cost:Xe,color:Te,d:X,def:X,defense:X,flow:Je,flows:Je,f:et,fusion:et,foil:Ze,foiling:Ze,i:tt,intellect:tt,is:it,k:rt,keyword:rt,l:ve,legal:ve,hero:ve,li:at,life:at,meta:it,n:st,name:st,p:Te,pitch:Te,pwr:se,pow:se,power:se,print:oe,printing:oe,printings:oe,prints:oe,r:ot,rarity:ot,referencedby:Yt,references:qt,rf:ze,s:nt,set:nt,short:Me,shorthand:Me,shorthands:Me,sp:ne,spec:ne,specialization:ne,specializations:ne,st:lt,subtype:lt,t:dt,type:dt,tal:xe,talent:xe,talents:xe,text:Xt,trait:Jt,treat:le,treatment:le,var:le,variation:le,x:ct,typetext:ct,year:Zt},er=new Map(Object.entries($)),de=e=>er.get(e.toLowerCase()),J=e=>de(e)?.category,tr=()=>{let e=Object.create(null);for(let[t,{category:r}]of Object.entries($)){let a=e[r];a?a.push(t):e[r]=[t]}return e},z=tr(),rr=()=>{let e=new Map,t=new Set,r=Object.values($);for(let a of r){let{vocabulary:i}=a;if(i&&!t.has(a)){t.add(a);for(let s of i){let o=w(s),n=e.get(o);n?n.push(a):e.set(o,[a])}}}return e},ut=rr(),Pe=(e,t)=>!!ut.get(w(t))?.some(r=>r.category===e),ar=(e,t)=>{let r=[],a=!0;for(let i of t){let s=(ut.get(w(i))||[]).filter(o=>o.category!==e);r=a?s:r.filter(o=>s.includes(o)),a=!1}return r},Se=(e,t)=>{let r=ar(e,t),[a]=r;return r.length===1?a.canonicalAlias:void 0};var ee=require("@flesh-and-blood/types");var ce=e=>Re.find(({abbreviations:t})=>t.find(r=>r.toLowerCase()===e)),ir=e=>Re.find(({card:t})=>t.toLowerCase()===e.name.toLowerCase()),Re=[{abbreviations:["10k"],card:"10,000 Year Reunion"},{abbreviations:["Pajamas","PJs"],card:"Alluvion Constellas"},{abbreviations:["Slippy","Arakni Slipped Through the Cracks","Arakni, Slipped Through the Cracks"],card:"Arakni, 5L!p3d 7hRu 7h3 cR4X"},{abbreviations:["Dullcap"],card:"Arcanite Skullcap"},{abbreviations:["ALS"],card:"Arc Light Sentinel"},{abbreviations:["AoW"],card:"Art of War"},{abbreviations:["BBD"],card:"Barraging Beatdown"},{abbreviations:["BBS"],card:"Big Blue Sky"},{abbreviations:["Starvo"],card:"Bravo, Star of the Show"},{abbreviations:["BEB"],card:"Bull's Eye Bracers"},{abbreviations:["BLW"],card:"Be Like Water"},{abbreviations:["BoJ"],card:"Balance of Justice"},{abbreviations:["BOHH"],card:"Blood on Her Hands"},{abbreviations:["BRB"],card:"Bloodrush Bellow"},{abbreviations:["Breezies"],card:"Breeze Rider Boots"},{abbreviations:["BTA"],card:"Burn Them All"},{abbreviations:["CStrike","C-Strike","C Strike"],card:"Celestial Cataclysm"},{abbreviations:["CBelly"],card:"Cerebellum Processor"},{abbreviations:["CLF"],card:"Channel Lake Frigid"},{abbreviations:["CLV"],card:"Channel Lightning Valley"},{abbreviations:["CMH"],card:"Channel Mount Heroic"},{abbreviations:["CMI"],card:"Channel Mount Isen"},{abbreviations:["CMT"],card:"Channel the Millennium Tree"},{abbreviations:["CnC","C&C"],card:"Command and Conquer"},{abbreviations:["Sea and Sea"],card:"Conqueror of the High Seas"},{abbreviations:["CYB"],card:"Count Your Blessings"},{abbreviations:["Cat","Kitty"],card:"Crouching Tiger"},{abbreviations:["CoD"],card:"Crown of Dominion"},{abbreviations:["CoP"],card:"Crown of Providence"},{abbreviations:["CtW"],card:"Crush the Weak"},{abbreviations:["DD"],card:"Death Dealer"},{abbreviations:["DnD"],card:"Devotion Never Dies"},{abbreviations:["DIO"],card:"Dash I/O"},{abbreviations:["EBTT"],card:"Even Bigger Than That!"},{abbreviations:["NewNigma"],card:"Enigma, New Moon"},{abbreviations:["EPot","E Pot"],card:"Energy Potion"},{abbreviations:["EStrike","E-Strike","E Strike"],card:"Enlightened Strike"},{abbreviations:["FFS"],card:"Fyendal's Fighting Spirit"},{abbreviations:["FoN"],card:"Force of Nature"},{abbreviations:["Frosty","\u{1F976}","\u{1F9CA}","\u2744\uFE0F"],card:"Frostbite"},{abbreviations:["Yum yum"],card:"Fruits of the Forest"},{abbreviations:["GnT"],card:"Give and Take"},{abbreviations:["Habibi"],card:"Hanabi Blaster"},{abbreviations:["HMH"],card:"Hope Merchant's Hood"},{abbreviations:["HoI"],card:"Heart of Ice"},{abbreviations:["Pumpkin"],card:"Jack-o'-lantern"},{abbreviations:["RKO","Cheato"],card:"Kayo, Underhanded Cheat"},{abbreviations:["KKBB"],card:"Knick Knack Bric-a-brac"},{abbreviations:["BStrike"],card:"Levels of Enlightenment"},{abbreviations:["LAG","Twominaris"],card:"Luminaris, Angel's Glow"},{abbreviations:["LCF","Newminaris"],card:"Luminaris, Celestial Fury"},{abbreviations:["LDE"],card:"Last Ditch Effort"},{abbreviations:["LtC"],card:"Lead the Charge"},{abbreviations:["LNW"],card:"Leave No Witnesses"},{abbreviations:["LFaL","L4aL"],card:"Life for a Life"},{abbreviations:["LiT"],card:"Lost in Thought"},{abbreviations:["MMB"],card:"Mage Master Boots"},{abbreviations:["MaxV"],card:"Maximum Velocity"},{abbreviations:["MoM"],card:"Mask of Momentum"},{abbreviations:["MoPL"],card:"Mask of the Pouncing Lynx"},{abbreviations:["MnG"],card:"Meat and Greet"},{abbreviations:["Cake","\u{1F382}"],card:"Ninth Blade of the Blood Oath"},{abbreviations:["PoM"],card:"Peace of Mind"},{abbreviations:["P-Bone"],card:"Performance Bonus"},{abbreviations:["PF","\u{1F525}"],card:"Phoenix Flame"},{abbreviations:["PtW"],card:"Poison the Well"},{abbreviations:["Thanos","Infinity Gauntlet"],card:"Polarity Reversal Script"},{abbreviations:["DPot","D Pot"],card:"Potion of D\xE9j\xE0 Vu"},{abbreviations:["Ponder Run"],card:"Premeditate"},{abbreviations:["Qi Unbound"],card:"Qi Unleashed"},{abbreviations:["RitL"],card:"Red in the Ledger"},{abbreviations:["Cats","Ghost cat","Ghost cats"],card:"Restless Coalescence"},{abbreviations:["Eugene"],card:"Rhinar, Reckless Rampage",isHidden:!0},{abbreviations:["SSGB"],card:"Sandscour Greatbow"},{abbreviations:["SSP"],card:"Sand Sketched Plan"},{abbreviations:["SFaS","S4aS"],card:"Scar for a Scar"},{abbreviations:["Tyler"],card:"Scurv, Stowaway",isHidden:!0},{abbreviations:["SWOMB"],card:"Shifting Winds of the Mystic Beast"},{abbreviations:["Snaps"],card:"Snapdragon Scalers"},{abbreviations:["SWK"],card:"Spinning Wheel Kick"},{abbreviations:["SFTL"],card:"Swing Fist, Think Later"},{abbreviations:["TTT"],card:"Take the Tempo"},{abbreviations:["Ultron"],card:"Teklovossen, the Mechropotent"},{abbreviations:["ToS"],card:"Test of Strength"},{abbreviations:["TAYG"],card:"That All You Got?"},{abbreviations:["TROM"],card:"This Round's on Me"},{abbreviations:["3oak"],card:"Three of a Kind"},{abbreviations:["Pox Malone","Post Malone"],card:"Virulent Touch"},{abbreviations:["Cast Homes"],card:"Visit Goldmane Estate"},{abbreviations:["Frosty Hammer"],card:"Winter's Wail"},{abbreviations:["Wreckless Wing"],card:"War Cry of Bellona"},{abbreviations:["ZTS"],card:"Zero to Sixty"}];var c=require("@flesh-and-blood/types");var R=require("@flesh-and-blood/types");var j={BannedFormats:"bannedFormats",LegalFormats:"legalFormats",LegalHeroes:"legalHeroes"},pe=Array.from(Array(50).keys()).map(e=>`${e}`),sr=[{format:R.Format.ClassicConstructed,nicknames:["cc","classic"]},{format:R.Format.LivingLegend,nicknames:["cc ll","classic constructed ll","ll cc","ll","living legend"]},{format:R.Format.SilverAge,nicknames:["sage"]},{format:R.Format.GoldenAge,nicknames:["gage"]},{format:R.Format.UltimatePitFight,nicknames:["upf"]}],or=Object.values(R.Format).map(e=>{let t=sr.find(({format:a})=>a===e),r=e.toLowerCase().replaceAll(P,"");return t?{...t,format:r}:{format:r}}),nr=[{hero:R.Hero.DataDoll,nicknames:["data","datadoll"]},{hero:R.Hero.Dorinthea,nicknames:["dori"]},{hero:R.Hero.Genis,nicknames:["genis"]},{hero:R.Hero.GravyBones,nicknames:["gravy"]},{hero:R.Hero.Iyslander,nicknames:["islander"]}],lr=Object.values(R.Hero).map(e=>{let t=nr.find(({hero:a})=>a===e),r=e.toLowerCase().replaceAll(P,"");return t?{...t,hero:r}:{hero:r}}),gt=["common","rare","super rare","majestic","legendary","fabled"],dr=({modifier:e,value:t})=>{let r=[],a=e==="<"||e==="<=",i=e===">="||e==="<=",s=a?[...gt].reverse():gt,o=!1;for(let n of s)o?r.push(n):n===t&&(o=!0,i&&r.push(n));return r},cr=(e,t)=>{let r=[];for(let a of e)a.modifier?r.push(...dr(a)):r.push(a.value);return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOr:!0,values:r}},ft=(e,t,r,a)=>{let i=r.map(d=>({hero:d.toLowerCase().replaceAll(P,"")})),s=[],o=[],n=[],p=[];for(let{value:d}of e){let u=or.find(({format:y,nicknames:h})=>y===d||!!h&&h.includes(d));if(u)o.push(u.format);else{let y=lr.find(({hero:h,nicknames:v})=>h===d||!!v&&v.includes(d))||i.find(({hero:h})=>h===d);y?n.push(y.hero):p.push(d)}}return o.length>0&&s.push({filterToPropertyMapping:{property:a,isArray:!0},values:o,isOr:!0,isExcluded:t}),n.length>0&&s.push({filterToPropertyMapping:{property:j.LegalHeroes,isArray:!0},values:n,isOr:!0,isExcluded:t}),{appliedFilters:s,unresolvedValues:p}},Z=(e,t,{additionalHeroes:r=[],isExcluded:a=!1}={})=>{let i=J(e),s={appliedFilters:[],unresolvedValues:[]};return i===l.Legal?s=ft(t,a,r,j.LegalFormats):i===l.Banned?s=ft(t,a,r,j.BannedFormats):i===l.Rarity&&(s={appliedFilters:[cr(t,a)],unresolvedValues:[]}),s},pr=(e,t,r,a,i,s)=>Z(r,a.map(o=>({modifier:i,value:o})),{additionalHeroes:s,isExcluded:e}).appliedFilters,ur=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"specialCost",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]}],gr=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"specialDefense",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["hero","placeholder","token","weapon"]}],fr=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],yr=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:pe},{filterToPropertyMapping:{property:"specialPower",isString:!0,partialMatch:!0},isExcluded:!0,values:["*","x"]},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token"]}],hr=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(R.Talent).map(e=>e.toLowerCase())}],Cr=[{category:l.Cost,filters:ur},{category:l.Defense,filters:gr},{category:l.Pitch,filters:fr},{category:l.Power,filters:yr},{category:l.Talent,filters:hr}],mr=()=>{let e=new Map;for(let{category:t,filters:r}of Cr)for(let a of z[t])for(let i of H)e.set(`${i}${a}`,r);return e},br=mr(),ke=e=>{let t=[],r=br.get(e);return r&&t.push(...r),t};var K=require("@flesh-and-blood/types");var yt=new WeakMap,Q=Object.freeze([]),Fr=Number.MAX_SAFE_INTEGER,ht=(e,t)=>{let r=new Map;for(let a of e)for(let i of t(a)||[]){let s=r.get(i);s?s.push(a):r.set(i,[a])}return r},vr=e=>{let t=new Map;for(let r of e){let a=r.types.includes(K.Type.Hero)&&!r.isCardBack,i=a?K.CardRole.Hero:(0,K.getCardRole)(r);if(a||i!==K.CardRole.Hero){let o=t.get(i);o?o.push(r):t.set(i,[r])}}return t},Tr=e=>{let t,r,a,i,s,o=()=>{if(!t){let g=new Map,f=new Map,C=[],T=new Map,M=0;for(let S of e){g.set(S.cardIdentifier,S),f.set(S.cardIdentifier,M),M++;let k=G(S.name),U=T.get(k);U?U.push(S):(T.set(k,[S]),C.push(k))}t={cardByCardIdentifier:g,corpusPositionByCardIdentifier:f,cleanedNames:C,pitchCycleByCleanedName:T}}return t},n=g=>{let{corpusPositionByCardIdentifier:f}=o(),C=({cardIdentifier:T})=>f.get(T)??Fr;return[...g].sort((T,M)=>C(T)-C(M))},p=g=>o().cardByCardIdentifier.get(g),d=g=>{let{cardByCardIdentifier:f}=o(),C=[];for(let T of g||[]){let M=f.get(T);M&&C.push(M)}return n(C)},u=g=>{let f=new Map;return C=>{let T=f.get(C);if(!T){let M=p(C),S=d(M&&g(M)),k=S.length>0;T=k?S:Q,k&&f.set(C,T)}return T}},y=g=>{let{pitchCycleByCleanedName:f}=o(),C=p(g);return C?f.get(G(C.name))??Q:Q},h=g=>{let{cleanedNames:f,pitchCycleByCleanedName:C}=o(),T=G(g),M=C.get(T);if(!M&&T.length>0){let k=f.find(U=>U.includes(T));k&&(M=C.get(k))}return M??Q},v=g=>{let{pitchCycleByCleanedName:f}=o();return f.get(G(g))??Q},I=()=>{if(!s){let g=new Set;for(let f of e)for(let C of f.artists)g.add(C);s=[...g].sort((f,C)=>f.localeCompare(C,"en",{sensitivity:"base"}))}return s},V=u(({oppositeSideCardIdentifiers:g})=>g),A=u(({referencedCards:g})=>g),E=g=>(r||(r=ht(e,({referencedCards:f})=>f)),r.get(g)??Q),L=u(({createdExtras:g})=>g);return{cards:e,getCard:p,getPitchCycle:y,getCardsByName:h,getCardsByExactName:v,getArtists:I,getOppositeSide:V,getReferences:A,getReferencedBy:E,getCreates:L,getCreatedBy:g=>(a||(a=ht(e,({createdExtras:f})=>f)),a.get(g)??Q),getCreatedClosure:g=>{let f=new Map,C=new Set,T=[...g];for(let M of T)if(!C.has(M)){C.add(M);for(let k of L(M))f.set(k.cardIdentifier,k),T.push(k.cardIdentifier)}return n([...f.values()])},getByRole:g=>(i||(i=vr(e)),i.get(g)??Q),getCardsInCorpusOrder:n}},we=e=>{let t=yt.get(e);return t||(t=Tr(e),yt.set(e,t)),t},Ve=(e,t)=>e.getPitchCycle(t.cardIdentifier),ue=(e,t)=>e.getCardsByName(t),Ct=(e,t)=>{let r=new Map;for(let a of t)for(let i of Ve(e,a))r.set(i.cardIdentifier,i);return e.getCardsInCorpusOrder([...r.values()])},ge=(e,t)=>{let r=[];for(let a of Ve(e,t))r.push(...e.getReferencedBy(a.cardIdentifier));return Ct(e,r)},fe=(e,t)=>{let r=[];for(let a of Ve(e,t))r.push(...e.getReferences(a.cardIdentifier));return Ct(e,r)};var Mr=e=>{let[t]=e,r=t?.modifier;return e.every(({modifier:i})=>i===r)?r:void 0},Ie=({filterValues:e,isAnd:t,isExcluded:r,mapping:a})=>{let i=[];for(let{value:s}of e)i.push(a.hasMarkup?W(s):s);return{filterToPropertyMapping:a,filterValues:e,isAnd:t,isExcluded:r,isOr:!t&&i.length>1,modifier:Mr(e),values:i}},vt=({isAnd:e,isExcluded:t,mapping:r},a)=>({filterToPropertyMapping:r,isAnd:e,isExcluded:t,isOr:!e&&a.length>1,values:a}),xr=({category:e,filterValues:t,mapping:r})=>{let a=[];if(r.kind===m.ExactMatch&&!!r.vocabulary)for(let{value:s}of t)Pe(e,s)||a.push(s);return a},Ar=e=>({appliedFilters:[Ie(e)],unresolvedValues:xr(e)}),Be=({isExcluded:e},t,r)=>e?void 0:{[t]:r},Tt=(e,t)=>({appliedFilters:[Ie(e)],attributes:Be(e,t,e.filterValues.map(({value:r})=>r)),unresolvedValues:[]}),Pr=e=>Tt(e,"artists"),Sr=e=>Tt(e,"prints"),Ne=(e,t,r)=>{let a=[],i=[],s=[];for(let{value:o}of e.filterValues){let n=r(o);if(n.length>0)for(let p of n)a.push(p),i.push(w(p));else s.push(o)}return{appliedFilters:[vt(e,i)],attributes:Be(e,t,a),canonicalValues:i,unresolvedValues:s}},Rr=new Map(Object.entries({purple:4,blue:3,yellow:2,red:1,white:0})),kr=e=>{let t=[],r=[];for(let{modifier:a,value:i}of e.filterValues){let s=Rr.get(i),o=s===void 0?i:`${s}`;t.push({modifier:a,value:o}),r.push(o)}return{appliedFilters:[Ie({...e,filterValues:t})],canonicalValues:r,unresolvedValues:[]}},Ee=new Map;for(let e of Object.values(c.Release)){let t=w(e),r=Ee.get(t);if(r===void 0)Ee.set(t,e);else throw new Error(`${r} and ${e} are one name as a filter reads it, so a set filter naming it could reach either`)}var mt=(e,t)=>{let r=e.get(t);return r?[r]:[]},wr=(e,t)=>{let r=[()=>mt(Ee,e),()=>mt(c.setIdentifierToSetMappings,e),()=>Object.values(c.Release).filter(i=>i.toLowerCase().includes(e)),()=>{let i=t.find(s=>w(s)===e);return i?[i]:[]}],a=[];for(let i of r)a.length===0&&a.push(...i());return a},Vr=(e,{additionalSets:t})=>Ne(e,"releases",r=>wr(r,t)),Er=new Map(Object.entries({r:c.Foiling.Rainbow,rf:c.Foiling.Rainbow,rainbow:c.Foiling.Rainbow,c:c.Foiling.Cold,cf:c.Foiling.Cold,cold:c.Foiling.Cold,g:c.Foiling.Gold,gf:c.Foiling.Gold,gold:c.Foiling.Gold})),Ir=e=>{let t=Er.get(e);return t?[t]:[]},Br=e=>Ne(e,"foilings",Ir),Mt=new Map(Object.entries({aa:c.Treatment.AA,alt:c.Treatment.AA,"alt art":c.Treatment.AA,ab:c.Treatment.AB,"alt border":c.Treatment.AB,at:c.Treatment.AT,"alt text":c.Treatment.AT,ea:c.Treatment.EA,extended:c.Treatment.EA,"extended art":c.Treatment.EA,fa:c.Treatment.FA,full:c.Treatment.FA,"full art":c.Treatment.FA}));for(let e of Object.values(c.Treatment))Mt.set(e.toLowerCase(),e);var Nr=new Map(Object.entries(c.Treatment)),Lr=e=>{let t=Mt.get(e)||Nr.get(e.toUpperCase());return t?[t]:[]},Or=e=>Ne(e,"treatments",Lr),Le=new Map(Object.entries({b:c.Rarity.Basic,c:c.Rarity.Common,f:c.Rarity.Fabled,l:c.Rarity.Legendary,m:c.Rarity.Majestic,p:c.Rarity.Promo,r:c.Rarity.Rare,s:c.Rarity.SuperRare,t:c.Rarity.Token,v:c.Rarity.Marvel})),Dr=e=>Le.get(e)||Object.values(c.Rarity).find(t=>t.toLowerCase()===e),Hr=(e,{additionalHeroes:t})=>{let r=[],a=[],i=[],s=[];for(let{modifier:n,value:p}of e.filterValues){let d=Dr(p);d?(r.push(d),a.push(d.toLowerCase()),i.push({modifier:n,value:d.toLowerCase()})):(s.push(p),i.push({modifier:n,value:p}))}let{appliedFilters:o}=Z(e.key,i,{additionalHeroes:t,isExcluded:e.isExcluded});return{appliedFilters:o,attributes:Be(e,"rarities",r),canonicalValues:a,unresolvedValues:s}},bt=({filterValues:e,isExcluded:t,key:r},{additionalHeroes:a})=>{let{appliedFilters:i,unresolvedValues:s}=Z(r,e,{additionalHeroes:a,isExcluded:t}),o=[];for(let{values:n}of i)o.push(...n);return{appliedFilters:i,canonicalValues:o,unresolvedValues:s}},Qr=["unique"],jr=["preview","spoiler","unreleased"],Kr=["released"],Ft={property:"firstReleaseDate",isDate:!0},Ur=new Map(Object.entries({dual:c.Meta.DualClass,exp:c.Meta.Expansion,expansion:c.Meta.Expansion,rainbow:c.Meta.Rainbow,reprint:c.Meta.Reprint,reprints:c.Meta.Reprint})),Gr=e=>{let t=[],r=[];for(let i of e){let s=Ur.get(i);s?t.push(s):r.push(i)}let a=[];if(t.length===0){let i=new Set;for(let s of Object.values(c.Meta)){let o=!1;for(let n of r)s.toLowerCase().includes(n)&&(o=!0,i.add(n));o&&t.push(s)}for(let s of r)i.has(s)||a.push(s)}else a.push(...r);return{unresolvedValues:a,values:t}},Wr=(e,{today:t})=>{let{filterValues:r,isAnd:a,isExcluded:i}=e,s=[],o=[],n=[],p=[],d=[];for(let{value:A}of r)Qr.includes(A)?o.push(A):jr.includes(A)?n.push(A):Kr.includes(A)?p.push(A):d.push(A);let u=!a&&r.length>1;o.length>0&&s.push({filterToPropertyMapping:$.is,values:[w(c.Meta.Reprint)],isAnd:a,isOr:u,isExcluded:!i}),n.length>0&&s.push({filterToPropertyMapping:Ft,values:[t],isAnd:a,isOr:u,isExcluded:i}),p.length>0&&s.push({filterToPropertyMapping:Ft,values:[t],isAnd:a,isOr:u,isExcluded:!i});let{unresolvedValues:y,values:h}=Gr(d),v=[...o,...n,...p,...h.map(w)];(d.length>0||s.length===0)&&s.push(vt(e,h.map(w)));let V=h.includes(c.Meta.Expansion)&&!i;return{appliedFilters:s,attributes:V?{isExpansionSlot:V}:void 0,canonicalValues:v,unresolvedValues:y}},_r={property:"cardIdentifier",isString:!0,isNormalized:!0},$r=20,zr=(e,t)=>{let r=new Set,a=[],i=new Set,s=[],o=d=>{r.add(d.cardIdentifier),i.has(d.name)||(i.add(d.name),a.push(d))},n=d=>{d.types.includes(c.Type.Hero)||o(d)};for(let d of t){let u=ue(e,d);for(let y of u)o(y);u.length===0&&s.push(d)}let p=0;for(;p<a.length&&p<=$r;){let d=a[p];for(let y of fe(e,d))n(y);if(p===0)for(let y of ge(e,d))n(y);p++}return{cardIdentifiers:r,unresolvedValues:s}},xt=(e,t,r)=>{let a=new Set;for(let i of ue(e,t)){let s=r?fe(e,i):ge(e,i);for(let o of s)a.add(o.cardIdentifier)}return a},Yr=(e,t)=>{let r=new Set,[a=new Set,...i]=e;if(t)for(let s of a)i.every(n=>n.has(s))&&r.add(s);else for(let s of e)for(let o of s)r.add(o);return r},At=(e,t)=>({filterToPropertyMapping:_r,values:[...e],valuesSet:e,isExcluded:t,isOr:!0}),Pt=({filterValues:e,isAnd:t,isExcluded:r},a)=>{let i=[],s=[];for(let{value:o}of e){let n=a(o);i.push(n),n.size===0&&s.push(o)}return{appliedFilters:[At(Yr(i,t),r)],unresolvedValues:s}},qr=(e,{index:t})=>{let{cardIdentifiers:r,unresolvedValues:a}=zr(t,e.filterValues.map(({value:i})=>i));return{appliedFilters:[At(r,e.isExcluded)],unresolvedValues:a}},Xr=(e,{index:t})=>Pt(e,r=>xt(t,r,!0)),Jr=(e,{index:t})=>Pt(e,r=>xt(t,r,!1)),Zr=new Map([[l.Artist,Pr],[l.Banned,bt],[l.Chain,qr],[l.Foiling,Br],[l.Is,Wr],[l.Legal,bt],[l.Pitch,kr],[l.Print,Sr],[l.Rarity,Hr],[l.ReferencedBy,Xr],[l.References,Jr],[l.Set,Vr],[l.Treatment,Or]]),St=(e,t)=>(Zr.get(e.category)||Ar)(e,t);var kt=H.map(_).join(""),ea=/(?:[^\s"]+|"[^"]*(?:"|$))+/g,ta=new RegExp(`^([${kt}])?([A-Za-z]+):(.+)$`),ra=new RegExp(`^([${kt}])?([A-Za-z]+):$`),aa=",",Rt="+",ia='"',wt=e=>{let t=[],r=!1,a="",i=!1;for(let s of e)s===ia?(i=!i,a+=s):!i&&(s===aa||s===Rt)?(r=r||s===Rt,a&&t.push(a),a=""):a+=s;return a&&t.push(a),{isAndList:r,parts:t}},ye=e=>{let t=[];for(let r of e.matchAll(ea))t.push({end:r.index+r[0].length,start:r.index,token:r[0]});return t},sa=e=>H.some(t=>e.startsWith(t)),he=e=>{let t=e.match(ta),r;if(t){let[,a,i,s]=t;r={isAndList:wt(s).isAndList,isExcluded:!!a,key:i,valueText:s}}return r},De=e=>{let t=e.match(ra),r;return t&&(r={isAndList:!1,isExcluded:!!t[1],key:t[2],valueText:""}),r},He=e=>{let t=e.trim(),r=Ae.find(a=>t.startsWith(a));return{modifier:r,value:r?t.slice(r.length).trim():t}},Oe=e=>J(e)??e.toLowerCase(),oa=(e,t)=>{let r=Oe(t),a=[];for(let{end:i,start:s,token:o}of ye(e)){let n=he(o);n&&Oe(n.key)===r&&a.push({...n,end:i,start:s,token:o})}return a},Vt=e=>wt(e).parts,Ce=e=>e.replace(/^"|"$/g,""),Qe=e=>{let t=[];for(let r of Vt(e)){let a=Ce(r);a&&t.push(a)}return t},na=/[\s,:+"]/,la=e=>{let t=e.replaceAll('"',"");return na.test(e)?`"${t}"`:t};var N=require("@flesh-and-blood/types"),je=[{description:"Attack actions",expanded:["st:attack"],filters:{subtypes:[N.Subtype.Attack]},isCardProperty:!1,shorthands:["AA"]},{description:"Arcane barrier",expanded:['k:"arcane barrier"'],filters:{keywords:[N.Keyword.ArcaneBarrier]},isCardProperty:!1,shorthands:["AB"]},{description:"Attack reactions",expanded:['t:"attack reaction"'],filters:{types:[N.Type.AttackReaction]},isCardProperty:!1,shorthands:["AR"]},{description:"Defense reactions",expanded:['t:"defense reaction"'],filters:{types:[N.Type.DefenseReaction]},isCardProperty:!1,shorthands:["DR"]},{description:"Gain life",expanded:["gain {h}"],filters:{functionalText:"gain {h}"},isCardProperty:!1,shorthands:["Gain life","Gains life"]},{description:"Go again",expanded:['k:"go again"'],filters:{keywords:[N.Keyword.GoAgain]},isCardProperty:!1,shorthands:["GA"]},{description:"Non-attack actions",expanded:["t:action","st:non-attack"],filters:{subtypes:[N.Subtype.NonAttack],types:[N.Type.Action]},isCardProperty:!1,shorthands:["NAA"]},{description:"Plus defense",expanded:["+ {d}"],filters:{functionalText:"+ {d}"},isCardProperty:!1,shorthands:["Pump defense","Pumps defense","Buff defense","Buffs defense"]},{description:"Spellvoid",expanded:['k:"spellvoid"'],filters:{keywords:[N.Keyword.Spellvoid]},isCardProperty:!1,shorthands:["SV"]}],Ke=je.filter(({shorthands:e})=>e.some(t=>t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)})),Ue=je.filter(({shorthands:e})=>e.some(t=>!t.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(t=>!t.includes(" ")).map(t=>t.toLowerCase()).sort((t,r)=>r.length-t.length)}));var da=["\u201C","\u201D"],ca=[{text:ee.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:ee.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(P,"")}],Ge=new Map([...ee.setToSetIdentifierMappings].map(([e,t])=>[e.toLowerCase(),t])),pa=[...z[l.Set],...z[l.Print]],ua=H.map(_).join(""),ga=[...Ge.keys()].sort((e,t)=>t.length-e.length).map(_).join("|"),fa=new RegExp(`(?<=^|\\s)([${ua}]?(?:${pa.join("|")}):(?:[^\\s]*[,+])?"?)(${ga})(?="?(?:[,+]|\\s|$))`,"g"),ya=(e,t)=>{let r=e.trim().toLowerCase();for(let s of da)r=r.replaceAll(s,'"');for(let{expanded:s,shorthands:o}of Ke)for(let n of o)if(r.includes(n)){r=r.replace(n,s.join(" "));break}r=r.replace(fa,(s,o,n)=>{let p=Ge.get(n);return p?`${o}${p[0]}`:s});let a=Ge.get(r),i=t.getCardsByExactName(r).length>0;a&&!i&&(r=`set:${a[0]}`);for(let{override:s,text:o}of ca)r.includes(o)&&(r=r.replace(o,s));return{isWholeQueryAbbreviation:!!ce(r)?.card,text:r}},ha=e=>{let t=Ue.find(({shorthands:a})=>a.includes(e)),r=!!t&&!t.isCardProperty;return{isExpanded:r,tokens:r?t.expanded:[e]}},Ca=({isWholeQueryAbbreviation:e,text:t})=>{let r=[],a=e?[{end:t.length,start:0,token:t}]:ye(t);for(let{end:i,start:s,token:o}of a){let{isExpanded:n,tokens:p}=ha(o);for(let d of p)r.push({end:i,isExpanded:n,start:s,token:d})}return r},ma=e=>{let t=[];for(let r of e){let{modifier:a,value:i}=He(r),s=w(i);s&&t.push({modifier:a,value:s})}return t},ba=(e,t,r)=>{let a={key:e,reason:"value",values:r},i=Se(t,r);return i&&(a.suggestedKey=i),a},Fa=()=>{let e=new Date,t=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${t}-${r}`},te=(e,t,{additionalHeroes:r=[],additionalSets:a=[],today:i=Fa()}={})=>{let s=ya(e,t),o={additionalHeroes:r,additionalSets:a,index:t,today:i},n=[],p={artists:[],foilings:[],isExpansionSlot:!1,prints:[],rarities:[],releases:[],treatments:[]},d=[],u=[],y=[];for(let h of Ca(s)){let v=he(h.token)||De(h.token);if(v){let{isAndList:I,isExcluded:V,key:A,valueText:E}=v,L=de(A),O=L?.category,F=Qe(E),B=ma(F),g={...h,canonicalValues:B.map(({value:f})=>f),category:O,filterValues:B,isAnd:I,isExcluded:V,isFilter:!0,isResolved:!0,key:A};if(F.length>0)if(L&&O){let f=F;if(B.length>0){let C=St({category:O,filterValues:B,isAnd:g.isAnd,isExcluded:V,key:A,mapping:L},o);n.push(...C.appliedFilters),C.canonicalValues&&(g.canonicalValues=C.canonicalValues),C.attributes&&Object.assign(p,C.attributes),f=C.unresolvedValues}f.length>0&&(g.isResolved=!1,y.push(ba(A,O,f)))}else g.isResolved=!1,y.push({key:A,reason:"key",values:[]});u.push(g)}else{let{end:I,start:V,token:A}=h;u.push({end:I,isFilter:!1,start:V,token:A});let E=Ce(h.token),L=ce(E)?.card,O=ke(E);L?d.push(`"${L.toLowerCase().replace(P,"")}"`):O.length>0?n.push(...O):E&&d.push(E.replace(P,""))}}return{appliedFilters:n,attributes:p,keywords:d,nodes:u,text:s.text,unresolvedFilters:y}};var x=require("@flesh-and-blood/types"),Et={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[x.Class.Generic],defaultImage:"FNG000",firstReleaseDate:"2022-06-02",functionalText:"If Fangs A Lot is put into your banished zone from your graveyard, instead put it into your hand.",legalFormats:[],legalHeroes:[x.Hero.Kayo,x.Hero.Levia,x.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:x.Rarity.Rare,set:x.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${x.Treatment.FA}`,rarity:x.Rarity.Marvel,set:x.Release.Promos,treatment:x.Treatment.FA}],name:"Fangs A Lot",rarities:[x.Rarity.Rare,x.Rarity.Marvel],rarity:x.Rarity.Rare,sets:[x.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[x.Subtype.Attack],types:[x.Type.Action],typeText:"Generic Action - Attack"},It=[{keyword:Et.name.toLowerCase(),card:Et}];var va={getFn:(e,t)=>{let r=_e.default.config.getFn(e,t),a=r;if(Array.isArray(r))a=r.map(i=>q(i.replace(P,"")));else if(r){let i=q(r).replace(P,"");a=t.includes("functionalText")?W(i):i}return a},ignoreLocation:!0,includeScore:!0,keys:[{name:"name",weight:10},{name:"functionalText",weight:6},{name:"shorthands",weight:4},{name:"setIdentifiers",weight:2},{name:"traits",weight:4},{name:"typeText",weight:6}],threshold:.15,useExtendedSearch:!0},We=class{constructor(t,r=[],a=[],i=!1){this.getFuse=()=>(this.fuse||(this.fuse=new _e.default(this.cards,va)),this.fuse);this.log=(t,...r)=>{this.debug&&console.log(t,...r)};this.search=(t,r)=>{let a,{appliedFilters:i,attributes:s,keywords:o,unresolvedFilters:n}=te(t,this.index,{additionalHeroes:this.additionalHeroes,additionalSets:this.additionalSets}),p=o.join(" "),d=r?It.filter(F=>F.keyword===p):[];if(d.length>0?a=d.map(({card:F})=>F):o.length?a=this.getFuse().search(p).map(F=>F.item):a=[...this.cards],i.length&&(a=a.filter(F=>F&&Lt(F,i))),o.length===0){let F="";if(s.releases.length===1){let f=me.setToSetIdentifierMappings.get(s.releases[0]);f?.length&&(F=f[0].toUpperCase())}if(!F&&s.prints.length===1){let f=s.prints[0];me.setIdentifierToSetMappings.has(f)&&(F=f.toUpperCase())}F?a.sort((f,C)=>{let T=f.setIdentifiers.find(S=>S.includes(F))?.replace(F,""),M=C.setIdentifiers.find(S=>S.includes(F))?.replace(F,"");return T&&M?T.localeCompare(M):-1}):a.sort((f,C)=>f.name===C.name?`${f.pitch}`.localeCompare(`${C.pitch}`):f.name.localeCompare(C.name))}else{let F=[],B=[],g=o.map(f=>f.toLowerCase().replace(P,"")).join(" ");for(let f of a)f.name.toLowerCase().replace(P,"")===g?F.push(f):B.push(f);a=[...F,...B]}let u=[],{artists:y,isExpansionSlot:h,foilings:v,prints:I,rarities:V,releases:A,treatments:E}=s;(y.length>0||h||v.length>0||I.length>0||V.length>0||A.length>0||E.length>0)&&(u=a.map(F=>{let B=F.printings.filter(g=>{let f=!!g.image,C=y.length===0||y.some(Y=>g.artists.find(Dt=>Dt.replace(P,"").toLowerCase().includes(Y))),T=!h||h===g.isExpansionSlot,M=v.length===0||!!g.foiling&&v.includes(g.foiling),S=I.length===0||I.some(Y=>g.identifier.includes(Y.toUpperCase())),k=V.length===0||V.includes(g.rarity),U=A.length===0||A.includes(g.set),Ot=E.length===0||g.treatments?.some(Y=>E.includes(Y));return f&&C&&T&&M&&S&&k&&U&&Ot});return{...F,matchingPrintings:B}}));let O=u.length>0?u:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:O,unresolvedFilters:n}};let s=Array.isArray(r)?{additionalHeroes:r,additionalSets:a,debug:i}:r;this.additionalHeroes=s.additionalHeroes||[],this.additionalSets=s.additionalSets||[],this.cards=[...t],this.debug=s.debug||!1,this.index=s.index||we(t)}},Nt=We,Lt=(e,t)=>{let r=!0;for(let a of t){let{isNumber:i,isString:s,isArray:o,isBoolean:n,isDate:p}=a.filterToPropertyMapping;a.isOptional||(i?r=r&&Ta(e,a):s?r=r&&Ma(e,a):o?r=r&&xa(e,a,t):n?r=r&&Aa(e,a):p&&(r=r&&Pa(e,a)))}return r},Bt=(e,t,r)=>{let a=parseInt(t),i;switch(r){case">=":i=e>=a;break;case">":i=e>a;break;case"<=":i=e<=a;break;case"<":i=e<a;break;default:i=e===a}return i},Ta=(e,t)=>{let{filterValues:r,values:a,modifier:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=t,n=!0;if(ae(t,e)){let p=re(e,t),d;if(p!=null&&!isNaN(p)){let u=parseInt(p);d=r?r.some(({modifier:y,value:h})=>Bt(u,h,y)):a.some(y=>Bt(u,y,i))}else{let u=Ra(e,t)?.toLowerCase();d=o?a.some(y=>!!u?.includes(y)):a.some(y=>u===y)}n=s?!d:d}return n},Ma=(e,t)=>{if(ae(t,e)){let{values:r,valuesSet:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{hasMarkup:o,isNormalized:n,partialMatch:p}}=t,d=re(e,t),u=n?d:d?.replaceAll(P,"").toLowerCase(),y=o&&u?W(u):u;if(p){let h=i?r?.every(v=>y?.includes(v)):r?.some(v=>y?.includes(v));return s?!h:h}else{let h;return i?h=r?.every(v=>y===v):a?h=a.has(y):h=r?.some(v=>y===v),s?!h:h}}else return!0},xa=(e,t,r)=>{if(ae(t,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=t,n=Sa(e,t,r).map(p=>p?.replaceAll(P,""));if(o){let p=i?a.every(u=>n?.some(y=>y?.toLowerCase().includes(u))):a.some(u=>n?.some(y=>y?.toLowerCase().includes(u))),d=n.length===0;return s?!p||d:p}else{let p=i?a.every(d=>n?.some(u=>u?.toLowerCase()===d)):a.some(d=>n?.some(u=>u?.toLowerCase()===d));return s?!p:p}}else return!0},Aa=(e,t)=>{if(ae(t,e)){let{isExcluded:r}=t,a=re(e,t);return r?!a:a}else return!0},Pa=(e,t)=>{if(ae(t,e)){let{values:r,isExcluded:a}=t,i=re(e,t),s=r?.some(o=>i>o);return a?!s:s}else return!0},re=(e,t)=>{let{filterToPropertyMapping:{property:r}}=t,a;return r!==D&&(a=e[r]),a},Sa=(e,t,r)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i}}=t,s=[],o=Object.keys(e.legalOverrides||{}).length>0,n=t.filterToPropertyMapping.property===j.LegalHeroes,p=r.find(({filterToPropertyMapping:u})=>u.property===j.LegalFormats);if(o&&n&&!!p){let u=new Set;for(let{format:y,heroes:h}of e.legalOverrides||[])if(p.values.includes(y.toLowerCase()))for(let v of h)u.add(v);s=Array.from(u)}if(s.length===0)if(i){let u=new Set;for(let y of e.printings){let h=y[i];if(a){if(Array.isArray(h))for(let v of h)u.add(v)}else h&&typeof h=="string"&&u.add(h)}s=Array.from(u)}else{let u=re(e,t);if(Array.isArray(u))for(let y of u)typeof y=="string"&&s.push(y)}return s},Ra=(e,t)=>{let{filterToPropertyMapping:{specialProperty:r}}=t,a;return r&&(a=e[r]),a},ae=({cardTypes:e},{types:t,subtypes:r})=>!e||e?.some(a=>t.map(i=>i.toLowerCase()).includes(a.toLowerCase())||r.map(i=>i.toLowerCase()).includes(a.toLowerCase()));var ka=(e,t,r=[],a=[],i)=>{let{appliedFilters:s,attributes:o,keywords:n}=te(e,t,{additionalHeroes:r,additionalSets:a,today:i});return{appliedFilters:s,attributes:o,keywords:n}};var wa=(e,t)=>{let r=[];if(e)for(let a of t){let i=a.name===e.name,s=a.cardIdentifier!==e.cardIdentifier,o=a.pitch!==e.pitch;i&&s&&o&&r.push(a)}return r},Va=(e,t)=>{let r=new Set(e?.referencedCards),a=[];for(let i of t)r.has(i.cardIdentifier)&&a.push(i);return a},Ea=e=>{let t=new Map;for(let r of e)for(let a of r.referencedCards||[]){let i=t.get(a);i?i.push(r):t.set(a,[r])}return t},Ia=(e,t)=>{let r=new Set;for(let i of e)for(let s of i.createdExtras||[])r.add(s);let a=[];for(let i of t)r.has(i.cardIdentifier)&&a.push(i);return a};0&&(module.exports={FilterCategory,FilterKind,FilterProperty,MARKUP,NO_CARD_PROPERTY,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,aliasesByFilterCategory,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getAbbreviation,getAbbreviationByCard,getCardsByName,getCardsByReferencedCardIdentifier,getCardsReferencedBy,getCardsReferencing,getCatalogueIndex,getCleanText,getEscapedForRegExp,getExcludedMetaFilters,getFilterCategory,getFilterMapping,getFilterTokenSpansForKey,getFilterValue,getIncompleteFilterToken,getIsExcludedToken,getIsValueInFilterVocabulary,getKeywordsAndAppliedFiltersFromText,getMetaFilterResolution,getMetaFilters,getNormalizedFilterValue,getNormalizedText,getOtherPitches,getParsedQuery,getQueryFilterToken,getQueryTokenSpans,getQuotedValue,getReferencedCards,getResolvedFilterKey,getSuggestedFilterKey,getTextWithoutMarkup,getTokensReferencedByCards,getUnquotedValue,getValuePartsFromFilterValue,getValuesFromFilterValue,multiWordShorthands,shorthands,singleWordShorthands});
|
package/dist/metaFilters.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Format, Hero, Talent } from "@flesh-and-blood/types";
|
|
2
2
|
import { PUNCTUATION } from "./constants.js";
|
|
3
|
-
import { getLookupWithoutInheritedKeys } from "./lookups.js";
|
|
4
3
|
import {
|
|
5
4
|
aliasesByFilterCategory,
|
|
6
5
|
availableExclusions,
|
|
@@ -338,11 +337,11 @@ const filtersByExcludedCategory = [
|
|
|
338
337
|
{ category: FilterCategory.Talent, filters: noTalents }
|
|
339
338
|
];
|
|
340
339
|
const getExcludedFilters = () => {
|
|
341
|
-
const filtersByKey =
|
|
340
|
+
const filtersByKey = /* @__PURE__ */ new Map();
|
|
342
341
|
for (const { category, filters } of filtersByExcludedCategory) {
|
|
343
342
|
for (const alias of aliasesByFilterCategory[category]) {
|
|
344
343
|
for (const exclusion of availableExclusions) {
|
|
345
|
-
filtersByKey
|
|
344
|
+
filtersByKey.set(`${exclusion}${alias}`, filters);
|
|
346
345
|
}
|
|
347
346
|
}
|
|
348
347
|
}
|
|
@@ -351,7 +350,7 @@ const getExcludedFilters = () => {
|
|
|
351
350
|
const excludedFilters = getExcludedFilters();
|
|
352
351
|
const getExcludedMetaFilters = (filterKey) => {
|
|
353
352
|
const filters = [];
|
|
354
|
-
const matchingFilters = excludedFilters
|
|
353
|
+
const matchingFilters = excludedFilters.get(filterKey);
|
|
355
354
|
if (matchingFilters) {
|
|
356
355
|
filters.push(...matchingFilters);
|
|
357
356
|
}
|
package/dist/queryParse.js
CHANGED
|
@@ -36,10 +36,12 @@ const punctuationOverrides = [
|
|
|
36
36
|
}
|
|
37
37
|
];
|
|
38
38
|
const setIdentifiersBySetName = new Map(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
[...setToSetIdentifierMappings].map(
|
|
40
|
+
([release, setIdentifiers]) => [
|
|
41
|
+
release.toLowerCase(),
|
|
42
|
+
setIdentifiers
|
|
43
|
+
]
|
|
44
|
+
)
|
|
43
45
|
);
|
|
44
46
|
const SET_FILTER_KEYS = [
|
|
45
47
|
...aliasesByFilterCategory[FilterCategory.Set],
|
package/dist/search.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setIdentifierToSetMappings,
|
|
3
|
+
setToSetIdentifierMappings
|
|
4
|
+
} from "@flesh-and-blood/types";
|
|
1
5
|
import Fuse from "fuse.js";
|
|
2
6
|
import { PUNCTUATION } from "./constants.js";
|
|
3
7
|
import {
|
|
@@ -8,7 +12,6 @@ import {
|
|
|
8
12
|
} from "./queryParse.js";
|
|
9
13
|
import { memes } from "./memes.js";
|
|
10
14
|
import { getNormalizedText, getTextWithoutMarkup } from "./helpers.js";
|
|
11
|
-
import { releasesBySetIdentifier, setIdentifiersByRelease } from "./lookups.js";
|
|
12
15
|
import { FilterProperty } from "./metaFilters.js";
|
|
13
16
|
import { getCatalogueIndex } from "./searchIndex.js";
|
|
14
17
|
const searchOptions = {
|
|
@@ -77,7 +80,9 @@ class Search {
|
|
|
77
80
|
let setIdentifierToSortBy = "";
|
|
78
81
|
const shouldSortByRelease = attributes.releases.length === 1;
|
|
79
82
|
if (shouldSortByRelease) {
|
|
80
|
-
const matchingSetIdentifiers =
|
|
83
|
+
const matchingSetIdentifiers = setToSetIdentifierMappings.get(
|
|
84
|
+
attributes.releases[0]
|
|
85
|
+
);
|
|
81
86
|
if (matchingSetIdentifiers?.length) {
|
|
82
87
|
setIdentifierToSortBy = matchingSetIdentifiers[0].toUpperCase();
|
|
83
88
|
}
|
|
@@ -85,7 +90,7 @@ class Search {
|
|
|
85
90
|
const shouldSortByPrint = !setIdentifierToSortBy && attributes.prints.length === 1;
|
|
86
91
|
if (shouldSortByPrint) {
|
|
87
92
|
const setToSort = attributes.prints[0];
|
|
88
|
-
if (
|
|
93
|
+
if (setIdentifierToSetMappings.has(setToSort)) {
|
|
89
94
|
setIdentifierToSortBy = setToSort.toUpperCase();
|
|
90
95
|
}
|
|
91
96
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesh-and-blood/search",
|
|
3
3
|
"description": "TypeScript search engine for Flesh and Blood cards",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.24",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@flesh-and-blood/types": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@flesh-and-blood/cards": "^5.0.
|
|
50
|
-
"@flesh-and-blood/types": "^5.0.
|
|
49
|
+
"@flesh-and-blood/cards": "^5.0.24",
|
|
50
|
+
"@flesh-and-blood/types": "^5.0.24",
|
|
51
51
|
"@types/jest": "^29.5.11",
|
|
52
52
|
"@types/node": "^20.10.5",
|
|
53
53
|
"esbuild": "^0.19.10",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"FAB",
|
|
78
78
|
"FABTCG"
|
|
79
79
|
],
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "fd15fc1aa7a56125a83334b0ef4c961cc5956658"
|
|
81
81
|
}
|
package/dist/lookups.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Release } from "@flesh-and-blood/types";
|
|
2
|
-
/**
|
|
3
|
-
* Copies a lookup table onto a null prototype so that a key can only ever match
|
|
4
|
-
* a real entry. Keys here come from raw search text, and a plain object literal
|
|
5
|
-
* answers `constructor`, `__proto__` and the rest of `Object.prototype` with an
|
|
6
|
-
* inherited member, handing the caller a function where it expects a value.
|
|
7
|
-
*
|
|
8
|
-
* Deliberately not re-exported from the package barrel: it guards an internal
|
|
9
|
-
* invariant rather than serving consumers.
|
|
10
|
-
*/
|
|
11
|
-
export declare const getLookupWithoutInheritedKeys: <T>(entries: {
|
|
12
|
-
[key: string]: T;
|
|
13
|
-
}) => {
|
|
14
|
-
[key: string]: T;
|
|
15
|
-
};
|
|
16
|
-
export declare const releasesBySetIdentifier: {
|
|
17
|
-
[key: string]: Release;
|
|
18
|
-
};
|
|
19
|
-
export declare const setIdentifiersByRelease: {
|
|
20
|
-
[key: string]: string[] | undefined;
|
|
21
|
-
};
|
package/dist/lookups.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
setIdentifierToSetMappings,
|
|
3
|
-
setToSetIdentifierMappings
|
|
4
|
-
} from "@flesh-and-blood/types";
|
|
5
|
-
const getLookupWithoutInheritedKeys = (entries) => Object.assign(/* @__PURE__ */ Object.create(null), entries);
|
|
6
|
-
const releasesBySetIdentifier = getLookupWithoutInheritedKeys(
|
|
7
|
-
setIdentifierToSetMappings
|
|
8
|
-
);
|
|
9
|
-
const setIdentifiersByRelease = getLookupWithoutInheritedKeys(setToSetIdentifierMappings);
|
|
10
|
-
export {
|
|
11
|
-
getLookupWithoutInheritedKeys,
|
|
12
|
-
releasesBySetIdentifier,
|
|
13
|
-
setIdentifiersByRelease
|
|
14
|
-
};
|