@flesh-and-blood/search 5.0.0 → 5.0.1
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/index.cjs +1 -1
- package/dist/searchIndex.d.ts +22 -16
- package/dist/searchIndex.js +33 -10
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var hr=Object.create;var Q=Object.defineProperty;var br=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var mr=Object.getPrototypeOf,Cr=Object.prototype.hasOwnProperty;var Mr=(e,r)=>{for(var t in r)Q(e,t,{get:r[t],enumerable:!0})},Re=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of yr(r))!Cr.call(e,i)&&i!==t&&Q(e,i,{get:()=>r[i],enumerable:!(a=br(r,i))||a.enumerable});return e};var Fr=(e,r,t)=>(t=e!=null?hr(mr(e)):{},Re(r||!e||!e.__esModule?Q(t,"default",{value:e,enumerable:!0}):t,e)),Sr=e=>Re(Q({},"__esModule",{value:!0}),e);var Tt={};Mr(Tt,{FilterProperty:()=>Le,MARKUP:()=>fe,PUNCTUATION:()=>y,RARITY_VALUES_MAPPING:()=>we,abbreviations:()=>ge,availableExclusions:()=>cr,availableModifiers:()=>dr,default:()=>fr,filterCard:()=>gr,filtersToCardPropertyMappings:()=>ke,getAbbreviation:()=>X,getAbbreviationByCard:()=>vr,getCardsByName:()=>ae,getCardsByReferencedCardIdentifier:()=>vt,getCardsReferencedBy:()=>se,getCardsReferencing:()=>ie,getCatalogueIndex:()=>Me,getCleanText:()=>_,getExcludedMetaFilters:()=>be,getKeywordsAndAppliedFiltersFromText:()=>Ie,getMetaFilters:()=>he,getNormalizedText:()=>$,getOtherPitches:()=>Ft,getReferencedCards:()=>St,getTextWithoutMarkup:()=>q,getTokensReferencedByCards:()=>At,multiWordShorthands:()=>me,shorthands:()=>ye,singleWordShorthands:()=>Ce});module.exports=Sr(Tt);var de=require("@flesh-and-blood/types"),Be=Fr(require("fuse.js"),1);var y=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g,fe=/\*/g;var l=require("@flesh-and-blood/types");var X=e=>ge.find(({abbreviations:r})=>r.find(t=>t.toLowerCase()===e)),vr=e=>ge.find(({card:r})=>r.toLowerCase()===e.name.toLowerCase()),ge=[{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 k=require("@flesh-and-blood/types");var Le=(a=>(a.BannedFormats="bannedFormats",a.LegalFormats="legalFormats",a.LegalHeroes="legalHeroes",a))(Le||{}),te=Array.from(Array(50).keys()).map(e=>`${e}`),Ar=[{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"]}],Tr=Object.values(k.Format).map(e=>{let r=Ar.find(({format:a})=>a===e),t=e.toLowerCase().replaceAll(y,"");return r?{...r,format:t}:{format:t}}),xr=[{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"]}],Pr=Object.values(k.Hero).map(e=>{let r=xr.find(({hero:a})=>a===e),t=e.toLowerCase().replaceAll(y,"");return r?{...r,hero:t}:{hero:t}}),Z=["common","rare","super rare","majestic","legendary","fabled"],wr=(e,r,t,a)=>{let i=[];if(!r)i.push(...e);else for(let s of e)switch(r){case">=":{let o=!1;for(let n of Z)o?i.push(n):n===s&&(o=!0,i.push(n));break}case">":{let o=!1;for(let n of Z)o?i.push(n):n===s&&(o=!0);break}case"<=":{let o=!1;for(let n of Z.slice().reverse())o?i.push(n):n===s&&(o=!0,i.push(n));break}case"<":{let o=!1;for(let n of Z.slice().reverse())o?i.push(n):n===s&&(o=!0);break}default:break}return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOptional:a,isOr:!0,values:i}},Ee=(e,r,t,a,i)=>{let s=a.map(h=>({hero:h.toLowerCase().replaceAll(y,"")})),o=[],n=[],c=[];for(let h of e){let g=Tr.find(({format:b,nicknames:C})=>b===h||!!C&&C.includes(h));if(g)n.push(g.format);else{let b=Pr.find(({hero:C,nicknames:A})=>C===h||!!A&&A.includes(h))||s.find(({hero:C})=>C===h);b&&c.push(b.hero)}}let F=i||"legalFormats";return n.length>0&&o.push({filterToPropertyMapping:{property:F,isArray:!0},values:n,isOr:!0,isExcluded:r,isOptional:t}),c.length>0&&o.push({filterToPropertyMapping:{property:"legalHeroes",isArray:!0},values:c,isOr:!0,isExcluded:r,isOptional:t}),o},kr=(e,r,t,a)=>Ee(e,r,t,a,"bannedFormats"),he=(e,r,t,a,i,s)=>{let o=[];return Br(t)?o.push(...Ee(a,e,r,s)):Lr(t)?o.push(...kr(a,e,r,s)):Nr(t)&&o.push(wr(a,i,e,r)),o},j=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:te},{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"]}],O=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:te},{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"]}],ee=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:te},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],W=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:te},{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"]}],re=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(k.Talent).map(e=>e.toLowerCase())}],Ir={"!co":j,"-co":j,"!cost":j,"-cost":j,"!color":j,"-color":j,"!b":O,"-b":O,"!block":O,"-block":O,"!d":O,"-d":O,"!def":O,"-def":O,"!defense":O,"-defense":O,"!pitch":ee,"-pitch":ee,"!p":ee,"-p":ee,"!attack":W,"-attack":W,"!power":W,"-power":W,"!pwr":W,"-pwr":W,"!pow":W,"-pow":W,"!talents":re,"-talents":re,"!tal":re,"-tal":re},be=e=>{let r=[],t=Ir[e];return t&&r.push(...t),r},Dr=["l","legal","hero"],Br=e=>Dr.includes(e),Rr=["banned"],Lr=e=>Rr.includes(e),Er=["r","rarity"],Nr=e=>Er.includes(e);var L=require("@flesh-and-blood/types"),ye=[{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"]}],me=ye.filter(({shorthands:e})=>e.some(r=>r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)})),Ce=ye.filter(({shorthands:e})=>e.some(r=>!r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>!r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)}));var _=e=>$(e.toLowerCase().trim().replace(y,"")),$=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),q=e=>e.replace(fe,"");var z=require("@flesh-and-blood/types");var Ne=new WeakMap,Oe=(e,r)=>{let t=new Map;for(let a of e)for(let i of r(a)||[]){let s=t.get(i);s?s.push(a):t.set(i,[a])}return t},Or=e=>{let r=new Map;for(let t of e){let a=t.types.includes(z.Type.Hero)&&!t.isCardBack,i=a?z.CardRole.Hero:(0,z.getCardRole)(t);if(a||i!==z.CardRole.Hero){let o=r.get(i);o?o.push(t):r.set(i,[t])}}return r},Hr=e=>{let r,t,a,i,s=()=>{if(!r){let f=new Map,d=new Map,M=[],p=new Map,u=0;for(let S of e){f.set(S.cardIdentifier,S),d.set(S.cardIdentifier,u),u++;let m=_(S.name),x=p.get(m);x?x.push(S):(p.set(m,[S]),M.push(m))}r={cardByCardIdentifier:f,corpusPositionByCardIdentifier:d,cleanedNames:M,pitchCycleByCleanedName:p}}return r},o=f=>{let{corpusPositionByCardIdentifier:d}=s(),M=({cardIdentifier:p})=>d.get(p)||0;return[...f].sort((p,u)=>M(p)-M(u))},n=f=>s().cardByCardIdentifier.get(f),c=f=>{let{cardByCardIdentifier:d}=s(),M=[];for(let p of f||[]){let u=d.get(p);u&&M.push(u)}return o(M)},F=f=>{let{pitchCycleByCleanedName:d}=s(),M=n(f);return M?d.get(_(M.name))||[]:[]},h=f=>{let{cleanedNames:d,pitchCycleByCleanedName:M}=s(),p=_(f),u=M.get(p);if(!u){let S=d.find(m=>m.includes(p));S&&(u=M.get(S))}return u||[]},g=f=>c(n(f)?.oppositeSideCardIdentifiers),b=f=>c(n(f)?.referencedCards),C=f=>(t||(t=Oe(e,({referencedCards:d})=>d)),t.get(f)||[]),A=f=>c(n(f)?.createdExtras);return{cards:e,getCard:n,getPitchCycle:F,getCardsByName:h,getOppositeSide:g,getReferences:b,getReferencedBy:C,getCreates:A,getCreatedBy:f=>(a||(a=Oe(e,({createdExtras:d})=>d)),a.get(f)||[]),getCreatedClosure:f=>{let d=new Map,M=new Set,p=[...f];for(let u of p)if(!M.has(u)){M.add(u);for(let m of A(u))d.set(m.cardIdentifier,m),p.push(m.cardIdentifier)}return o([...d.values()])},getByRole:f=>(i||(i=Or(e)),i.get(f)||[]),getCardsInCorpusOrder:o}},Me=e=>{let r=Ne.get(e);return r||(r=Hr(e),Ne.set(e,r)),r},Fe=(e,r)=>e.getPitchCycle(r.cardIdentifier),ae=(e,r)=>e.getCardsByName(r),He=(e,r)=>{let t=new Map;for(let a of r)for(let i of Fe(e,a))t.set(i.cardIdentifier,i);return e.getCardsInCorpusOrder([...t.values()])},ie=(e,r)=>{let t=[];for(let a of Fe(e,r))t.push(...e.getReferencedBy(a.cardIdentifier));return He(e,t)},se=(e,r)=>{let t=[];for(let a of Fe(e,r))t.push(...e.getReferences(a.cardIdentifier));return He(e,t)};var dr=[">=",">","<=","<"],cr=["!","-"],Vr={property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},Se={property:"artists",isArray:!0,partialMatch:!0},Ve={property:"n/a",isMeta:!0},Ge={property:"bonds",isArray:!0},Gr={property:"cardIdentifier",isString:!0,isNormalized:!0},We=(e,{isAnd:r,isExcluded:t,isOptional:a,modifier:i})=>({filterToPropertyMapping:Gr,values:[...e],valuesSet:e,isAnd:r,isOr:!0,modifier:i,isExcluded:t,isOptional:a}),Wr={property:"n/a"},Ue={property:"classes",isArray:!0,partialMatch:!0},Ke={property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},Y={property:"defense",specialProperty:"specialDefense",isNumber:!0},ze={property:"flows",isArray:!0},je={nestedProperty:"foiling",property:"printings",isArray:!0},qe={property:"fusions",isArray:!0},_e={property:"intellect",isNumber:!0},$e={property:"keywords",isArray:!0},ve={property:"n/a",isMeta:!0},Ye={property:"life",specialProperty:"specialLife",isNumber:!0},Pe={property:"meta",isArray:!0},Je={property:"name",isString:!0,partialMatch:!0},Ae={property:"pitch",isNumber:!0},Qe={property:"firstReleaseDate",isDate:!0},oe={property:"power",specialProperty:"specialPower",isNumber:!0},Ur={property:"setIdentifiers",isArray:!0,partialMatch:!0},Xe={property:"n/a",isMeta:!0},Kr={property:"n/a"},zr={property:"n/a"},Ze={property:"sets",isArray:!0,partialMatch:!0},Te={property:"shorthands",isArray:!0,partialMatch:!0},ne={property:"specializations",isArray:!0,partialMatch:!0},er={property:"subtypes",isArray:!0},rr={property:"types",isArray:!0},tr={property:"talents",isArray:!0},jr={property:"functionalText",hasMarkup:!0,isString:!0,partialMatch:!0},qr={property:"traits",isArray:!0,partialMatch:!0},_r={property:"typeText",isString:!0,partialMatch:!0},le={nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},$r={property:"firstReleaseDate",isString:!0,partialMatch:!0},ke={arcane:Vr,a:Se,artist:Se,art:Se,attack:oe,b:Y,block:Y,banned:Ve,bond:Ge,bonds:Ge,c:Ue,class:Ue,chain:Wr,co:Ke,cost:Ke,color:Ae,d:Y,def:Y,defense:Y,flow:ze,flows:ze,f:qe,fusion:qe,foil:je,foiling:je,i:_e,intellect:_e,is:Pe,k:$e,keyword:$e,l:ve,legal:ve,hero:ve,li:Ye,life:Ye,meta:Pe,n:Je,name:Je,p:Ae,pitch:Ae,pwr:oe,pow:oe,power:oe,print:Ur,r:Xe,rarity:Xe,referencedby:Kr,references:zr,rf:Ve,s:Ze,set:Ze,short:Te,shorthand:Te,shorthands:Te,sp:ne,spec:ne,specialization:ne,specializations:ne,st:er,subtype:er,t:rr,type:rr,tal:tr,talent:tr,text:jr,trait:qr,treat:le,treatment:le,var:le,variation:le,x:_r,year:$r},Yr=[{text:l.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:l.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(y,"")}],Jr=e=>{let r=[],t=e.replaceAll("\u201D",'"');for(let{text:i,override:s}of Yr)t.includes(i)&&(t=t.replace(i,s));if(X(t)?.card)r.push(t);else{let i=t.split(/[ ]+/),s="",o=0;for(let n of i)o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0),o<2&&n.split('"').length===2?(s+=" "+n,o++):o===0&&s===""?r.push(n):o===1&&(s+=" "+n);o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0)}return r},Qr=20,Ie=(e,r,t=[],a=[],i=it())=>{let s=e.trim().toLowerCase();for(let{expanded:P,shorthands:f}of me)for(let d of f)if(s.includes(d)){s=s.replace(d,P.join(" "));break}for(let[P,f]of Object.entries(l.setToSetIdentifierMappings))s.includes(P.toLowerCase())&&(s=s.replace(P.toLowerCase(),f[0]));let o=Jr(s),n=[];for(let P of o){let f=Ce.find(({shorthands:d})=>d.includes(P));f&&!f.isCardProperty?n.push(...f.expanded):n.push(P)}let c=[],F=[],h=[],g=[],b=!1,C=[],A=[],D=[],H=[];for(let P of n)if(pt(P)){let[f,d]=P.split(":"),{modifier:M,values:p,isAnd:u,isOr:S}=dt(d),{filterKey:m,isExcluded:x,isOptional:B,isMeta:pe}=ct(f),U=!1;if(pe){if(["rarity","r"].includes(m)){let V=lt(p);x||(A=[...V]),p=V.map(T=>T.toLowerCase())}["legal","l","hero"].includes(m),c.push(...he(x,B,m,p,M,t))}else{if(["chain"].includes(m)){let T=new Set,I=[],E=new Set,N=w=>{T.add(w.cardIdentifier),E.has(w.name)||(E.add(w.name),I.push(w))},K=w=>{w.types.includes(l.Type.Hero)||N(w)};for(let w of p)if(w)for(let R of ae(r,w))N(R);let G=0;for(let w of I){if(G>Qr)break;for(let ue of se(r,w))K(ue);if(G===0)for(let ue of ie(r,w))K(ue);G++}c.push(We(T,{isAnd:u,isExcluded:x,isOptional:B,modifier:M})),U=!0}else if(["referencedby","references"].includes(m)){let T=["referencedby"].includes(m),I=new Set;for(let E of p)if(E)for(let N of ae(r,E)){let K=T?se(r,N):ie(r,N);for(let G of K)I.add(G.cardIdentifier)}c.push(We(I,{isAnd:u,isExcluded:x,isOptional:B,modifier:M})),U=!0}else if(["art","artist"].includes(m))F=p;else if(["print","prints","printing","printings"].includes(m))C=p;else if(["is","meta"].includes(m)){let T=[],I=[],E=[],N=[];for(let R of p)rt.includes(R)?T.push(R):tt.includes(R)?I.push(R):at.includes(R)?E.push(R):N.push(R);T.length>0&&(c.push({filterToPropertyMapping:Pe,values:[l.Meta.Reprint.toLowerCase().replaceAll(y,"")],isAnd:u,isOr:S,isExcluded:!x,isOptional:B}),U=N.length===0);let K=I.length>0;K&&c.push({filterToPropertyMapping:Qe,values:[i],isAnd:u,isOr:S,isExcluded:x,isOptional:B});let G=E.length>0;G&&c.push({filterToPropertyMapping:Qe,values:[i],isAnd:u,isOr:S,isExcluded:!x,isOptional:B}),(K||G)&&(U=N.length===0);let w=st(N);p=w.map(R=>R.toLowerCase().replaceAll(y,"")),w.includes(l.Meta.Expansion)&&!x&&(b=!0)}else["foiling","foil"].includes(m)?(g=ot(p),p=g.map(T=>T.toLowerCase())):["treat","treatment","var","variation"].includes(m)?(H=nt(p),p=H.map(T=>T.toLowerCase())):["set","s"].includes(m)?(D=Xr(p,a),p=D.map(T=>T.toLowerCase().replaceAll(y,""))):["pitch","p","color"].includes(m)&&(p=et(p));let V=ke[m];V&&!U&&c.push({filterToPropertyMapping:V,values:V.hasMarkup?p.map(T=>q(T)):p,isAnd:u,isOr:S,modifier:M,isExcluded:x,isOptional:B})}}else if(P){let f=X(P)?.card,d=be(P);f?h.push(`"${f.toLowerCase().replace(y,"")}"`):d&&d.length>0?c.push(...d):h.push(P.replace(y,""))}return{appliedFilters:c,attributes:{artists:F,foilings:g,isExpansionSlot:b,prints:C,rarities:A,releases:D,treatments:H},keywords:h}},Xr=(e,r=[])=>{let t=[];for(let a of e)t.push(...Zr(a,r));return t},Zr=(e,r=[])=>{let t=[],a=Object.values(l.Release).find(i=>i.toLowerCase().replaceAll(y,"")===e);if(a&&t.push(a),t.length===0){let i=l.setIdentifierToSetMappings[e];i&&t.push(i)}if(t.length===0){let i=Object.values(l.Release).filter(s=>s.toLowerCase().includes(e));i.length>0&&t.push(...i)}if(t.length===0){let i=r.find(s=>s.toLowerCase().replaceAll(y,"")===e);i&&t.push(i)}return t},xe={purple:4,blue:3,yellow:2,red:1,white:0},et=e=>{let r=[];for(let t of e)xe[t]||xe[t]===0?r.push(xe[t].toString()):r.push(t);return r},rt=["unique"],tt=["preview","spoiler","unreleased"],at=["released"],it=()=>{let e=new Date,r=`${e.getMonth()+1}`.padStart(2,"0"),t=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${r}-${t}`},ar={dual:l.Meta.DualClass,exp:l.Meta.Expansion,expansion:l.Meta.Expansion,expansionSlot:l.Meta.Expansion,rainbow:l.Meta.Rainbow,reprint:l.Meta.Reprint,reprints:l.Meta.Reprint},st=e=>{let r=[];for(let t of e)ar[t]?r.push(ar[t]):l.Meta[t]&&r.push(l.Meta[t]);if(e.length>0&&r.length===0){for(let t of Object.values(l.Meta))for(let a of e)if(t.toLowerCase().includes(a)){r.push(t);break}}return r},ir={r:l.Foiling.Rainbow,rf:l.Foiling.Rainbow,rainbow:l.Foiling.Rainbow,c:l.Foiling.Cold,cf:l.Foiling.Cold,cold:l.Foiling.Cold,g:l.Foiling.Gold,gf:l.Foiling.Gold,gold:l.Foiling.Gold},ot=e=>{let r=[];for(let t of e)ir[t]&&r.push(ir[t]);return r},sr={...Object.values(l.Treatment).reduce((e,r)=>(e[r.toLowerCase()]=r,e),{}),aa:l.Treatment.AA,alt:l.Treatment.AA,"alt art":l.Treatment.AA,ab:l.Treatment.AB,"alt border":l.Treatment.AB,at:l.Treatment.AT,"alt text":l.Treatment.AT,ea:l.Treatment.EA,extended:l.Treatment.EA,"extended art":l.Treatment.EA,fa:l.Treatment.FA,full:l.Treatment.FA,"full art":l.Treatment.FA},nt=e=>{let r=[];for(let t of e)sr[t]?r.push(sr[t]):l.Treatment[t.toUpperCase()]&&r.push(l.Treatment[t.toUpperCase()]);return r},we={b:l.Rarity.Basic,c:l.Rarity.Common,f:l.Rarity.Fabled,l:l.Rarity.Legendary,m:l.Rarity.Majestic,p:l.Rarity.Promo,r:l.Rarity.Rare,s:l.Rarity.SuperRare,t:l.Rarity.Token,v:l.Rarity.Marvel},lt=e=>{let r=[];for(let t of e)we[t]?r.push(we[t]):r.push(t);return r},dt=e=>{let r=[],t,a,i=dr.find(s=>e.includes(s));if(i){let[,s]=e.split(i);or(s)?(t=!0,r.push(...s.trim().split("+").map(o=>o.replace(y,"")))):nr(s)?(a=!0,r.push(...s.trim().split(",").map(o=>o.replace(y,"")))):r.push(s.trim().replace(y,""))}else or(e)?(t=!0,r.push(...e.trim().split("+").map(s=>s.replace(y,"")))):nr(e)?(a=!0,r.push(...e.trim().split(",").map(s=>s.replace(y,"")))):e.startsWith('"')&&e.endsWith('"')?r.push(e.trim().replaceAll('"',"").replace(y,"")):r.push(e.trim().replace(y,""));return{modifier:i,values:r,isAnd:t,isOr:a}},ct=e=>{let r=ut(e);if(r){let[,t]=e.split(r);return{filterKey:t,isExcluded:!0,isOptional:!1,isMeta:lr(t)}}else return{filterKey:e,isExcluded:!1,isOptional:!1,isMeta:lr(e)}},pt=e=>e.indexOf(":")>=0,or=e=>e.indexOf("+")>=0,nr=e=>e.indexOf(",")>=0,lr=e=>!!ke[e]?.isMeta,ut=e=>cr.find(r=>e.includes(r))?.slice(0,1);var v=require("@flesh-and-blood/types"),pr={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[v.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:[v.Hero.Kayo,v.Hero.Levia,v.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:v.Rarity.Rare,set:v.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${v.Treatment.FA}`,rarity:v.Rarity.Marvel,set:v.Release.Promos,treatment:v.Treatment.FA}],name:"Fangs A Lot",rarities:[v.Rarity.Rare,v.Rarity.Marvel],rarity:v.Rarity.Rare,sets:[v.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[v.Subtype.Attack],types:[v.Type.Action],typeText:"Generic Action - Attack"},ur=[{keyword:pr.name.toLowerCase(),card:pr}];var ft={getFn:(e,r)=>{let t=Be.default.config.getFn(e,r),a=t;if(Array.isArray(t))a=t.map(i=>$(i.replace(y,"")));else if(t){let i=$(t).replace(y,"");a=r.includes("functionalText")?q(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},De=class{constructor(r,t=[],a=[],i=!1){this.getFuse=()=>(this.fuse||(this.fuse=new Be.default(this.cards,ft)),this.fuse);this.log=(r,...t)=>{this.debug&&console.log(r,...t)};this.search=(r,t)=>{let a,{appliedFilters:i,attributes:s,keywords:o}=Ie(r,this.index,this.additionalHeroes,this.additionalSets),n=o.join(" "),c=t?ur.filter(d=>d.keyword===n):[];if(c.length>0?a=c.map(({card:d})=>d):o.length?a=this.getFuse().search(n).map(d=>d.item):a=[...this.cards],i.length&&(a=a.filter(d=>d&&gr(d,i))),o.length===0){let d="";if(s.releases.length===1)try{let u=s.releases[0];d=de.setToSetIdentifierMappings[u][0].toUpperCase()}catch(u){console.error("Error getting set identifier from search",u)}if(!d&&s.prints.length===1)try{let u=s.prints[0];de.setIdentifierToSetMappings[u]&&(d=u.toUpperCase())}catch(u){console.error("Error getting set identifier from search",u)}d?a.sort((u,S)=>{let m=u.setIdentifiers.find(B=>B.includes(d))?.replace(d,""),x=S.setIdentifiers.find(B=>B.includes(d))?.replace(d,"");return m&&x?m.localeCompare(x):-1}):a.sort((u,S)=>u.name===S.name?`${u.pitch}`.localeCompare(`${S.pitch}`):u.name.localeCompare(S.name))}else{let d=[],M=[],p=o.map(u=>u.toLowerCase().replace(y,"")).join(" ");for(let u of a)u.name.toLowerCase().replace(y,"")===p?d.push(u):M.push(u);a=[...d,...M]}let F,{artists:h,isExpansionSlot:g,foilings:b,prints:C,rarities:A,releases:D,treatments:H}=s;(h.length>0||g||b.length>0||C.length>0||A.length>0||D.length>0||H.length>0)&&(F=a.map(d=>{let M=d.printings.filter(p=>{let u=!!p.image,S=h.length===0||h.some(I=>p.artists.find(E=>E.replace(y,"").toLowerCase().includes(I))),m=!g||g===p.isExpansionSlot,x=b.length===0||b.includes(p.foiling),B=C.length===0||C.some(I=>p.identifier.includes(I.toUpperCase())),pe=A.length===0||A.includes(p.rarity),U=D.length===0||D.includes(p.set),V=H.length===0||p.treatments?.some(I=>H.includes(I));return u&&S&&m&&x&&B&&pe&&U&&V});return{...d,matchingPrintings:M}}));let f=F?.length>0?F:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:f}};let s=Array.isArray(t)?{additionalHeroes:t,additionalSets:a,debug:i}:t;this.additionalHeroes=s.additionalHeroes||[],this.additionalSets=s.additionalSets||[],this.cards=[...r],this.debug=s.debug||!1,this.index=s.index||Me(r)}},fr=De,gr=(e,r)=>{let t=!0,a=!1;for(let i of r){let s=i.isOptional,{isNumber:o,isString:n,isArray:c,isBoolean:F,isDate:h}=i.filterToPropertyMapping;if(o){let g=gt(e,i);s?g&&(a=!0):t=t&&g}else if(n){let g=ht(e,i);s?g&&(a=!0):t=t&&g}else if(c){let g=bt(e,i,r);s?g&&(a=!0):t=t&&g}else if(F){let g=yt(e,i);s?g&&(a=!0):t=t&&g}else if(h){let g=mt(e,i);s?g&&(a=!0):t=t&&g}}return t},gt=(e,r)=>{if(J(r,e)){let{values:t,modifier:a,isExcluded:i,filterToPropertyMapping:{partialMatch:s}}=r,o=ce(e,r);if(o!=null&&!isNaN(o))if(o=parseInt(o),a)switch(a){case">=":{let n=t?.some(c=>o>=parseInt(c));return i?!n:n}case">":{let n=t?.some(c=>o>parseInt(c));return i?!n:n}case"<=":{let n=t?.some(c=>o<=parseInt(c));return i?!n:n}case"<":{let n=t?.some(c=>o<parseInt(c));return i?!n:n}default:return!1}else{let n=t?.some(c=>o===parseInt(c));return i?!n:n}else{let n=Mt(e,r)?.toLowerCase(),c=s?t?.some(F=>n?.includes(F)):t?.some(F=>n===F);return i?!c:c}}else return!0},ht=(e,r)=>{if(J(r,e)){let{values:t,valuesSet:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{hasMarkup:o,isNormalized:n,partialMatch:c}}=r,F=ce(e,r),h=n?F:F?.replaceAll(y,"").toLowerCase(),g=o&&h?q(h):h;if(c){let b=i?t?.every(C=>g?.includes(C)):t?.some(C=>g?.includes(C));return s?!b:b}else{let b;return i?b=t?.every(C=>g===C):a?b=a.has(g):b=t?.some(C=>g===C),s?!b:b}}else return!0},bt=(e,r,t)=>{if(J(r,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=r,n=Ct(e,r,t).map(c=>c?.replaceAll(y,""));if(o){let c=i?a.every(h=>n?.some(g=>g?.toLowerCase().includes(h))):a.some(h=>n?.some(g=>g?.toLowerCase().includes(h))),F=n.length===0;return s?!c||F:c}else{let c=i?a.every(F=>n?.some(h=>h?.toLowerCase()===F)):a.some(F=>n?.some(h=>h?.toLowerCase()===F));return s?!c:c}}else return!0},yt=(e,r)=>{if(J(r,e)){let{isExcluded:t}=r,a=ce(e,r);return t?!a:a}else return!0},mt=(e,r)=>{if(J(r,e)){let{values:t,isExcluded:a}=r,i=ce(e,r),s=t?.some(o=>i>o);return a?!s:s}else return!0},ce=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.property]},Ct=(e,r,t)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i,property:s}}=r,o=e[s]||[],n=[],c=Object.keys(e.legalOverrides||{}).length>0,F=r.filterToPropertyMapping.property==="legalHeroes",h=t.find(({filterToPropertyMapping:b})=>b.property==="legalFormats");if(c&&F&&!!h){let b=new Set;for(let{format:C,heroes:A}of e.legalOverrides||[])if(h.values.includes(C.toLowerCase()))for(let D of A)b.add(D);n=Array.from(b)}if(n.length===0)if(i){let b=new Set;for(let C of o)if(a){let A=C[i]||[];for(let D of A)b.add(D)}else{let A=C[i];A&&b.add(A)}n=Array.from(b)}else n=o;return n},Mt=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.specialProperty]},J=({cardTypes:e},{types:r,subtypes:t})=>!e||e?.some(a=>r.map(i=>i.toLowerCase()).includes(a.toLowerCase())||t.map(i=>i.toLowerCase()).includes(a.toLowerCase()));var Ft=(e,r)=>{let t=[];if(e)for(let a of r){let i=a.name===e.name,s=a.cardIdentifier!==e.cardIdentifier,o=a.pitch!==e.pitch;i&&s&&o&&t.push(a)}return t},St=(e,r)=>{let t=new Set(e?.referencedCards),a=[];for(let i of r)t.has(i.cardIdentifier)&&a.push(i);return a},vt=e=>{let r=new Map;for(let t of e)for(let a of t.referencedCards||[]){let i=r.get(a);i?i.push(t):r.set(a,[t])}return r},At=(e,r)=>{let t=new Set;for(let i of e)for(let s of i.createdExtras||[])t.add(s);let a=[];for(let i of r)t.has(i.cardIdentifier)&&a.push(i);return a};0&&(module.exports={FilterProperty,MARKUP,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getAbbreviation,getAbbreviationByCard,getCardsByName,getCardsByReferencedCardIdentifier,getCardsReferencedBy,getCardsReferencing,getCatalogueIndex,getCleanText,getExcludedMetaFilters,getKeywordsAndAppliedFiltersFromText,getMetaFilters,getNormalizedText,getOtherPitches,getReferencedCards,getTextWithoutMarkup,getTokensReferencedByCards,multiWordShorthands,shorthands,singleWordShorthands});
|
|
1
|
+
var hr=Object.create;var X=Object.defineProperty;var Cr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var mr=Object.getPrototypeOf,Tr=Object.prototype.hasOwnProperty;var Mr=(e,r)=>{for(var t in r)X(e,t,{get:r[t],enumerable:!0})},Ee=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of br(r))!Tr.call(e,i)&&i!==t&&X(e,i,{get:()=>r[i],enumerable:!(a=Cr(r,i))||a.enumerable});return e};var Fr=(e,r,t)=>(t=e!=null?hr(mr(e)):{},Ee(r||!e||!e.__esModule?X(t,"default",{value:e,enumerable:!0}):t,e)),vr=e=>Ee(X({},"__esModule",{value:!0}),e);var Pt={};Mr(Pt,{FilterProperty:()=>Ne,MARKUP:()=>ge,PUNCTUATION:()=>m,RARITY_VALUES_MAPPING:()=>ke,abbreviations:()=>ye,availableExclusions:()=>pr,availableModifiers:()=>cr,default:()=>gr,filterCard:()=>yr,filtersToCardPropertyMappings:()=>Ie,getAbbreviation:()=>Z,getAbbreviationByCard:()=>Ar,getCardsByName:()=>ie,getCardsByReferencedCardIdentifier:()=>xt,getCardsReferencedBy:()=>oe,getCardsReferencing:()=>se,getCatalogueIndex:()=>Me,getCleanText:()=>$,getExcludedMetaFilters:()=>Ce,getKeywordsAndAppliedFiltersFromText:()=>Re,getMetaFilters:()=>he,getNormalizedText:()=>Y,getOtherPitches:()=>vt,getReferencedCards:()=>At,getTextWithoutMarkup:()=>_,getTokensReferencedByCards:()=>St,multiWordShorthands:()=>me,shorthands:()=>be,singleWordShorthands:()=>Te});module.exports=vr(Pt);var ce=require("@flesh-and-blood/types"),Le=Fr(require("fuse.js"),1);var m=/[!"#$%&'’(),./:;<=>?@[\]^_`|~]/g,ge=/\*/g;var d=require("@flesh-and-blood/types");var Z=e=>ye.find(({abbreviations:r})=>r.find(t=>t.toLowerCase()===e)),Ar=e=>ye.find(({card:r})=>r.toLowerCase()===e.name.toLowerCase()),ye=[{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 k=require("@flesh-and-blood/types");var Ne=(a=>(a.BannedFormats="bannedFormats",a.LegalFormats="legalFormats",a.LegalHeroes="legalHeroes",a))(Ne||{}),ae=Array.from(Array(50).keys()).map(e=>`${e}`),xr=[{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"]}],Sr=Object.values(k.Format).map(e=>{let r=xr.find(({format:a})=>a===e),t=e.toLowerCase().replaceAll(m,"");return r?{...r,format:t}:{format:t}}),Pr=[{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"]}],wr=Object.values(k.Hero).map(e=>{let r=Pr.find(({hero:a})=>a===e),t=e.toLowerCase().replaceAll(m,"");return r?{...r,hero:t}:{hero:t}}),ee=["common","rare","super rare","majestic","legendary","fabled"],kr=(e,r,t,a)=>{let i=[];if(!r)i.push(...e);else for(let s of e)switch(r){case">=":{let o=!1;for(let n of ee)o?i.push(n):n===s&&(o=!0,i.push(n));break}case">":{let o=!1;for(let n of ee)o?i.push(n):n===s&&(o=!0);break}case"<=":{let o=!1;for(let n of ee.slice().reverse())o?i.push(n):n===s&&(o=!0,i.push(n));break}case"<":{let o=!1;for(let n of ee.slice().reverse())o?i.push(n):n===s&&(o=!0);break}default:break}return{filterToPropertyMapping:{nestedProperty:"rarity",property:"printings",isArray:!0},isExcluded:t,isOptional:a,isOr:!0,values:i}},De=(e,r,t,a,i)=>{let s=a.map(g=>({hero:g.toLowerCase().replaceAll(m,"")})),o=[],n=[],u=[];for(let g of e){let f=Sr.find(({format:h,nicknames:M})=>h===g||!!M&&M.includes(g));if(f)n.push(f.format);else{let h=wr.find(({hero:M,nicknames:A})=>M===g||!!A&&A.includes(g))||s.find(({hero:M})=>M===g);h&&u.push(h.hero)}}let T=i||"legalFormats";return n.length>0&&o.push({filterToPropertyMapping:{property:T,isArray:!0},values:n,isOr:!0,isExcluded:r,isOptional:t}),u.length>0&&o.push({filterToPropertyMapping:{property:"legalHeroes",isArray:!0},values:u,isOr:!0,isExcluded:r,isOptional:t}),o},Ir=(e,r,t,a)=>De(e,r,t,a,"bannedFormats"),he=(e,r,t,a,i,s)=>{let o=[];return Lr(t)?o.push(...De(a,e,r,s)):Nr(t)?o.push(...Ir(a,e,r,s)):Or(t)&&o.push(kr(a,i,e,r)),o},q=[{filterToPropertyMapping:{property:"cost",isNumber:!0},isExcluded:!0,values:ae},{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"]}],O=[{filterToPropertyMapping:{property:"defense",isNumber:!0},isExcluded:!0,values:ae},{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"]}],re=[{filterToPropertyMapping:{property:"pitch",isNumber:!0},isExcluded:!0,values:ae},{filterToPropertyMapping:{property:"types",isArray:!0,partialMatch:!0},isExcluded:!0,values:["equipment","hero","placeholder","token","weapon"]},{filterToPropertyMapping:{property:"isCardBack",isBoolean:!0},isExcluded:!0,values:["true"]}],W=[{filterToPropertyMapping:{property:"power",isNumber:!0},isExcluded:!0,values:ae},{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"]}],te=[{filterToPropertyMapping:{property:"talents",isArray:!0},isExcluded:!0,values:Object.values(k.Talent).map(e=>e.toLowerCase())}],Rr={"!co":q,"-co":q,"!cost":q,"-cost":q,"!color":q,"-color":q,"!b":O,"-b":O,"!block":O,"-block":O,"!d":O,"-d":O,"!def":O,"-def":O,"!defense":O,"-defense":O,"!pitch":re,"-pitch":re,"!p":re,"-p":re,"!attack":W,"-attack":W,"!power":W,"-power":W,"!pwr":W,"-pwr":W,"!pow":W,"-pow":W,"!talents":te,"-talents":te,"!tal":te,"-tal":te},Ce=e=>{let r=[],t=Rr[e];return t&&r.push(...t),r},Br=["l","legal","hero"],Lr=e=>Br.includes(e),Er=["banned"],Nr=e=>Er.includes(e),Dr=["r","rarity"],Or=e=>Dr.includes(e);var E=require("@flesh-and-blood/types"),be=[{description:"Attack actions",expanded:["st:attack"],filters:{subtypes:[E.Subtype.Attack]},isCardProperty:!1,shorthands:["AA"]},{description:"Arcane barrier",expanded:['k:"arcane barrier"'],filters:{keywords:[E.Keyword.ArcaneBarrier]},isCardProperty:!1,shorthands:["AB"]},{description:"Attack reactions",expanded:['t:"attack reaction"'],filters:{types:[E.Type.AttackReaction]},isCardProperty:!1,shorthands:["AR"]},{description:"Defense reactions",expanded:['t:"defense reaction"'],filters:{types:[E.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:[E.Keyword.GoAgain]},isCardProperty:!1,shorthands:["GA"]},{description:"Non-attack actions",expanded:["t:action","st:non-attack"],filters:{subtypes:[E.Subtype.NonAttack],types:[E.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:[E.Keyword.Spellvoid]},isCardProperty:!1,shorthands:["SV"]}],me=be.filter(({shorthands:e})=>e.some(r=>r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)})),Te=be.filter(({shorthands:e})=>e.some(r=>!r.includes(" "))).map(e=>({...e,shorthands:e.shorthands.filter(r=>!r.includes(" ")).map(r=>r.toLowerCase()).sort((r,t)=>t.length-r.length)}));var $=e=>Y(e.toLowerCase().trim().replace(m,"")),Y=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,""),_=e=>e.replace(ge,"");var j=require("@flesh-and-blood/types");var Oe=new WeakMap,K=Object.freeze([]),Hr=Number.MAX_SAFE_INTEGER,He=(e,r)=>{let t=new Map;for(let a of e)for(let i of r(a)||[]){let s=t.get(i);s?s.push(a):t.set(i,[a])}return t},Vr=e=>{let r=new Map;for(let t of e){let a=t.types.includes(j.Type.Hero)&&!t.isCardBack,i=a?j.CardRole.Hero:(0,j.getCardRole)(t);if(a||i!==j.CardRole.Hero){let o=r.get(i);o?o.push(t):r.set(i,[t])}}return r},Gr=e=>{let r,t,a,i,s=()=>{if(!r){let l=new Map,C=new Map,c=[],p=new Map,y=0;for(let b of e){l.set(b.cardIdentifier,b),C.set(b.cardIdentifier,y),y++;let F=$(b.name),x=p.get(F);x?x.push(b):(p.set(F,[b]),c.push(F))}r={cardByCardIdentifier:l,corpusPositionByCardIdentifier:C,cleanedNames:c,pitchCycleByCleanedName:p}}return r},o=l=>{let{corpusPositionByCardIdentifier:C}=s(),c=({cardIdentifier:p})=>C.get(p)??Hr;return[...l].sort((p,y)=>c(p)-c(y))},n=l=>s().cardByCardIdentifier.get(l),u=l=>{let{cardByCardIdentifier:C}=s(),c=[];for(let p of l||[]){let y=C.get(p);y&&c.push(y)}return o(c)},T=l=>{let C=new Map;return c=>{let p=C.get(c);if(!p){let y=n(c),b=u(y&&l(y)),F=b.length>0;p=F?b:K,F&&C.set(c,p)}return p}},g=l=>{let{pitchCycleByCleanedName:C}=s(),c=n(l);return c?C.get($(c.name))??K:K},f=l=>{let{cleanedNames:C,pitchCycleByCleanedName:c}=s(),p=$(l),y=c.get(p);if(!y&&p.length>0){let F=C.find(x=>x.includes(p));F&&(y=c.get(F))}return y??K},h=T(({oppositeSideCardIdentifiers:l})=>l),M=T(({referencedCards:l})=>l),A=l=>(t||(t=He(e,({referencedCards:C})=>C)),t.get(l)??K),I=T(({createdExtras:l})=>l);return{cards:e,getCard:n,getPitchCycle:g,getCardsByName:f,getOppositeSide:h,getReferences:M,getReferencedBy:A,getCreates:I,getCreatedBy:l=>(a||(a=He(e,({createdExtras:C})=>C)),a.get(l)??K),getCreatedClosure:l=>{let C=new Map,c=new Set,p=[...l];for(let y of p)if(!c.has(y)){c.add(y);for(let F of I(y))C.set(F.cardIdentifier,F),p.push(F.cardIdentifier)}return o([...C.values()])},getByRole:l=>(i||(i=Vr(e)),i.get(l)??K),getCardsInCorpusOrder:o}},Me=e=>{let r=Oe.get(e);return r||(r=Gr(e),Oe.set(e,r)),r},Fe=(e,r)=>e.getPitchCycle(r.cardIdentifier),ie=(e,r)=>e.getCardsByName(r),Ve=(e,r)=>{let t=new Map;for(let a of r)for(let i of Fe(e,a))t.set(i.cardIdentifier,i);return e.getCardsInCorpusOrder([...t.values()])},se=(e,r)=>{let t=[];for(let a of Fe(e,r))t.push(...e.getReferencedBy(a.cardIdentifier));return Ve(e,t)},oe=(e,r)=>{let t=[];for(let a of Fe(e,r))t.push(...e.getReferences(a.cardIdentifier));return Ve(e,t)};var cr=[">=",">","<=","<"],pr=["!","-"],Wr={property:"arcane",specialProperty:"specialArcane",isNumber:!0,partialMatch:!0},ve={property:"artists",isArray:!0,partialMatch:!0},Ge={property:"n/a",isMeta:!0},We={property:"bonds",isArray:!0},Ur={property:"cardIdentifier",isString:!0,isNormalized:!0},Ue=(e,{isAnd:r,isExcluded:t,isOptional:a,modifier:i})=>({filterToPropertyMapping:Ur,values:[...e],valuesSet:e,isAnd:r,isOr:!0,modifier:i,isExcluded:t,isOptional:a}),zr={property:"n/a"},ze={property:"classes",isArray:!0,partialMatch:!0},Ke={property:"cost",specialProperty:"specialCost",isNumber:!0,partialMatch:!0},J={property:"defense",specialProperty:"specialDefense",isNumber:!0},je={property:"flows",isArray:!0},qe={nestedProperty:"foiling",property:"printings",isArray:!0},_e={property:"fusions",isArray:!0},$e={property:"intellect",isNumber:!0},Ye={property:"keywords",isArray:!0},Ae={property:"n/a",isMeta:!0},Je={property:"life",specialProperty:"specialLife",isNumber:!0},we={property:"meta",isArray:!0},Qe={property:"name",isString:!0,partialMatch:!0},xe={property:"pitch",isNumber:!0},Xe={property:"firstReleaseDate",isDate:!0},ne={property:"power",specialProperty:"specialPower",isNumber:!0},Kr={property:"setIdentifiers",isArray:!0,partialMatch:!0},Ze={property:"n/a",isMeta:!0},jr={property:"n/a"},qr={property:"n/a"},er={property:"sets",isArray:!0,partialMatch:!0},Se={property:"shorthands",isArray:!0,partialMatch:!0},le={property:"specializations",isArray:!0,partialMatch:!0},rr={property:"subtypes",isArray:!0},tr={property:"types",isArray:!0},ar={property:"talents",isArray:!0},_r={property:"functionalText",hasMarkup:!0,isString:!0,partialMatch:!0},$r={property:"traits",isArray:!0,partialMatch:!0},Yr={property:"typeText",isString:!0,partialMatch:!0},de={nestedProperty:"treatments",property:"printings",isArray:!0,isNestedPropertyArray:!0},Jr={property:"firstReleaseDate",isString:!0,partialMatch:!0},Ie={arcane:Wr,a:ve,artist:ve,art:ve,attack:ne,b:J,block:J,banned:Ge,bond:We,bonds:We,c:ze,class:ze,chain:zr,co:Ke,cost:Ke,color:xe,d:J,def:J,defense:J,flow:je,flows:je,f:_e,fusion:_e,foil:qe,foiling:qe,i:$e,intellect:$e,is:we,k:Ye,keyword:Ye,l:Ae,legal:Ae,hero:Ae,li:Je,life:Je,meta:we,n:Qe,name:Qe,p:xe,pitch:xe,pwr:ne,pow:ne,power:ne,print:Kr,r:Ze,rarity:Ze,referencedby:jr,references:qr,rf:Ge,s:er,set:er,short:Se,shorthand:Se,shorthands:Se,sp:le,spec:le,specialization:le,specializations:le,st:rr,subtype:rr,t:tr,type:tr,tal:ar,talent:ar,text:_r,trait:$r,treat:de,treatment:de,var:de,variation:de,x:Yr,year:Jr},Qr=[{text:d.Release.ClassicBattlesRhinarDorinthea.toLowerCase(),override:d.Release.ClassicBattlesRhinarDorinthea.toLowerCase().replaceAll(m,"")}],Xr=e=>{let r=[],t=e.replaceAll("\u201D",'"');for(let{text:i,override:s}of Qr)t.includes(i)&&(t=t.replace(i,s));if(Z(t)?.card)r.push(t);else{let i=t.split(/[ ]+/),s="",o=0;for(let n of i)o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0),o<2&&n.split('"').length===2?(s+=" "+n,o++):o===0&&s===""?r.push(n):o===1&&(s+=" "+n);o===2&&(r.push(s.trim().replaceAll('"',"")),s="",o=0)}return r},Zr=20,Re=(e,r,t=[],a=[],i=ot())=>{let s=e.trim().toLowerCase();for(let{expanded:P,shorthands:R}of me)for(let l of R)if(s.includes(l)){s=s.replace(l,P.join(" "));break}for(let[P,R]of Object.entries(d.setToSetIdentifierMappings))s.includes(P.toLowerCase())&&(s=s.replace(P.toLowerCase(),R[0]));let o=Xr(s),n=[];for(let P of o){let R=Te.find(({shorthands:l})=>l.includes(P));R&&!R.isCardProperty?n.push(...R.expanded):n.push(P)}let u=[],T=[],g=[],f=[],h=!1,M=[],A=[],I=[],H=[];for(let P of n)if(ft(P)){let[R,l]=P.split(":"),{modifier:C,values:c,isAnd:p,isOr:y}=pt(l),{filterKey:b,isExcluded:F,isOptional:x,isMeta:ue}=ut(R),U=!1;if(ue){if(["rarity","r"].includes(b)){let V=ct(c);F||(A=[...V]),c=V.map(S=>S.toLowerCase())}["legal","l","hero"].includes(b),u.push(...he(F,x,b,c,C,t))}else{if(["chain"].includes(b)){let S=new Set,B=[],N=new Set,D=w=>{S.add(w.cardIdentifier),N.has(w.name)||(N.add(w.name),B.push(w))},z=w=>{w.types.includes(d.Type.Hero)||D(w)};for(let w of c)if(w)for(let L of ie(r,w))D(L);let G=0;for(let w of B){if(G>Zr)break;for(let fe of oe(r,w))z(fe);if(G===0)for(let fe of se(r,w))z(fe);G++}u.push(Ue(S,{isAnd:p,isExcluded:F,isOptional:x,modifier:C})),U=!0}else if(["referencedby","references"].includes(b)){let S=["referencedby"].includes(b),B=new Set;for(let N of c)if(N)for(let D of ie(r,N)){let z=S?oe(r,D):se(r,D);for(let G of z)B.add(G.cardIdentifier)}u.push(Ue(B,{isAnd:p,isExcluded:F,isOptional:x,modifier:C})),U=!0}else if(["art","artist"].includes(b))T=c;else if(["print","prints","printing","printings"].includes(b))M=c;else if(["is","meta"].includes(b)){let S=[],B=[],N=[],D=[];for(let L of c)at.includes(L)?S.push(L):it.includes(L)?B.push(L):st.includes(L)?N.push(L):D.push(L);S.length>0&&(u.push({filterToPropertyMapping:we,values:[d.Meta.Reprint.toLowerCase().replaceAll(m,"")],isAnd:p,isOr:y,isExcluded:!F,isOptional:x}),U=D.length===0);let z=B.length>0;z&&u.push({filterToPropertyMapping:Xe,values:[i],isAnd:p,isOr:y,isExcluded:F,isOptional:x});let G=N.length>0;G&&u.push({filterToPropertyMapping:Xe,values:[i],isAnd:p,isOr:y,isExcluded:!F,isOptional:x}),(z||G)&&(U=D.length===0);let w=nt(D);c=w.map(L=>L.toLowerCase().replaceAll(m,"")),w.includes(d.Meta.Expansion)&&!F&&(h=!0)}else["foiling","foil"].includes(b)?(f=lt(c),c=f.map(S=>S.toLowerCase())):["treat","treatment","var","variation"].includes(b)?(H=dt(c),c=H.map(S=>S.toLowerCase())):["set","s"].includes(b)?(I=et(c,a),c=I.map(S=>S.toLowerCase().replaceAll(m,""))):["pitch","p","color"].includes(b)&&(c=tt(c));let V=Ie[b];V&&!U&&u.push({filterToPropertyMapping:V,values:V.hasMarkup?c.map(S=>_(S)):c,isAnd:p,isOr:y,modifier:C,isExcluded:F,isOptional:x})}}else if(P){let R=Z(P)?.card,l=Ce(P);R?g.push(`"${R.toLowerCase().replace(m,"")}"`):l&&l.length>0?u.push(...l):g.push(P.replace(m,""))}return{appliedFilters:u,attributes:{artists:T,foilings:f,isExpansionSlot:h,prints:M,rarities:A,releases:I,treatments:H},keywords:g}},et=(e,r=[])=>{let t=[];for(let a of e)t.push(...rt(a,r));return t},rt=(e,r=[])=>{let t=[],a=Object.values(d.Release).find(i=>i.toLowerCase().replaceAll(m,"")===e);if(a&&t.push(a),t.length===0){let i=d.setIdentifierToSetMappings[e];i&&t.push(i)}if(t.length===0){let i=Object.values(d.Release).filter(s=>s.toLowerCase().includes(e));i.length>0&&t.push(...i)}if(t.length===0){let i=r.find(s=>s.toLowerCase().replaceAll(m,"")===e);i&&t.push(i)}return t},Pe={purple:4,blue:3,yellow:2,red:1,white:0},tt=e=>{let r=[];for(let t of e)Pe[t]||Pe[t]===0?r.push(Pe[t].toString()):r.push(t);return r},at=["unique"],it=["preview","spoiler","unreleased"],st=["released"],ot=()=>{let e=new Date,r=`${e.getMonth()+1}`.padStart(2,"0"),t=`${e.getDate()}`.padStart(2,"0");return`${e.getFullYear()}-${r}-${t}`},ir={dual:d.Meta.DualClass,exp:d.Meta.Expansion,expansion:d.Meta.Expansion,expansionSlot:d.Meta.Expansion,rainbow:d.Meta.Rainbow,reprint:d.Meta.Reprint,reprints:d.Meta.Reprint},nt=e=>{let r=[];for(let t of e)ir[t]?r.push(ir[t]):d.Meta[t]&&r.push(d.Meta[t]);if(e.length>0&&r.length===0){for(let t of Object.values(d.Meta))for(let a of e)if(t.toLowerCase().includes(a)){r.push(t);break}}return r},sr={r:d.Foiling.Rainbow,rf:d.Foiling.Rainbow,rainbow:d.Foiling.Rainbow,c:d.Foiling.Cold,cf:d.Foiling.Cold,cold:d.Foiling.Cold,g:d.Foiling.Gold,gf:d.Foiling.Gold,gold:d.Foiling.Gold},lt=e=>{let r=[];for(let t of e)sr[t]&&r.push(sr[t]);return r},or={...Object.values(d.Treatment).reduce((e,r)=>(e[r.toLowerCase()]=r,e),{}),aa:d.Treatment.AA,alt:d.Treatment.AA,"alt art":d.Treatment.AA,ab:d.Treatment.AB,"alt border":d.Treatment.AB,at:d.Treatment.AT,"alt text":d.Treatment.AT,ea:d.Treatment.EA,extended:d.Treatment.EA,"extended art":d.Treatment.EA,fa:d.Treatment.FA,full:d.Treatment.FA,"full art":d.Treatment.FA},dt=e=>{let r=[];for(let t of e)or[t]?r.push(or[t]):d.Treatment[t.toUpperCase()]&&r.push(d.Treatment[t.toUpperCase()]);return r},ke={b:d.Rarity.Basic,c:d.Rarity.Common,f:d.Rarity.Fabled,l:d.Rarity.Legendary,m:d.Rarity.Majestic,p:d.Rarity.Promo,r:d.Rarity.Rare,s:d.Rarity.SuperRare,t:d.Rarity.Token,v:d.Rarity.Marvel},ct=e=>{let r=[];for(let t of e)ke[t]?r.push(ke[t]):r.push(t);return r},pt=e=>{let r=[],t,a,i=cr.find(s=>e.includes(s));if(i){let[,s]=e.split(i);nr(s)?(t=!0,r.push(...s.trim().split("+").map(o=>o.replace(m,"")))):lr(s)?(a=!0,r.push(...s.trim().split(",").map(o=>o.replace(m,"")))):r.push(s.trim().replace(m,""))}else nr(e)?(t=!0,r.push(...e.trim().split("+").map(s=>s.replace(m,"")))):lr(e)?(a=!0,r.push(...e.trim().split(",").map(s=>s.replace(m,"")))):e.startsWith('"')&&e.endsWith('"')?r.push(e.trim().replaceAll('"',"").replace(m,"")):r.push(e.trim().replace(m,""));return{modifier:i,values:r,isAnd:t,isOr:a}},ut=e=>{let r=gt(e);if(r){let[,t]=e.split(r);return{filterKey:t,isExcluded:!0,isOptional:!1,isMeta:dr(t)}}else return{filterKey:e,isExcluded:!1,isOptional:!1,isMeta:dr(e)}},ft=e=>e.indexOf(":")>=0,nr=e=>e.indexOf("+")>=0,lr=e=>e.indexOf(",")>=0,dr=e=>!!Ie[e]?.isMeta,gt=e=>pr.find(r=>e.includes(r))?.slice(0,1);var v=require("@flesh-and-blood/types"),ur={artists:["Hoodwill"],cardIdentifier:"fangs-a-lot-blue",classes:[v.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:[v.Hero.Kayo,v.Hero.Levia,v.Hero.Rhinar],printings:[{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000",print:"FNG000",rarity:v.Rarity.Rare,set:v.Release.Promos},{artists:["Hoodwill"],identifier:"FNG000",image:"FNG000_Marvel",print:`FNG000-${v.Treatment.FA}`,rarity:v.Rarity.Marvel,set:v.Release.Promos,treatment:v.Treatment.FA}],name:"Fangs A Lot",rarities:[v.Rarity.Rare,v.Rarity.Marvel],rarity:v.Rarity.Rare,sets:[v.Release.Promos],setIdentifiers:["FNG000"],specialImage:"FNG000_Marvel",subtypes:[v.Subtype.Attack],types:[v.Type.Action],typeText:"Generic Action - Attack"},fr=[{keyword:ur.name.toLowerCase(),card:ur}];var yt={getFn:(e,r)=>{let t=Le.default.config.getFn(e,r),a=t;if(Array.isArray(t))a=t.map(i=>Y(i.replace(m,"")));else if(t){let i=Y(t).replace(m,"");a=r.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},Be=class{constructor(r,t=[],a=[],i=!1){this.getFuse=()=>(this.fuse||(this.fuse=new Le.default(this.cards,yt)),this.fuse);this.log=(r,...t)=>{this.debug&&console.log(r,...t)};this.search=(r,t)=>{let a,{appliedFilters:i,attributes:s,keywords:o}=Re(r,this.index,this.additionalHeroes,this.additionalSets),n=o.join(" "),u=t?fr.filter(l=>l.keyword===n):[];if(u.length>0?a=u.map(({card:l})=>l):o.length?a=this.getFuse().search(n).map(l=>l.item):a=[...this.cards],i.length&&(a=a.filter(l=>l&&yr(l,i))),o.length===0){let l="";if(s.releases.length===1)try{let p=s.releases[0];l=ce.setToSetIdentifierMappings[p][0].toUpperCase()}catch(p){console.error("Error getting set identifier from search",p)}if(!l&&s.prints.length===1)try{let p=s.prints[0];ce.setIdentifierToSetMappings[p]&&(l=p.toUpperCase())}catch(p){console.error("Error getting set identifier from search",p)}l?a.sort((p,y)=>{let b=p.setIdentifiers.find(x=>x.includes(l))?.replace(l,""),F=y.setIdentifiers.find(x=>x.includes(l))?.replace(l,"");return b&&F?b.localeCompare(F):-1}):a.sort((p,y)=>p.name===y.name?`${p.pitch}`.localeCompare(`${y.pitch}`):p.name.localeCompare(y.name))}else{let l=[],C=[],c=o.map(p=>p.toLowerCase().replace(m,"")).join(" ");for(let p of a)p.name.toLowerCase().replace(m,"")===c?l.push(p):C.push(p);a=[...l,...C]}let T,{artists:g,isExpansionSlot:f,foilings:h,prints:M,rarities:A,releases:I,treatments:H}=s;(g.length>0||f||h.length>0||M.length>0||A.length>0||I.length>0||H.length>0)&&(T=a.map(l=>{let C=l.printings.filter(c=>{let p=!!c.image,y=g.length===0||g.some(B=>c.artists.find(N=>N.replace(m,"").toLowerCase().includes(B))),b=!f||f===c.isExpansionSlot,F=h.length===0||h.includes(c.foiling),x=M.length===0||M.some(B=>c.identifier.includes(B.toUpperCase())),ue=A.length===0||A.includes(c.rarity),U=I.length===0||I.includes(c.set),V=H.length===0||c.treatments?.some(B=>H.includes(B));return p&&y&&b&&F&&x&&ue&&U&&V});return{...l,matchingPrintings:C}}));let R=T?.length>0?T:a;return{appliedFilters:i,attributes:s,keywords:o,searchResults:R}};let s=Array.isArray(t)?{additionalHeroes:t,additionalSets:a,debug:i}:t;this.additionalHeroes=s.additionalHeroes||[],this.additionalSets=s.additionalSets||[],this.cards=[...r],this.debug=s.debug||!1,this.index=s.index||Me(r)}},gr=Be,yr=(e,r)=>{let t=!0,a=!1;for(let i of r){let s=i.isOptional,{isNumber:o,isString:n,isArray:u,isBoolean:T,isDate:g}=i.filterToPropertyMapping;if(o){let f=ht(e,i);s?f&&(a=!0):t=t&&f}else if(n){let f=Ct(e,i);s?f&&(a=!0):t=t&&f}else if(u){let f=bt(e,i,r);s?f&&(a=!0):t=t&&f}else if(T){let f=mt(e,i);s?f&&(a=!0):t=t&&f}else if(g){let f=Tt(e,i);s?f&&(a=!0):t=t&&f}}return t},ht=(e,r)=>{if(Q(r,e)){let{values:t,modifier:a,isExcluded:i,filterToPropertyMapping:{partialMatch:s}}=r,o=pe(e,r);if(o!=null&&!isNaN(o))if(o=parseInt(o),a)switch(a){case">=":{let n=t?.some(u=>o>=parseInt(u));return i?!n:n}case">":{let n=t?.some(u=>o>parseInt(u));return i?!n:n}case"<=":{let n=t?.some(u=>o<=parseInt(u));return i?!n:n}case"<":{let n=t?.some(u=>o<parseInt(u));return i?!n:n}default:return!1}else{let n=t?.some(u=>o===parseInt(u));return i?!n:n}else{let n=Ft(e,r)?.toLowerCase(),u=s?t?.some(T=>n?.includes(T)):t?.some(T=>n===T);return i?!u:u}}else return!0},Ct=(e,r)=>{if(Q(r,e)){let{values:t,valuesSet:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{hasMarkup:o,isNormalized:n,partialMatch:u}}=r,T=pe(e,r),g=n?T:T?.replaceAll(m,"").toLowerCase(),f=o&&g?_(g):g;if(u){let h=i?t?.every(M=>f?.includes(M)):t?.some(M=>f?.includes(M));return s?!h:h}else{let h;return i?h=t?.every(M=>f===M):a?h=a.has(f):h=t?.some(M=>f===M),s?!h:h}}else return!0},bt=(e,r,t)=>{if(Q(r,e)){let{values:a,isAnd:i,isExcluded:s,filterToPropertyMapping:{partialMatch:o}}=r,n=Mt(e,r,t).map(u=>u?.replaceAll(m,""));if(o){let u=i?a.every(g=>n?.some(f=>f?.toLowerCase().includes(g))):a.some(g=>n?.some(f=>f?.toLowerCase().includes(g))),T=n.length===0;return s?!u||T:u}else{let u=i?a.every(T=>n?.some(g=>g?.toLowerCase()===T)):a.some(T=>n?.some(g=>g?.toLowerCase()===T));return s?!u:u}}else return!0},mt=(e,r)=>{if(Q(r,e)){let{isExcluded:t}=r,a=pe(e,r);return t?!a:a}else return!0},Tt=(e,r)=>{if(Q(r,e)){let{values:t,isExcluded:a}=r,i=pe(e,r),s=t?.some(o=>i>o);return a?!s:s}else return!0},pe=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.property]},Mt=(e,r,t)=>{let{filterToPropertyMapping:{isNestedPropertyArray:a,nestedProperty:i,property:s}}=r,o=e[s]||[],n=[],u=Object.keys(e.legalOverrides||{}).length>0,T=r.filterToPropertyMapping.property==="legalHeroes",g=t.find(({filterToPropertyMapping:h})=>h.property==="legalFormats");if(u&&T&&!!g){let h=new Set;for(let{format:M,heroes:A}of e.legalOverrides||[])if(g.values.includes(M.toLowerCase()))for(let I of A)h.add(I);n=Array.from(h)}if(n.length===0)if(i){let h=new Set;for(let M of o)if(a){let A=M[i]||[];for(let I of A)h.add(I)}else{let A=M[i];A&&h.add(A)}n=Array.from(h)}else n=o;return n},Ft=(e,r)=>{let{filterToPropertyMapping:t}=r;return e[t.specialProperty]},Q=({cardTypes:e},{types:r,subtypes:t})=>!e||e?.some(a=>r.map(i=>i.toLowerCase()).includes(a.toLowerCase())||t.map(i=>i.toLowerCase()).includes(a.toLowerCase()));var vt=(e,r)=>{let t=[];if(e)for(let a of r){let i=a.name===e.name,s=a.cardIdentifier!==e.cardIdentifier,o=a.pitch!==e.pitch;i&&s&&o&&t.push(a)}return t},At=(e,r)=>{let t=new Set(e?.referencedCards),a=[];for(let i of r)t.has(i.cardIdentifier)&&a.push(i);return a},xt=e=>{let r=new Map;for(let t of e)for(let a of t.referencedCards||[]){let i=r.get(a);i?i.push(t):r.set(a,[t])}return r},St=(e,r)=>{let t=new Set;for(let i of e)for(let s of i.createdExtras||[])t.add(s);let a=[];for(let i of r)t.has(i.cardIdentifier)&&a.push(i);return a};0&&(module.exports={FilterProperty,MARKUP,PUNCTUATION,RARITY_VALUES_MAPPING,abbreviations,availableExclusions,availableModifiers,filterCard,filtersToCardPropertyMappings,getAbbreviation,getAbbreviationByCard,getCardsByName,getCardsByReferencedCardIdentifier,getCardsReferencedBy,getCardsReferencing,getCatalogueIndex,getCleanText,getExcludedMetaFilters,getKeywordsAndAppliedFiltersFromText,getMetaFilters,getNormalizedText,getOtherPitches,getReferencedCards,getTextWithoutMarkup,getTokensReferencedByCards,multiWordShorthands,shorthands,singleWordShorthands});
|
package/dist/searchIndex.d.ts
CHANGED
|
@@ -4,40 +4,46 @@ import { Card, CardRole, DoubleSidedCard } from "@flesh-and-blood/types";
|
|
|
4
4
|
* cards carry, and what each card is for. Every relation is identifier-level,
|
|
5
5
|
* so a card named at one pitch answers for that pitch alone; widening a
|
|
6
6
|
* relation to the whole name is the reader's rule rather than the corpus's.
|
|
7
|
-
* Every list
|
|
8
|
-
*
|
|
7
|
+
* Every list-returning read but `getCreatedClosure` and `getCardsInCorpusOrder`
|
|
8
|
+
* answers with a list the index holds, the same one on each call for the same
|
|
9
|
+
* argument and never a copy, so a reader that reorders or grows one works on a
|
|
10
|
+
* copy of its own. Those two build a fresh array for each call.
|
|
9
11
|
*/
|
|
10
|
-
export interface CatalogueIndex {
|
|
11
|
-
cards: readonly
|
|
12
|
-
getCard: (cardIdentifier: string) =>
|
|
12
|
+
export interface CatalogueIndex<CardType extends DoubleSidedCard = DoubleSidedCard> {
|
|
13
|
+
cards: readonly CardType[];
|
|
14
|
+
getCard: (cardIdentifier: string) => CardType | undefined;
|
|
13
15
|
/** Every pitch of the card's name, the card itself among them. */
|
|
14
|
-
getPitchCycle: (cardIdentifier: string) => readonly
|
|
16
|
+
getPitchCycle: (cardIdentifier: string) => readonly CardType[];
|
|
15
17
|
/**
|
|
16
18
|
* Every pitch of the named card. An exact name wins; failing that the first
|
|
17
19
|
* name the corpus carries containing the text answers, so a fragment
|
|
18
20
|
* resolves to one card.
|
|
19
21
|
*/
|
|
20
|
-
getCardsByName: (name: string) => readonly
|
|
22
|
+
getCardsByName: (name: string) => readonly CardType[];
|
|
21
23
|
/** The cards the card is printed on the back of. */
|
|
22
|
-
getOppositeSide: (cardIdentifier: string) => readonly
|
|
24
|
+
getOppositeSide: (cardIdentifier: string) => readonly CardType[];
|
|
23
25
|
/** The cards the card names. */
|
|
24
|
-
getReferences: (cardIdentifier: string) => readonly
|
|
26
|
+
getReferences: (cardIdentifier: string) => readonly CardType[];
|
|
25
27
|
/** The cards naming the card. */
|
|
26
|
-
getReferencedBy: (cardIdentifier: string) => readonly
|
|
28
|
+
getReferencedBy: (cardIdentifier: string) => readonly CardType[];
|
|
27
29
|
/** The extras the card brings into play. */
|
|
28
|
-
getCreates: (cardIdentifier: string) => readonly
|
|
30
|
+
getCreates: (cardIdentifier: string) => readonly CardType[];
|
|
29
31
|
/** The cards bringing the card into play. */
|
|
30
|
-
getCreatedBy: (cardIdentifier: string) => readonly
|
|
32
|
+
getCreatedBy: (cardIdentifier: string) => readonly CardType[];
|
|
31
33
|
/**
|
|
32
34
|
* What the cards bring into play, what those creations create, and on down
|
|
33
35
|
* the chain. A card joins the answer only when something the walk reaches
|
|
34
36
|
* creates it, so a card asked about appears only if the chain circles back
|
|
35
37
|
* to it.
|
|
36
38
|
*/
|
|
37
|
-
getCreatedClosure: (cardIdentifiers: string[]) =>
|
|
38
|
-
getByRole: (role: CardRole) => readonly
|
|
39
|
+
getCreatedClosure: (cardIdentifiers: string[]) => CardType[];
|
|
40
|
+
getByRole: (role: CardRole) => readonly CardType[];
|
|
39
41
|
/** The cards handed in, as a new array in the order the corpus holds them. */
|
|
40
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Generic in what it orders rather than tied to the index's card type, so an
|
|
44
|
+
* index over a richer card type still satisfies the plain interface.
|
|
45
|
+
*/
|
|
46
|
+
getCardsInCorpusOrder: <OrderedCard extends DoubleSidedCard>(cardsToOrder: readonly OrderedCard[]) => OrderedCard[];
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
43
49
|
* The index for a corpus, one per array, so everything reading the same cards
|
|
@@ -45,7 +51,7 @@ export interface CatalogueIndex {
|
|
|
45
51
|
* array is treated as immutable from that first read on: a caller that changes
|
|
46
52
|
* which cards the catalogue holds builds a new array.
|
|
47
53
|
*/
|
|
48
|
-
export declare const getCatalogueIndex: (cards:
|
|
54
|
+
export declare const getCatalogueIndex: <CardType extends DoubleSidedCard = DoubleSidedCard>(cards: readonly CardType[]) => CatalogueIndex<CardType>;
|
|
49
55
|
/** {@link CatalogueIndex.getCardsByName}, as a free function over an index. */
|
|
50
56
|
export declare const getCardsByName: (index: CatalogueIndex, name: string) => readonly DoubleSidedCard[];
|
|
51
57
|
/** The cards naming the card, at every pitch of both. */
|
package/dist/searchIndex.js
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
} from "@flesh-and-blood/types";
|
|
6
6
|
import { getCleanText } from "./helpers.js";
|
|
7
7
|
const catalogueIndexByCards = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
const noCards = Object.freeze([]);
|
|
9
|
+
const strayCorpusPosition = Number.MAX_SAFE_INTEGER;
|
|
8
10
|
const getNamingCardsByNamedCardIdentifier = (cards, getNamedCardIdentifiers) => {
|
|
9
11
|
const namingCardsByNamedCardIdentifier = /* @__PURE__ */ new Map();
|
|
10
12
|
for (const card of cards) {
|
|
@@ -72,7 +74,7 @@ const getNewCatalogueIndex = (cards) => {
|
|
|
72
74
|
};
|
|
73
75
|
const getCardsInCorpusOrder = (cardsToOrder) => {
|
|
74
76
|
const { corpusPositionByCardIdentifier } = getCardLookups();
|
|
75
|
-
const getCorpusPosition = ({ cardIdentifier }) => corpusPositionByCardIdentifier.get(cardIdentifier)
|
|
77
|
+
const getCorpusPosition = ({ cardIdentifier }) => corpusPositionByCardIdentifier.get(cardIdentifier) ?? strayCorpusPosition;
|
|
76
78
|
return [...cardsToOrder].sort(
|
|
77
79
|
(first, second) => getCorpusPosition(first) - getCorpusPosition(second)
|
|
78
80
|
);
|
|
@@ -89,16 +91,33 @@ const getNewCatalogueIndex = (cards) => {
|
|
|
89
91
|
}
|
|
90
92
|
return getCardsInCorpusOrder(namedCards);
|
|
91
93
|
};
|
|
94
|
+
const getNamedCardsReader = (getNamedCardIdentifiers) => {
|
|
95
|
+
const namedCardsByCardIdentifier = /* @__PURE__ */ new Map();
|
|
96
|
+
return (cardIdentifier) => {
|
|
97
|
+
let namedCards = namedCardsByCardIdentifier.get(cardIdentifier);
|
|
98
|
+
if (!namedCards) {
|
|
99
|
+
const card = getCard(cardIdentifier);
|
|
100
|
+
const cardsNamed = getNamedCards(card && getNamedCardIdentifiers(card));
|
|
101
|
+
const namesCards = cardsNamed.length > 0;
|
|
102
|
+
namedCards = namesCards ? cardsNamed : noCards;
|
|
103
|
+
if (namesCards) {
|
|
104
|
+
namedCardsByCardIdentifier.set(cardIdentifier, namedCards);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return namedCards;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
92
110
|
const getPitchCycle = (cardIdentifier) => {
|
|
93
111
|
const { pitchCycleByCleanedName } = getCardLookups();
|
|
94
112
|
const card = getCard(cardIdentifier);
|
|
95
|
-
return card ? pitchCycleByCleanedName.get(getCleanText(card.name))
|
|
113
|
+
return card ? pitchCycleByCleanedName.get(getCleanText(card.name)) ?? noCards : noCards;
|
|
96
114
|
};
|
|
97
115
|
const getCardsByName2 = (name) => {
|
|
98
116
|
const { cleanedNames, pitchCycleByCleanedName } = getCardLookups();
|
|
99
117
|
const cleanedName = getCleanText(name);
|
|
100
118
|
let pitchCycle = pitchCycleByCleanedName.get(cleanedName);
|
|
101
|
-
|
|
119
|
+
const canMatchFragment = !pitchCycle && cleanedName.length > 0;
|
|
120
|
+
if (canMatchFragment) {
|
|
102
121
|
const containingName = cleanedNames.find(
|
|
103
122
|
(candidate) => candidate.includes(cleanedName)
|
|
104
123
|
);
|
|
@@ -106,10 +125,14 @@ const getNewCatalogueIndex = (cards) => {
|
|
|
106
125
|
pitchCycle = pitchCycleByCleanedName.get(containingName);
|
|
107
126
|
}
|
|
108
127
|
}
|
|
109
|
-
return pitchCycle
|
|
128
|
+
return pitchCycle ?? noCards;
|
|
110
129
|
};
|
|
111
|
-
const getOppositeSide = (
|
|
112
|
-
|
|
130
|
+
const getOppositeSide = getNamedCardsReader(
|
|
131
|
+
({ oppositeSideCardIdentifiers }) => oppositeSideCardIdentifiers
|
|
132
|
+
);
|
|
133
|
+
const getReferences = getNamedCardsReader(
|
|
134
|
+
({ referencedCards }) => referencedCards
|
|
135
|
+
);
|
|
113
136
|
const getReferencedBy = (cardIdentifier) => {
|
|
114
137
|
if (!referencingCardsByCardIdentifier) {
|
|
115
138
|
referencingCardsByCardIdentifier = getNamingCardsByNamedCardIdentifier(
|
|
@@ -117,9 +140,9 @@ const getNewCatalogueIndex = (cards) => {
|
|
|
117
140
|
({ referencedCards }) => referencedCards
|
|
118
141
|
);
|
|
119
142
|
}
|
|
120
|
-
return referencingCardsByCardIdentifier.get(cardIdentifier)
|
|
143
|
+
return referencingCardsByCardIdentifier.get(cardIdentifier) ?? noCards;
|
|
121
144
|
};
|
|
122
|
-
const getCreates = (
|
|
145
|
+
const getCreates = getNamedCardsReader(({ createdExtras }) => createdExtras);
|
|
123
146
|
const getCreatedBy = (cardIdentifier) => {
|
|
124
147
|
if (!creatingCardsByCardIdentifier) {
|
|
125
148
|
creatingCardsByCardIdentifier = getNamingCardsByNamedCardIdentifier(
|
|
@@ -127,7 +150,7 @@ const getNewCatalogueIndex = (cards) => {
|
|
|
127
150
|
({ createdExtras }) => createdExtras
|
|
128
151
|
);
|
|
129
152
|
}
|
|
130
|
-
return creatingCardsByCardIdentifier.get(cardIdentifier)
|
|
153
|
+
return creatingCardsByCardIdentifier.get(cardIdentifier) ?? noCards;
|
|
131
154
|
};
|
|
132
155
|
const getCreatedClosure = (cardIdentifiers) => {
|
|
133
156
|
const createdCardByCardIdentifier = /* @__PURE__ */ new Map();
|
|
@@ -152,7 +175,7 @@ const getNewCatalogueIndex = (cards) => {
|
|
|
152
175
|
if (!cardsByRole) {
|
|
153
176
|
cardsByRole = getCardsByRole(cards);
|
|
154
177
|
}
|
|
155
|
-
return cardsByRole.get(role)
|
|
178
|
+
return cardsByRole.get(role) ?? noCards;
|
|
156
179
|
};
|
|
157
180
|
return {
|
|
158
181
|
cards,
|
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.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@flesh-and-blood/types": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@flesh-and-blood/cards": "^5.0.
|
|
49
|
+
"@flesh-and-blood/cards": "^5.0.1",
|
|
50
50
|
"@flesh-and-blood/types": "^5.0.0",
|
|
51
51
|
"@types/jest": "^29.5.11",
|
|
52
52
|
"@types/node": "^20.10.5",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"FAB",
|
|
78
78
|
"FABTCG"
|
|
79
79
|
],
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "7cc77e876fc187163ab15640b2452557d6a571c2"
|
|
81
81
|
}
|