From ba4d9a5085f31047292eec72bb0f574779fb9721 Mon Sep 17 00:00:00 2001 From: lauqerm Date: Mon, 30 Sep 2024 21:02:37 +0700 Subject: [PATCH] Updates --- asset-manifest.json | 6 +++--- index.html | 2 +- static/js/main.386f4d58.chunk.js | 2 ++ static/js/main.386f4d58.chunk.js.map | 1 + static/js/main.7ea04692.chunk.js | 2 -- static/js/main.7ea04692.chunk.js.map | 1 - 6 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 static/js/main.386f4d58.chunk.js create mode 100644 static/js/main.386f4d58.chunk.js.map delete mode 100644 static/js/main.7ea04692.chunk.js delete mode 100644 static/js/main.7ea04692.chunk.js.map diff --git a/asset-manifest.json b/asset-manifest.json index d1163b1..1262a21 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,8 +1,8 @@ { "files": { "main.css": "/ygocarder/static/css/main.f6bdbbbb.chunk.css", - "main.js": "/ygocarder/static/js/main.7ea04692.chunk.js", - "main.js.map": "/ygocarder/static/js/main.7ea04692.chunk.js.map", + "main.js": "/ygocarder/static/js/main.386f4d58.chunk.js", + "main.js.map": "/ygocarder/static/js/main.386f4d58.chunk.js.map", "runtime-main.js": "/ygocarder/static/js/runtime-main.63fcb15b.js", "runtime-main.js.map": "/ygocarder/static/js/runtime-main.63fcb15b.js.map", "static/css/2.371b2cfe.chunk.css": "/ygocarder/static/css/2.371b2cfe.chunk.css", @@ -20,6 +20,6 @@ "static/css/2.371b2cfe.chunk.css", "static/js/2.8abe8d92.chunk.js", "static/css/main.f6bdbbbb.chunk.css", - "static/js/main.7ea04692.chunk.js" + "static/js/main.386f4d58.chunk.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index a228fb9..9fc744f 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Yugioh Carder
\ No newline at end of file +Yugioh Carder
\ No newline at end of file diff --git a/static/js/main.386f4d58.chunk.js b/static/js/main.386f4d58.chunk.js new file mode 100644 index 0000000..3c15317 --- /dev/null +++ b/static/js/main.386f4d58.chunk.js @@ -0,0 +1,2 @@ +(this.webpackJsonpygocarder=this.webpackJsonpygocarder||[]).push([[0],{222:function(e,t,n){},224:function(e,t,n){},225:function(e,t,n){},226:function(e,t,n){},227:function(e,t,n){},241:function(e,t,n){},272:function(e,t,n){},273:function(e,t,n){},274:function(e,t,n){},275:function(e,t,n){},383:function(e,t,n){},389:function(e,t,n){},390:function(e,t,n){},391:function(e,t,n){},407:function(e,t,n){"use strict";n.r(t);var r,a=n(1),o=n(0),i=n.n(o),c=n(30),l=n.n(c),s=(n(222),n(2)),u=n(11),d=(n(223),n(224),n(225),n(226),n(227),813),f=1185,b=210,p=912,m=52,h="#404040",g=function(){return{body:100,pendulum:100,text:100,name:100,baseFill:h,artBorder:!0,nameBorder:!0,boundless:!1}},v={normal:{artFinishX:100,artFinishY:219,artWidth:614,artX:100,artY:219,ratio:1,type:"normal"},pendulum:{artFinishX:56,artFinishY:213,artWidth:702,artX:56,artY:213,ratio:1.325,type:"pendulum"},extendedCard:{artFinishX:100,artFinishY:219,artWidth:702,artX:56,artY:213,ratio:.775,type:"extendedCard"},extendedPendulum:{artFinishX:56,artFinishY:213,artWidth:702,artX:56,artY:213,ratio:.775,type:"extendedPendulum"},truePendulum:{artFinishX:56,artFinishY:213,artWidth:702,artX:56,artY:213,ratio:1.057,type:"truePendulum"},fullCard:{artFinishX:100,artFinishY:219,artWidth:758,artX:28,artY:28,ratio:.67,type:"fullCard"},fullPendulum:{artFinishX:56,artFinishY:213,artWidth:758,artX:28,artY:28,ratio:.67,type:"fullPendulum"}},x=function(e,t,n){var r=Object(s.a)(Object(s.a)({},g()),t),a=r.boundless,o=r.body,i=r.pendulum,c=r.text;return"full"===n?v.fullCard:v["fit"!==n&&a||o<100?e?"fullPendulum":"fullCard":e?c<100?"extendedPendulum":i<100?"truePendulum":"pendulum":c<100?"extendedCard":"normal"]},j=n(423),y="NONE",O=[{name:y,nameKey:"input.attribute.none",color:"#000000"},{name:"DARK",nameKey:"input.attribute.dark",label:"Dark",color:"#b41dda"},{name:"EARTH",nameKey:"input.attribute.earth",label:"Earth",color:"#8d8e8e"},{name:"FIRE",nameKey:"input.attribute.fire",label:"Fire",color:"#e51b23"},{name:"LIGHT",nameKey:"input.attribute.light",label:"Light",color:"#bfae32"},{name:"WATER",nameKey:"input.attribute.water",label:"Water",color:"#008ecd"},{name:"WIND",nameKey:"input.attribute.wind",label:"Wind",color:"#28ab35"},{name:"DIVINE",nameKey:"input.attribute.divine",label:"Divine",color:"#ef6300"},{name:"SPELL",nameKey:"input.attribute.spell",label:"Spell",color:"#1b8f83"},{name:"TRAP",nameKey:"input.attribute.trap",label:"TRAP",color:"#c32a8c"}],w="NO ICON",k=[{label:Object(a.jsx)(j.a,{}),value:w,nameKey:"input.icon.none"},{label:"Field",value:"FIELD",nameKey:"input.icon.field"},{label:"Continuous",value:"CONTINUOUS",nameKey:"input.icon.continuous"},{label:"Quick-Play",value:"QUICK-PLAY",nameKey:"input.icon.quick-play"},{label:"Ritual",value:"RITUAL",nameKey:"input.icon.ritual"},{label:"Equip",value:"EQUIP",nameKey:"input.icon.equip"},{label:"Counter",value:"COUNTER",nameKey:"input.icon.counter"}],F=function(e){return Object(s.a)({hasGradient:!1,hasOutline:!1,hasShadow:!1,pattern:"none"},e)},C={commonB:{key:"commonB",label:"Common (Black)",image:"asset/image/other/name-common-b.png",value:F({preset:"commonB",fillStyle:"#000000"})},commonW:{key:"commonW",label:"Common (White)",image:"asset/image/other/name-common-w.png",value:F({preset:"commonW",fillStyle:"#ffffff"})},skillDefault:{key:"skillDefault",label:"Skill (Default)",image:"asset/image/other/name-skill-default.png",value:F({preset:"skillDefault",fillStyle:"#ffffff",lineWidth:6,lineColor:"#000",hasOutline:!0})},skillArial:{key:"skillArial",label:"Skill (Arial)",image:"asset/image/other/name-skill-arial.png",value:F({preset:"skillArial",font:"Arial",fillStyle:"#ffffff",lineWidth:6,lineColor:"#000",lineOffsetX:1,hasOutline:!0})},rare:{key:"rare",label:"Rare",image:"asset/image/other/name-rare.png",value:F({preset:"rare",fillStyle:"#cfc6de"})},secretGradient:{key:"secretGradient",label:"Secret (Gradient)",image:"asset/image/other/name-secret-gradient.png",value:F({preset:"secretGradient",gradientAngle:180,gradientColor:"0.000|#7a71a6,1.000|#a8c1e5",hasGradient:!0})},secret:{key:"secret",label:"Secret",image:"asset/image/other/name-secret.png",value:F({preset:"secret",fillStyle:"#8a8381"})},platinum2:{key:"platinum2",label:"Platinum",image:"asset/image/other/name-platinum.png",value:F({preset:"platinum2",fillStyle:"#a49f9e"})},ultra:{key:"ultra",label:"Ultra",image:"asset/image/other/name-ultra.png",value:F({preset:"ultra",fillStyle:"#dbb473"})},ultra2:{key:"ultra2",label:"Ultra (Type 2)",image:"asset/image/other/name-ultra-2.png",value:F({preset:"ultra2",fillStyle:"#fee002"})},platinum:{key:"platinum",label:"Foil Platinum",image:"asset/image/other/name-foil-platinum.png",value:F({preset:"platinum",fillStyle:"#CCCCCC",shadowColor:"#FFFFFF",shadowOffsetY:1,shadowOffsetX:0,shadowBlur:1,hasShadow:!0})},gold:{key:"gold",label:"Foil Gold",image:"asset/image/other/name-foil-gold.png",value:F({preset:"gold",fillStyle:"#b88c43",shadowColor:"#FCC400",shadowOffsetY:1,shadowOffsetX:0,shadowBlur:1,hasShadow:!0})},animeRed:{key:"animeRed",label:"Anime (Type Red)",image:"asset/image/other/name-anime-red.png",value:F({preset:"animeRed",gradientAngle:180,gradientColor:"0.000|#d81961,0.220|#b81654,0.270|#9e1348,0.330|#95093e,0.380|#95093e,0.450|#ba3264,0.530|#ff5e99,0.620|#ffa0c3,0.690|#ffffff,0.770|#ff5e99,0.870|#d81961,1.000|#b81654",hasGradient:!0,hasOutline:!0,hasShadow:!0,lineColor:"#333333",lineOffsetX:1,lineOffsetY:0,lineWidth:3,shadowBlur:2,shadowColor:"#383838",shadowOffsetX:2,shadowOffsetY:3})},animeSilver:{key:"animeSilver",label:"Anime (Type Silver)",image:"asset/image/other/name-anime-silver.png",value:F({preset:"animeSilver",shadowColor:"#383838",shadowOffsetY:3,shadowOffsetX:2,shadowBlur:2,hasShadow:!0,lineColor:"#333333",lineWidth:3,lineOffsetX:1,lineOffsetY:0,hasOutline:!0,gradientAngle:180,gradientColor:"0.000|#cecbb8,0.220|#b0ad9b,0.270|#94917e,0.330|#797768,0.380|#797768,0.450|#d9d9d9,0.610|#ffffff,0.700|#ffffff,0.870|#d6d7c7,1.000|#c9cbb6",hasGradient:!0})},animeGold:{key:"animeGold",label:"Anime (Type Gold)",image:"asset/image/other/name-anime-gold.png",value:F({preset:"animeGold",shadowColor:"#383838",shadowOffsetY:3,shadowOffsetX:2,shadowBlur:2,hasShadow:!0,lineColor:"#333333",lineWidth:3,lineOffsetX:1,lineOffsetY:0,hasOutline:!0,gradientAngle:180,gradientColor:"0.000|#eee317,0.220|#dbbe15,0.270|#d0920c,0.330|#b57f0b,0.380|#d0920c,0.450|#ffff6b,0.610|#ffffff,0.700|#ffffff,0.870|#e5dd2d,1.000|#e3da23",hasGradient:!0})},promo:{key:"promo",label:"Promo",image:"asset/image/other/name-promo.png",value:F({preset:"promo",fillStyle:"#c7080b",shadowColor:"#333333",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:1,hasShadow:!0,lineColor:"#8a1801",lineWidth:3,lineOffsetX:0,hasOutline:!0,lineOffsetY:0})}},S=Object.values(C),T={none:{key:"none",patternImage:"",blendMode:"source-atop"},type1:{key:"type1",patternImage:"finish-name-type1",blendMode:"source-atop"},type2:{key:"type2",patternImage:"finish-name-type2",blendMode:"source-atop"},type3:{key:"type3",patternImage:"finish-name-type3",blendMode:"source-atop"},type4:{key:"type4",patternImage:"finish-name-type4",blendMode:"source-atop"},type5:{key:"type5",patternImage:"finish-name-type5",blendMode:"multiply",overrideFill:!0},type6:{key:"type6",patternImage:"finish-name-type6",blendMode:"source-atop"},type7:{key:"type7",patternImage:"finish-name-type7",blendMode:"lighter",overrideFill:!0},type8:{key:"type8",patternImage:"finish-name-type8",blendMode:"source-atop"},type9:{key:"type9",patternImage:"finish-name-type9",blendMode:"source-atop"}},R=Object.values(T),N={tcg:[{trueWidth:684,trueBaseline:890.23,trueEdge:64.8}],"tcg-stat":[{trueWidth:684,trueBaseline:890.23,trueEdge:64.8}],"tcg-type-stat":[{trueWidth:684,trueBaseline:919.8,trueEdge:64.5}],"tcg-type":[{trueWidth:684,trueBaseline:921.8,trueEdge:64.5}],ocg:[{trueWidth:684,trueBaseline:895.23,trueEdge:64.8}],"ocg-stat":[{trueWidth:684,trueBaseline:891.23,trueEdge:64.8}],"ocg-type-stat":[{trueWidth:684,trueBaseline:918.5,trueEdge:64.5}],"ocg-type":[{trueWidth:684,trueBaseline:918.5,trueEdge:64.5}]},L=[{trueWidth:555.47,trueBaseline:746.29,trueEdge:128.94},{trueWidth:555.47,trueBaseline:746.29,trueEdge:128.94}],M={tcg:{small:{trueBaseline:919,trueEdge:62.5,trueWidth:684.5},medium:{trueBaseline:920,trueEdge:62.5,trueWidth:684.5},large:{trueBaseline:187.5,trueEdge:732,edgeAlignment:"right",trueWidth:648.5}},ocg:{small:{trueBaseline:917,trueEdge:63.7,trueWidth:684.5},medium:{trueBaseline:917,trueEdge:63.7,trueWidth:684.5},large:{trueBaseline:190.5,trueEdge:728,edgeAlignment:"right",trueWidth:642.5}}},E={ocg:{trueBaseline:1146.5,trueEdge:736,trueWidth:435},tcg:{trueBaseline:1149.5,trueEdge:733,trueWidth:380}},I={ocg:{trueBaseline:1148.931,trueEdge:37.031,trueWidth:255},tcg:{trueBaseline:1149.431,trueEdge:37.031,trueWidth:311}},A=[{shortForm:"\u7279\u6b8a\u53ec\u559a",rubyForm:"{\u7279|\u3068\u304f}{\u6b8a|\u3057\u3085}{\u53ec|\u3057\u3087\u3046}{\u559a|\u304b\u3093}"},{shortForm:"\u30ab\u30fc\u30c9",rubyForm:"{\u30ab\u30fc\u30c9}"},{shortForm:"\u30c7\u30e5\u30a8\u30eb",rubyForm:"{\u30c7\u30e5\u30a8\u30eb}"},{shortForm:"\u30de\u30c3\u30c1",rubyForm:"{\u30de\u30c3\u30c1}"},{shortForm:"\u30bf\u30fc\u30f3",rubyForm:"{\u30bf\u30fc\u30f3}"},{shortForm:"\u30d7\u30ec\u30a4\u30e4\u30fc",rubyForm:"{\u30d7\u30ec\u30a4\u30e4\u30fc}"},{shortForm:"\u81ea\u5206",rubyForm:"{\u81ea|\u3058}{\u5206|\u3076\u3093}"},{shortForm:"\u76f8\u624b",rubyForm:"{\u76f8|\u3042\u3044}{\u624b|\u3066}"},{shortForm:"LP",regexForm:"(?","\uff01":"!","\uff08":"(","\uff09":")","\uff06":"&","\uff07":"'","\uff20":"@"},se={"\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff41":"a","\uff42":"b","\uff43":"c","\uff44":"d","\uff45":"e","\uff46":"f","\uff47":"g","\uff48":"h","\uff49":"i","\uff4a":"j","\uff4b":"k","\uff4c":"l","\uff4d":"m","\uff4e":"n","\uff4f":"o","\uff50":"p","\uff51":"q","\uff52":"r","\uff53":"s","\uff54":"t","\uff55":"u","\uff56":"v","\uff57":"w","\uff58":"x","\uff59":"y","\uff5a":"z","\uff21":"A","\uff22":"B","\uff23":"C","\uff24":"D","\uff25":"E","\uff26":"F","\uff27":"G","\uff28":"H","\uff29":"I","\uff2a":"J","\uff2b":"K","\uff2c":"L","\uff2d":"M","\uff2e":"N","\uff2f":"O","\uff30":"P","\uff31":"Q","\uff32":"R","\uff33":"S","\uff34":"T","\uff35":"U","\uff36":"V","\uff37":"W","\uff38":"X","\uff39":"Y","\uff3a":"Z","\uff62":"\u300c","\uff63":"\u300d","\uff64":"\u3001","\uff1a":":","\u2200":"\u2c6f","\ua4ef":"\u2c6f","\ua4db":"\u0186","\ua4f1":"\u018e","\ua4de":"\u2132","\ua4e8":"\u2141","\ua4d8":"\ua7b0","\ua4f6":"\ua780","\u2142":"\ua780","\ua4d2":"\u0500","\ua4d5":"\ua7b1","\u0548":"\ua4f5","\ua4e5":"\u0245","\uff1c":"<","\uff1e":">","\uff01":"!","\uff08":"(","\uff09":")","\uff06":"&","\uff07":"'","\uff20":"@"},ue={"(\uff11)":"\u2460","(\uff12)":"\u2461","(\uff13)":"\u2462","(\uff14)":"\u2463","(\uff15)":"\u2464","(\uff16)":"\u2465","(\uff17)":"\u2466","(\uff18)":"\u2467","(\uff19)":"\u2468","(\uff11\uff10)":"\u2469","(\uff11\uff11)":"\u246a","(\uff11\uff12)":"\u246b","(\uff11\uff13)":"\u246c","(\uff11\uff14)":"\u246d","(\uff11\uff15)":"\u246e","(\uff11\uff16)":"\u246f","(\uff11\uff17)":"\u2470","(\uff11\uff18)":"\u2471","(\uff11\uff19)":"\u2472","(\uff12\uff10)":"\u2473","(1)":"\u2460","(2)":"\u2461","(3)":"\u2462","(4)":"\u2463","(5)":"\u2464","(6)":"\u2465","(7)":"\u2466","(8)":"\u2467","(9)":"\u2468","(10)":"\u2469","(11)":"\u246a","(12)":"\u246b","(13)":"\u246c","(14)":"\u246d","(15)":"\u246e","(16)":"\u246f","(17)":"\u2470","(18)":"\u2471","(19)":"\u2472","(20)":"\u2473"},de=(r={"\u6c34\u65cf":"Aqua","\u7363\u65cf":"Beast","\u7363\u6226\u58eb\u65cf":"Beast-Warrior","\u5275\u9020\u795e\u65cf":"Creator God","\u30b5\u30a4\u30d0\u30fc\u30b9\u65cf":"Cyberse","\u6050\u7adc\u65cf":"Dinosaur","\u5e7b\u795e\u7363\u65cf":"Divine-Beast","\u30c9\u30e9\u30b4\u30f3\u65cf":"Dragon","\u5929\u4f7f\u65cf":"Fairy","\u60aa\u9b54\u65cf":"Fiend","\u9b5a\u65cf":"Fish","\u30ae\u30e3\u30e9\u30af\u30b7\u30fc\u65cf":"Galaxy","\u5e7b\u60f3\u9b54\u65cf":"Illusion","\u6606\u866b\u65cf":"Insect","\u6a5f\u68b0\u65cf":"Machine","\u690d\u7269\u65cf":"Plant","\u30b5\u30a4\u30ad\u30c3\u30af\u65cf":"Psychic","\u708e\u65cf":"Pyro","\u722c\u866b\u985e\u65cf":"Reptile","\u5ca9\u77f3\u65cf":"Rock","\u6d77\u7adc\u65cf":"Sea Serpent","\u9b54\u6cd5\u4f7f\u3044\u65cf":"Spellcaster","\u96f7\u65cf":"Thunder","\u6226\u58eb\u65cf":"Warrior","\u9ce5\u7363\u65cf":"Winged Beast","\u5e7b\u7adc\u65cf":"Wyrm","\u30a2\u30f3\u30c7\u30c3\u30c8\u65cf":"Zombie","\u30b5\u30a4\u30dc\u30fc\u30b0\u65cf":"Cyborg","\u5929\u754c\u6226\u58eb\u65cf":"Celestial Warrior","\u30cf\u30a4\u30c9\u30e9\u30b4\u30f3\u65cf":"High Dragon","\u9b54\u5c0e\u9a0e\u58eb\u65cf":"Magical Knight","\u30aa\u30e1\u30ac\u30b5\u30a4\u30ad\u30c3\u30af\u65cf":"Omega Psychic","\u30e2\u30f3\u30b9\u30bf\u30fc":"Monster","\u9b54\u6cd5\u30ab\u30fc\u30c9":"Spell Card","\u7f60\u30ab\u30fc\u30c9":"Trap Card","\u30a2\u30af\u30b7\u30e7\u30f3":"Action","\u901a\u5e38":"Normal","\u52b9\u679c":"Effect","\u5100\u5f0f":"Ritual","\u30d5\u30e5\u30fc\u30b8\u30e7\u30f3":"Fusion","\u878d\u5408":"Fusion","\u30b7\u30f3\u30af\u30ed":"Synchro","\u30a8\u30af\u30b7\u30fc\u30ba":"Xyz","\u30da\u30f3\u30c7\u30e5\u30e9\u30e0":"Pendulum","\u30ea\u30f3\u30af":"Link","\u30de\u30ad\u30b7\u30de\u30e0":"Maximum","\u30c8\u30fc\u30af\u30f3":"Token","\u7279\u6b8a\u53ec\u559a":"Special Summon","\u30c0\u30fc\u30af\u30b7\u30f3\u30af\u30ed\u30e2\u30f3\u30b9\u30bf\u30fc":"Dark Synchro","\u30c1\u30e5\u30fc\u30ca\u30fc":"Tuner","\u30c7\u30e5\u30a2\u30eb":"Gemini","\u30ea\u30d0\u30fc\u30b9":"Flip","\u30c8\u30a5\u30fc\u30f3":"Toon","\u30b9\u30d4\u30ea\u30c3\u30c8":"Spirit","\u30e6\u30cb\u30aa\u30f3":"Union","\xa9\u9ad8\u6a4b\u548c\u5e0c \u30b9\u30bf\u30b8\u30aa\u30fb\u30c0\u30a4\u30b9\uff0f\u96c6\u82f1\u793e":"\xa91996 KAZUKI TAKAHASHI","\xa9\u30b9\u30bf\u30b8\u30aa\u30fb\u30c0\u30a4\u30b9\uff0f\u96c6\u82f1\u793e\u30fb\u30c6\u30ec\u30d3\u6771\u4eac\u30fbKONAMI":"\xa92020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI","{\u7d14|\u30b8\u30e5\u30f3}{\u72d0|\u3053}":"Junko"},Object(ce.a)(r,"\u81ea\u5206\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u52b9\u679c\u30e2\u30f3\u30b9\u30bf\u30fc\xd7\uff12\u4f53\u4ee5\u4e0a\n\u2460\uff1a\u3053\u306e\u30ab\u30fc\u30c9\u304c\u30e2\u30f3\u30b9\u30bf\u30fc\u30be\u30fc\u30f3\u306b\u5b58\u5728\u3059\u308b\u9650\u308a\u3001\u76f8\u624b\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30e2\u30f3\u30b9\u30bf\u30fc\u304c\u52b9\u679c\u3092\u767a\u52d5\u3059\u308b\u5ea6\u306b\u3001\u305d\u306e\u76f8\u624b\u306e\u8868\u5074\u8868\u793a\u30e2\u30f3\u30b9\u30bf\u30fc\u306b\u30d4\u30e5\u30a2\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\uff11\u3064\u7f6e\u304f(\u6700\u5927\uff11\u3064\u307e\u3067\uff09\u3002\u2461\uff1a\u3053\u306e\u30ab\u30fc\u30c9\u306f\u30d4\u30e5\u30a2\u30ab\u30a6\u30f3\u30bf\u30fc\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30e2\u30f3\u30b9\u30bf\u30fc\u304c\u767a\u52d5\u3057\u305f\u52b9\u679c\u3092\u53d7\u3051\u306a\u3044\u3002\u2462\uff1a\u3053\u306e\u30ab\u30fc\u30c9\u306f\u30d4\u30e5\u30a2\u30ab\u30a6\u30f3\u30bf\u30fc\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30e2\u30f3\u30b9\u30bf\u30fc\u3068\u306e\u6226\u95d8\u3067\u306f\u7834\u58ca\u3055\u308c\u306a\u3044\u3002","[2+ Effect Monsters on your field]\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter."),Object(ce.a)(r,"\u203b\u516c\u5f0f\u306e\u30c7\u30e5\u30a8\u30eb\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002","This card cannot be used in a Duel."),Object(ce.a)(r,"\u2460\uff1a\uff11\u30bf\u30fc\u30f3\u306b\uff11\u5ea6\u3001\uff18\uff10\uff10\uff2c\uff30\u3092\u6255\u3063\u3066\u767a\u52d5\u3067\u304d\u308b\u3002\u3053\u306e\u30ab\u30fc\u30c9\u306e\uff30\u30b9\u30b1\u30fc\u30eb\u30921\u3064\u4e0a\u3052\u308b\u3002","Once per turn: You can pay 800 LP, increase this card's Pendulum Scale by 1."),r),fe=Object.entries(de).reduce((function(e,t){var n=Object(u.a)(t,2),r=n[0];return e[n[1]]=r,e}),{"Once per turn: You can pay 800 LP, increase this card\u2019s Pendulum Scale by 1.":"\u2460\uff1a\uff11\u30bf\u30fc\u30f3\u306b\uff11\u5ea6\u3001\uff18\uff10\uff10\uff2c\uff30\u3092\u6255\u3063\u3066\u767a\u52d5\u3067\u304d\u308b\u3002\u3053\u306e\u30ab\u30fc\u30c9\u306e\uff30\u30b9\u30b1\u30fc\u30eb\u30921\u3064\u4e0a\u3052\u308b\u3002"}),be={normal:{name:"normal",nameKey:"input.frame.normal",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#c49c5e"},effect:{name:"effect",nameKey:"input.frame.effect",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#b96c49"},fusion:{name:"fusion",nameKey:"input.frame.fusion",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#8948a4"},synchro:{name:"synchro",nameKey:"input.frame.synchro",labelColor:"#000",edition:"normal",labelBackgroundColor:"#efefef"},xyz:{name:"xyz",nameKey:"input.frame.xyz",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#000000"},link:{name:"link",nameKey:"input.frame.link",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#0c8ac6"},ritual:{name:"ritual",nameKey:"input.frame.ritual",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#5e85c9"},spell:{name:"spell",nameKey:"input.frame.spell",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#1b8f83"},trap:{name:"trap",nameKey:"input.frame.trap",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#c32a8c"},token:{name:"token",nameKey:"input.frame.token",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#6f6c6b"},"dark-synchro":{name:"dark-synchro",nameKey:"input.frame.dark-synchro",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#4d4543"},obelisk:{name:"obelisk",nameKey:"input.frame.obelisk",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#515eb0"},osiris:{name:"osiris",nameKey:"input.frame.osiris",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#bd5044"},ra:{name:"ra",nameKey:"input.frame.ra",labelColor:"#000",edition:"extendend",labelBackgroundColor:"#b9ad34"},raviel:{name:"raviel",nameKey:"input.frame.raviel",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#313c5f"},uria:{name:"uria",nameKey:"input.frame.uria",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#623320"},hamon:{name:"hamon",nameKey:"input.frame.hamon",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#534a19"},"lg-dragon":{name:"lg-dragon",nameKey:"input.frame.lg-dragon",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#4e84a4"},"speed-skill":{name:"speed-skill",nameKey:"input.frame.speed-skill",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#199cd5"},zarc:{name:"zarc",nameKey:"input.frame.zarc",labelColor:"#000",edition:"extendend",labelBackgroundColorList:["rgba(185,108,73,1)","rgba(137,72,164,1)","rgba(239,239,239,1)","rgba(0,0,0,1)"],labelBackgroundImage:"linear-gradient(90deg, ".concat(["rgba(185,108,73,1) 23%","rgba(137,72,164,1) 27%","rgba(137,72,164,1) 48%","rgba(239,239,239,1) 52%","rgba(239,239,239,1) 73%","rgba(0,0,0,1) 77%"].join(", "),")")}},pe=Object.values(be),me=[{top:175,left:55,width:100,height:100},{top:165,left:323,width:170,height:80},{top:175,left:655,width:100,height:100},{top:442,left:45,width:70,height:170},{top:0,left:0,width:0,height:0},{top:442,left:700,width:70,height:170},{top:775,left:55,width:100,height:100},{top:810,left:323,width:170,height:80},{top:775,left:655,width:100,height:100}],he=new RegExp("[A-Z\uff21-\uff3a]"),ge=new RegExp("[\\[\\]\u3010\u3011]"),ve="[#@\u221ea-z\uff41-\uff5aA-Z\uff21-\uff3a0-9\uff10-\uff19!\uff01+\xd7\uff03#@\u221e\u2018\u201c\u2019\u201d:;\\[\\]\\(\\)\u3010\u3011\\.,]+",xe=new RegExp(ve),je=new RegExp("({[^{}]+?}|".concat(ve,"|.)")),ye="\u2989",Oe="\u298a",we="\u27c5",ke="\u27c6",Fe="\u27ec",Ce="\u27ed",Se=new RegExp("[".concat([ye,Oe,we,ke,Fe,Ce].join(""),"]|(\\|[^}]+})"),"g"),Te="".concat(ye,"|").concat(Oe),Re=new RegExp(Te),Ne="(\\n^[\\r\\t\\f\\v \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*\\n".concat(ye,"?\\([\\w\\W]+\\)").concat(Oe,"?)\\s*$"),Le=new RegExp("[".concat("#\u2605@\u221e","]")),Me=A.map((function(e){var t;return null!==(t=e.regexForm)&&void 0!==t?t:e.shortForm})).join("|"),Ee="(".concat(Me,")(?![^{]*})"),Ie="\u30fd\u30fe\u30fc\u30a1\u30a3\u30a5\u30a7\u30a9\u30c3\u30e3\u30e5\u30e7\u30ee\u30f5\u30f6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308e\u3095\u3096\u31f0\u31f1\u31f2\u31f3\u31f4\u31f5\u31f6\u31f7\u31f8\u31f9\u31fa\u31fb\u31fc\u31fd\u31fe\u31ff\u3005\u303b",Ae=new RegExp("[".concat(Ie,"]")),Be=".[".concat(Ie,")\\]\uff5d\u3015\u3009\u300b\u300d\uff63\u300f\u3011\u3019\u3017\u301f'\"\u2019\u201d\uff60\xbb\u2010\u30a0\u2013\u301c\uff1f!\u203c\u2047\u2048\u2049\u30fb\u3001:;,\u3002.\uff61\uff64]+"),We=new RegExp("[\u2460-\u2473\u203b]"),Pe=new RegExp("[\uff21-\uff3a\uff41-\uff5a]"),De=new RegExp("[\uff10-\uff19]"),ze=new RegExp("[0-9]"),He=/[\u3042\u3044\u3046\u3048\u304a\u304b\u304c\u304d\u304e\u304f\u3050\u3051\u3052\u3053\u3054\u3055\u3056\u3057\u3058\u3059\u305a\u305b\u305c\u305d\u305e\u305f\u3060\u3061\u3062\u3064\u3065\u3066\u3067\u3068\u3069\u306a\u306b\u306c\u306d\u306e\u306f\u3070\u3071\u3072\u3073\u3074\u3075\u3076\u3077\u3078\u3079\u307a\u307b\u307c\u307d\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a\u308b\u308c\u308d\u308f\u3090\u3091\u3092\u3093\u3094]/,Ke=/[\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ac\u30ad\u30ae\u30af\u30b0\u30b1\u30b2\u30b3\u30b4\u30b5\u30b6\u30b7\u30b8\u30b9\u30ba\u30bb\u30bc\u30bd\u30be\u30bf\u30c0\u30c1\u30c2\u30c4\u30c5\u30c6\u30c7\u30c8\u30c9\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d0\u30d1\u30d2\u30d3\u30d4\u30d5\u30d6\u30d7\u30d8\u30d9\u30da\u30db\u30dc\u30dd\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea\u30eb\u30ec\u30ed\u30ef\u30f0\u30f1\u30f2\u30f3\u30f4\u30f7\u30f8\u30f9\u30fa]/,Ge=new RegExp("[\u30fb]"),Ye=new RegExp("[\u30fc]"),Xe=new RegExp("[\u2015]"),Ve=new RegExp("[".concat("\uff1a","]")),Ue=new RegExp("[".concat("\u3002\uff64","]")),qe=new RegExp("[".concat("\uff1a","]")),Je={"\u3002":-.2,"\uff64":-.2,"\uff62":0,"\uff63":0,"\uff1a":0,">":.25,"<":-.25},$e={"\u3002":-.5,"\uff1a":-.25},_e={">":.125,"<":.125},Ze={"\\":-.025},Qe={},et={"\\":.3},tt=function(e){return"tcg"===e?7:1},nt=/{[^{}]+?}/,rt="\\s\\-/",at=-2.25,ot=function(){return{version:0,format:"tcg",frame:"fusion",foil:"normal",opacity:g(),finish:[],artFinish:"normal",name:"Junko",nameStyleType:"auto",nameStyle:{font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"},attribute:"LIGHT",subFamily:w,cardIcon:"auto",star:6,starAlignment:"auto",art:"https://i.imgur.com/h5kXZeC.png",artCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},hasBackground:!1,background:"",backgroundType:"fit",backgroundCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},linkMap:["1","3","7","9"],isPendulum:!1,pendulumFrame:"auto",pendulumEffect:"Once per turn: You can pay 800 LP, increase this card's Pendulum Scale by 1.",pendulumScaleRed:"4",pendulumScaleBlue:"4",typeAbility:["Fairy","Fusion","Effect"],effectStyle:{condenseTolerant:"strict"},effect:"[2+ Effect Monsters on your field]\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter.",setId:"YGOC-EN001",atk:"2000",def:"2000",password:"18111996",sticker:"holo5",isFirstEdition:!0,isSpeedCard:!1,isDuelTerminalCard:!1,creator:"\xa92020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI",furiganaHelper:!0,statTextStyle:[!1,"#000000",!1,"#000000"],typeTextStyle:[!1,"#000000",!1,"#000000"],effectTextStyle:[!1,"#000000",!1,"#000000"],pendulumTextStyle:[!1,"#000000",!1,"#000000"]}},it=function(){return{version:0,format:"tcg",frame:"effect",foil:"normal",opacity:g(),finish:[],artFinish:"normal",name:"",nameStyleType:"auto",nameStyle:{font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"},attribute:"LIGHT",subFamily:w,cardIcon:"auto",star:6,starAlignment:"auto",art:"https://i.imgur.com/jjtCuG5.png",artCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},hasBackground:!1,background:"",backgroundType:"fit",backgroundCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},linkMap:[],isPendulum:!1,pendulumFrame:"auto",pendulumEffect:"",pendulumScaleRed:"4",pendulumScaleBlue:"4",typeAbility:[],effectStyle:{condenseTolerant:"strict"},effect:"",setId:"",atk:"0",def:"0",password:"",sticker:"no-sticker",isFirstEdition:!1,isSpeedCard:!1,isDuelTerminalCard:!1,creator:"",furiganaHelper:!0,statTextStyle:[!1,"#000000",!1,"#000000"],typeTextStyle:[!1,"#000000",!1,"#000000"],effectTextStyle:[!1,"#000000",!1,"#000000"],pendulumTextStyle:[!1,"#000000",!1,"#000000"]}},ct=[{type:"body",subType:"artBorder",label:"Card",labelKey:"input.opacity.body.label",tooltipKey:"input.opacity.art-border.tooltip"},{type:"name",subType:"nameBorder",label:"Name",labelKey:"input.opacity.name.label",tooltipKey:"input.opacity.name-border.tooltip"},{type:"pendulum",label:"Pendulum",labelKey:"input.opacity.pendulum.label",tooltipKey:null},{type:"text",label:"Effect",labelKey:"input.opacity.effect.label",tooltipKey:null}],lt=["#4D4D4D","#999999","#FFFFFF","#FF7F7F","#FFD27F","#FFFF7F","#7FFF7F","#7FBF7F","#7FFFFF","#7F7FFF","#BF7FBF","#FF7FFF","#333333","#808080","#cccccc","#7F0000","#7F5200","#7F7F00","#007F00","#004000","#007F7F","#00007F","#400040","#7F007F","#000000","#666666","#B3B3B3","#FF0000","#FFA500","#FFFF00","#00FF00","#008000","#00FFFF","#0000FF","#800080","#FF00FF"],st=function(e){return"xyz"===e.frame},ut=function(e){return"link"===e.frame&&ft(e)},dt=function(e){return"speed-skill"===e.frame&&!ft(e)},ft=function(e){return"spell"!==e.frame&&"trap"!==e.frame&&"speed-skill"!==e.frame},bt=function(e){return"spell"===e||"trap"===e?"st":"xyz"===e?"rank":"dark-synchro"===e?"negative-level":"speed-skill"===e?"none":"level"},pt=function(e){return!ft({frame:e})||mt(e)},mt=function(e){return["link","xyz","dark-synchro","speed-skill","hamon","uria","raviel"].includes(e)},ht=function(e){var t,n=e.format,r=e.frame,a=e.nameStyle,o=e.nameStyleType,i=e.foil;if("custom"===o)return a;var c=dt({frame:r}),l=pt(r),u="Default";"ocg"===n&&(u="OCG"),c&&"tcg"===n&&(u="Arial");var d={fillStyle:l?"#ffffff":"#000000",headTextFillStyle:l?"#ffffff":"#000000"};if("predefined"===o){var f,b,p=Object(s.a)({},C[null!==(f=a.preset)&&void 0!==f?f:"commonB"].value);return C[null!==(b=p.preset)&&void 0!==b?b:"commonB"].value.font||(p.font=u),Object(s.a)(Object(s.a)({},d),p)}var m=c?{hasOutline:!0,lineWidth:6,strokeStyle:"#000"}:{},h="normal"!==i&&null!==(t=C[i].value)&&void 0!==t?t:{},g="zarc"===r?C.animeGold.value:{};return Object(s.a)(Object(s.a)(Object(s.a)(Object(s.a)({font:u},d),m),h),g)},gt=1e3,vt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt,n=e,r=t,a=r,o=a,i=30,c=100,l=10,s=function(){return 1===c?v():(a+=c,a-=c/=l),Math.min(a,r)},u=function(){return i-=1,a-=c},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;n=e,r=t,a=t,i=30,c=100,o=t},f=function(){return a},b=function(e){return a=e},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;return o=e},m=function(){return o},h=function(){return i=-1,a=o},g=function(){return i},v=function(){return i=-1};return{reset:d,searchDown:u,reverseSearch:s,finish:v,getMedian:f,setMedian:b,setLastEffective:p,getLastEffective:m,applyLastEffective:h,getIterateCount:g}},xt=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=gt,r=vt();r.getIterateCount()>=0;){if(r.getIterateCount()<=0){var a=r.getMedian();n=a;break}var o=e(r.getMedian());if(!o&&r.getMedian()>0)r.searchDown();else{if(r.getMedian()===gt)break;n=r.reverseSearch()}}var i=Math.max(t,Math.min(n,gt));return i!==n&&e(i),i},jt=function(e){var t=null!==e&&void 0!==e?e:{},n=t.defaultWeight,r=void 0===n?"":n,a=t.defaultStyle,o=void 0===a?"":a,i=t.defaultSize,c=void 0===i?"10px":i,l=t.defaultFamily,s=void 0===l?"Arial":l,u=r,d=o,f="number"===typeof c?"".concat(c,"px"):c,b="number"===typeof c?c:parseFloat(c.replaceAll("px","")),p=s;return{getFont:function(){return"".concat([d,u,f,p].filter((function(e){return""!==e})).join(" "),", Arial")},getFontInfo:function(){return{style:d,size:f,family:p,sizeAsNumber:b,weight:u}},setWeight:function(e){return u=e,this},setStyle:function(e){return d=e,this},setSize:function(e){var t="function"===typeof e?e(b):e;return f="number"===typeof t?"".concat(t,"px"):t,b="number"===typeof t?t:parseFloat(t.replaceAll("px","")),this},setFamily:function(e){return p=e,this}}},yt=function(e){return(null!==e&&void 0!==e?e:[]).map((function(e){var t=e.color,n=e.offset;return"".concat(n,"|").concat(t)})).join(",")},Ot=function e(t){return t?t.split(",").map((function(e,t){var n=e.split("|"),r=Object(u.a)(n,2),a=r[0];return{color:r[1],offset:a,id:t+1}})):e("0.000|#eef10b,0.5|#d78025,1.000|#7e20cf")},wt=function(e){var t=e.debug,n=e.optionLength,r=e.stopPropagation,a=void 0!==r&&r,o=e.setFocus,i=e.onTrigger,c=e.onCancel,l=e.onKeyPress;return{tabIndex:0,onFocus:function(){t&&console.info("Navigation Focus",t),o(0)},onBlur:function(){t&&console.info("Navigation Blur",t),o(-1)},onKeyDown:function(e){a&&e.stopPropagation(),t&&console.info("Navigation Keydown",t,e.key),!1!==(null===l||void 0===l?void 0:l(e))&&("ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o((function(e){return Math.max(0,n+e+1)%n}))):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o((function(e){return Math.max(0,n+e-1)%n}))):"Enter"===e.key||" "===e.key?i():"Escape"===e.key&&(null===c||void 0===c||c()))}}},kt=n(416),Ft=n(61),Ct=function(e){var t=(e=e.substring(0,e.length-1)).split("\x01");if(e=t[0],11&&void 0!==arguments[1]?arguments[1]:1,n=[['"',"'"],["':","!"],[",'","~"],["}",")","\\","\\"],["{","(","\\","\\"]],r=function(e,t){return e.replace(new RegExp("".concat((t[2]?t[2]:"")+t[0],"|").concat((t[3]?t[3]:"")+t[1]),"g"),(function(e){return e===t[0]?t[1]:t[0]}))};if(t)for(t=0;t1&&void 0!==arguments[1]?arguments[1]:Tt,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a={},o=Object(s.a)({},t);return Object.keys(o).forEach((function(t){var r=o[t];if("object"!==typeof r||null===r||Array.isArray(r)){var i=n[t];"string"===typeof i&&(a[i]=r)}else{var c,l=null===(c=n[t])||void 0===c?void 0:c._newKey;l&&(a[l]=e(r,n[t],!1))}})),r?JSON.stringify(a):a},Nt=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tt,r={};return Object.keys(n).forEach((function(a){var o=n[a];if("object"!==typeof o||null===o||Array.isArray(o))null!=t[o]&&(r[a]=t[o]);else{var i=null===o||void 0===o?void 0:o._newKey;i&&t[i]&&(r[a]=e(t[i],n[a]))}})),r},Lt=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tt,r="string"===typeof t?JSON.parse(Ct(decodeURIComponent(t))):t,a={};return Object.keys(n).forEach((function(t){var o=n[t];if("object"!==typeof o||null===o||Array.isArray(o))null!=r[o]&&(a[t]=r[o]);else{var i=null===o||void 0===o?void 0:o._newKey;i&&r[i]&&(a[t]=e(r[i],n[t]))}})),a},Mt=function(e,t){var n="string"===typeof e?JSON.parse(e):e,r=Nt(n);return Et(r,t)},Et=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it(),a=Object(s.a)(Object(s.a)({},r),Object(kt.a)(e));return null==a.effectStyle&&(a.effectStyle=Object(s.a)({},it().effectStyle)),null==a.version&&(a.version=1),null==a.format&&(a.format="tcg"),null==a.pendulumFrame&&(a.pendulumFrame="auto"),null==a.finish&&(a.finish=[]),null==a.artFinish&&(a.artFinish="normal"),a.picture&&!e.art&&(a.art=a.picture),delete a.picture,a.pictureCrop&&!e.artCrop&&(a.artCrop=a.pictureCrop),delete a.pictureCrop,""===(null!==(t=a.art)&&void 0!==t?t:"")&&(a.art=""),"boolean"===typeof a.opacity.artFrame&&null==a.opacity.boundless&&(a.opacity.boundless=!a.opacity.artFrame,delete a.opacity.artFrame),a.opacity=Object(s.a)(Object(s.a)({},g()),a.opacity),""===(null!==(n=a.background)&&void 0!==n?n:"")&&(a.background=""),null==a.hasBackground&&(a.background||a.opacity.baseFill)&&(a.hasBackground=!0),a.kanjiHelper&&!e.furiganaHelper&&(a.furiganaHelper=a.kanjiHelper),delete a.kanjiHelper,void 0===a.furiganaHelper&&(a.furiganaHelper=!0),a.passcode&&!e.password&&(a.password=a.passcode),delete a.passcode,a.effectTextStyle||(a.effectTextStyle=[!1,"#000000",!1,"#000000"]),a.pendulumTextStyle||(a.pendulumTextStyle=[!1,"#000000",!1,"#000000"]),a.typeTextStyle||(a.typeTextStyle=[!1,"#000000",!1,"#000000"]),a.statTextStyle||(a.statTextStyle=[!1,"#000000",!1,"#000000"]),a.starAlignment||(a.starAlignment="auto"),a},It=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n="",r=e.length,a=0;a0&&void 0!==arguments[0]?arguments[0]:".radio-train-input-group";null===(e=document.querySelector(t))||void 0===e||e.focus()},Pt=/^#[a-fA-F0-9]{3}([a-fA-F0-9]{3})?$/,Dt=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n,r,a,o=e.replace("#",""),i=[0,0,0,1];if(3===o.length||4===o.length)i=[parseInt("".concat(o[0]).concat(o[0]),16),parseInt("".concat(o[1]).concat(o[1]),16),parseInt("".concat(o[2]).concat(o[2]),16),parseInt("".concat(null!==(n=o[3])&&void 0!==n?n:"f").concat(null!==(r=o[3])&&void 0!==r?r:"f"),16)];if(6===o.length||8===o.length)i=[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(null!==(a=o.slice(6,8))&&void 0!==a?a:"ff",16)];return i.map((function(e){return isNaN(e)?255:e})).slice(0,t?4:3)}catch(c){return[0,0,0,1].slice(0,t?4:3)}},zt=function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e.substr(0,4)))&&(t=!0),t};function Ht(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=Object(s.a)(Object(s.a)({},t),e.rawDictionary),r=function(e){var t;return null!==(t=n[e])&&void 0!==t?t:""},o=function(e,t){var n=new RegExp("\\{(".concat(Object.keys(t).join("|"),")\\}")),r=e.split(n);return Object(a.jsx)(a.Fragment,{children:r.map((function(e,n){return n%2===0?Object(a.jsx)(i.a.Fragment,{children:e},"".concat(e,"-").concat(n)):t[e]}))})},c={"error.load.font.tcg":function(e){return r("error.load.font.tcg").replaceAll("{familyName}",e)},"error.load.font.ocg":function(e){return r("error.load.font.ocg").replaceAll("{familyName}",e)},"contributor.disclaimer.line-1":function(e){return o(r("contributor.disclaimer.line-1"),{siteLink:e})},"contributor.disclaimer.line-5":function(e,t){return o(r("contributor.disclaimer.line-5"),{author1:e,author2:t})},"contributor.template-maker":function(e,t,n,a){return o(r("contributor.template-maker"),{artist1:e,artist2:t,artist3:n,artist4:a})},"guide.format.introduction":function(e){return o(r("guide.format.introduction"),{settingIcon:e})},"guide.format.section-1.content":function(e,t,n,a){return o(r("guide.format.section-1.content"),{openTag:e,closeTag:t,hotkey:n,hotkeyAlternative:a})},"guide.format.section-2.content":function(e,t,n,a){return o(r("guide.format.section-2.content"),{openTag:e,closeTag:t,hotkey:n,hotkeyAlternative:a})},"guide.format.section-3.content":function(e,t,n){return o(r("guide.format.section-3.content"),{separator:e,hotkey:t,hotkeyAlternative:n})},"guide.format.section-4.content":function(e,t,n){return o(r("guide.format.section-4.content"),{separator:e,hotkey:t,hotkeyAlternative:n})},"guide.format.section-5.content":function(e,t,n,a){return o(r("guide.format.section-5.content"),{openTag:e,closeTag:t,hotkey:n,hotkeyAlternative:a})},"input.scale.label":function(e){return o(r("input.scale.label"),{scaleType:e})}};return Object(s.a)(Object(s.a)({},e),{},{rawDictionary:n,dictionary:Object(s.a)(Object(s.a)({},n),c)})},gn=Object(cn.create)((function(e,t){var n=function(){var e=new URL(window.location.href),t=e.searchParams,n=t.get("language");if(t.delete("language"),window.history.replaceState(window.history.state,"",e.href),n)return n;try{var r=window.localStorage.getItem("language");return r||"eng"}catch(a){return console.error("useSetting: Error when getting cached language",a),"eng"}}(),r={},a=hn(Object(s.a)(Object(s.a)({},{name:"Default",formalName:"Default",codeName:"def",initialMessage:"",order:1e3,active:!1}),{},{rawDictionary:{}})),o=function(){var t=Object(mn.a)(pn.a.mark((function t(){var n,r;return pn.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("".concat("/ygocarder","/asset/i18n/metadata.json"),{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 3:return n=t.sent,t.next=6,n.json();case 6:if(r=t.sent){t.next=9;break}throw new Error("No metadata found");case 9:e({languageMetadataMap:r,isMetadataReady:!0}),t.next=16;break;case 12:t.prev=12,t.t0=t.catch(0),console.error("loadLanguageMetadata: Could not load language metadata, try to use English",t.t0),e({languageMetadataMap:{eng:{name:"English",formalName:"English",codeName:"eng",initialMessage:"Loading fonts and scripts\u2026",order:1,active:!0}},isMetadataReady:!0});case 16:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(){return t.apply(this,arguments)}}(),i=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,a,o,i;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r[t]){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,fetch("".concat("/ygocarder","/asset/i18n/").concat(t,".json"),{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 5:return a=e.sent,e.next=8,a.json();case 8:if((o=e.sent).rawDictionary){e.next=11;break}throw new Error("No dictionary found");case 11:return i=hn(o,null===(n=r.eng)||void 0===n?void 0:n.rawDictionary),r[t]=i,e.abrupt("return",i);case 16:return e.prev=16,e.t0=e.catch(2),console.error("loadLanguage: Could not load language, revert back to default",e.t0),e.abrupt("return",null);case 20:case"end":return e.stop()}}),e,null,[[2,16]])})));return function(t){return e.apply(this,arguments)}}(),c=function(){var n=Object(mn.a)(pn.a.mark((function n(o){var c,l;return pn.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c=t().languageMetadataMap[o]){n.next=3;break}return n.abrupt("return");case 3:if(r[o]){n.next=9;break}return n.next=6,i(o);case 6:n.t0=n.sent,n.next=10;break;case 9:n.t0=r[o];case 10:(l=n.t0)?(e({languageInfo:t().languageMetadataMap[o],language:l.dictionary}),window.localStorage.setItem("language",o),e({isLoading:!1,languageInfo:c})):e({isLoading:!1,languageInfo:t().languageMetadataMap.eng,language:a.dictionary});case 12:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}();return{languageMetadataMap:{},languageInfo:{name:"Default",formalName:"Default",codeName:"def",initialMessage:"",order:1e3,active:!1},language:a.dictionary,error:null,isInitiating:!0,isLoading:!0,isMetadataReady:!1,initiate:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),loadDefaultLanguage:function(){var t=Object(mn.a)(pn.a.mark((function t(){return pn.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i("eng");case 2:return t.next=4,c(n);case 4:e({isInitiating:!1});case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),loadLanguage:i,changeLanguage:c}})),vn=function(){return gn((function(e){return e.language}))},xn=function(){return gn.getState().language},jn=function(e,t){var n=it();if(!e)return n;try{n=Mt(e,t)}catch(r){console.error("decodedCard",e,r);try{n=function(e){var t;return t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Lt(e):"string"===typeof e?JSON.parse(e):e,Et(t)}(e,!0),fn.a.info({message:xn()["service.decode.outdated.message"],description:xn()["service.decode.outdated.description"]})}catch(r){console.error("cardData",e,r),fn.a.error({message:xn()["service.decode.error.message"],description:xn()["service.decode.error.description"]})}}return n},yn={debounce:{type:"debounce",wait:400},throttle:{type:"throttle",wait:1e3}},On=Object(cn.create)((function(e,t){return{card:ot(),setCard:function(t){e("function"===typeof t?function(e){return{card:t(e.card)}}:{card:t})},getUpdater:function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e},a=arguments.length>2?arguments[2]:void 0,o=t(),i=o.setCard,c=function(t){i((function(n){var a;return Object(s.a)(Object(s.a)({},n),{},Object(ce.a)({},e,r("string"===typeof t||"number"===typeof t||Array.isArray(t)?t:null===t||void 0===t||null===(a=t.target)||void 0===a?void 0:a.value)))}))};if(!a)return c;var l="string"===typeof a?null!==(n=yn[a])&&void 0!==n?n:void 0:a;if(!l)return c;var u=l.wait,d=l.type;return"debounce"===d?sn()(c,u):"throttle"===d?dn()(c,u):c}}})),wn=n(33),kn=Object(cn.create)((function(e){var t=function(){try{var e,t=JSON.parse(null!==(e=window.localStorage.getItem("setting"))&&void 0!==e?e:"{}");return t&&"object"===typeof t&&!Array.isArray(t)?t:{}}catch(n){return console.error("useSetting: Error when getting cached setting",n),{}}}(),n=t.resolution,r=t.allowHotkey,a=t.reduceMotionColor,o=t.showCreativeOption,i=t.showExtraDecorativeOption;return{setting:{resolution:Array.isArray(n)&&"number"===typeof n[0]&&"number"===typeof n[1]?n:[d,f],allowHotkey:"boolean"!==typeof r||r,reduceMotionColor:"boolean"===typeof a&&a,showCreativeOption:"boolean"!==typeof o||o,showExtraDecorativeOption:"boolean"!==typeof i||i},updateSetting:function(t){e((function(e){var n="function"===typeof t?t(e.setting):Object(s.a)(Object(s.a)({},e.setting),t);return window.localStorage.setItem("setting",JSON.stringify(n)),{setting:n}}))}}})),Fn=f,Cn=d,Sn=function(e){var t=e.ctx,n=e.color,r=void 0===n?"#000000".replace(/0/g,(function(){return(~~(12*Math.random()+2)).toString(16)})):n,a=e.width,o=e.offset,i=void 0===o?4:o,c=e.edge,l=e.baseline,s=e.xRatio,u=t.fillStyle;t.fillStyle=r,t.beginPath(),t.rect(c/s,l+1+Math.random()*i,a/s,2),t.fillStyle=u},Tn=function(e,t,n,r,a,o){if(!e||!t)return r;var i=(null!==o&&void 0!==o?o:{}).stroke,c=void 0!==i&&i;e.textAlign="left";var l=t.split(""),s=r;return l.forEach((function(t){e.fillText(t,s,a),c&&e.strokeText(t,s,a),s+=e.measureText(t).width*(2+n)/2})),s},Rn=function(e,t,n,r,a,o){if(!e||!t)return r;var i=(null!==o&&void 0!==o?o:{}).stroke,c=void 0!==i&&i;e.textAlign="right";var l=t.split(""),s=r;return l.forEach((function(t,r){var o=l[l.length-r-1];e.fillText(o,s,a),c&&e.strokeText(o,s,a),s-=e.measureText(o).width*(2+n)/2})),s},Nn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cn,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fn;return!!e&&(e.clearRect(0,0,t,n),!0)},Ln=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;return function(){var n=Object(mn.a)(pn.a.mark((function n(r,a,o){var i,c,l,s,u,d,f,b,p,m,h,g,v,x;return pn.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r&&Array.isArray(e)&&!(e.length<=0)){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:i=Object(Ft.a)(e),n.prev=3,i.s();case 5:if((c=i.n()).done){n.next=39;break}if(l=c.value,s=t[l],!o||!t[l]){n.next=37;break}if(d=s.partInstructionMap,!(f=a&&null!==(u=d[a])&&void 0!==u?u:[]).length){n.next=33;break}b=Object(Ft.a)(f),n.prev=13,b.s();case 15:if((p=b.n()).done){n.next=23;break}return m=p.value,h=m.blendMode,g=void 0===h?"source-over":h,v=m.opacity,x=void 0===v?1:v,r.globalCompositeOperation=g,r.globalAlpha=x,n.next=21,o(l);case 21:n.next=15;break;case 23:n.next=28;break;case 25:n.prev=25,n.t0=n.catch(13),b.e(n.t0);case 28:return n.prev=28,b.f(),n.finish(28);case 31:n.next=35;break;case 33:return n.next=35,o(l);case 35:r.globalAlpha=1,r.globalCompositeOperation="source-over";case 37:n.next=5;break;case 39:n.next=44;break;case 41:n.prev=41,n.t1=n.catch(3),i.e(n.t1);case 44:return n.prev=44,i.f(),n.finish(44);case 47:r.globalAlpha=1,r.globalCompositeOperation="source-over";case 49:case"end":return n.stop()}}),n,null,[[3,41,44,47],[13,25,28,31]])})));return function(e,t,r){return n.apply(this,arguments)}}()},Mn="#000000",En="#000000",In=function(e){var t=e.ctx,n=e.x,r=void 0===n?0:n,a=e.y,o=void 0===a?0:a,i=e.blur,c=void 0===i?0:i,l=e.color,s=void 0===l?En:l,u=e.shadowColor,d=void 0===u?Mn:u;return t.shadowOffsetX=r,t.shadowOffsetY=o,t.shadowBlur=c,t.shadowColor=d,t.fillStyle=s,function(){t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,t.shadowColor=Mn,t.fillStyle=En}},An={},Bn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n){var r,a,o=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>2&&void 0!==o[2]?o[2]:0,a=o.length>3&&void 0!==o[3]?o[3]:0,t&&""!==n){e.next=4;break}return e.abrupt("return",new Promise((function(e){return e(!1)})));case 4:return e.abrupt("return",new Promise((function(e){var o;if(!0===(null===(o=An[n])||void 0===o?void 0:o.ready)){var i=An[n].image,c="number"===typeof r?r:r(i),l="number"===typeof a?a:a(i);t.drawImage(i,c,l),e(!0)}else{var s;if(null===(s=An[n])||void 0===s?void 0:s.error)return void e(!0);var u=An[n]&&(An[n].cache||An[n].ready),d=u?An[n].image:new Image;u||(d.src="/ygocarder"+n),d.addEventListener("load",(function(){var o="number"===typeof r?r:r(d),i="number"===typeof a?a:a(d);t.drawImage(d,o,i),An[n].ready=!0,An[n].error=!1,e(!0)}),{once:!0}),d.addEventListener("error",(function(){An[n].error=!0,e(!1)}),{once:!0}),u||(An[n]={image:d,ready:!1,error:!1,cache:!0})}})));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Wn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n){var r,a,o=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>2&&void 0!==o[2]?o[2]:0,a=o.length>3&&void 0!==o[3]?o[3]:0,e.next=4,Bn(t,"/asset/image/"+n,r,a);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Pn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&""!==n){e.next=2;break}return e.abrupt("return",new Promise((function(e){return e(!1)})));case 2:return e.abrupt("return",new Promise((function(e){var c;if(!0===(null===(c=An[n])||void 0===c?void 0:c.ready)){var l=An[n].image,s="number"===typeof r?r:r(l),u="number"===typeof a?a:a(l),d="number"===typeof o?o:o(l),f="number"===typeof i?i:i(l);t.drawImage(l,s,u,d,f),e(!0)}else{var b;if(null===(b=An[n])||void 0===b?void 0:b.error)return void e(!0);var p=An[n]&&(An[n].cache||An[n].ready),m=p?An[n].image:new Image;p||(m.src="/ygocarder"+n),m.addEventListener("load",(function(){var c="number"===typeof r?r:r(m),l="number"===typeof a?a:a(m),s="number"===typeof o?o:o(m),u="number"===typeof i?i:i(m);t.drawImage(m,c,l,s,u),An[n].ready=!0,An[n].error=!1,e(!0)}),{once:!0}),m.addEventListener("error",(function(){An[n].error=!0,e(!1)}),{once:!0}),p||(An[n]={image:m,ready:!1,error:!1,cache:!0})}})));case 3:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i){return e.apply(this,arguments)}}(),Dn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pn(t,"/asset/image/"+n,r,a,o,i);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i){return e.apply(this,arguments)}}(),zn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i,c,l){var u,d,f,b,p,m,h,g,v,x,j,y;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=t.getContext("2d"),(d=document.createElement("canvas")).width=a,d.height=o,(f=d.getContext("2d",{willReadFrequently:!0}))&&u){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,Wn(f,n,0,0);case 9:return b=Dt(r),p=f.getImageData(0,0,a,o).data,m=In(Object(s.a)({ctx:f},l)),e.next=14,Wn(f,n,0,0);case 14:for(h=f.getImageData(0,0,a,o),g=h.data,m(),f.clearRect(0,0,a,o),f.drawImage(t,i,c,a,o,0,0,a,o),v=f.getImageData(0,0,a,o),x=v.data,j=0;j0?(x[j+0]=b[0]*(1-p[j+0]/255),x[j+1]=b[1]*(1-p[j+1]/255),x[j+2]=b[2]*(1-p[j+2]/255),x[j+3]=255):g[j+3]>0&&(y=g[j+3]/255,x[j+0]=(1-y)*x[j+0]+y*g[j+0],x[j+1]=(1-y)*x[j+1]+y*g[j+1],x[j+2]=(1-y)*x[j+2]+y*g[j+2],x[j+3]=255);u.putImageData(v,i,c);case 23:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i,c,l){return e.apply(this,arguments)}}(),Hn=function(e){var t,n,r=e.ctx,a=e.letter,o=e.isLastOfLine,i=void 0!==o&&o,c=e.debug,l=e.fontStyle,s=e.xRatio,u=e.metricMethod,d=void 0===u?"standard":u;if(Re.test(a))return{width:0,boundWidth:0};var f="tcg"===l?et:_e,b="tcg"===l?Ze:Je,p="tcg"===l?Qe:$e,m=r.measureText(a),h=m.width,g=m.actualBoundingBoxLeft+m.actualBoundingBoxRight,v=1;"name"===d&&(v=1+8*(1-s));var x,j="name"===d||"compact"===d||"furigana"===d?.046875:0,y=g,O=null!==(t=i?p[a]:b[a])&&void 0!==t?t:0;if("tcg"===l)return{width:h,actualBoundWidth:g,boundWidth:h+2*((null!==(x=f[a])&&void 0!==x?x:0)*h),metric:m,offsetRatio:O};var w=(null!==(n=f[a])&&void 0!==n?n:0)*h+("furigana"===d?0:Math.min(.075*h,Math.max(.45,h*j)*v)),k=1;Ge.test(a)?(y="furigana"===d?g:g*("creator"===d?1.75:2.5),k=.6):Ye.test(a)?(y="furigana"===d?g:Math.max(g,.75*h),w=2):Ae.test(a)?y="furigana"===d?g:Math.max(g,.7*h):De.test(a)?y=h:Ve.test(a)?y=2*g:Ue.test(a)?y=1.25*g*(i?.5:1):He.test(a)?y="furigana"===d?g:Math.max(g,.75*h):Ke.test(a)?y=Math.max(g,.69*h)*("creator"===d?.975:1):Xe.test(a)?(y=h,w=0):y="furigana"===d?g:Math.max(g,.75*h),w="furigana"===d?0:w;var F=1*h*1;return c&&console.info("getLetterWidth ".concat(c),a,m,1,1,"|",F),{width:h,actualBoundWidth:g,boundWidth:"standard"===d?h*k:y+2*w,metric:m,offsetRatio:O}},Kn=function(e){var t=e.ctx,n=e.baseline,r=e.edge,a=e.letter,o=e.xRatio,i=e.deviation,c=void 0===i?{}:i,l=e.letterMetric,s=e.textDrawer,u=null!==l&&void 0!==l?l:{},d=u.boundWidth,f=u.metric,b=void 0===f?t.measureText(a):f,p=u.offsetRatio,m=void 0===p?0:p,h=o<1?{}:c,g=h.yOffset,v=void 0===g?K:g,x=h.yRatio,j=void 0===x?G:x,y=b.width*o,O=d?d*o:y,w=null!==s&&void 0!==s?s:function(e){var t=e.ctx,n=e.letter,r=e.scaledBaseline,a=e.scaledEdge;t.fillText(n,a,r)},k=(y-O)/2,F=O*m;t.scale(1,j),w({ctx:t,letter:a,scaledEdge:r/o-k-F,scaledBaseline:(n+v)/j}),t.scale(1,1/j)},Gn=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t?new RegExp("([".concat(rt,"])|(").concat(ye,"[\\w\\W]+?").concat(Oe,")|(.+?)")):new RegExp("([".concat(rt,"])|").concat(ye,"([\\w\\W]+?)").concat(Oe,"|(.+?)"));return e.split(n).filter((function(e){return null!=e&&""!==e}))},Yn=function(e,t,n,r){var a=n.fontSize,o=n.ordinalFontRatio,i=void 0===o?H.ordinalFontRatio:o,c=n.headTextFontRatio,l=void 0===c?H.headTextFontRatio:c,s=t.font,u=t.ordinalFont,d=t.symbolFont,f=t.symbolFontRatio,b=t.numberFont,p=void 0===b?s:b,m=t.numberFontRatio,h=void 0===m?1:m,g=t.furiganaFont,v=r.getFontInfo(),x=r.getFontInfo(),j=r.getFontInfo(),y=r.getFontInfo(),O=r.getFontInfo();return{applyNumberFont:function(){v=r.getFontInfo(),e.font=r.setFamily(p).setSize(a*h).getFont()},stopApplyNumberFont:function(){e.font=r.setFamily(v.family).setSize(v.size).getFont()},applyLargerText:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;O=r.getFontInfo(),e.font=r.setSize(a*t).getFont()},stopApplyLargerText:function(){e.font=r.setSize(O.size).getFont()},applySymbolFont:function(){x=r.getFontInfo(),e.font=r.setFamily(d).setSize(a*f).getFont()},stopApplySymbolFont:function(){e.font=r.setFamily(x.family).setSize(x.size).getFont()},applyOrdinalFont:function(){j=r.getFontInfo(),e.font=r.setFamily(u).setSize(a*i).getFont()},stopApplyOrdinalFont:function(){e.font=r.setFamily(j.family).setSize(j.size).getFont()},applyFuriganaFont:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];y=r.getFontInfo(),e.font=r.setFamily(g).setWeight(t?"bold":"").setSize(a*l).getFont()},stopApplyFuriganaFont:function(){e.font=r.setFamily(y.family).setWeight(y.weight).setSize(y.size).getFont()},applyAsymmetricScale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;e.scale(t,n)},applyScale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;e.scale(t,n)},resetScale:function(){e.setTransform(1,0,0,1,0,0)},reverseScale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;e.scale(1/t,1/t)}}},Xn=function(e,t,n,r,a){var o=(r-a)/2;e.beginPath(),e.arc(t+o,n-o-1,o,0,2*Math.PI,!1),e.fill(),e.lineWidth=1,e.strokeStyle="#003300",e.stroke()},Vn=function(e){var t=e.footText,n=e.footTextWidth,r=e.headText,a=e.headTextLetterWidth,o=e.headTextGap,i=e.headTextSpacing,c=e.gapPadding,l=e.debug,s=e.fitFootText,u=e.sentenceXRatio,d=e.xRatio,f=0===r.length,b=a/n*u,p=i,m=0;b<=.95?p=i:b<=1.175?p=i>=0?0:3*i:b<=1.56?p=i>=0?-1*i/4:3*i:(m=.66,p=i>=0?-1*i/4:2*i),(s||d>0&&d<1)&&(p=i);var h=a*(d&&!s?d:!m||s?1:m)+p*(r.length-1),g=f?0:(n-a)/r.length,v=n,x=1===t.length||2*c+h>n?"center":"space-around",j="center"===x?p:g,y="center"===x?2*c+h:v,O=s?Math.min(y,n):y,w="center"===x?(h-n)/2:0,k=Math.max(o,s?Math.min(w,0):w);return l&&console.info("analyzeHeadText ".concat(l),x,j,"|",r,O,y,t,n,k),{gapPadding:c,letterSpacing:j,trueHeadTextWidth:y,headTextWidth:O,alignment:x,halfGap:k,headTextXRatio:"center"===x?m:0}},Un=function(e,t){return e>=0?t>=0?0:-1*Math.max(-1*e,t):t>=0?-1*Math.max(e,-1*t):0},qn=function e(t){var n=t.ctx,r=t.token,a=t.nextToken,o=t.xRatio,i=t.previousTokenGap,c=void 0===i?0:i,l=t.letterSpacing,s=void 0===l?H.letterSpacing:l,d=t.format,f=t.textData;if(!n||!r)return{totalWidth:0,leftMostLetter:"",spaceCount:0,spaceAtEnd:!1,rightGap:0,leftGap:0};for(var b=f.currentFont,p=f.fontData,m=f.fontLevel,h=p.metricMethod,g=p.headTextGapRatio,v=void 0===g?U:g,x=p.headTextOverflow,j=void 0===x?X:x,y=p.fontStyle,O=p.fontList[m],w=O.bulletSymbolWidth,k=O.capitalLetterRatio,F=O.fontSize,C=O.iconSymbolWidth,S=void 0===C?w:C,T=O.largeSymbolRatio,R=void 0===T?H.largeSymbolRatio:T,N=O.headTextSpacing,L=void 0===N?H.headTextSpacing:N,M=O.squareBracketRatio,E=O.wordLetterSpacing,I=-.5*F,A=Yn(n,p,O,b),B=A.applyScale,W=A.reverseScale,P=A.applyLargerText,D=A.stopApplyLargerText,z=A.applyFuriganaFont,K=A.stopApplyFuriganaFont,G=A.applyOrdinalFont,Y=A.stopApplyOrdinalFont,V=A.applySymbolFont,q=A.stopApplySymbolFont,J=A.applyNumberFont,$=A.stopApplyNumberFont,_=1+s/2,Z="",Q=0,ee=0,te=!1,ne=void 0===a,re=null!==c&&void 0!==c?c:0,ae=!1,oe=0,ie=r.replaceAll(new RegExp(Te,"g"),"").split(je).filter((function(e){return null!=e&&""!==e})),ce=0;ce1?Math.min(1,o+.1):0}),Ce=Fe.halfGap,Se=Fe.headTextWidth,Re=0===ye.length?Math.max(I,we/at):Ce,Ne=Re,Me=Re,Ee=Math.max(Se,we),Ie=Un(re,Ne);re=Me,Q+=Ee-Ie,ee+=1,le&&(ae=!0,oe=Ne,Z=pe[0])}else if(xe.test(se)){var Ae=E?1+E/2:_;n.letterSpacing="".concat((Ae-1)*b.getFontInfo().sizeAsNumber,"px");for(var Be=se,Pe=0;""!==Be;){var De=Be[0],He=Be.slice(1),Ke=n.measureText(Be).width-n.measureText(He).width;ge.test(De)?(B(M),Ke=n.measureText(Be).width-n.measureText(He).width,W(M)):he.test(De)?(B(k),Ke=n.measureText(Be).width-n.measureText(He).width,W(k)):ze.test(De)?(J(),Ke=n.measureText(Be).width-n.measureText(He).width,$()):Le.test(De)&&"tcg"===y?(V(),Ke=n.measureText(Be).width-n.measureText(He).width,q()):Ke=n.measureText(Be).width-n.measureText(He).width,Pe+=Ke,Be=He}var Ge=Math.max(I,Pe/at),Ye=Ge;Q+=Pe-Un(re,Ge),re=Ye,le&&(oe=Ge,Z=se[0]),n.letterSpacing="0px"}else if(Le.test(se)&&"tcg"===y){V();var Ve=n.measureText(se).width*_;q();var Ue=Math.max(I,Ve/at),Je=Ue;Q+=Ve-Un(re,Ue),re=Je,le&&(oe=Ue,Z=se[0])}else{var $e=Hn({ctx:n,letter:se,isLastOfLine:ne,fontStyle:y,metricMethod:h,xRatio:o}).boundWidth*_,_e=Math.max(I,$e/at),Ze=_e;Q+=$e-Un(re,_e),re=Ze,("ocg"===d||"tcg"===d&&/\s+/.test(se))&&!1===Xe.test(se)&&(ee+=1,ce===ie.length-1&&(te=!0)),le&&(oe=_e,Z=se[0]),qe.test(se)&&(oe=0,re=0)}}return{totalWidth:Q,spaceCount:ee,spaceAtEnd:te,leftMostLetter:Z,rightGap:re,leftGap:oe,offsetable:ae}},Jn=function(e){var t=e.ctx,n=e.median,r=e.paragraphList,a=e.additionalLineCount,o=void 0===a?0:a,i=e.width,c=e.format,l=e.textData,s=l.fontData,u=l.fontLevel,d=s.fontList[u].letterSpacing,f=[],b=r.reduce((function(e,r){for(var a=(n<=100?100:n)/1e3,o=i/a,s=Gn(r,!0),u=1,b=[],p=0,m=0,h=0,g=0,v=a;g0?a:1)+(0===g?(F>0?-1*Math.min(20/v,F):0)+(Pe.test(O)?4:0):0);if(p+C>o){var S=b.join("").trim();h>0&&(S+=Ce),h<0&&(S=Fe+S),h=0,f.push({line:S,effectiveMedian:n,isLast:!1,actualLineWidth:p});var T=qn({ctx:t,token:x,nextToken:j,xRatio:v,previousTokenGap:0,format:c,textData:l}),R=T.totalWidth,N=T.rightGap,L=T.leftGap;p=R+((L>0?-1*Math.min(20/v,L):0)+(Pe.test(O)?4:0)),m=N,b=[x],u+=1}else p+=C,m=k,b.push(x)}var M=b.join("").trim();return h>0&&(M+=Ce),h<0&&(M=Fe+M),h=0,f.push({line:M,effectiveMedian:n,isLast:!0,actualLineWidth:p}),e+u}),0)+(null!==o&&void 0!==o?o:0);return{currentLineList:f,currentLineCount:b}},$n=function(e){var t=e.ctx,n=e.fontSize,r=e.edge,a=e.baseline,o=e.headText,i=e.headTextLetterWidth,c=e.footText,l=e.footTextWidth,s=e.headTextGap,u=e.headTextSpacing,d=e.headTextHeightRatio,f=e.headTextBold,b=e.headTextGapRatio,p=e.xRatio,m=e.fontStyle,h=e.textWorker,g=e.fitFootText,v=e.headTextOverflow,x=h.applyFuriganaFont,j=h.stopApplyFuriganaFont,y=h.resetScale,O=h.applyScale,w="condense"===v&&c.length>1?Math.min(1,p+.1):0,k=Vn({headText:o,headTextLetterWidth:i,footText:c,footTextWidth:l*p,headTextGap:s,headTextSpacing:u*p,gapPadding:n*b,fitFootText:g,sentenceXRatio:p,xRatio:w}),F=k.gapPadding,C=k.letterSpacing,S=k.trueHeadTextWidth,T=k.halfGap,R=k.alignment,N=k.headTextXRatio,L=S>l*p;if(0===o.length)return{trueHeadTextWidth:S,halfGap:T};var M=g?Math.min(1,l*p/S):1,E=g?M:w&&"center"===R?w:N,I=r;y(),(g||E)&&(O(E,1),I=r/E),"center"===R?(I+=F,L?E>M&&(I+=(l*p/E-S)/2/E):I+=(l*p-S)/2):I+=C/2;var A,B=Object(Ft.a)(o);try{for(B.s();!(A=B.n()).done;){var W=A.value;x();var P=Hn({ctx:t,letter:W,fontStyle:m,metricMethod:"furigana",xRatio:1}),D=P.width,z=P.boundWidth,H=(D-z)/2;j(),x(f),t.fillText(W,I-H,a-n*d),j(),I+=z+C}}catch(K){B.e(K)}finally{B.f()}return(g||E)&&y(),O(p,1),{trueHeadTextWidth:S,halfGap:T}},_n=function e(t){for(var n=t.ctx,r=t.tokenList,a=t.trueEdge,o=t.trueBaseline,i=t.spaceWidth,c=void 0===i?0:i,l=t.xRatio,d=t.yRatio,f=void 0===d?1:d,b=t.textData,p=t.format,m=t.textDrawer,h=t.debug,g=void 0!==h&&h,v=b.currentFont,x=b.fontData,j=b.fontLevel,y=x.fontList[j],O=x.headTextFillStyle,w=x.headTextBold,k=void 0===w?V:w,F=x.headTextHeightRatio,C=void 0===F?Y:F,S=x.headTextOverflow,T=void 0===S?X:S,R=x.headTextGapRatio,N=void 0===R?U:R,L=x.metricMethod,M=x.fontStyle,E=x.letterDeviationMap,I=void 0===E?{}:E,A=y.bulletSymbolWidth,B=y.capitalLetterRatio,W=void 0===B?H.capitalLetterRatio:B,P=y.fontSize,D=y.headTextSpacing,z=void 0===D?H.headTextSpacing:D,K=y.iconSymbolWidth,G=void 0===K?A:K,q=y.largeSymbolRatio,J=void 0===q?H.largeSymbolRatio:q,$=y.letterSpacing,_=void 0===$?H.letterSpacing:$,Z=y.ordinalFontOffsetY,Q=void 0===Z?H.ordinalFontOffsetY:Z,ee=y.squareBracketRatio,te=void 0===ee?H.squareBracketRatio:ee,ne=y.wordLetterSpacing,re=Yn(n,x,y,v),ae=re.stopApplyFuriganaFont,oe=re.applyFuriganaFont,ie=re.stopApplyLargerText,ce=re.applyLargerText,le=re.stopApplyNumberFont,se=re.applyNumberFont,ue=re.stopApplyOrdinalFont,de=re.applyOrdinalFont,fe=re.applyScale,be=re.reverseScale,pe=re.applySymbolFont,me=re.stopApplySymbolFont,ve=re.applyAsymmetricScale,ye=re.resetScale,Oe=1+_/2,we=o/f,ke=0,Se=[],Te=0,Re=a,Ne=0,Me=l;Ne0?-1*Math.min(20,Ue*Me):0)+(Pe.test(Ve)?4:0):0,Qe=Re+Ze,et=ke,rt=0;rt1?Math.min(1,Me+.1):0}),xt=vt.headTextWidth,jt=vt.halfGap,yt=0===pt.length?Math.max(Ae,ht*Ie):jt,Ot=yt,wt=yt,kt=Un(et,wt),Ft=wt>0?wt-kt:0,Ct=qn(Object(s.a)({token:ct,nextToken:lt,previousTokenGap:Ot/Me},He)),St=Ct.offsetable,Tt=Ct.leftGap*Me,Rt=Un(Ot,Tt),Nt=Ft+(Ot>0?Ot-Rt:0),Lt=0,Mt=0;Nt>0&&Tt>=-2&&St?(Lt=(Nt+2*Math.max(Tt,0))/3,Mt=Math.max(Tt,0)-Lt):Lt=Ft;var Et=Qe+(yt<0?-kt:Ze?-Ze:Lt)+Te;Te=Mt,e({ctx:n,format:p,textData:b,tokenList:Gn(dt),trueBaseline:we,trueEdge:Et,xRatio:Me,yRatio:f,spaceWidth:0,textDrawer:m,debug:!1});var It=n.fillStyle,At=n.strokeStyle,Bt=n.shadowColor,Wt=n.shadowOffsetX,Pt=n.shadowOffsetY,Dt=n.shadowBlur;O&&(n.fillStyle=O,n.strokeStyle="",n.shadowColor="",n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=0),$n({ctx:n,fontSize:P,edge:Qe-kt,baseline:we,headText:pt,headTextLetterWidth:gt,footText:dt,footTextWidth:ht,headTextGap:Ae,headTextSpacing:z,headTextHeightRatio:C,headTextBold:k,headTextGapRatio:N,xRatio:Me,fontStyle:M,textWorker:re,fitFootText:mt,headTextOverflow:T}),n.fillStyle=It,n.strokeStyle=At,n.shadowColor=Bt,n.shadowOffsetX=Wt,n.shadowOffsetY=Pt,n.shadowBlur=Dt,Qe+=Math.max(ht*Me,xt)-kt+c,et=Ot}else if(xe.test(it)){var zt=ne?1+ne/2:Oe;n.letterSpacing="".concat((zt-1)*v.getFontInfo().sizeAsNumber,"px");for(var Ht=n.measureText(it).width*Me,Kt=Math.max(Ae,Ht*Ie),Gt=Kt,Yt=it,Xt=Qe-=Un(et,Kt);""!==Yt;){var Vt=Yt[0],Ut=Yt.slice(1),qt=0,Jt=Object(s.a)(Object(s.a)({},Ke),{},{deviation:I[Vt],letter:Vt,edge:Xt});if(ge.test(Vt))fe(te),qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Object(s.a)(Object(s.a)({},Jt),{},{edge:Xt/te,baseline:we/te})),be(te);else if(he.test(Vt)){fe(W);var $t=(qt=n.measureText(Yt).width-n.measureText(Ut).width)>n.measureText(Vt).width*W?Math.round(qt*(1-W))/2:0;Kn(Object(s.a)(Object(s.a)({},Jt),{},{edge:Xt/W+$t,baseline:we/W})),be(W)}else ze.test(Vt)?(se(),qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Jt),le()):Le.test(Vt)&&"tcg"===M?(pe(),qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Jt),me()):(qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Jt));Xt+=qt*Me,Yt=Ut}Qe=Xt,et=Gt,Te=0,n.letterSpacing="0px"}else if(Le.test(it)&&"tcg"===M){var _t=it;pe();var Zt=n.measureText(_t).width*Oe*Me,Qt=Math.max(Ae,Zt*Ie),en=Qt;Qe-=Un(et,Qt),Kn(Object(s.a)(Object(s.a)({},Ke),{},{letter:_t,edge:Qe})),Qe+=Zt,me(),et=en,Te=0}else{var tn=it,nn=Hn({ctx:n,letter:tn,fontStyle:M,metricMethod:L,isLastOfLine:void 0===ct,xRatio:Me}),rn=nn.boundWidth*Oe*Me,an=Math.max(Ae,rn*Ie),on=an;Qe-=Un(et,an),Kn(Object(s.a)(Object(s.a)({},Ke),{},{letter:tn,edge:Qe,deviation:I[tn],letterMetric:nn})),Qe+=rn,("ocg"===p||"tcg"===p&&/\s+/.test(tn))&&!0!==Xe.test(tn)&&(Qe+=c),qe.test(tn)||(et=on),Te=0}}ke=Je*Me,g&&Sn({ctx:n,baseline:we,edge:Re,width:$e*Me,xRatio:Me}),Re+=$e*Me+_e*c+Ze}else Me=l,n.scale(Me,1);else Me=1,n.setTransform(1,0,0,1,0,0)}return{tokenEdge:Re,iconPositionList:Se}},Zn=function(e,t,n){var r,a=null!==n&&void 0!==n?n:{},o=a.multiline,i=void 0===o||o,c=a.furiganaHelper,l=void 0===c||c,s=a.dictionaryType,u=void 0===s?"rubyForm":s,d=null!==e&&void 0!==e?e:"",f="",b="ocg"===t?le:se,p=Object(Ft.a)(d);try{for(p.s();!(r=p.n()).done;){var m,h=r.value;f+=null!==(m=b[h])&&void 0!==m?m:h}}catch(F){p.e(F)}finally{p.f()}var g,v=f,x=(i?v.replace(/^\[([\w\W]*?)\](?=(\n|$))/gm,"".concat(we,"$1").concat(ke)):v).replace(/(^|[-\u2014\s(["])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/[(\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/--/g,"\u2014").replace(/\u25cf /g,"\u25cf").replace(/(\([\uff10-\uff190-9]{1,2}\))/g,(function(e){var t=ue[e];return null!==t&&void 0!==t?t:e})).replaceAll(new RegExp("{{([^{}]+?)}}","g"),(function(e){return e.replaceAll("{{",Fe).replaceAll("}}",Ce)})).replaceAll(new RegExp("{[^{}]+?}","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})),j=("tcg"===t||!1===l?x:x.replaceAll(new RegExp(Ee,"g"),(function(e){var t,n=null!==(t=B[e][u])&&void 0!==t?t:B[e].rubyForm;return"".concat(ye).concat(n).concat(Oe)}))).replaceAll(new RegExp(ve,"g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp("[(\\[\uff5b\u3014\u3008\u300a\u300c\uff62\u300e\u3010\u3018\u3016\u301d'\"\u2018\u201c\uff5f\xab\u25cf]+.","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp(Be,"g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp(".[\u2014...\u2025\u3033\u3034\u3035)]+[^\\s]","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp("[\u2460-\u2473]\uff1a.","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})),y=[],O=0,w=Object(Ft.a)(j);try{for(w.s();!(g=w.n()).done;){var k=g.value;k===ye?(0===O&&y.push(k),O+=1):k===Oe?0===(O-=1)&&y.push(k):y.push(k)}}catch(F){w.e(F)}finally{w.f()}return y.join("").replaceAll("".concat(ke).concat(Oe),"".concat(Oe).concat(ke)).replaceAll("".concat(ye).concat(we),"".concat(we).concat(ye)).replaceAll("".concat(Fe).concat(Oe),"".concat(Oe).concat(Fe)).replaceAll("".concat(ye).concat(Ce),"".concat(Ce).concat(ye)).replaceAll("".concat(we).concat(ke),"").replaceAll("".concat(ye).concat(Oe),"")},Qn=function(e){var t=e.format,n=e.isNormal,r=e.statInEffect,a=e.typeInEffect,o=[t,a?"type":"",r?"stat":""].filter((function(e){return""!==e})).join("-"),i=[t,a?"type":"",r?"stat":""].filter((function(e){return""!==e})).join("-"),c=Z[i];return r&&a&&n&&"tcg"===t&&((c=$).fontList=Q),{fontData:c,sizeList:N[o]}},er=d,tr=function(e){var t,n,r=e.ctx,a=e.content,o=e.isNormal,i=void 0!==o&&o,c=e.fontData,l=void 0===c?Z.tcg:c,u=e.textStyle,d=e.sizeList,f=void 0===d?N["tcg-type"]:d,b=e.condenseTolerant,p=void 0===b?"strict":b,m=e.format,h=e.furiganaHelper,g=0;if(!r||!a)return g;for(var v=Zn(a.trim(),m,{furiganaHelper:h}),x="tcg"===m?null!==(t=te[p])&&void 0!==t?t:te.strict:{1:800,2:800,3:800},j=function(e){var t,n,r,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=e,i=[],c=new RegExp("^(".concat(we,"([^").concat(ke,"]*)").concat(ke,"\\s*)"));do{var l,s;n=null===(l=c.exec(o))||void 0===l?void 0:l[1],(r=null===(s=c.exec(o))||void 0===s?void 0:s[2])&&n&&(i.push(r),o=o.replace(n,""))}while(n&&r);var u="",d=new RegExp(Ne,"m"),f=null===(t=d.exec(e))||void 0===t?void 0:t[1];return f&&a?(u=f,o=o.replace(f,"")):u="",{fullLineList:i,effectText:o,effectFlavorCondition:u}}(v,i),y=j.effectText,O=j.effectFlavorCondition,w=j.fullLineList,k=(null!==(n=w.length)&&void 0!==n?n:0)+(O.length>0?1:0),F=y?y.split("\n"):[],C=l.font,S=l.fontList,T=function(){var e,t,n=S[g],a=n.fontSize,o=n.lineHeight,c=n.lineCount,d=null!==(e=f[g])&&void 0!==e?e:f[f.length-1],b=d.trueEdge,p=d.trueWidth,h=d.trueBaseline,v=i&&"tcg"===m?p-2:p,j=jt();r.font=j.setStyle(i&&"tcg"===m?"italic":"").setWeight("").setSize(a).setFamily(C).getFont(),r.textAlign="left";var y={fontData:l,fontLevel:g,currentFont:j},T=[],R=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:F,additionalLineCount:k,format:m,textData:y,width:v}),n=t.currentLineList,a=t.currentLineCount;return T=n,!(a>c)}),200),N=In(Object(s.a)({ctx:r},u));if(!(R<(null!==(t=x["".concat(F.length)])&&void 0!==t?t:x[3])&&g1)}))}}));if([].concat(Object(wn.a)(M),Object(wn.a)(T)).forEach((function(e){var t=e.line,n=e.isLast,a=e.effectiveMedian/1e3,i=function(e){for(var t=e.ctx,n=e.line,r=e.width,a=e.xRatio,o=e.format,i=e.isLast,c=e.textData,l=Gn(n),s=0,u=0,d=0,f=0,b=a;f0?-1*Math.min(20,j*b):0)+(0===f&&Pe.test(O)?4*b:0)),u+=g-(x&&void 0===m?1:0)}else b=a;else b=1}var w=u>0?(r-s)/u:0;return{tokenList:l,spaceWidth:i?"tcg"===o?w>1.5?0:w:w>3.65?0:w:w}}({ctx:r,line:t,xRatio:a,format:m,isLast:n,textData:y,width:v}),c=i.tokenList,l=i.spaceWidth;r.scale(a,1),_n({ctx:r,tokenList:c,xRatio:a,yRatio:1,trueEdge:b,trueBaseline:L,spaceWidth:l,textData:y,format:m}),L+=o,r.setTransform(1,0,0,1,0,0)})),O.length>0){var E=xt((function(e){return!(Jn({ctx:r,median:e,paragraphList:[O],format:m,textData:y,width:v}).currentLineCount>1)}))/1e3;r.scale(E,1),r.font=j.setStyle("").getFont();var I=Gn(O);I="\n"===I[0]?I.slice(1):I,_n({ctx:r,tokenList:I,xRatio:E,yRatio:1,trueEdge:b,trueBaseline:L,textData:y,format:m}),L+=o,r.setTransform(1,0,0,1,0,0)}return"break"}g+=1,N()};g12&&(b="center"),a&&"center"===b&&(d=0,f=0),p="center"===b?(nr+f)/2:"left"===b?85.9125+f:728.775,m=-54,n&&a&&"st"!==r&&(50,h=In(Object(s.a)({ctx:n},l)),n.textAlign="left"===b||"right"===b?b:"left",n.font="bold ".concat(50,"px RoGSanSrfStd-Bd"),g="center"===b?n.measureText(a).width/-2:"left"===b?4:-58,n.fillText(a,p+g,190),n.textAlign="left",h()),e.next=16,Promise.all(Object(wn.a)(Array(d)).map(Object(mn.a)(pn.a.mark((function e(){var t;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[p-(50+(m+=54)),145],e.next=4,Wn.apply(void 0,[n,"subfamily/subfamily-".concat(r,".png")].concat(t));case 4:return e.next=6,u(t);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))));case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ar=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ctx,r=t.sticker,Nn(n)){e.next=3;break}return e.abrupt("return");case 3:if("no-sticker"!==r){e.next=5;break}return e.abrupt("return",Promise.resolve());case 5:return e.abrupt("return",Wn(n,"sticker/sticker-".concat(r.toLowerCase(),".png"),739.1438,1110.938));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),or=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r,a,o,i,c,l,s,u;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ctx,r=t.type,a=t.isPendulum,o=t.isLink,i=t.isDuelTerminalCard,c=t.isSpeedCard,l=t.bordered,n){e.next=3;break}return e.abrupt("return");case 3:if(!i){e.next=7;break}return s=a?[250,1087,180,20]:o?[151,848,216,24]:[80,843,270,30],e.next=7,Dn.apply(void 0,[n,"text/text-duel-terminal-".concat(r).concat(l?"-bordered":"",".png")].concat(s));case 7:if(!c){e.next=11;break}return u=a?[250,1090,176.4,18]:o?[151,855,215.6,22]:[80,850,245,25],e.next=11,Dn.apply(void 0,[n,"text/text-speed-duel-".concat(r).concat(l?"-bordered":"",".png")].concat(u));case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ir=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r){var a,o,i;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=t.getContext("2d"))&&Array.isArray(n)){e.next=3;break}return e.abrupt("return");case 3:return i=null!==(a=r.color)&&void 0!==a?a:"#000000",e.next=6,zn(t,"link/link-text.png",i,120,30,600,1080,r);case 6:o.textAlign="right",o.scale(1.2,1),o.font="bold 26.55px RoGSanSrfStd-Bd",o.fillText("".concat(n.length),622.75,1105),o.setTransform(1,0,0,1,0,0),o.textAlign="left";case 12:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),cr=b,lr=p,sr=m,ur=function(e){var t=e.canvas,n=e.artworkCanvas,r=e.backgroundCanvas,a=e.format,o=e.hasBackground,i=e.frame,c=e.bottomFrame,l=e.backgroundType,u=e.cardIcon,d=e.attribute,f=e.star,b=e.foil,p=e.pendulumSize,m=e.opacity,h=e.isLink,g=e.isSpeedSkill,v=e.isXyz,j=e.isPendulum,O=e.loopFinish,w=e.loopArtFinish,k=t.getContext("2d"),F=m.artBorder,C=m.nameBorder,S=m.body,T=m.name,R=m.pendulum,N=m.text,L=m.boundless,M=x(j,m),E=M.artX,I=M.artY,A=M.artFinishX,B=M.artFinishY,W=M.artWidth,P=S>0||F,D=860,z="normal"!==b,H=v||g?i:"normal",K=H,G=!L&&P,Y={calculateCardArtRedrawCoordination:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,a=null!==t&&void 0!==t?t:m,o=a.body,i=x(j,a,r),c=i.artX,l=i.artY,s=i.artWidth,u=e.width,d=e.height,f=s/u,b=o<100?(sr-c)/f:0,p=b*f,h=o<100?(cr-l)/f:0,g=h*f,v=o<100?d-lr/f:0,y=c+p,O=l+g,w=s-2*p,k=s/(u/d)*n-v*f;return{imageScaledRatio:f,sourceOffsetX:b,sourceOffsetY:h,destinationOffsetX:p,destinationOffsetY:g,offsetHeight:v,destinationX:y,destinationY:O,destinationWidth:w,destinationHeight:k}},drawFrame:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k){e.next=2;break}return e.abrupt("return");case 2:return k.globalAlpha=S/100,e.next=5,Wn(k,"frame/frame-".concat(i,".png"),0,0);case 5:return e.next=7,Wn(k,"frame-pendulum/frame-pendulum-".concat(c,".png"),0,0);case 7:k.globalAlpha=1;case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawCardArt:function(){if(n&&k){var e=n.width,t=n.height;t<=0||k.drawImage(n,0,0,e,t,E,I,W,W/(e/t))}},drawBackground:function(e){if(r&&k&&o){var t=r.width,n=r.height;if(!(n<=0))if("pendulum"!==e){var a=x(j,Object(s.a)(Object(s.a)({},m),{},{boundless:!0}),l),i=a.artX,c=a.artY,u=a.artWidth;k.drawImage(r,0,0,t,n,i,c,u,u/(t/n))}else{var d=Y.calculateCardArtRedrawCoordination(r);"full"===l?d=Y.calculateCardArtRedrawCoordination(r,Object(s.a)(Object(s.a)({},m),{},{body:0}),void 0,"full"):"fit"===l&&(d=Y.calculateCardArtRedrawCoordination(r,m,void 0,"fit"));var f=d,b=f.sourceOffsetX,p=f.sourceOffsetY,h=f.offsetHeight,g=f.destinationX,v=f.destinationY,y=f.destinationWidth,O=f.destinationHeight;k.drawImage(r,b,p,t-2*b,n-h,g,v,y,O)}}},drawAttribute:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"attribute/attr-".concat(a,"-").concat(d.toLowerCase(),".png"),678,55);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawStar:function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r,a;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.style,r=t.starAlignment,a="auto"===u?bt(i):u,e.next=4,rr({ctx:k,cardIcon:a,text:"string"===typeof f?f:null,star:f,starAlignment:r,style:n,onStarDraw:function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("st"!==a){e.next=4;break}e.t0=Promise.resolve(),e.next=7;break;case 4:return e.next=6,O(k,"star",function(){var e=Object(mn.a)(pn.a.mark((function e(n){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn.apply(void 0,[k,"finish/finish-".concat(n,"-star.png")].concat(Object(wn.a)(t))));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 6:e.t0=e.sent;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),drawPendulumScaleIcon:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame-pendulum/pendulum-scale-".concat(p,".png"),0,750);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawLinkArrowMap:function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([1,2,3,4,6,7,8,9].map(function(){var e=Object(mn.a)(pn.a.mark((function e(n){var r,a,o,i,c,l,s,u,d;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(r=me[n-1]).left,o=r.top,i=r.height,c=r.width,l=t.includes("".concat(n)),s="link/link-inactive-".concat(n),u="link/link-active-".concat(n),d=[a,o,c,i],e.next=7,Dn.apply(void 0,[k,"".concat(s,"-base").concat(L?"-full":"",".png")].concat(d));case 7:return e.next=9,Dn.apply(void 0,[k,"".concat(s,"-core.png")].concat(d));case 9:if(!l){e.next=15;break}return e.next=12,Dn.apply(void 0,[k,"".concat(u,"-base.png")].concat(d));case 12:return e.abrupt("return",Dn.apply(void 0,[k,"".concat(u,"-core.png")].concat(d)));case 15:return e.abrupt("return");case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),drawStatBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(n){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zn(t,"frame/frame-stat-border.png",n,813,20,0,1070);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),drawNameBackground:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k){e.next=2;break}return e.abrupt("return");case 2:return k.globalAlpha=T/100,e.next=5,Wn(k,"background/background-name-".concat(i,".png"),0,0);case 5:k.globalAlpha=1;case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawEffectBackground:function(){var e=Object(mn.a)(pn.a.mark((function e(){var t,n=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],k){e.next=3;break}return e.abrupt("return");case 3:return k.globalAlpha=N/100,e.next=6,Wn(k,"background/background-text-".concat(c,".png"),54,884);case 6:if(!t){e.next=10;break}return k.globalAlpha=R/100,e.next=10,Wn(k,"background/background-pendulum-".concat(c,".png"),55,738);case 10:k.globalAlpha=1;case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawFrameBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"frame/frame-border-".concat(H,".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawNameBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",C?Wn(k,"frame/name-border-".concat(K,".png"),0,0):Promise.resolve());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){var t;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=5;break}return t="",t=v||g?"frame/art-border-".concat(i,".png"):h||["zarc","hamon","uria","raviel"].includes(i)?"frame/art-border-special.png":"frame/art-border.png",e.next=5,Wn(k,t,60,170);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawPendulumBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(t,n){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame-pendulum/border-pendulum-".concat(p)+"-".concat(n)+(t?"":"-artless")+".png",30,185);case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),drawEffectBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(z||"speed-skill"!==c){e.next=5;break}return e.next=3,Wn(k,"frame/effect-border-speed-skill.png",35,D);case 3:e.next=7;break;case 5:return e.next=7,Wn(k,"frame/effect-border.png",35,D);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawCardBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame/card-border".concat(z?"-".concat(b):"",".png"),0,0);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtBorderFoil:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=3;break}return e.next=3,Wn(k,"frame/art-border-".concat(b,".png"),60,170);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawEffectBorderFoil:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame/effect-border-".concat(b,".png"),35,D);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawLinkMapFoil:function(){var e=Object(mn.a)(pn.a.mark((function e(){var t,n=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:P,e.next=3,Wn(k,"link/link-overlay-arrow-".concat(b).concat(t?"":"-artless",".png"),0,175);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawNameFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P&&!C){e.next=3;break}return e.next=3,O(k,"name",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-name.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawAttributeFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d===y){e.next=3;break}return e.next=3,O(k,"attribute",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-attribute.png"),678,55));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!G){e.next=3;break}return e.next=3,w(k,"art",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"finish/art-finish-".concat(t).concat(j?"-pendulum-".concat(p):"",".png"),A,B);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtOverlayFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"art-overlay",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish"+"-".concat(t)+"-".concat(G?"art":"unart")+"-overlay"+(j?"-pendulum-".concat(p):"")+".png",A,B));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtBorderFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=3;break}return e.next=3,O(k,"art-border",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-art-border.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawPendulumArtBorderFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=3;break}return e.next=3,O(k,"art-border-pendulum",(function(e){return Wn(k,"finish/finish-".concat(e,"-art-border-pendulum-").concat(p,".png"),0,0)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawBorderPendulumFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"border-pendulum",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-border-pendulum-").concat(p,".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawFrameFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"frame",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-frame").concat(j?"-pendulum-".concat(p):"",".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawFrameBackgroundFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"frame-background",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-frame-background").concat(j?"-pendulum-".concat(p):"",".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawOverlayFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"overlay",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-overlay.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawCardBorderFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"card-border",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-card-border.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()};return Y},dr=function(e,t,n,r,a,o,i,c){var l=t%360,s="".concat(Math.floor(l/90)),u=l%90,d=i+c,f=r+a/2,b=o+(c-i)/2,p=a,m=d;"1"!==s&&"3"!==s||(p=d,m=a);var h=Math.sqrt(Math.pow(p,2)/4+Math.pow(m,2)/4);if(h>0){var g=90-(180*Math.asin(p/2/h)/Math.PI-u),v=Math.sin(g/180*Math.PI)*h,x=Math.sin(u/180*Math.PI)*v,j=Math.cos(u/180*Math.PI)*v,y=x,O=j;"1"===s&&(y=j,O=-x),"2"===s&&(y=-x,O=-j),"3"===s&&(y=-j,O=x);var w=f+y,k=b-O,F=f-y,C=b+O,S=e.createLinearGradient(w,k,F,C);return n.forEach((function(e){var t=e.color,n=e.offset;return S.addColorStop(parseFloat(n),t)})),S}},fr=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i,c){var l,u,d,f,b,p,m,h,g,v,x,j,y,O,w,k,F,C,S,R,N,L,M,E,I,A,B,W,P,D,z,K,G,Y,X,V,U,q,J,$,_,Z,Q,ee,te,re,ae,oe,ie;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=c.isSpeedSkill,u=c.format,d=c.cloneNode,f=c.frame,b=c.furiganaHelper,p=null===d||void 0===d?void 0:d.getContext("2d"),!(t&&p&&n)){e.next=58;break}if(v=Object(s.a)(Object(s.a)({},{font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"}),i),x=v.font,j=v.fillStyle,y=v.headTextFillStyle,O=v.shadowBlur,w=v.hasShadow,k=v.shadowColor,F=v.shadowOffsetX,C=v.shadowOffsetY,S=v.hasOutline,R=v.lineColor,N=v.lineWidth,L=v.lineOffsetX,M=v.lineOffsetY,E=v.hasGradient,I=v.gradientAngle,A=v.gradientColor,B=v.pattern,W=null!==(m=T[null!==B&&void 0!==B?B:""])&&void 0!==m?m:{},P=W.patternImage,D=W.blendMode,z=S,t.textAlign="left",w&&(t.shadowColor=k,t.shadowOffsetY=C,t.shadowOffsetX=F,t.shadowBlur=O),S&&(t.lineWidth=N,t.strokeStyle=R),K=Object(s.a)(Object(s.a)({},(null!==(h=ne[x])&&void 0!==h?h:ne.Default).fontData),{},{headTextFillStyle:y}),G=jt({defaultFamily:K.font,defaultSize:K.fontList[0].fontSize,defaultWeight:K.weight}),Y={fontLevel:0,fontData:K,currentFont:G},X=Zn(n,u,{multiline:!1,furiganaHelper:b,dictionaryType:"rubyFormName"}),V="ocg"===u?[X]:X.split(new RegExp("([^".concat("&A-Za-z0-9\\-/\\s\\(\\)!,.\u2018\u201c\u2019\u201d:;<>\\[\\]\\\\","])"),"g")),U=jt({defaultFamily:K.font,defaultSize:K.fontList[0].fontSize,defaultWeight:K.weight}),q=U.getFont(),J=U.setSize((function(e){return e*K.symbolFontRatio})).setStyle("small-caps").setFamily(K.symbolFont).getFont(),$=0,_=0,V.forEach((function(e,n){t.font=n%2===0?q:J;var r=t.measureText(e.replaceAll(Se,""));$=Math.max($,r.actualBoundingBoxAscent),_=Math.max(_,r.actualBoundingBoxDescent)}),0),t.font=q,Z=0,Q=xt((function(e){var n=Jn({ctx:t,median:e,paragraphList:[X],format:u,textData:Y,width:o}),r=n.currentLineCount,a=n.currentLineList;return!(r>1)&&(Z=a[0].actualLineWidth,!0)})),ee=Q/1e3,te=1,t.scale(ee,te),re=null!==(g=K.fontList[0].offsetY)&&void 0!==g?g:H.offsetY,ae=Gn(X),oe=Z>0&&E?dr(t,I,Ot(A),r,Z,a,$,_):void 0,t.fillStyle=null!==oe&&void 0!==oe?oe:j,_n({ctx:t,tokenList:ae,xRatio:ee,yRatio:te,trueEdge:r,trueBaseline:a,textData:Y,format:u,textDrawer:function(e){var t=e.ctx,n=e.letter,r=e.scaledEdge,a=e.scaledBaseline;t.fillText(n,r,a-(l?re:0))}}),!P||!d){e.next=45;break}return t.setTransform(1,0,0,1,0,0),e.next=35,Wn(p,"frame/frame-".concat(f,".png"),0,0);case 35:return e.next=37,Wn(p,"background/background-name-".concat(f,".png"),0,0);case 37:return p.globalCompositeOperation=D,e.next=40,Dn(p,"finish-name/".concat(P,".png"),r,a-$,o,$+_);case 40:t.globalCompositeOperation="source-in",t.drawImage(d,0,0),t.scale(ee,te),t.globalCompositeOperation="source-over",_n({ctx:t,tokenList:ae,xRatio:ee,yRatio:te,trueEdge:r,trueBaseline:a,textData:Y,format:u,textDrawer:function(){}});case 45:z&&(t.globalCompositeOperation="destination-over",_n({ctx:t,tokenList:ae,xRatio:ee,yRatio:te,trueEdge:r,trueBaseline:a,textData:Y,format:u,textDrawer:function(e){var t=e.ctx,n=e.letter,r=e.scaledEdge,a=e.scaledBaseline;t.lineJoin="round",t.strokeText(n,r+L,a+M-(l?re:0))}})),t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),ie={font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"},t.fillStyle=ie.fillStyle,t.shadowColor=ie.shadowColor,t.shadowOffsetY=ie.shadowOffsetY,t.shadowOffsetX=ie.shadowOffsetX,t.shadowBlur=ie.shadowBlur,t.lineWidth=ie.lineWidth,t.strokeStyle=ie.lineColor,t.lineJoin="miter",t.globalCompositeOperation="source-over";case 58:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i,c){return e.apply(this,arguments)}}(),br={small:0,medium:1,large:2},pr=function(e){var t,n,r=e.ctx,a=e.value,o=e.format,i=e.metricMethod,c=e.size,l=e.furiganaHelper,u=null!==(t=null===(n=M[o])||void 0===n?void 0:n[c])&&void 0!==t?t:M.tcg.medium,d=u.edgeAlignment,f=void 0===d?"left":d,b=u.trueEdge,p=u.trueBaseline,m=u.trueWidth,h={tcg:oe,ocg:ie}[o];i&&(h.metricMethod=i);var g=h.font,v=br[c],x=h.fontList[v],j=jt({defaultFamily:g,defaultSize:"".concat(x.fontSize,"px")}),y={fontLevel:v,fontData:h,currentFont:j},O=0;r.font=j.getFont(),r.textAlign="left";var w=Zn(a,o,{multiline:!1,furiganaHelper:l}),k=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:[w],format:o,textData:y,width:m}),n=t.currentLineCount,a=t.currentLineList;return!(n>1)&&(O=a[0].actualLineWidth,!0)}))/1e3;r.scale(k,1);var F=_n({ctx:r,tokenList:Gn(w),xRatio:k,yRatio:1,trueEdge:"left"===f?b:b-O*k,trueBaseline:p,textData:y,format:o,textDrawer:function(e){var t=e.ctx,n=e.letter,r=e.scaledEdge,a=e.scaledBaseline;t.fillText(n,r,a)}});return r.setTransform(1,0,0,1,0,0),Object(s.a)(Object(s.a)({},F),{},{xRatio:k})},mr=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r,a,o,i,c,l,u,d,f,b,p,m,h,g,v,x,j,y,O,k,F,C,S;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ctx,r=t.typeAbility,a=t.subFamily,o=t.format,i=t.frame,c=t.size,l=t.isMonster,u=t.textStyle,d=t.furiganaHelper,Nn(n)){e.next=3;break}return e.abrupt("return");case 3:if(f=r.length>0,p=r+((b=a!==w&&"large"===c)?"\u29be":""),m=f?"tcg"===o?"large"===c?"[\u200a\u200a".concat(p,"\u200a\u200a]"):"[".concat(p,"]"):"\u3010".concat(p,"\u3011"):"",f){e.next=9;break}return e.abrupt("return");case 9:if(h=mt(i)&&!dt({frame:i})&&"large"===c?"#ffffff":"#000000",g=Object(s.a)({color:h},u),v=In(Object(s.a)({ctx:n},g)),x=pr({ctx:n,format:o,size:c,value:m,metricMethod:l?void 0:"compact",furiganaHelper:d}),j=x.iconPositionList,y=x.xRatio,v(),O="ocg"===o?-4:0,k="ocg"===o?-3:0,!b){e.next=22;break}return F=j[0],C=F.edge,S=F.baseline,e.next=20,Dn(n,"subfamily/subfamily-".concat(a.toLowerCase(),".png"),(function(e){return C+.175*e.naturalWidth*y+k}),(function(e){return S-.8*e.naturalWidth+O}),(function(e){return e.naturalWidth}),(function(e){return e.naturalWidth}));case 20:e.next=22;break;case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),hr=function(e,t,n,r){if(e&&t){e.font="".concat(60.5,"px MatrixBoldSmallCaps"),e.textAlign="left";var a="".concat(t).split(""),o=0;a.forEach((function(t){o+=e.measureText(t).width*("1"===t?.65:1)}));var i=n-o/2;a.forEach((function(t){e.fillText(t,"1"===t?i-3:i,r+60.5),i+=e.measureText(t).width*("1"===t?.65:1)}))}},gr=function(e,t,n,r){if(e){e.scale(1,.98),e.font="bold 35.73px Matrix-Bold";var a=Tn(e,t,.075,n,r/.98);e.setTransform(1,0,0,1,0,0),e.scale(1,1.01),e.font="bold 34.74px Matrix-Bold",Tn(e,"/",.15,a+5,r/1.01),e.setTransform(1,0,0,1,0,0)}},vr=function(e,t,n,r){if(e&&null!=t){var a=73.97;if("\u221e"===t)e.textAlign="right",e.font="bold 37px matrix",e.fillText(t,n+a,r);else if("?"===t)e.textAlign="right",e.font="bold 34px matrix",e.fillText(t,n+a,r);else{e.textAlign="left";var o="".concat(t).split("?"),i=o.reduce((function(t,n,r){e.font="37px MatrixBoldSmallCaps";var a=t+e.measureText(n).width;return r0){var c=Math.min(a/i,1);e.scale(c,1),o.reduce((function(t,n,a,i){var l=i[i.length-1-a],s=t;return e.font="37px MatrixBoldSmallCaps",s-=e.measureText(l).width*c,e.fillText(l,s/c,r),a0||i,(f=function(e,n,r,a){t.fillStyle=A?d:h,t.fillRect(e,n,r,a)})(0,0,jr,xr),p=ur({canvas:l.current,artworkCanvas:n,backgroundCanvas:r,format:M,frame:W,bottomFrame:Fe,hasBackground:A,backgroundType:B,attribute:fe,cardIcon:be,star:me,foil:P,pendulumSize:_e,opacity:o,isLink:Re,isSpeedSkill:Le,isXyz:Te,isPendulum:ne,loopFinish:Qe,loopArtFinish:et}),m=p.drawFrame,x=p.drawCardArt,j=p.drawBackground,y=p.drawPendulumScaleIcon,O=p.drawLinkArrowMap,w=p.drawStar,k=p.drawAttribute,F=p.drawNameBackground,C=p.drawEffectBackground,S=p.drawFrameBorder,T=p.drawNameBorder,R=p.drawArtBorder,N=p.drawPendulumBorder,L=p.drawBorderPendulumFinish,E=p.drawEffectBorder,I=p.drawCardBorder,D=p.drawStatBorder,z=p.drawAttributeFinish,H=p.drawArtBorderFoil,K=p.drawEffectBorderFoil,G=p.drawLinkMapFoil,X=p.drawNameFinish,V=p.drawArtFinish,U=p.drawArtOverlayFinish,q=p.drawArtBorderFinish,J=p.drawPendulumArtBorderFinish,$=p.drawFrameFinish,_=p.drawFrameBackgroundFinish,Z=p.drawOverlayFinish,Q=p.drawCardBorderFinish,ee=p.calculateCardArtRedrawCoordination,r&&t&&j(),n&&t&&!u&&x(),e.next=12,m();case 12:return e.next=14,I();case 14:return e.next=16,Q();case 16:if(ne){e.next=32;break}if(u){e.next=26;break}return e.next=20,F();case 20:return e.next=22,C();case 22:return e.next=24,E();case 24:return e.next=26,K();case 26:return e.next=28,R();case 28:return e.next=30,H();case 30:return e.next=32,q();case 32:if(!ne||Re||u){e.next=38;break}return n&&t&&n.height>0&&(te=n.width,re=n.height,ae=ee(n),oe=ae.sourceOffsetX,ie=ae.sourceOffsetY,ce=ae.offsetHeight,le=ae.destinationX,se=ae.destinationY,ue=ae.destinationWidth,pe=ae.destinationHeight,f(le,se,ue,pe),j("pendulum"),t.drawImage(n,oe,ie,te-2*oe,re-ce,le,se,ue,pe)),e.next=36,F();case 36:return e.next=38,C(!0);case 38:return e.next=40,V();case 40:return e.next=42,U();case 42:if(!ne||Re||u){e.next=54;break}return e.next=45,y();case 45:return e.next=47,N(b,"normal");case 47:return e.next=49,N(b,P);case 49:return e.next=51,J();case 51:if(!b){e.next=54;break}return e.next=54,L();case 54:if(u){e.next=59;break}return e.next=57,$();case 57:return e.next=59,X();case 59:if(!b){e.next=62;break}return e.next=62,_();case 62:if(!u){e.next=108;break}if(!Re){e.next=68;break}return e.next=66,q();case 66:e.next=78;break;case 68:if(!ne){e.next=78;break}if(ge=v.fullCard.ratio/v.extendedPendulum.ratio,n&&t&&n.height>0&&(ve=ee(n,Object(s.a)(Object(s.a)(Object(s.a)({},g()),Y),{},{body:100,boundless:!1}),ge),xe=ve.destinationX,je=ve.destinationY,ye=ve.destinationWidth,ke=ve.destinationHeight,f(xe,je,ye,ke),j("pendulum")),!b){e.next=76;break}return e.next=74,N(b,"normal");case 74:return e.next=76,N(b,P);case 76:return e.next=78,J();case 78:return e.next=80,F();case 80:return e.next=82,X();case 82:return e.next=84,T();case 84:return n&&t&&x(),e.next=87,U();case 87:if(!ne||Re){e.next=100;break}return e.next=90,C(!0);case 90:return e.next=92,y();case 92:return e.next=94,N(!1,"normal");case 94:return e.next=96,N(!1,P);case 96:return e.next=98,L();case 98:e.next=106;break;case 100:return e.next=102,C();case 102:return e.next=104,E();case 104:return e.next=106,K();case 106:return e.next=108,$();case 108:if(!Ve){e.next=111;break}return e.next=111,D(null!==(a=Ke.color)&&void 0!==a?a:"#000000");case 111:if(ne||!Re){e.next=120;break}return e.next=114,O(de);case 114:return e.next=116,G(!1);case 116:return Ce=In(Object(s.a)({ctx:t},Ke)),e.next=119,ir(l.current,null!==de&&void 0!==de?de:[],Ke);case 119:Ce();case 120:return e.next=122,k();case 122:return e.next=124,z();case 124:if(Re){e.next=127;break}return e.next=127,w({style:De,starAlignment:he});case 127:if(u){e.next=130;break}return e.next=130,T();case 130:return e.next=132,S();case 132:return e.next=134,or({ctx:t,type:Be&&!ne?"white":"black",bordered:(c<50||u)&&!ne,isDuelTerminalCard:Oe,isSpeedCard:we,isLink:Re,isPendulum:ne});case 134:return e.next=136,Z();case 136:case"end":return e.stop()}}),e)})))}}),[Ze,i,c,l,W,M,A,B,fe,Fe,P,me,he,be,Oe,Re,ne,we,Le,Te,Be,de,Ke,et,Qe,Y,_e,Ve,De,Je]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=w.current)||void 0===e?void 0:e.getContext("2d");Nn(t)&&ne&&(hr(t,null!==ce&&void 0!==ce?ce:0,84.4,790),hr(t,null!==le&&void 0!==le?le:0,728,790))}}),[Ze,ne,ce,le,w]),Object(o.useEffect)((function(){Ze&&(tt.current.name.rerun+=1,tt.current.name.instructor=Object(mn.a)(pn.a.mark((function e(){var t,n,r,a;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null===(t=m.current)||void 0===t?void 0:t.getContext("2d"),a=null===(n=m.current)||void 0===n?void 0:n.cloneNode(),Nn(r)&&a){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,fr(r,X,"tcg"===M?60:68,116,fe===y?"tcg"===M?688:674:"tcg"===M?608:598,ht({format:M,frame:W,nameStyle:V,nameStyleType:U,foil:P}),{isSpeedSkill:Le,format:M,cloneNode:a,frame:W,furiganaHelper:ke});case 6:case"end":return e.stop()}}),e)}))))}),[Ze,fe,P,M,W,ke,Le,X,m,V,U]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=F.current)||void 0===e?void 0:e.getContext("2d");if(Nn(t)&&Ve){var n=In(Object(s.a)({ctx:t},Ke));gr(t,"ATK",432.1,1106.494),vr(t,se,508.824,1106.494),Re||(gr(t,"DEF",600.85,1106.494),vr(t,ue,673.865,1106.494)),n()}}}),[Ze,se,ue,Re,Ne,Ke,F,Ve]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=k.current)||void 0===e?void 0:e.getContext("2d");Nn(t)&&function(e,t,n){if(e){var r=n.isPendulum,a=n.isLink,o=n.withShadow,i=n.format,c=n.lightFooter,l=.175,s=0,u=0;e.fillStyle=c&&!r?"#ffffff":"#000000",e.shadowColor=o?c?"#000000":"#ffffff":"#000000",e.shadowOffsetY=0,e.shadowOffsetX=0,e.shadowBlur=o&&!r?3:0,e.font="".concat(o?"bold":""," 22px stone-serif-regular"),"ocg"===i&&(l=.145,s=-1,u=-3),r?Tn(e,t,l,66.65+u,1105.01+s):a?Rn(e,t,l,666.56+u,872.94+s):Rn(e,t,l,728.78+u,871.5+s)}}(t,ge,{isLink:Re,isPendulum:ne,withShadow:Ae&&!ne,format:M,lightFooter:Be})}}),[Ze,M,Re,ne,Be,k,ge,Le,Fe,Ae]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=j.current)||void 0===e?void 0:e.getContext("2d");if(Nn(t)){var n=function(e){var t,n,r=e.ctx,a=e.value,o=e.format,i=e.alignment,c=e.baselineOffset,l=void 0===c?0:c,s=e.lightFooter,u=e.hasShadow;if(!Nn(r))return 0;r.fillStyle=s?"#ffffff":"#000000",r.shadowColor=u?s?"#000000":"#ffffff":"#000000",r.shadowOffsetY=0,r.shadowOffsetX=0,r.shadowBlur=u?3:0;for(var d=null!==(t=I[o])&&void 0!==t?t:I.tcg,f=d.trueEdge,b=d.trueBaseline,p=d.trueWidth,m=/^[0-9]*$/.test(a),h=ae[o],g=h.font,v=Zn(a,o,{multiline:!1,furiganaHelper:!1}),x={fontLevel:m?0:1,fontData:h,currentFont:jt()},j=0,y=1e3,O=h.fontList[0],w=function(e){O=h.fontList[e];var t=jt({defaultFamily:g,defaultSize:"".concat(O.fontSize,"px"),defaultWeight:u?"bold":""}),n={fontLevel:e,fontData:h,currentFont:t},a=0;if(r.font=t.getFont(),r.textAlign="left",y=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:[v],format:o,textData:n,width:p}),i=t.currentLineCount,c=t.currentLineList;return!(i>1)&&(a=c[0].actualLineWidth,!0)})),j=a,x=n,y>=1e3)return"break"},k=0;k1&&void 0!==arguments[1]?arguments[1]:99,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{stroke:!1};if(e){var a=(null!==r&&void 0!==r?r:{}).stroke,o=void 0!==a&&a;e.font="bold 23.7px palatino-linotype-bold";var i=t;e.fillText("1",i,1150.93+n),o&&e.strokeText("1",i,1150.93),i+=e.measureText("1").width-2,e.font="bold 17.78px palatino-linotype-bold",e.fillText("st",i,1143.53+n),o&&e.strokeText("st",i,1143.53),i+=e.measureText("st").width,e.font="bold 22.22px palatino-linotype-bold",e.fillText(" Edition",i,1150.93+n),o&&e.strokeText(" Edition",i,1150.93)}}(t,Math.max(n+14.813,142.2)-("ocg"===M?10:0),Le?-2:-1))}}}),[Ze,Oe,ye,ve,j,Be,M,Ae,Le,Fe]),Object(o.useEffect)((function(){var e;Ze&&function(e){var t,n,r=e.ctx,a=e.value,o=e.format,i=e.alignment,c=e.baselineOffset,l=void 0===c?0:c,s=e.lightFooter,u=e.hasShadow;if(Nn(r)){r.fillStyle=s?"#ffffff":"#000000",r.shadowColor=u?s?"#000000":"#ffffff":"#000000",r.shadowOffsetY=0,r.shadowOffsetX=0,r.shadowBlur=u?3:0;for(var d=null!==(t=E[o])&&void 0!==t?t:E.tcg,f=d.trueEdge,b=d.trueBaseline,p=d.trueWidth,m=re[o],h=m.font,g=Zn(a,o,{multiline:!1,furiganaHelper:!1}),v={fontLevel:0,fontData:m,currentFont:jt()},x=0,j=1e3,y=m.fontList[0],O=function(e){y=m.fontList[e];var t=jt({defaultFamily:h,defaultSize:"".concat(y.fontSize,"px"),defaultWeight:u?"bold":""}),n={fontLevel:e,fontData:m,currentFont:t},a=0;if(r.font=t.getFont(),r.textAlign="left",j=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:[g],format:o,textData:n,width:p}),i=t.currentLineCount,c=t.currentLineList;return!(i>1)&&(a=c[0].actualLineWidth,!0)})),x=a,v=n,j>=1e3)return"break"},w=0;w2&&void 0!==arguments[2]?arguments[2]:0;return new Promise((function(r){setTimeout((function(){if(e.current&&t)try{e.current.toBlob((function(e){if(e){var n=URL.createObjectURL(e);if(n){var a=new Image;a.src=n,a.onload=function(){t.drawImage(a,0,0),URL.revokeObjectURL(n),r(!0)},a.onerror=function(){URL.revokeObjectURL(n),r(!1)}}else r(!1)}else r(!1)}))}catch(n){console.error(n),r(!1)}else r(!1)}),25*n)}))},!c||!s){e.next=37;break}return s.clearRect(0,0,d,f),e.next=8,Promise.all(Object.values(tt.current).sort((function(e,t){return e.order-t.order})).map((function(e){var t=e.instructor,n=e.rerun,r=e.name;return 0!==n&&nt.current[r]!==n||!nt.current[r]?(nt.current[r]=n,t()):Promise.resolve()})));case 8:return(v=i.current)&&s&&(y=x(r,o),L=y.artX,M=y.artY,E=y.artWidth,I=v.width,(A=v.height)>0&&s.drawImage(v,0,0,I,A,L,M,E,E/(I/A))),e.next=12,u(l,s,0);case 12:return e.next=14,u(m,s,0);case 14:return e.next=16,u(S,s,0);case 16:return e.next=18,u(w,s,0);case 18:return e.next=20,u(O,s,0);case 20:return e.next=22,u(T,s,0);case 22:return e.next=24,u(p,s,0);case 24:return e.next=26,u(F,s,0);case 26:return e.next=28,u(k,s,0);case 28:return e.next=30,u(j,s,0);case 30:return e.next=32,u(b,s,0);case 32:return e.next=34,u(C,s,0);case 34:return e.next=36,u(R,s,0);case 36:null===(h=N.current)||void 0===h||null===(g=h.getContext("2d"))||void 0===g||g.drawImage(c,0,0);case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[i,S,b,a,p,R,N,m,j,O,w,k,l,F,C,T]);return{drawingPipeline:tt,onExport:rt}},Or=n(120),wr=n.n(Or),kr=n(26);var Fr=function(e,t,n){if(!t)return e;var r=e.width,a=e.height,o=e.x,i=void 0===o?0:o,c=e.y,l=void 0===c?0:c;if("px"===e.unit){var u=t.width,d=t.height,f=d/u>=.8?400/300:1,b=Math.min((null!==i&&void 0!==i?i:0)*f,u),p=Math.min((null!==l&&void 0!==l?l:0)*f,d),m=Math.min((null!==r&&void 0!==r?r:0)*f,u);return{unit:"%",x:b/u*100,y:p/d*100,width:m/u*100,height:m/(null!==n&&void 0!==n?n:1)/d*100,aspect:n}}if(i<0)return Object(s.a)(Object(s.a)({},e),{},{x:0});if(l<0)return Object(s.a)(Object(s.a)({},e),{},{y:0});var h=t.naturalHeight,g=t.naturalWidth,v=null!==r&&void 0!==r?r:0,x=null!==a&&void 0!==a?a:0,j=.05*(h>g?h:g),y=Math.abs(x*h*n-v*g)<=j;return Object(s.a)(Object(s.a)({},e),{},{x:i<0?0:i,y:l<0?0:l,height:y?x:v*t.naturalWidth/n/t.naturalHeight,aspect:n})},Cr=i.a.forwardRef((function(e,t){var n=e.title,r=e.backgroundColor,i=e.className,c=e.defaultExternalSource,l=void 0===c?"":c,d=e.receivingCanvas,f=e.children,b=e.beforeCropper,p=e.defaultCropInfo,m=e.ratio,h=e.onSourceLoaded,g=void 0===h?function(){}:h,v=e.onSourceChange,x=void 0===v?function(){}:v,j=e.onCropChange,y=void 0===j?function(){}:j,O=e.onTainted,w=void 0===O?function(){}:O,k=vn(),F=Object(o.useRef)(null),C=Object(o.useState)("anonymous"),S=Object(u.a)(C,1)[0],T=Object(o.useState)(0),R=Object(u.a)(T,2),N=R[0],L=R[1],M=Object(o.useState)("external"),E=Object(u.a)(M,2),I=E[0],A=E[1],B=Object(o.useState)("external"),W=Object(u.a)(B,2),P=W[0],D=W[1],z=Object(o.useState)(""),H=Object(u.a)(z,2),K=H[0],G=H[1],Y=Object(o.useState)(!1),X=Object(u.a)(Y,2),V=X[0],U=X[1],q=Object(o.useState)(null),J=Object(u.a)(q,2),$=J[0],_=J[1],Z=Object(o.useState)(l),Q=Object(u.a)(Z,2),ee=Q[0],te=Q[1],ne=Object(o.useRef)(null),re=Object(o.useState)({current:p,completed:null}),ae=Object(u.a)(re,2),oe=ae[0],ie=ae[1],ce=Object(o.useState)("%"===p.unit),le=Object(u.a)(ce,2),se=le[0],ue=le[1],de=oe.current,fe=oe.completed,be=Object(o.useRef)({source:"",crop:null}),pe=Object(o.useCallback)((function(e){if(U(!1),_(null),g(),ne.current=e,e.src===be.current.source&&be.current.crop){var t=me.current;setTimeout((function(){if(t===me.current&&be.current.crop){var n=Fr(be.current.crop,e,m);ie({completed:n,current:n}),ue(!0),be.current={source:"",crop:null}}}),250)}else setTimeout((function(){ie((function(t){var n=Fr(t.current,e,m);return{completed:n,current:n}})),ue(!0)}),250)}),[g,m]);Object(o.useEffect)((function(){var e,t,n,r,a,o,i=ne.current;if(fe&&d&&i){var c=fe.aspect;d.style.transform="scale(2)";var l=d.getContext("2d");if(l&&"number"===typeof c&&!(c<=0)){var u=i.naturalHeight,f=i.naturalWidth,b=f/i.width,p=u/i.height,m=null!==(e=fe.unit)&&void 0!==e?e:"px",h=window.devicePixelRatio;l.setTransform(h,0,0,h,0,0);var g=Math.floor((null!==(t=fe.width)&&void 0!==t?t:0)*("px"===m?b:f/100)),v=Math.min(f,g),x=Math.floor(g/c),j=Math.min(u,x),O=Math.min(f,Math.floor((null!==(n=fe.x)&&void 0!==n?n:0)*("px"===m?b:f/100))),w=Math.min(u,Math.floor((null!==(r=fe.y)&&void 0!==r?r:0)*("px"===m?p:u/100)));if(l.imageSmoothingQuality="high",!(v<=0||j<=0)){var k=void 0;if(O+v>f||w+j>u||O<0||w<0||Math.abs((g-v)/v)>.01||Math.abs((x-j)/j)>.01)"width"===(c*u>f?"width":"height")?(O=0,k={unit:"%",aspect:c,height:(j=(v=f)/c)/u*100,width:v/f*100,x:0,y:(w=(u-j)/2)/u*100}):(w=0,k={unit:"%",aspect:c,height:(j=u)/u*100,width:(v=u*c)/f*100,x:(O=(f-v)/2)/f*100,y:0});d.width=null!==(a=v)&&void 0!==a?a:0,d.height=null!==(o=j)&&void 0!==o?o:0,l.drawImage(i,O,w,v,j,0,0,v,j),"internal"===I&&(null!==K&&void 0!==K?K:"").length<=0||c===fe.aspect&&y(fe,I),k&&ie((function(e){return Object(s.a)(Object(s.a)({},e),{},{current:k})}))}}}}),[fe,d,N]),Object(o.useEffect)((function(){ie((function(e){if(null!=ne.current&&e.current){var t=Fr(e.current,ne.current,m);return{current:t,completed:t}}return e}))}),[m]);var me=Object(o.useRef)(0);Object(o.useImperativeHandle)(t,(function(){return{hasImage:function(){return"string"===typeof K&&K.length>0&&"internal"===I||"string"===typeof ee&&ee.length>0&&"external"===I},forceExternalSource:function(e,t){("internal"===I?K:ee)!==e&&(U(!0),A("external"),D("external"),x(e),te(e)),ue("%"===t.unit),me.current+=1,be.current={source:e,crop:t},L((function(e){return e+1}))}}}));var he=d&&!V&&(null===fe||void 0===fe?void 0:fe.width)&&(null===fe||void 0===fe?void 0:fe.height);return Object(a.jsxs)("div",{className:"card-image-cropper ".concat(i),children:[Object(a.jsxs)("div",{className:"card-image-source-input",children:[f,Object(a.jsxs)("div",{className:"card-image-source-input-container",children:[Object(a.jsxs)("div",{className:"card-image-source-input-title",children:[Object(a.jsxs)("span",{className:"field-title",children:[n," ",Object(a.jsx)(an,{Icon:Jt.a,containerProps:{className:he?"":"disabled"},tooltipProps:{overlay:he?k["image-cropper.download"]:k["image-cropper.no-download"]},onClick:function(){return he&&d&&function(e,t){t&&e&&e.toBlob((function(e){if(null!==e){var t=window.URL.createObjectURL(e),n=document.createElement("a");n.download="crop-preview.png",n.href=URL.createObjectURL(e),n.click(),window.URL.revokeObjectURL(t)}}),"image/png",1)}(d,fe)}})]}),Object(a.jsxs)(Yt.a.Group,{className:"card-image-source-type-input",onChange:function(e){var t=e.target.value;D(t),((null!==K&&void 0!==K?K:"").length>0&&"internal"===t||(null!==ee&&void 0!==ee?ee:"").length>0&&"external"===t)&&A(t)},value:P,children:[Object(a.jsx)(Yt.a.Button,{value:"external",checked:"external"===P,children:k["image-cropper.source.online.tooltip"]}),Object(a.jsx)(Xt.a,{title:Object(a.jsx)("div",{className:"image-warning",children:k["image-cropper.offline-warning"]}),children:Object(a.jsxs)(Yt.a.Button,{value:"internal",checked:"internal"===P,children:[k["image-cropper.source.offline.tooltip"]," ",Object(a.jsx)($t.a,{})]})})]})]}),Object(a.jsxs)("div",{className:["card-image-input","external"===P?"":"input-inactive"].join(" "),children:[Object(a.jsx)(Vt.a,{placeholder:k["image-cropper.placeholder"],value:ee,onChange:function(e){var t=e.target.value;U(!0),A("external"),D("external"),x(t),te(t)},maxLength:512,allowClear:!0},"key"),$?Object(a.jsx)("div",{className:"online-image-tip image-warning",children:k["image-cropper.not-found-warning"]}):Object(a.jsx)("div",{className:"online-image-tip",children:k["image-cropper.online-tip"]})]}),Object(a.jsxs)("div",{className:["card-image-input","internal"===P?"":"input-inactive"].join(" "),children:[Object(a.jsx)(Vt.a,{ref:F,type:"file",accept:"image/*",onChange:function(e){if(e.target.files&&e.target.files.length>0){U(!0);var t=new FileReader;t.addEventListener("load",(function(){"string"===typeof t.result&&(G(t.result),A("internal"),D("internal"),U(!1))})),t.readAsDataURL(e.target.files[0])}else alert(k["image-cropper.not-found-warning"])},onClick:function(){var e;return null===(e=F.current)||void 0===e?void 0:e.setValue("")}}),Object(a.jsx)("hr",{}),k["image-cropper.offline-warning"]]})]})]}),b,Object(a.jsxs)("div",{className:"card-cropper",children:[V&&Object(a.jsx)(en.FullView,{}),Object(a.jsx)(qt.a,{src:"internal"===I?K:ee,imageStyle:r?{backgroundColor:r}:{backgroundImage:'url("'.concat("/ygocarder",'/asset/image/texture/transparent-tile.png")')},onImageLoaded:pe,onImageError:function(){if(be.current={source:"",crop:null},_("Image error"),U(!1),"external"===I&&""===(null!==ee&&void 0!==ee?ee:"")&&d){var e=d.width,t=d.height,n=d.getContext("2d");null===n||void 0===n||n.clearRect(0,0,e,t),fe&&y(fe,I),g()}else w()},crop:de,onChange:function(e,t){var n=ne.current;be.current.crop||(se?ie((function(e){return Object(s.a)(Object(s.a)({},e),{},{current:Fr(t,n,m)})})):(ue(!0),ie((function(t){return Object(s.a)(Object(s.a)({},t),{},{current:Fr(e,n,m)})}))))},onComplete:function(e,t){be.current.crop||ie((function(e){return Object(s.a)(Object(s.a)({},e),{},{completed:t})}))},ruleOfThirds:!0,crossorigin:S},"".concat(I,"-").concat(se,"-").concat(N))]})]})})),Sr=(n(272),function(e){var t=e.defaultValue,n=void 0===t?[]:t,r=e.onChange,i=void 0===r?function(){}:r,c=Object(o.useState)(n),l=Object(u.a)(c,2),s=l[0],d=l[1],f=[-45,0,45,-90,0,90,-135,180,135],b=vn(),p=JSON.stringify(s);return Object(o.useEffect)((function(){i(s)}),[p]),Object(a.jsxs)("div",{className:"link-marker-chooser",children:[Object(a.jsx)("div",{className:"title",children:b["link-picker.label"]}),Object(a.jsx)("div",{className:"container",children:Object(wn.a)(Array(9)).map((function(e,t){var n="".concat(t+1);return"5"===n?Object(a.jsx)(Xt.a,{overlay:b["link-picker.reset.tooltip"],children:Object(a.jsx)("div",{className:"link-marker-reset",onClick:function(){d([])},children:Object(a.jsx)(j.a,{})})},"5"):Object(a.jsx)("div",{className:"link-marker-button marker-".concat(t+1," ").concat(s.includes(n)?"marker-checked":""),onClick:function(){d((function(e){var t=Object(wn.a)(e);return t.includes(n)?t=t.filter((function(e){return e!==n})):t.push(n),t}))},children:Object(a.jsx)("div",{className:"link-marker-icon link-marker-icon-".concat(t+1),style:{transform:"rotate(".concat(f[t],"deg)")}})},n)}))})]})}),Tr=n(422),Rr=(n(273),function(e){var t=e.overlayClassName,n=e.iconProps,r=Object(tn.a)(e,["overlayClassName","iconProps"]),o=null!==n&&void 0!==n?n:{},i=o.className,c=Object(tn.a)(o,["className"]);return Object(a.jsx)(Tr.a,Object(s.a)(Object(s.a)({overlayClassName:["explanation-overlay",null!==t&&void 0!==t?t:""].join(" ")},r),{},{children:Object(a.jsx)($t.a,Object(s.a)({className:["explanation-icon",null!==i&&void 0!==i?i:""].join(" ")},c))}))}),Nr=n(418),Lr=n(60),Mr=n(426),Er=n(427);n(274);function Ir(){var e=Object(Kt.a)(["\n min-width: 0;\n position: relative;\n overflow: hidden;\n .caption {\n position: absolute;\n right: 0;\n bottom: 0;\n padding: var(--spacing-px) var(--spacing-sm);\n background: var(--main-level-5);\n border-radius: var(--br-lg) 0 0 0;\n box-shadow: var(--bs-block);\n }\n > img {\n max-width: 100%;\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br-lg);\n }\n"]);return Ir=function(){return e},e}function Ar(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 615fr 703fr;\n gap: var(--spacing-sm);\n padding: var(--spacing-sm) 0;\n overflow: hidden;\n .panel-box {\n min-width: 0;\n position: relative;\n overflow: hidden;\n }\n"]);return Ar=function(){return e},e}function Br(){var e=Object(Kt.a)(["\n white-space: pre-line;\n"]);return Br=function(){return e},e}function Wr(){var e=Object(Kt.a)(["\n background: var(--main-level-1);\n padding: var(--spacing-px) var(--spacing-xxs);\n border: var(--bw) solid #4e84a4;\n border-radius: var(--br);\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\n"]);return Wr=function(){return e},e}var Pr=Gt.b.span(Wr()),Dr=Gt.b.div(Br()),zr=Gt.b.div(Ar()),Hr=Gt.b.div(Ir()),Kr=function(e){var t=e.caption,n=e.containerProps,r=e.alt,o=Object(tn.a)(e,["caption","containerProps","alt"]),i=(null!==n&&void 0!==n?n:{}).className;return Object(a.jsxs)(Hr,{className:"image-with-caption ".concat(i),children:[Object(a.jsx)("img",Object(s.a)({alt:r},o)),Object(a.jsx)("div",{className:"caption",children:t})]})},Gr=function(){var e=Object(o.useState)(!1),t=Object(u.a)(e,2),n=t[0],r=t[1],i=vn();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Nr.a,{footer:null,visible:n,width:"60%",title:Object(a.jsxs)("div",{className:"overlay-title",children:[i["guide.format.label"]," ",Object(a.jsx)(Lr.a,{size:"small",type:"primary",onClick:function(){r(!1)},children:i["guide.format.close"]})]}),className:"formattting-guide-overlay",onClose:function(){r(!1)},children:Object(a.jsxs)(Dr,{children:[Object(a.jsxs)("p",{children:[i["guide.format.introduction"](Object(a.jsx)(Mr.a,{},"icon")),"."]}),Object(a.jsx)("h2",{children:i["guide.format.section-1.label"]}),i["guide.format.section-1.content"](Object(a.jsx)(Pr,{children:"["},"open-tag"),Object(a.jsx)(Pr,{children:"]"},"close-tag"),Object(a.jsx)(Pr,{children:"Ctrl-1"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-1"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-1-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-1-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-2.label"]}),i["guide.format.section-2.content"](Object(a.jsx)(Pr,{children:"{"},"open-tag"),Object(a.jsx)(Pr,{children:"}"},"close-tag"),Object(a.jsx)(Pr,{children:"Ctrl-2"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-2"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-2-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-2-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-3.label"]}),i["guide.format.section-3.content"](Object(a.jsx)(Pr,{children:"|"},"separator"),Object(a.jsx)(Pr,{children:"Ctrl-3"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-3"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-3-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-3-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-4.label"]}),i["guide.format.section-4.content"](Object(a.jsx)(Pr,{children:"||"},"separator"),Object(a.jsx)(Pr,{children:"Ctrl-4"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-4"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-4-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-4-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-5.label"]}),i["guide.format.section-5.content"](Object(a.jsx)(Pr,{children:"{{"},"open-tag"),Object(a.jsx)(Pr,{children:"}}"},"close-tag"),Object(a.jsx)(Pr,{children:"Ctrl-5"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-5"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-5-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-5-preview.jpg"),caption:i["guide.format.caption.output"]})]})]})}),Object(a.jsxs)(Lr.a,{className:"formatting-help-button",type:"primary",onClick:function(){r(!0)},children:[i["guide.format.label"]," ",Object(a.jsx)(Er.a,{})]})]})};function Yr(){var e=Object(Kt.a)(["\n display: inline-block;\n width: 10px;\n"]);return Yr=function(){return e},e}function Xr(){var e=Object(Kt.a)(["\n display: grid;\n ","\n > label {\n cursor: pointer;\n padding: 0 var(--spacing-xxs);\n text-align: center;\n }\n"]);return Xr=function(){return e},e}var Vr=Gt.b.div(Xr(),(function(e){return e.$withPillar?"grid-template-columns: max-content 1fr;":"grid-template-columns: 1fr;"})),Ur=Gt.b.div(Yr()),qr=function(e){var t=e.nameKey,n=e.labelBackgroundColor,r=e.labelBackgroundColorList,o=e.className,i=vn();return Object(a.jsxs)(Vr,{className:"frame-info-block ".concat(null!==o&&void 0!==o?o:""),$withPillar:!(!n&&!r),children:[r?Object(a.jsx)(Ur,{children:r.map((function(e){return Object(a.jsx)("div",{style:{backgroundColor:e,height:"".concat(100/r.length,"%")}},e)}))}):n?Object(a.jsx)(Ur,{style:{backgroundColor:n}}):null,Object(a.jsx)("label",{className:"frame-info-block-label",children:i[t]})]})},Jr=n(419);function $r(){var e=Object(Kt.a)(["animation: "," 12s linear infinite;"]);return $r=function(){return e},e}function _r(){var e=Object(Kt.a)(["\n cursor: pointer;\n .setting-button-label {\n display: grid;\n label {\n cursor: pointer;\n line-height: 1;\n font-size: var(--fs-xs);\n margin-top: var(--spacing-xs);\n }\n }\n .anticon-setting {\n font-size: var(--fs-xl);\n justify-self: center;\n > svg {\n ","\n }\n }\n &:hover {\n color: var(--main-active);\n .anticon-setting {\n color: var(--sub-active);\n }\n }\n"]);return _r=function(){return e},e}function Zr(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 1fr;\n gap: var(--spacing-sm);\n background-color: var(--main-level-3);\n padding: var(--spacing-sm);\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br-lg);\n color: var(--color);\n"]);return Zr=function(){return e},e}function Qr(){var e=Object(Kt.a)(["\n to {\n transform: rotate(360deg);\n }\n"]);return Qr=function(){return e},e}var ea=Object(Gt.c)(Qr()),ta=Gt.b.div(Zr()),na=Gt.b.div(_r(),(function(e){return e.$softMode?"":Object(Gt.a)($r(),ea)})),ra=function(){var e=vn(),t=kn((function(e){return{setting:e.setting,updateSetting:e.updateSetting}})),n=t.setting,r=t.updateSetting,o=n.allowHotkey,i=n.reduceMotionColor,c=n.showCreativeOption,l=n.showExtraDecorativeOption;return Object(a.jsx)(na,{className:"setting-button",$softMode:i,children:Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"setting-button-overlay",content:Object(a.jsxs)(ta,{children:[Object(a.jsx)("div",{children:Object(a.jsx)(Jr.a,{checked:i,onChange:function(e){return r({reduceMotionColor:e.target.checked})},children:e["setting.option.soft-mode.label"]})}),Object(a.jsx)("div",{children:Object(a.jsx)(Jr.a,{checked:l,onChange:function(e){return r({showExtraDecorativeOption:e.target.checked})},children:e["setting.option.extra-decorative.label"]})}),Object(a.jsx)("div",{children:Object(a.jsx)(Jr.a,{checked:c,onChange:function(e){return r({showCreativeOption:e.target.checked})},children:e["setting.option.creative.label"]})}),Object(a.jsx)("div",{children:Object(a.jsx)(Xt.a,{title:e["setting.option.hotkey.tooltip"],placement:"left",children:Object(a.jsx)(Jr.a,{checked:o,onChange:function(e){return r({allowHotkey:e.target.checked})},children:e["setting.option.hotkey.label"]})})}),Object(a.jsx)("div",{children:Object(a.jsx)("small",{children:e["setting.alert"]})})]}),children:Object(a.jsxs)("div",{className:"setting-button-label",children:[Object(a.jsx)(Mr.a,{}),Object(a.jsx)("label",{children:e["setting.button.label"]})]})})})},aa=n(428);n(275);function oa(){var e=Object(Kt.a)(["\n align-content: center;\n align-self: center;\n border-left: var(--bw) dashed #b1b1b1;\n padding-left: var(--spacing);\n margin-left: var(--spacing);\n"]);return oa=function(){return e},e}var ia=function(){var e;return Object(a.jsxs)("div",{className:"affiliation",children:[Object(a.jsxs)("span",{className:"version",children:["v",null!==(e="2.0.15")?e:"unknown"]}),Object(a.jsx)("div",{className:"affiliation-link",children:Object(a.jsx)("a",{href:"https://github.com/lauqerm/ygocarder",target:"_blank",rel:"noreferrer",children:Object(a.jsx)(aa.a,{})})})]})},ca=Gt.b.div(oa()),la=function(){var e=gn((function(e){return{languageInfo:e.languageInfo,language:e.language,languageMetadataMap:e.languageMetadataMap,changeLanguage:e.changeLanguage}})),t=e.language,n=e.languageInfo,r=e.languageMetadataMap,o=e.changeLanguage;return Object(a.jsxs)("div",{className:"app-header",children:[Object(a.jsx)("img",{alt:"app-logo",src:"".concat("/ygocarder","/logo192.png"),width:35}),Object(a.jsxs)("div",{className:"app-description",children:[Object(a.jsxs)("div",{className:"header-language",children:[Object(a.jsx)("h1",{children:"Yugioh Carder"}),Object(a.jsx)(Yt.a.Group,{value:n.codeName,size:"small",children:Object.values(r).filter((function(e){return e.active})).map((function(e){var t=e.codeName,n=e.name;return Object(a.jsx)(Yt.a.Button,{value:t,onChange:function(e){return o(e.target.value)},children:n},t)}))})]}),Object(a.jsxs)("div",{className:"app-contribution",children:[Object(a.jsxs)("span",{className:"app-creator",children:[t["contributor.gui.label"],": ",Object(a.jsx)("a",{href:"https://github.com/lauqerm/ygocarder",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"Lauqerm"})}),"\xa0",Object(a.jsx)(Rr,{content:Object(a.jsxs)("div",{className:"disclaimer",children:[Object(a.jsx)("h2",{children:t["contributor.disclaimer.label"]}),Object(a.jsxs)("ul",{children:[Object(a.jsx)("li",{children:t["contributor.disclaimer.line-1"](Object(a.jsx)("a",{href:"https://lauqerm.github.io/ygocarder",children:"lauqerm.github.io/ygocarder"},"app-author"))}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-2"]}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-3"]}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-4"]}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-5"](Object(a.jsx)("a",{href:"https://www.deviantart.com/grezar",target:"_blank",rel:"noreferrer",children:"Grezar"},"template-maker-1"),Object(a.jsx)("a",{href:"https://www.deviantart.com/9558able",target:"_blank",rel:"noreferrer",children:"9558able"},"template-maker-2"))}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-6"]})]})]})})]}),Object(a.jsx)("span",{className:"template-creator",children:t["contributor.template-maker"](Object(a.jsx)("a",{href:"https://www.deviantart.com/grezar/art/SKILL-UPDATE-Series-10-Card-Proxy-Template-686736691",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"Grezar"})},"artist-1"),Object(a.jsx)("a",{href:"https://www.deviantart.com/9558able/art/Yugioh-Series-10-Proxy-Template-DELUXE-EDITION-843282421",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"9558able"})},"artist-2"),Object(a.jsx)("a",{href:"https://www.deviantart.com/slackermagician",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"SlackerMagician"})},"artist-3"),Object(a.jsx)("a",{href:"https://www.deviantart.com/icycatelf",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"icycatelf"})},"artist-4"))})]})]}),Object(a.jsx)(ca,{className:"app-setting",children:Object(a.jsx)(ra,{})})]})},sa=function(){var e=vn();return Object(a.jsx)(Rr,{overlayClassName:"disclaimer-overlay",content:Object(a.jsxs)("div",{className:"disclaimer",children:[Object(a.jsx)("h2",{children:e["alert.explaination.tainted.first-question"]}),Object(a.jsx)("p",{children:e["alert.explaination.tainted.first-answer"]}),Object(a.jsx)("h2",{children:e["alert.explaination.tainted.second-question"]}),Object(a.jsx)("p",{children:e["alert.explaination.tainted.second-answer"]}),Object(a.jsx)("h2",{children:e["alert.explaination.tainted.third-question"]}),Object(a.jsx)("p",{children:e["alert.explaination.tainted.third-answer"]})]})})};function ua(){var e=Object(Kt.a)(["\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br-lg);\n background-color: var(--main-level-3);\n box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); // Mimic antd\n padding: var(--spacing-xs) 0;\n color: var(--color);\n"]);return ua=function(){return e},e}function da(){var e=Object(Kt.a)(["\n display: flex;\n align-items: center;\n padding: var(--spacing-xs) var(--spacing);\n cursor: pointer;\n &:hover {\n background-color: var(--sub-active);\n }\n &.menu-active {\n background-color: var(--main-active);\n &:hover {\n background-color: var(--sub-active);\n }\n }\n"]);return da=function(){return e},e}function fa(){var e=Object(Kt.a)(["\n font-weight: 500;\n border-color: transparent;\n background-color: transparent;\n color: var(--color-vendor);\n text-shadow: var(--ts);\n user-select: none;\n display: inline-block;\n height: 32px;\n width: var(--width-label);\n line-height: 30px;\n position: relative;\n min-width: var(--width-label);\n text-align: right;\n padding-right: var(--spacing-antd);\n"]);return fa=function(){return e},e}var ba=Gt.b.div(fa()),pa=Gt.b.div(da()),ma={Container:Gt.b.div(ua()),Option:pa},ha=[{label:"OCG",value:"ocg",props:{className:"ocg-button",style:{fontWeight:"bold"}}},{label:"TCG",value:"tcg",props:{className:"tcg-button",style:{fontWeight:"bold"}}}],ga=Object.values(D).map((function(e){var t=e.value;return{label:e.label,value:t}})),va=[{value:"normal",label:Object(a.jsx)(j.a,{})}].concat(Object(wn.a)(Object.values(z).map((function(e){var t=e.value;return{label:e.label,value:t}})))),xa=function(){return pe.map((function(e){var t=e.name,n=e.nameKey,r=e.labelBackgroundColor,o=e.labelBackgroundColorList,i=e.edition;return{label:Object(a.jsx)(qr,{labelBackgroundColor:r,labelBackgroundColorList:o,nameKey:n}),value:t,edition:i}}))},ja=Object(wn.a)(Array(14)).map((function(e,t){return{label:t,value:t}})),ya={auto:{value:"auto",labelKey:"input.icon-type.auto.label",fullLabelKey:"input.icon-type.auto.label",icon:null},st:{value:"st",labelKey:"input.icon-type.icon.label",fullLabelKey:"input.icon-type.icon.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-continuous.png")})},level:{value:"level",labelKey:"input.icon-type.level.label",fullLabelKey:"input.icon-type.level.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-level.png")})},"negative-level":{value:"negative-level",labelKey:"input.icon-type.negative-level.label",fullLabelKey:"input.icon-type.negative-level.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-negative-level.png")})},rank:{value:"rank",labelKey:"input.icon-type.rank.label",fullLabelKey:"input.icon-type.rank.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-rank.png")})}},Oa=Object.values(ya),wa=["no-sticker","gold","silver","beta","holo5","holo4","holo3","holo2","holo1","limited","unlimited"].map((function(e){return{label:"no-sticker"===e?Object(a.jsx)(j.a,{}):Object(a.jsx)("img",{alt:e,src:"".concat("/ygocarder","/asset/image/sticker/sticker-").concat(e.toLowerCase(),".png")}),value:e}})),ka=Object.entries({veryStrict:{label:"5",order:1},strict:{label:"4",order:2},loose:{label:"3",order:3},veryLoose:{label:"2",order:4},relaxed:{label:"1",order:5}}).map((function(e){var t=Object(u.a)(e,2),n=t[0],r=t[1];return{label:r.label,value:n,order:r.order}})).sort((function(e,t){return e.order-t.order}));function Fa(){var e=Object(Kt.a)(["\n z-index: 10;\n display: inline-grid;\n grid-template-columns: 1fr max-content;\n align-items: center;\n column-gap: var(--spacing-sm);\n .char-picker-guideline {\n\n }\n .char-picker {\n z-index: 1;\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));\n .handler,\n .ant-btn {\n background-color: var(--main-level-1);\n color: var(--color-heavy);\n text-shadow: var(--ts);\n font-family: Segoe UI Symbol, sans-serif;\n border: 1px solid var(--sub-level-1);\n border-radius: 0;\n padding: 0 var(--spacing);\n + .ant-btn {\n border-left-width: 0;\n }\n &:hover {\n color: var(--main-active);\n }\n &:first-child {\n border-radius: var(--br) 0 0 var(--br);\n }\n &:last-child {\n border-radius: 0 var(--br) var(--br) 0;\n }\n }\n /** Currently char picker no longer movable */\n /* .handler {\n cursor: grabbing;\n background-color: var(--main-level-2);\n height: unset;\n font-size: var(--fs-xl);\n height: var(--fs-xl);\n line-height: 1;\n padding: 0;\n text-align: center;\n } */\n }\n .moveable-control-box {\n .moveable-control.moveable-origin,\n .moveable-line.moveable-direction {\n border-color: transparent;\n background: none;\n }\n }\n"]);return Fa=function(){return e},e}var Ca=Gt.b.div(Fa()),Sa=function(e){var t=e.targetId,n=void 0===t?"":t,r=e.onPick,o=void 0===r?function(){}:r,i=vn(),c=function(e){var t=document.getElementById(n);if(t){var r=function(e,t){if(document.selection)return e.focus(),document.selection.createRange().text=t,{value:e.value,position:0};if(e.selectionStart||0===e.selectionStart){var n=e.selectionStart,r=e.selectionEnd;return e.value=e.value.substring(0,n)+t+e.value.substring(r,e.value.length),e.selectionStart=n+t.length,e.selectionEnd=n+t.length,e.focus(),{value:e.value,position:n+t.length}}return e.value+=t,{value:e.value,position:0}}(t,e).value;o(r,e)}};return Object(a.jsxs)(Ca,{tabIndex:-1,className:"char-picker-container",children:[Object(a.jsx)("div",{id:"char-picker",className:"char-picker",children:["\u221e","\u2606","\u25cf","\xa9","\u2122","\u2c6f","\u042f","\u203b"].map((function(e){return Object(a.jsx)("button",{tabIndex:-1,className:"ant-btn",onClick:function(){return c(e)},children:e},e)}))}),Object(a.jsx)("div",{className:"char-picker-guideline",children:Object(a.jsx)(Rr,{content:Object(a.jsxs)(a.Fragment,{children:[i["input.char-picker.guide.header"],Object(a.jsxs)("ul",{children:[Object(a.jsx)("li",{children:i["input.char-picker.guide.instruction-1"]}),Object(a.jsx)("li",{children:i["input.char-picker.guide.instruction-2"]})]})]})})})]})},Ta=n(59),Ra=n(429),Na=n(420),La=n(151),Ma=(n(382),n(383),Object(o.forwardRef)((function(e,t){var n=e.color,r=e.onSelect,i=e.onOffsetChange,c=e.onRemove,l=vn(),s=Object(o.useState)(n),d=Object(u.a)(s,2),f=d[0],b=d[1],p=Object(o.useState)(0),m=Object(u.a)(p,2),h=m[0],g=m[1],v=Object(o.useState)(-1),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useRef)(sn()(g,250)).current;return Object(o.useImperativeHandle)(t,(function(){return{setColor:function(e){var t=e.color,n=e.offset,r=e.id,a=Math.min,o=Math.max,i=Math.round;b(t),g(o(0,a(100,i(100*parseFloat(n))))),y(r)},setCurrentOffset:function(e,t){var n=Math.min,r=Math.max,a=Math.round;e===j&&g(r(0,n(100,a(100*parseFloat(t)))))}}})),Object(o.useEffect)((function(){j>0&&(null===i||void 0===i||i(j,"".concat(h/100)))}),[j,h,i]),Object(a.jsxs)("div",{className:"stop-point-control-panel",children:[Object(a.jsxs)("div",{className:"stop-point-offset-input",children:[Object(a.jsxs)("div",{children:[l["input.name-style.gradient.color-stop.label"],": ",Object(a.jsx)(Na.a,{value:h,size:"small",max:100,min:0,onChange:function(e){return O("string"===typeof e?parseInt(e):null!==e&&void 0!==e?e:0)}})]}),Object(a.jsx)(Lr.a,{className:"remove-stop-color",size:"small",onClick:function(){return null===c||void 0===c?void 0:c(j)},children:l["input.name-style.gradient.color-remove.label"]})]}),Object(a.jsx)(Ta.a,{styles:{default:{picker:{color:"#000000",background:"var(--main-level-3)",boxShadow:"none"},body:{padding:"var(--spacing) var(--spacing)"}}},disableAlpha:!0,color:f,onChange:function(e){return b(e.hex)},onChangeComplete:function(e){b(e.hex),null===r||void 0===r||r(e.hex)}})]})}))),Ea=function(e){return{colorList:e,raw:yt(e)}},Ia=function(e){var t,n,r=e.palette,i=void 0===r?yt(Ot("0.000|#eef10b,0.5|#d78025,1.000|#7e20cf")):r,c=e.angle,l=void 0===c?180:c,d=e.memoizedOnChange,f=vn(),b=Object(o.useRef)(null),p=Object(o.useState)(l),m=Object(u.a)(p,2),h=m[0],g=m[1],v=Object(o.useState)((function(){var e,t,n=Ot(i);return{raw:i,colorList:n,currentControlId:null!==(e=null===(t=n[0])||void 0===t?void 0:t.id)&&void 0!==e?e:-1}})),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useCallback)((function(e,t){return y((function(n){var r=n.colorList.map((function(n){return n.id===e?Object(s.a)(Object(s.a)({},n),{},{offset:t}):n}));return Object(s.a)(Object(s.a)({},n),Ea(r))}))}),[]);Object(o.useEffect)((function(){g(l)}),[l]),Object(o.useEffect)((function(){var e,t,n=Ot(i);y({raw:i,colorList:n,currentControlId:null!==(e=null===(t=n[0])||void 0===t?void 0:t.id)&&void 0!==e?e:-1})}),[i]);var w=Object(o.useRef)(!1);return Object(o.useEffect)((function(){var e;j.colorList[0]&&w.current&&(w.current=!0,null===(e=b.current)||void 0===e||e.setColor(j.colorList[0]))}),[j.colorList]),Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){var t=j.colorList,n=j.currentControlId;if(e&&n>=0){var r,a=t.find((function(e){return e.id===n}));a&&(null===(r=b.current)||void 0===r||r.setCurrentOffset(n,a.offset))}}),100),function(){e=!1}}),[j]),Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){e&&d(j.colorList,h)}),200),function(){e=!1}}),[j,h,d]),Object(a.jsxs)("div",{className:"controls-wrapper gradient-picker-container",children:[Object(a.jsxs)("div",{className:"gradient-angle-control",children:[Object(a.jsx)("h2",{children:f["input.name-style.gradient.color-point.label"]}),Object(a.jsxs)(Lr.a,{size:"small",className:"add-stop-color",disabled:(null!==(t=null===(n=j.colorList)||void 0===n?void 0:n.length)&&void 0!==t?t:1e4)>20,onClick:function(){y((function(e){var t=[].concat(Object(wn.a)(e.colorList),[{offset:"0.5",color:"#ffffff",id:e.colorList.length+1}]).sort((function(e,t){return Number(e.offset)-Number(t.offset)}));return Object(s.a)(Object(s.a)({},e),Ea(t))}))},children:[f["input.name-style.gradient.add-point.label"]," (",j.colorList.length,"/",20,")"]}),Object(a.jsxs)("div",{className:"angle-picker-container",children:[Object(a.jsx)("h2",{children:f["input.name-style.gradient.gradient-direction.label"]}),Object(a.jsx)(La.AnglePicker,{angle:h,size:120,setAngle:g})]})]}),Object(a.jsx)("div",{className:"stop-color-picker-container",children:Object(a.jsx)(La.GradientPicker,Object(s.a)(Object(s.a)({},{width:370,paletteHeight:32,maxStops:20,minStops:2,stopRemovalDrop:99999,palette:j.colorList,onPaletteChange:function(e){return y((function(t){return Object(s.a)(Object(s.a)({},t),Ea(e))}))},onColorStopSelect:function(e){var t;y((function(t){return Object(s.a)(Object(s.a)({},t),{},{currentControlId:e.id})})),null===(t=b.current)||void 0===t||t.setColor(e)}}),{},{children:Object(a.jsx)(Ma,{ref:b,onOffsetChange:O,onRemove:function(e){y((function(t){var n,r,a=t.colorList.filter((function(t){return t.id!==e})),o=null!==(n=null===a||void 0===a?void 0:a[0].id)&&void 0!==n?n:-1;return o>0&&(null===(r=b.current)||void 0===r||r.setColor(j.colorList[o])),Object(s.a)(Object(s.a)({},Ea(a)),{},{currentControlId:o})}))}})}))})]})};function Aa(){var e=Object(Kt.a)(["\n line-height: 0;\n cursor: pointer;\n min-height: 26.13px;\n &.menu-active {\n outline: var(--bw-lg) solid var(--main-active);\n &:hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n }\n &.preset-item-focused {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n :hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n img {\n max-width: 100%;\n }\n"]);return Aa=function(){return e},e}function Ba(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: repeat(4, 120px);\n gap: var(--spacing-sm);\n padding: var(--spacing-xs);\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--focus) inset;\n }\n"]);return Ba=function(){return e},e}function Wa(){var e=Object(Kt.a)(["\n line-height: 0;\n cursor: pointer;\n align-self: center;\n text-align: center;\n &:not(.menu-off) {\n min-height: 23.2px;\n &.menu-active {\n outline: var(--bw-lg) solid var(--main-active);\n &:hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n }\n :hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n }\n &.menu-off {\n &:hover {\n color: var(--main-link);\n .anticon {\n color: var(--main-link);\n }\n }\n }\n img {\n max-width: 100%;\n border: var(--bw) solid var(--sub-level-1);\n }\n"]);return Wa=function(){return e},e}function Pa(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: repeat(2, 200px);\n gap: var(--spacing-sm);\n padding: var(--spacing-xs);\n .alert {\n grid-column: span 2;\n font-size: var(--fs-sm);\n text-align: center;\n }\n"]);return Pa=function(){return e},e}function Da(){var e=Object(Kt.a)(["\n background-color: var(--main-level-4);\n ","\n padding: var(--spacing-xxs) var(--spacing-xs);\n margin: calc(-1 * var(--spacing-xxs)) 0;\n border-radius: var(--br-lg);\n box-shadow: var(--bs-button);\n color: var(--color-heavy);\n cursor: pointer;\n ","\n &:hover {\n background-color: var(--sub-level-4);\n }\n"]);return Da=function(){return e},e}var za=Gt.b.div(Da(),(function(e){return e.$active?"border: var(--bw) solid var(--main-active);":"border: var(--bw) solid var(--sub-level-1);"}),(function(e){var t=e.$softMode,n=e.$active;return t?"\n border: var(--bw) solid var(--main-level-4);\n ".concat(n?"outline: var(--bw) solid var(--main-active);":"","\n "):""})),Ha=Object(Gt.b)(ma.Container)(Pa()),Ka=Gt.b.div(Wa()),Ga=Object(Gt.b)(ma.Container)(Ba()),Ya=Gt.b.div(Aa()),Xa=n(412),Va=n(211),Ua=Object(o.forwardRef)((function(e,t){var n=e.className,r=e.defaultValue,i=e.fieldMap,c=e.labelMap,l=e.onChange,d=vn(),f=i.x,b=i.y,p=i.color,m=i.width,h=Object(o.useState)((function(){var e=r[f],t=r[b],n=r[p],a=r[m];return{x:null!==e&&void 0!==e?e:0,y:null!==t&&void 0!==t?t:0,width:null!==a&&void 0!==a?a:0,color:n}})),g=Object(u.a)(h,2),v=g[0],x=g[1],j=v.x,y=v.y,O=v.color,w=v.width,k=c[m];return Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){e&&l(v)}),500),function(){e=!1}}),[v]),Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t=Object.keys(e);for(var n in t)if(e[n]!==v[n])return void x((function(t){return Object(s.a)(Object(s.a)({},t),e)}))}}})),Object(a.jsxs)("div",{className:n,children:[Object(a.jsx)("h2",{children:d["input.name-style.slider.position.label"]}),Object(a.jsxs)("div",{className:"line-position",children:[Object(a.jsx)(Va.a,{axis:"xy",styles:{track:{backgroundColor:"var(--main-slider)",width:100,height:100,gridRow:"span 3",position:"relative"},thumb:{backgroundColor:"var(--sub-slider)",zIndex:10}},xmax:5,xmin:-5,ymax:5,ymin:-5,x:null!==j&&void 0!==j?j:0,y:null!==y&&void 0!==y?y:0,onChange:function(e){var t=e.x,n=e.y;return x((function(e){return Object(s.a)(Object(s.a)({},e),{},{x:t,y:n})}))}}),Object(a.jsxs)("div",{className:"single-slider",children:[d["input.name-style.slider.x-offset.label"],": ",Object(a.jsx)(Na.a,{size:"small",value:j,onChange:function(e){return x((function(t){return Object(s.a)(Object(s.a)({},t),{},{x:"number"===typeof e?e:parseInt(null!==e&&void 0!==e?e:"0")})}))}})]}),Object(a.jsxs)("div",{className:"single-slider",children:[d["input.name-style.slider.y-offset.label"],": ",Object(a.jsx)(Na.a,{size:"small",value:y,onChange:function(e){return x((function(t){return Object(s.a)(Object(s.a)({},t),{},{y:"number"===typeof e?e:parseInt(null!==e&&void 0!==e?e:"0")})}))}})]}),Object(a.jsxs)("div",{className:"single-slider",children:[k,": ",Object(a.jsx)(Xa.a,{value:w,min:1,max:10,onChange:function(e){"number"===typeof e&&x((function(t){return Object(s.a)(Object(s.a)({},t),{},{width:e})}))}})]})]}),Object(a.jsx)("h2",{children:d["input.name-style.slider.color.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:O,onChangeComplete:function(e){return x((function(t){return Object(s.a)(Object(s.a)({},t),{},{color:e.hex})}))}})]})})),qa=Object(o.forwardRef)((function(e,t){var n=e.active,r=e.value,i=e.onClick,c=e.onCancel,l=Object(o.useRef)(null),d=Object(o.useState)(0),f=Object(u.a)(d,2),b=f[0],p=f[1];return Object(o.useImperativeHandle)(t,(function(){return{focus:function(){var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}}})),Object(a.jsx)(Ga,Object(s.a)(Object(s.a)({ref:l},wt({stopPropagation:!0,optionLength:S.length,setFocus:p,onTrigger:function(){b>=0&&i(S[b])},onCancel:function(){null===c||void 0===c||c()}})),{},{children:S.map((function(e,t){var o=e.key,c=e.image,l=e.label;return Object(a.jsx)(Ya,{className:Ht("preset-item",r.preset===o&&n?"menu-active":"",b===t?"preset-item-focused":""),onClick:function(t){t.stopPropagation(),i(e)},children:Object(a.jsx)("img",{className:"preset-preview",src:"".concat("/ygocarder","/").concat(c),alt:l})},o)}))}))})),Ja=(n(389),Object(o.forwardRef)((function(e,t){var n=e.frameInfo,r=e.defaultType,i=e.defaultValue,c=e.showExtraDecorativeOption,l=e.onChange,d=vn(),f=Object(o.useRef)(null),b=Object(o.useState)(-1),p=Object(u.a)(b,2),m=p[0],h=p[1],g=Object(o.useState)(!1),v=Object(u.a)(g,2),x=v[0],y=v[1],O=Object(o.useState)(r),w=Object(u.a)(O,2),k=w[0],F=w[1],S=Object(o.useState)(i),T=Object(u.a)(S,2),N=T[0],L=T[1],M=function(){var e=Object(o.useState)(0),t=Object(u.a)(e,2),n=t[0],r=t[1];return[Object(o.useCallback)((function(){r((function(e){return e+1}))}),[]),n]}(),E=Object(u.a)(M,2),I=E[0],A=E[1],B=Object(o.useRef)(sn()(l,250)).current,W=Object(o.useCallback)((function(e,t){L((function(n){return Object(s.a)(Object(s.a)({},n),{},{gradientAngle:t,gradientColor:yt(e)})})),I()}),[I]),P=kn((function(e){return e.setting.reduceMotionColor})),D=Object(o.useMemo)((function(){return e=d,Object.values(ne).map((function(t){var n=t.value,r=t.labelKey;return{label:e[r],value:n}}));var e}),[d]);Object(o.useEffect)((function(){0!==A&&(F("custom"),B("custom",N))}),[A]);var z=Object(o.useRef)(null),H=Object(o.useRef)(null);Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n;L((function(t){return Object(s.a)(Object(s.a)({},t),e)}));var r=e.lineColor,a=e.lineWidth,o=e.lineOffsetX,i=e.lineOffsetY,c=e.shadowBlur,l=e.shadowColor,u=e.shadowOffsetX,d=e.shadowOffsetY;null===(t=z.current)||void 0===t||t.setValue({x:u,y:d,width:c,color:l}),null===(n=H.current)||void 0===n||n.setValue({x:o,y:i,width:a,color:r})}}}));var K=N.fillStyle,G=N.headTextFillStyle,Y=N.hasOutline,X=N.hasShadow,V=N.hasGradient,U=N.gradientColor,q=N.gradientAngle,J=N.pattern,$=N.font,_=null!==n&&void 0!==n?n:{},Z={background:_.labelBackgroundColor,backgroundImage:_.labelBackgroundImage},Q="custom"===k,ee="predefined"===k,te="name-style-option-input-container",re=function(){F("auto"),"auto"!==k&&B("auto",N)},ae=function(){var e,t=N.preset?null===(e=C[N.preset])||void 0===e?void 0:e.value:{};F("predefined"),L((function(e){return Object(s.a)(Object(s.a)({},e),t)})),B("predefined",Object(s.a)(Object(s.a)({},N),t))},oe=function(){F("custom"),"custom"!==k&&B("custom",N)};return Object(a.jsx)("div",{className:"ant-input-group-wrapper text-style-input",children:Object(a.jsxs)("span",{className:"ant-input-wrapper ant-input-group",children:[Object(a.jsx)("span",{className:"ant-input-group-addon",children:d["input.name-style.label"]}),Object(a.jsxs)("span",{className:"name-style-input-container",children:[Object(a.jsxs)("div",Object(s.a)(Object(s.a)({id:te,className:"ant-radio-group ant-radio-group-outline name-style-option-input-container"},wt({setFocus:h,optionLength:3,onKeyPress:function(e){if(1===m&&("ArrowDown"===e.key||"Enter"===e.key||" "===e.key))return e.preventDefault(),h(1),y(!0),setTimeout((function(){var e;1===m&&(null===(e=f.current)||void 0===e||e.focus())}),200),!1},onTrigger:function(){0===m&&re(),1===m&&ae(),2===m&&oe()}})),{},{children:[Object(a.jsxs)("label",{className:Ht("ant-radio-wrapper","auto"===k&&"ant-radio-wrapper-checked",0===m&&"ant-radio-focused"),onClick:function(){return re()},children:[Object(a.jsxs)("span",{className:"ant-radio ".concat("auto"===k?"ant-radio-checked":""),children:[Object(a.jsx)("input",{tabIndex:-1,type:"radio",className:"ant-radio-input",value:"auto"}),Object(a.jsx)("span",{className:"ant-radio-inner"})]}),Object(a.jsx)("span",{className:"ant-radio-label",children:d["input.name-style.type.auto.label"]})]}),Object(a.jsx)("span",{className:"name-style-option-break"}),Object(a.jsx)("label",{className:Ht("ant-radio-wrapper",ee&&"ant-radio-wrapper-checked",1===m&&"ant-radio-focused"),onClick:function(){return ae()},children:Object(a.jsx)(Tr.a,{visible:x,onVisibleChange:y,trigger:["hover","click"],placement:"bottomLeft",overlayClassName:"predefined-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(qa,{ref:f,active:ee,value:N,onCancel:function(){var e;y(!1),null===(e=document.getElementById(te))||void 0===e||e.focus()},onClick:function(e){var t,n=e.key,r=n?null===(t=C[n])||void 0===t?void 0:t.value:{};F("predefined"),L((function(e){return Object(s.a)(Object(s.a)({},e),r)})),B("predefined",Object(s.a)(Object(s.a)({},N),r))}})}),children:Object(a.jsxs)("span",{className:"name-style-option-label",children:[Object(a.jsxs)("span",{className:"ant-radio ".concat(ee?"ant-radio-checked":""),children:[Object(a.jsx)("input",{tabIndex:-1,type:"radio",className:"ant-radio-input",value:"predefined"}),Object(a.jsx)("span",{className:"ant-radio-inner"})]}),Object(a.jsx)("span",{className:"ant-radio-label",children:d["input.name-style.type.predefined.label"]})]})})}),Object(a.jsx)("span",{className:"name-style-option-break"}),Object(a.jsx)("label",{className:Ht("ant-radio-wrapper",Q&&"ant-radio-wrapper-checked",2===m&&"ant-radio-focused"),onClick:function(){return oe()},children:Object(a.jsxs)("span",{children:[Object(a.jsxs)("span",{className:"ant-radio ".concat(Q?"ant-radio-checked":""),children:[Object(a.jsx)("input",{tabIndex:-1,type:"radio",className:"ant-radio-input",value:"custom"}),Object(a.jsx)("span",{className:"ant-radio-inner"})]}),Object(a.jsx)("span",{className:"ant-radio-label ant-radio-label-custom",children:d["input.name-style.type.custom.label"]})]})})]})),Object(a.jsxs)("div",{className:"style-picker",children:[Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsxs)("div",{className:"custom-style-text",children:[Object(a.jsx)("h3",{children:d["input.name-style.color.text.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:K,onChangeComplete:function(e){F("custom"),L((function(t){return Object(s.a)(Object(s.a)({},t),{},{fillStyle:e.hex})})),I()}})]}),Object(a.jsx)("hr",{}),Object(a.jsxs)("div",{className:"custom-style-text",children:[Object(a.jsx)("h3",{children:d["input.name-style.color.ruby.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:G,onChangeComplete:function(e){F("custom"),L((function(t){return Object(s.a)(Object(s.a)({},t),{},{headTextFillStyle:e.hex})})),I()}})]})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,className:"picker-dropdown color-picker-dropdown",children:[d["input.name-style.color.label"]," ",Object(a.jsx)(Ra.a,{})]})},"color-picker"),c&&Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsx)("h3",{className:"custom-style-expand",children:Object(a.jsx)(Jr.a,{value:"has-shadow",checked:X,onChange:function(){F("custom"),L((function(e){return Object(s.a)(Object(s.a)({},e),{},{hasShadow:!e.hasShadow})})),I()},children:d["input.name-style.shadow.toggle.label"]})}),X&&Object(a.jsx)(Ua,{ref:z,className:"custom-style-shadow",fieldMap:{color:"shadowColor",width:"shadowBlur",x:"shadowOffsetX",y:"shadowOffsetY"},labelMap:{shadowBlur:d["input.name-style.slider.blur.label"]},defaultValue:N,onChange:function(e){var t=e.color,n=e.width,r=e.x,a=e.y;L((function(e){return Object(s.a)(Object(s.a)({},e),{},{shadowBlur:n,shadowColor:t,shadowOffsetX:r,shadowOffsetY:a})})),I()}})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,$active:Q&&X,className:"picker-dropdown shadow-picker-dropdown",children:[d["input.name-style.shadow.label"]," ",Object(a.jsx)(Ra.a,{})]})},"shadow-picker"),Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsx)("h3",{className:"custom-style-expand",children:Object(a.jsx)(Jr.a,{value:"has-line",checked:Y,onChange:function(){F("custom"),L((function(e){return Object(s.a)(Object(s.a)({},e),{},{hasOutline:!e.hasOutline})})),I()},children:d["input.name-style.outline.toggle.label"]})}),Y&&Object(a.jsx)(Ua,{ref:H,className:"custom-style-line",fieldMap:{color:"lineColor",width:"lineWidth",x:"lineOffsetX",y:"lineOffsetY"},labelMap:{lineWidth:d["input.name-style.slider.thickness.label"]},defaultValue:N,onChange:function(e){var t=e.color,n=e.width,r=e.x,a=e.y;L((function(e){return Object(s.a)(Object(s.a)({},e),{},{lineWidth:n,lineColor:t,lineOffsetX:r,lineOffsetY:a})})),I()}})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,$active:Q&&Y,className:"picker-dropdown outline-picker-dropdown",children:[d["input.name-style.outline.label"]," ",Object(a.jsx)(Ra.a,{})]})},"outline-picker"),c&&Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsx)("h3",{className:"custom-style-expand",children:Object(a.jsx)(Jr.a,{value:"has-gradient",checked:V,onChange:function(){F("custom"),L((function(e){return Object(s.a)(Object(s.a)({},e),{},{hasGradient:!e.hasGradient})})),I()},children:d["input.name-style.gradient.toggle.label"]})}),V&&Object(a.jsx)("div",{className:"custom-style-gradient",children:Object(a.jsx)(Ia,{angle:q,palette:U,memoizedOnChange:W})})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,$active:Q&&V,className:"picker-dropdown gradient-picker-dropdown",children:[d["input.name-style.gradient.label"]," ",Object(a.jsx)(Ra.a,{})]})},"gradient-picker"),c&&Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay pattern-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)(Ha,{onClick:function(e){return e.stopPropagation()},children:[Object(a.jsx)("div",{className:"alert",children:d["input.name-style.pattern.alert"]}),R.map((function(e){var t=e.key,n=e.patternImage;return Object(a.jsx)(Ka,{className:["pattern-option",N.pattern===t?"menu-active":"",n?"":"menu-off"].join(" "),onClick:function(){L((function(e){return Object(s.a)(Object(s.a)({},e),{},{pattern:t})})),I()},children:n?Object(a.jsx)("img",{style:n?Z:{},className:"pattern-image",src:"".concat("/ygocarder","/asset/image/finish-name/").concat(n,".png"),alt:t}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(j.a,{})," ",d["input.name-style.pattern.no-pattern.label"]]})},t)}))]})}),placement:"bottomLeft",children:Object(a.jsx)(za,{$softMode:P,$active:Q&&"string"===typeof J&&"none"!==J,className:"picker-dropdown pattern-picker-dropdown",children:d["input.name-style.pattern.label"]})},"pattern-picker"),Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay font-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(ma.Container,{children:D.map((function(e){var t=e.value,n=e.label;return Object(a.jsx)(ma.Option,{className:$===t?"menu-active":"",onClick:function(){L((function(e){return Object(s.a)(Object(s.a)({},e),{},{font:t})})),I()},children:n},t)}))})}),placement:"bottomLeft",children:Object(a.jsx)(za,{$softMode:P,className:"picker-dropdown font-picker-dropdown",children:d["input.name-style.font.label"]})},"font-picker")]})]})]})})})));function $a(){var e=Object(Kt.a)(["\n .checkbox-train-input-group,\n .radio-train-input-group {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tcolumn-gap: var(--spacing-xs);\n\t\trow-gap: var(--spacing-xs);\n\t\tbox-shadow: none;\n\t\tborder-radius: 0;\n\t\t&:focus-visible {\n\t\t\toutline: 3px solid var(--focus); // +1 width size to account for shadow\n\t\t}\n\t\t.ant-radio-button-wrapper:first-child,\n\t\t.ant-radio-button-wrapper:last-child {\n\t\t\tborder-radius: 0;\n\t\t}\n\t\t.ant-radio-button-wrapper {\n\t\t\tflex: 1;\n\t\t\twhite-space: nowrap;\n\t\t\tborder: none;\n\t\t\tbox-shadow: var(--bs-1);\n\t\t\tpadding: 0;\n\t\t\tmin-width: 90px;\n\t\t\theight: 28px;\n\t\t\tline-height: 28px;\n\t\t\ttext-align: center;\n\t\t\ttext-shadow: none;\n\t\t\tfont-size: var(--fs-sm);\n\t\t\t&:hover {\n\t\t\t\toutline: var(--bw) solid var(--main-active);\n\t\t\t\toutline-offset: var(--bw);\n\t\t\t}\n\t\t\t&::before {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t\t.ant-radio-button-wrapper-checked {\n\t\t\toutline: var(--bw) solid var(--main-active);\n\t\t\toutline-offset: var(--bw);\n\t\t}\n\t}\n"]);return $a=function(){return e},e}function _a(){var e=Object(Kt.a)(["\n display: flex;\n .checkbox-train-input-group,\n .radio-train-input-group {\n display: flex;\n flex: 1 1 auto;\n\t\t&:focus-visible {\n\t\t\t.radio-train-focused,\n\t\t\t.checkbox-train-focused {\n\t\t\t\tbackground-color: var(--main-level-3);\n\t\t\t}\n\t\t}\n }\n .ant-radio-button-wrapper {\n user-select: none;\n }\n .ant-radio-button-wrapper:first-child,\n .ant-radio-button-wrapper:last-child {\n border-radius: 0;\n }\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):first-child {\n border-left-color: var(--sub-level-1);\n }\n"]);return _a=function(){return e},e}var Za=Object(Gt.a)(_a()),Qa=Object(Gt.a)($a());function eo(){var e=Object(Kt.a)(["\n ","\n"]);return eo=function(){return e},e}var to=Gt.b.div(eo(),Za),no=Object(o.forwardRef)((function(e,t){var n=e.onChange,r=e.value,i=e.optionList,c=e.children,l=e.suffix,d=e.className,f=e.strict,b=void 0!==f&&f,p=Object(o.useState)(-1),m=Object(u.a)(p,2),h=m[0],g=m[1],v=Object(o.useRef)(null),x=i.length;return Object(o.useImperativeHandle)(t,(function(){return{focus:function(){var e;return null===(e=v.current)||void 0===e?void 0:e.focus()}}})),Object(a.jsxs)(to,{className:["ant-radio-group ant-radio-group-outline radio-train",d].join(" "),children:[c&&Object(a.jsx)("label",{className:"standalone-addon ant-input-group-addon",children:c}),Object(a.jsx)("div",Object(s.a)(Object(s.a)({ref:v,className:"radio-train-input-group"},wt({setFocus:g,optionLength:x,onTrigger:function(){var e=i[h];e&&n(e.value)}})),{},{children:i.map((function(e,t){var o=e.value,i=e.props,c=e.label,l=e.tooltipProps,u=(null!==i&&void 0!==i?i:{}).className,d=b?o===r:"".concat(o)==="".concat(r);return Object(a.jsx)(Xt.a,Object(s.a)(Object(s.a)({overlay:null},l),{},{children:Object(a.jsxs)("label",Object(s.a)(Object(s.a)({},i),{},{className:["ant-radio-button-wrapper",d?"ant-radio-button-wrapper-checked":"",null!==u&&void 0!==u?u:"",h===t?"radio-train-focused":""].join(" "),onClick:function(){return n(o)},children:[Object(a.jsx)("span",{className:"ant-radio-button ".concat(d?"ant-radio-button-checked":""),children:Object(a.jsx)("span",{className:"ant-radio-button-inner"})}),Object(a.jsx)("span",{className:"label",children:c})]}),o)}))}))})),l]})}));function ro(){var e=Object(Kt.a)(["\n\t","\n"]);return ro=function(){return e},e}var ao=Object(Gt.b)(no)(ro(),Qa),oo=function(e){var t=e.onSTFrameChange,n=kn().setting.showExtraDecorativeOption,r=Object(o.useMemo)((function(){return xa().filter((function(e){return n||"normal"===e.edition}))}),[n]),i=On(Object(kr.useShallow)((function(e){var t=e.card,n=e.setCard;return{frame:t.frame,setCard:n}}))),c=i.frame,l=i.setCard,u=Object(o.useCallback)((function(e){l((function(n){var r=n.typeAbility,a=n.isPendulum,o=n.attribute,i=n.format,c="".concat(e),l="spell"===c||"trap"===c,u="tcg"===i?{"Spell Card":"Spell Card","Trap Card":"Trap Card"}:fe,d="spell"===c?[u["Spell Card"]]:"trap"===c?[u["Trap Card"]]:r;return l&&t(d),Object(s.a)(Object(s.a)({},n),{},{frame:c,isPendulum:"link"!==c&&a,attribute:l?"".concat(c).toUpperCase():o,typeAbility:d})}))}),[l,t]);return Object(a.jsx)(ao,{className:"frame-radio",value:c,onChange:u,optionList:r})};function io(){var e=Object(Kt.a)(["\n ","\n"]);return io=function(){return e},e}var co=Gt.b.div(io(),Za),lo=function(e){var t=e.onChange,n=e.value,r=e.optionList,i=e.children,c=e.className,l=Object(o.useState)(-1),d=Object(u.a)(l,2),f=d[0],b=d[1],p=r.length;return Object(a.jsxs)(co,{className:["ant-radio-group ant-radio-group-outline checkbox-train",c].join(" "),children:[i&&Object(a.jsx)("label",{className:"standalone-addon ant-input-group-addon",children:i}),Object(a.jsx)("div",Object(s.a)(Object(s.a)({className:"checkbox-train-input-group"},wt({setFocus:b,optionLength:p,onTrigger:function(){var e=r[f];if(e){var a=!!Array.isArray(n)&&n.includes("".concat(e.value));t(a?n.filter((function(t){return"".concat(e.value)!==t})):[].concat(Object(wn.a)(n),["".concat(e.value)]))}}})),{},{children:r.map((function(e,r){var o=e.label,i=e.value,c=e.props,l=!!Array.isArray(n)&&n.includes("".concat(i));return Object(a.jsxs)("label",Object(s.a)(Object(s.a)({},c),{},{className:["ant-radio-button-wrapper",l?"ant-radio-button-wrapper-checked":"",f===r?"checkbox-train-focused":""].join(" "),onClick:function(){t(l?n.filter((function(e){return"".concat(i)!==e})):[].concat(Object(wn.a)(n),["".concat(i)]))},children:[Object(a.jsx)("span",{className:"ant-radio-button ".concat(l?"ant-radio-button-checked":""),children:Object(a.jsx)("span",{className:"ant-radio-button-inner"})}),Object(a.jsx)("span",{className:"label",children:o})]}),i)}))}))]})};function so(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: max-content max-content;\n align-items: start;\n gap: 0;\n .card-image-source-input {\n display: flex;\n flex-direction: column-reverse;\n .online-image-tip {\n text-align: center;\n }\n }\n .card-cropper {\n width: 375px;\n text-align: center;\n }\n"]);return so=function(){return e},e}var uo=Object(Gt.b)(Cr)(so()),fo=Object(o.forwardRef)((function(e,t){var n=e.backgroundColor,r=e.children,i=e.receivingCanvas,c=e.onSourceLoaded,l=e.onTainted,u=e.onCropChange,d=vn(),f=On(Object(kr.useShallow)((function(e){var t=e.card;return{background:t.background,backgroundCrop:t.backgroundCrop,backgroundType:t.backgroundType,isPendulum:t.isPendulum,opacity:t.opacity,getUpdater:e.getUpdater,setCard:e.setCard}}))),b=f.background,p=f.backgroundCrop,m=f.backgroundType,h=f.isPendulum,g=f.opacity,v=f.getUpdater,j=f.setCard,y=Object(o.useRef)(null),O=Object(o.useMemo)((function(){return v("background")}),[v]),w=Object(o.useCallback)((function(e,t){null===u||void 0===u||u(e,t),e&&j((function(t){return Object(s.a)(Object(s.a)({},t),{},{backgroundCrop:e})}))}),[u,j]);return Object(o.useImperativeHandle)(t,(function(){return{hasImage:function(){var e,t;return null!==(e=null===(t=y.current)||void 0===t?void 0:t.hasImage())&&void 0!==e&&e},setValue:function(e){var t,n=e.background,r=e.backgroundCrop;"string"===typeof n&&r&&(null===(t=y.current)||void 0===t||t.forceExternalSource(n,r))}}})),Object(a.jsx)(uo,{ref:y,title:d["input.background-image.label"],backgroundColor:n,defaultExternalSource:b,defaultCropInfo:p,receivingCanvas:i,onSourceChange:O,onCropChange:w,onTainted:l,onSourceLoaded:c,ratio:x(h,g,m).ratio,beforeCropper:null,children:r})})),bo=n(430);n(390);function po(){var e=Object(Kt.a)(["\n --input-width: 315px;\n &.overlay-no-background-image {\n .card-image-cropper {\n grid-template-columns: 1fr;\n }\n .card-cropper {\n min-height: 0;\n line-height: 0;\n width: 0;\n visibility: hidden;\n position: absolute;\n }\n .card-image-source-input {\n padding-right: 0;\n margin-right: 0;\n border-right: none;\n }\n i {\n max-width: var(--input-width); // Alignment\n }\n }\n i {\n display: inline-block;\n font-size: var(--fs-sm);\n color: var(--color);\n font-weight: normal;\n }\n .background-picker {\n padding: var(--spacing-xs);\n /** No display none here, again we want to keep card cropper painted, just not visible */\n &.overlay-no-background {\n visibility: hidden;\n height: 0;\n width: 0;\n padding: 0;\n }\n .card-image-input {\n text-align: center;\n max-width: var(--input-width);\n }\n }\n .card-image-source-input {\n height: 100%;\n justify-content: start;\n padding-right: var(--spacing-xs);\n margin-right: var(--spacing-xs);\n border-right: var(--bw) solid var(--sub-level-4);\n .type-section h2 {\n margin-top: var(--spacing-xs);\n }\n .color-section h2 {\n padding-top: 0;\n padding-left: 0;\n }\n }\n .color-section {\n > h2 + div {\n > div:first-child {\n box-shadow: none !important; // Override inline style\n }\n > div:nth-child(2) {\n border: var(--bw) solid var(--main-level-1);\n }\n }\n }\n"]);return po=function(){return e},e}function mo(){var e=Object(Kt.a)(["\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n column-gap: var(--spacing-sm);\n row-gap: var(--spacing-sm);\n padding: 2px 0;\n align-items: center;\n .slider-label,\n .ant-slider,\n .slider-padding {\n border: var(--bw) solid var(--sub-level-1);\n background-color: var(--main-level-4);\n }\n .slider-label {\n display: inline-flex;\n column-gap: var(--spacing-xs);\n border-right: none;\n padding: var(--spacing-xxs) var(--spacing-xs);\n border-radius: var(--br) 0 0 var(--br);\n box-shadow: var(--bs-input);\n .ant-checkbox-wrapper {\n transform: translateY(-1px); // Alignment\n }\n }\n .ant-slider {\n margin: 0;\n border-left: none;\n border-right: none;\n height: 28px; // Alignment\n padding-top: 11px; // Alignment\n }\n .slider-padding {\n border-left: none;\n border-radius: 0 var(--br) var(--br) 0;\n }\n .ant-slider-rail,\n .ant-slider-track {\n border-radius: 0 var(--br) var(--br) 0;\n }\n .card-opacity-slider {\n flex: 0 1 auto;\n display: grid;\n grid-template-columns: max-content 60px 45px 12px;\n &.inactive {\n .slider-label,\n .ant-slider,\n .slider-padding {\n background-color: var(--main-level-3);\n }\n }\n }\n .ant-input-number.ant-input-number-sm {\n height: 28px; // Alignment\n width: unset;\n border-radius: 0;\n box-shadow: var(--bs-input);\n .ant-input-number-input {\n height: 26px; // Alignment\n }\n }\n .background-preview {\n display: inline-block;\n line-height: 0;\n width: 17px;\n height: 17px; // Alignment\n align-self: center;\n border: 1px solid #333333;\n cursor: pointer;\n text-align: center;\n user-select: none;\n &:hover {\n box-shadow: 0 0 2px 0 #222222;\n }\n .background-image-preview {\n max-width: 15px;\n max-height: 15px;\n }\n .no-background-icon {\n font-size: 15px; // Alignment\n }\n }\n"]);return mo=function(){return e},e}function ho(){var e=Object(Kt.a)(["\n white-space: pre-line;\n"]);return ho=function(){return e},e}var go=Gt.b.span(ho()),vo=Gt.b.div(mo()),xo=Gt.b.div(po()),jo=Object(o.forwardRef)((function(e,t){var n,r=e.receivingCanvas,i=e.defaultValue,c=e.onTainted,l=e.onChange,d=e.onSourceLoaded,f=e.onCropChange,b=vn(),p=On(Object(kr.useShallow)((function(e){var t=e.card,n=t.isPendulum;return{hasBackground:t.hasBackground,backgroundType:t.backgroundType,isPendulum:n,background:t.background,setCard:e.setCard,getUpdater:e.getUpdater}}))),m=p.hasBackground,v=p.backgroundType,x=p.isPendulum,j=p.background,y=p.setCard,O=p.getUpdater,w=Object(o.useState)(!0),k=Object(u.a)(w,2),F=k[0],C=k[1],S=Object(o.useState)(!0),T=Object(u.a)(S,2),R=T[0],N=T[1],L=Object(o.useState)(Object(s.a)(Object(s.a)({},g()),i)),M=Object(u.a)(L,2),E=M[0],I=M[1],A=Object(o.useRef)(null),B=Object(o.useMemo)((function(){return O("backgroundType")}),[O]),W=Object(o.useCallback)((function(e){return y((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{hasBackground:n})}))}),[y]);Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){e&&l(E)}),500),function(){e=!1}}),[E]),Object(o.useEffect)((function(){C(!1),setTimeout((function(){N(!1)}),250)}),[]),Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.background,r=e.backgroundCrop,a=Object(tn.a)(e,["background","backgroundCrop"]);"string"===typeof n&&r&&(null===(t=A.current)||void 0===t||t.setValue({background:n,backgroundCrop:r}));for(var o in a)a[o]!==E[o]&&I((function(e){return Object(s.a)(Object(s.a)({},e),a)}))}}}));var P=0===(null!==j&&void 0!==j?j:"").length&&!0!==(null===(n=A.current)||void 0===n?void 0:n.hasImage());return Object(a.jsxs)(vo,{className:"card-opacity-slider-container",children:[Object(a.jsx)(Xt.a,{overlayClassName:"long-tooltip-overlay",title:Object(a.jsx)(go,{children:b["input.opacity.boundless.tooltip"]}),children:Object(a.jsx)(Jr.a,{className:"art-frame",onChange:function(e){return I((function(t){return Object(s.a)(Object(s.a)({},t),{},{boundless:e.target.checked})}))},checked:E.boundless,children:b["input.opacity.boundless.label"]})}),ct.map((function(e){var t,n,o,i=e.labelKey,l=e.type,u=e.subType,p=e.tooltipKey;if("pendulum"===l&&!x)return null;var g,y=!!u,O=u&&E[u];return Object(a.jsxs)("div",{className:["card-opacity-slider",O?"":"inactive"].join(" "),children:[Object(a.jsxs)("div",{className:"slider-label",children:["body"===l&&Object(a.jsx)(Tr.a,{visible:F,destroyTooltipOnHide:!1,trigger:["click"],onVisibleChange:C,overlayClassName:["global-input-overlay global-style-picker-overlay layout-picker-overlay",F?"picker-visible":"",R?"picker-hidden":""].join(" "),content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)(xo,{className:["custom-style-picker",P?"overlay-no-background-image":""].join(" "),children:[Object(a.jsxs)("h3",{className:"custom-style-expand ".concat(m?"":"inactive"),children:[Object(a.jsx)(Jr.a,{checked:m,onChange:function(e){W(e)},children:b["input.background.toggle-label"]}),Object(a.jsx)("br",{}),Object(a.jsx)("i",{children:b["input.background.description"]})]}),Object(a.jsx)("div",{className:"background-picker ".concat(m?"":"overlay-no-background"),children:Object(a.jsx)(fo,{ref:A,receivingCanvas:r,onSourceLoaded:d,onTainted:c,onCropChange:f,backgroundColor:E.baseFill,children:Object(a.jsxs)("div",{className:"layout-picker-panel",children:[Object(a.jsxs)("div",{className:"layout-picker-subpanel color-section",children:[Object(a.jsx)("h2",{children:b["input.background-color.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:E.baseFill,onChangeComplete:function(e){I((function(t){return Object(s.a)(Object(s.a)({},t),{},{baseFill:e.hex})}))}})]}),!P&&Object(a.jsxs)("div",{className:"layout-picker-subpanel type-section",children:[Object(a.jsx)("h2",{children:b["input.background-type.label"]}),Object(a.jsx)(no,{onChange:B,optionList:(g={fit:b["input.background-type.fit.label"],full:b["input.background-type.full.label"]},[{value:"fit",label:g.fit},{value:"full",label:g.full}]),value:v})]})]})})})]})}),placement:"bottom",children:Object(a.jsx)("div",{className:"background-preview",style:{backgroundColor:m?E.baseFill:h},children:m?j?Object(a.jsx)("img",{className:"background-image-preview",src:j,alt:"Background"}):null:Object(a.jsx)(bo.a,{className:"no-background-icon"})})}),y&&Object(a.jsx)(Xt.a,{title:p&&null!==(t=b[p])&&void 0!==t?t:null,overlayClassName:"long-tooltip-overlay",children:Object(a.jsx)(Jr.a,{checked:O,onChange:function(e){return u&&I((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},u,e.target.checked))}))}})}),b[i]]}),Object(a.jsx)(Na.a,{size:"small",min:0,max:100,onChange:function(e){return I((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},l,"number"===typeof e?e:100))}))},value:null!==(n=E[l])&&void 0!==n?n:100}),Object(a.jsx)(Xa.a,{min:0,max:100,step:5,onChange:function(e){return I((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},l,e))}))},value:null!==(o=E[l])&&void 0!==o?o:100}),Object(a.jsx)("div",{className:"slider-padding"})]},l)}))]})})),yo=n(431),Oo=n(432),wo=n(433);function ko(){var e=Object(Kt.a)(["\n .custom-star-input {\n margin-left: var(--spacing-sm);\n width: 6.5rem;\n }\n .checkbox-star-suffix {\n display: grid;\n grid-template-columns: max-content max-content;\n column-gap: var(--spacing-sm);\n }\n"]);return ko=function(){return e},e}function Fo(){var e=Object(Kt.a)(["\n img {\n max-height: 1.3em;\n }\n"]);return Fo=function(){return e},e}var Co=Object(Gt.b)(ma.Container)(Fo()),So=Object(Gt.b)(no)(ko()),To=Object(o.forwardRef)((function(e,t){var n=e.isLink,r=e.isMonster,i=e.showCreativeOption,c=vn(),l=On(Object(kr.useShallow)((function(e){var t=e.card;return{frame:t.frame,subFamily:t.subFamily,cardIcon:t.cardIcon,star:t.star,starAlignment:t.starAlignment,getUpdater:e.getUpdater}}))),s=l.frame,u=l.subFamily,d=l.cardIcon,f=l.star,b=l.starAlignment,p=l.getUpdater,m="dark-synchro"==={frame:s}.frame,h=st({frame:s}),g=Object(o.useMemo)((function(){return p("cardIcon")}),[p]),v=Object(o.useMemo)((function(){return p("subFamily")}),[p]),x=Object(o.useMemo)((function(){return p("star")}),[p]),y=Object(o.useMemo)((function(){return p("starAlignment")}),[p]);Object(o.useImperativeHandle)(t,(function(){return{}}));var O,F="auto"===d?ya[r?h?"rank":m?"negative-level":"level":"st"]:ya[d],C=c[F.labelKey],S=i?Object(a.jsxs)(a.Fragment,{children:[C," ",Object(a.jsx)(Ra.a,{})]}):C,T=Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay pattern-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(Co,{children:Oa.map((function(e){var t=e.fullLabelKey,n=e.value,r=e.icon;return Object(a.jsxs)(ma.Option,{className:n===d?"menu-active":"",onClick:function(){return g(n)},children:[r?Object(a.jsxs)(a.Fragment,{children:[r,"\xa0"]}):null,c[t]]},n)}))})}),placement:"bottomRight",children:Object(a.jsx)("span",{className:"card-icon-dropdown ".concat("auto"===d?"":"active"," ").concat(i?"":"disabled"),children:S})},"icon-type-picker"),R=i?T:S;return n?null:"st"===F.value?Object(a.jsx)(no,{className:"fill-input-train",value:u,onChange:v,optionList:(O=c,k.map((function(e){var t=e.value,n=e.nameKey;return{label:t===w?Object(a.jsx)(j.a,{}):Object(a.jsx)(Xt.a,{overlay:O[n],children:Object(a.jsx)("img",{alt:O[n],src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-").concat(t.toLowerCase(),".png")})}),value:t}}))),children:R}):Object(a.jsx)(So,{className:"checkbox-star-train",value:f,onChange:x,optionList:ja,strict:!0,suffix:i&&Object(a.jsxs)("div",{className:"checkbox-star-suffix",children:[Object(a.jsx)(Vt.a,{className:"custom-star-input",value:"number"===typeof f?"":f,allowClear:!0,onChange:x,placeholder:c["input.icon-type.custom.placeholder"]}),Object(a.jsx)(no,{value:b,onChange:y,optionList:[{value:"auto",tooltipProps:{overlay:c["input.icon-type.alignment.auto"]},label:Object(a.jsx)(j.a,{})},{value:"left",tooltipProps:{overlay:c["input.icon-type.alignment.left"]},label:Object(a.jsx)(yo.a,{})},{value:"center",tooltipProps:{overlay:c["input.icon-type.alignment.center"]},label:Object(a.jsx)(Oo.a,{})},{value:"right",tooltipProps:{overlay:c["input.icon-type.alignment.right"]},label:Object(a.jsx)(wo.a,{})}]})]}),children:R})})),Ro=new Set(["1","2","3","4","5"]),No=function(e,t,n,r,a,o){var i=e.substring(n,r),c="\n"===e[r]||!a,l=i,s=2;switch(t){case"1":l="[".concat(i,"]").concat(c?"":"\n"),s=c?2:3;break;case"2":l="{".concat(i,"}");break;case"3":l="{".concat(i,"|}");break;case"4":l="{".concat(i,"||}"),s=3;break;case"5":l="{{".concat(i,"}}"),s=4}o(e.substring(0,n)+"".concat(l)+e.substring(r,e.length),r+s)},Lo=function(e){var t=e.id,n=e.placement;if(t&&n>=0){var r,a=document.querySelector("#".concat(t));a&&(null!==(r=a.selectionEnd)&&void 0!==r?r:-1)>=0&&(a.selectionEnd=n)}},Mo=Vt.a.TextArea,Eo=Object(o.forwardRef)((function(e,t){var n=e.id,r=e.allowHotkey,i=e.defaultValue,c=e.onTakePicker,l=e.onChange,d=e.onKeyDown,f=e.className,b=Object(tn.a)(e,["id","allowHotkey","defaultValue","onTakePicker","onChange","onKeyDown","className"]),p=Object(o.useRef)(i),m=Object(o.useState)(i),h=Object(u.a)(m,2),g=h[0],v=h[1],x=Object(o.useState)({id:"",placement:-1}),j=Object(u.a)(x,2),y=j[0],O=j[1],w=Object(o.useCallback)((function(e){var t="string"===typeof e?e:e.target.value;p.current=t,v(t)}),[]);Object(o.useEffect)((function(){Lo(y)}),[y]),Object(o.useEffect)((function(){l({target:{value:g}})}),[g]);var k=function(e){e!==p.current&&w(e)};return Object(o.useImperativeHandle)(t,(function(){return{setValue:k,getPickerRef:function(){return n?{id:n,setValue:k}:null}}})),Object(a.jsx)(Mo,Object(s.a)({id:n,autoComplete:"off",onFocus:function(){return n&&(null===c||void 0===c?void 0:c({id:n,setValue:k}))},allowClear:!0,spellCheck:!1,className:"".concat(n,"-input ").concat(f),value:g,onKeyDown:function(e){var t,a;if(null===d||void 0===d||d(e),r){var o=e.ctrlKey,i=e.key,c=e.metaKey,l=null!==(t=e.currentTarget.selectionStart)&&void 0!==t?t:-1,s=null!==(a=e.currentTarget.selectionEnd)&&void 0!==a?a:-1;(o||c)&&n&&s!==l&&Ro.has(i)&&(e.preventDefault(),No(e.currentTarget.value,i,l,s,!0,(function(e,t){w(e),O({id:n,placement:t})})))}},onChange:w},b))})),Io=Object(o.forwardRef)((function(e,t){var n=e.id,r=e.defaultValue,i=e.onTakePicker,c=e.onChange,l=e.onKeyDown,d=e.className,f=Object(tn.a)(e,["id","defaultValue","onTakePicker","onChange","onKeyDown","className"]),b=kn().setting.allowHotkey,p=Object(o.useRef)(r),m=Object(o.useState)(r),h=Object(u.a)(m,2),g=h[0],v=h[1],x=Object(o.useState)({id:"",placement:-1}),j=Object(u.a)(x,2),y=j[0],O=j[1],w=Object(o.useCallback)((function(e){var t="string"===typeof e?e:e.target.value;p.current=t,v(t)}),[]);Object(o.useEffect)((function(){Lo(y)}),[y]),Object(o.useEffect)((function(){c({target:{value:g}})}),[g]);var k=function(e){e!==g&&w(e)};return Object(o.useImperativeHandle)(t,(function(){return{setValue:k}})),Object(a.jsx)(Vt.a,Object(s.a)({id:n,autoComplete:"off",onFocus:function(){return n&&(null===i||void 0===i?void 0:i({id:n,setValue:k}))},allowClear:!0,className:"".concat(n,"-input ").concat(d),value:g,onKeyDown:function(e){var t,r;if(null===l||void 0===l||l(e),b){var a=e.ctrlKey,o=e.key,i=e.metaKey,c=null!==(t=e.currentTarget.selectionStart)&&void 0!==t?t:-1,s=null!==(r=e.currentTarget.selectionEnd)&&void 0!==r?r:-1;(a||i)&&n&&s!==c&&Ro.has(o)&&(e.preventDefault(),No(e.currentTarget.value,o,c,s,!1,(function(e,t){w(e),O({id:n,placement:t})})))}},onChange:function(e){return w(e.target.value)}},f))})),Ao=Object(o.forwardRef)((function(e,t){var n=e.onTakePicker,r=On((function(e){return e.getUpdater})),i=Object(o.useRef)(null),c=Object(o.useMemo)((function(){return r("effect",void 0,"debounce")}),[r]);return Object(o.useEffect)((function(){var e,t=null===(e=i.current)||void 0===e?void 0:e.getPickerRef();t&&(null===n||void 0===n||n(t))}),[]),Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t;null===(t=i.current)||void 0===t||t.setValue(e)}}})),Object(a.jsx)(Eo,{ref:i,id:"effect",allowHotkey:!0,defaultValue:On.getState().card.effect,onChange:c,onTakePicker:n,rows:9})}));function Bo(){var e=Object(Kt.a)(["\n align-self: center;\n text-align: right;\n .ant-checkbox + span {\n user-select: none;\n }\n"]);return Bo=function(){return e},e}var Wo=Gt.b.div(Bo()),Po=function(e){var t=vn(),n=On(Object(kr.useShallow)((function(e){var t=e.card,n=e.setCard;return{isSpeedCard:t.isSpeedCard,isDuelTerminalCard:t.isDuelTerminalCard,isFirstEdition:t.isFirstEdition,setCard:n}}))),r=n.isDuelTerminalCard,i=n.isFirstEdition,c=n.isSpeedCard,l=n.setCard,u=Object(o.useCallback)((function(e){return l((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isFirstEdition:n})}))}),[l]),d=Object(o.useCallback)((function(e){return l((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isDuelTerminalCard:n,isSpeedCard:!n&&t.isSpeedCard})}))}),[l]),f=Object(o.useCallback)((function(e){return l((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isSpeedCard:e.target.checked,isDuelTerminalCard:!n&&t.isDuelTerminalCard})}))}),[l]);return Object(a.jsxs)(Wo,{className:"checkbox-input",children:[Object(a.jsx)(Jr.a,{className:"input-1st",onChange:u,checked:i,tabIndex:0,children:t["input.1st-edition.label"]}),Object(a.jsx)(Xt.a,{overlayClassName:"long-tooltip-overlay",overlay:"Will turn off Duel Terminal mark.",children:Object(a.jsx)(Jr.a,{className:"input-speed",onChange:f,checked:c,tabIndex:0,children:t["input.speed-duel.label"]})}),Object(a.jsx)(Xt.a,{overlayClassName:"long-tooltip-overlay",overlay:"Will turn off Speed Duel mark.",children:Object(a.jsx)(Jr.a,{className:"input-terminal",onChange:d,checked:r,tabIndex:0,children:t["input.duel-terminal.label"]})})]})},Do=n(434);function zo(){var e=Object(Kt.a)(['\n &.radio-train {\n .ant-radio-button-wrapper-checked {\n &.ocg-button {\n background-color: var(--main-red-scale);\n border-color: var(--sub-red-scale);\n &:not([class*=" ant-radio-button-wrapper-disabled"]).ant-radio-button-wrapper:first-child {\n border-right-color: var(--sub-red-scale);\n }\n &:not(.ant-radio-button-wrapper-disabled):first-child {\n border-color: var(--sub-red-scale);\n }\n &:hover {\n background-color: var(--sub-red-scale);\n color: var(--color-heavy);\n }\n }\n &.tcg-button {\n background-color: var(--main-blue-scale);\n border-color: var(--sub-blue-scale);\n &:hover {\n background-color: var(--sub-blue-scale);\n color: var(--color-heavy);\n }\n }\n }\n .ocg-button {\n color: var(--color-heavy);\n &:hover {\n color: var(--sub-red-scale);\n }\n }\n .tcg-button {\n color: var(--color-heavy);\n &:hover {\n color: var(--sub-blue-scale);\n }\n }\n }\n']);return zo=function(){return e},e}function Ho(){var e=Object(Kt.a)(["\n display: flex;\n align-items: center;\n margin-top: var(--spacing-sm);\n flex-wrap: wrap;\n row-gap: var(--spacing-sm);\n"]);return Ho=function(){return e},e}function Ko(){var e=Object(Kt.a)(["\n\tdisplay: flex;\n\talign-items: center;\n\t.input-label {\n\t\tflex: 1;\n\t}\n"]);return Ko=function(){return e},e}function Go(){var e=Object(Kt.a)(["\n padding: var(--spacing-xs);\n .radio-train {\n display: flex;\n flex-wrap: wrap;\n max-width: 550px;\n .radio-train-input-group {\n gap: var(--spacing);\n }\n }\n .ant-checkbox-wrapper {\n color: var(--color-heavy);\n }\n .frame-auto-checkbox {\n margin-bottom: var(--spacing-xs);\n }\n ","\n"]);return Go=function(){return e},e}var Yo=Object(Gt.b)(ma.Container)(Go(),Qa),Xo=Gt.b.div(Ko()),Vo=Gt.b.div(Ho()),Uo=Object(Gt.b)(no)(zo());function qo(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--spacing-sm);\n .checkbox-input {\n align-self: center;\n .ant-checkbox + span {\n user-select: none;\n }\n }\n .sticker-input,\n .creator-input {\n grid-column: span 2;\n }\n .sticker-input .ant-radio-button-wrapper {\n padding-left: var(--spacing-sm);\n padding-right: var(--spacing-sm);\n }\n"]);return qo=function(){return e},e}var Jo=Gt.b.div(qo()),$o=Object(o.forwardRef)((function(e,t){var n=e.isMonster,r=e.showCreativeOption,i=e.onTakePicker,c=vn(),l=On(Object(kr.useShallow)((function(e){return{sticker:e.card.sticker,getUpdater:e.getUpdater}}))),s=l.sticker,u=l.getUpdater,d=Object(o.useRef)(null),f=Object(o.useRef)(null),b=Object(o.useRef)(null),p=Object(o.useRef)(null),m=Object(o.useMemo)((function(){return u("atk",(function(e){return"string"===typeof e?e.trim():e}))}),[u]),h=Object(o.useMemo)((function(){return u("def",(function(e){return"string"===typeof e?e.trim():e}))}),[u]),g=Object(o.useMemo)((function(){return u("password",void 0,"debounce")}),[u]),v=Object(o.useMemo)((function(){return u("sticker")}),[u]),x=Object(o.useMemo)((function(){return u("creator",void 0,"debounce")}),[u]);return Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n,r,a,o=e.password,i=e.creator,c=e.atk,l=e.def;"string"===typeof c&&(null===(t=b.current)||void 0===t||t.setValue(c)),"string"===typeof l&&(null===(n=p.current)||void 0===n||n.setValue(l)),"string"===typeof o&&(null===(r=d.current)||void 0===r||r.setValue(o)),"string"===typeof i&&(null===(a=f.current)||void 0===a||a.setValue(i))}}})),Object(a.jsxs)(Jo,{className:"card-footer-input",children:[(n||r)&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Io,{ref:b,id:"atk",addonBefore:c["input.atk.label"],defaultValue:On.getState().card.atk,onChange:m,onTakePicker:i}),Object(a.jsx)(Io,{ref:p,id:"def",addonBefore:c["input.def.label"],defaultValue:On.getState().card.def,onChange:h,onTakePicker:i})]}),Object(a.jsx)(Io,{ref:d,id:"password",addonBefore:Object(a.jsxs)(Xo,{className:"input-label-with-button",children:[Object(a.jsx)("div",{className:"input-label",children:c["input.password.label"]}),Object(a.jsx)(an,{onClick:function(){var e;return null===(e=d.current)||void 0===e?void 0:e.setValue("".concat(It("0123456789",8)))},Icon:Do.a,tooltipProps:{overlay:c["button.randomize.label"]}})]}),defaultValue:On.getState().card.password,onChange:g,onTakePicker:i}),Object(a.jsx)(Po,{}),Object(a.jsx)(Io,{ref:f,id:"creator",addonBefore:c["input.creator-text.label"],defaultValue:On.getState().card.creator,onChange:x,onTakePicker:i}),Object(a.jsx)(no,{className:"sticker-input fill-input-train",value:s,onChange:v,optionList:wa,children:Object(a.jsx)("span",{children:c["input.sticker.label"]})})]})}));function _o(){var e=Object(Kt.a)(["\n .ant-input-group-addon {\n flex: 0;\n }\n .radio-train-input-group .ant-radio-button-wrapper {\n min-width: unset;\n }\n"]);return _o=function(){return e},e}var Zo=Object(Gt.b)(no)(_o()),Qo=Object(o.forwardRef)((function(e,t){var n=e.isLink,r=e.showExtraDecorativeOption,i=e.receivingCanvas,c=e.onSourceLoaded,l=e.onTainted,u=e.onCropChange,d=vn(),f=On(Object(kr.useShallow)((function(e){var t=e.card;return{opacity:t.opacity,artFinish:t.artFinish,linkMap:t.linkMap,isPendulum:t.isPendulum,art:t.art,artCrop:t.artCrop,getUpdater:e.getUpdater,setCard:e.setCard}}))),b=f.opacity,p=f.artFinish,m=f.linkMap,h=f.isPendulum,g=f.art,v=f.artCrop,j=f.getUpdater,y=f.setCard,O=Object(o.useRef)(null),w=Object(o.useMemo)((function(){return j("linkMap")}),[j]),k=Object(o.useMemo)((function(){return j("art")}),[j]),F=Object(o.useMemo)((function(){return j("artFinish")}),[j]),C=Object(o.useCallback)((function(e,t){null===u||void 0===u||u(e,t),e&&y((function(t){return Object(s.a)(Object(s.a)({},t),{},{artCrop:e})}))}),[u,y]);return Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.art,r=e.artCrop;"string"===typeof n&&r&&(null===(t=O.current)||void 0===t||t.forceExternalSource(n,r))}}})),Object(a.jsx)(Cr,{ref:O,title:d["input.card-art.label"],defaultExternalSource:g,defaultCropInfo:v,receivingCanvas:i,onSourceChange:k,onCropChange:C,onTainted:l,onSourceLoaded:c,ratio:x(h,b).ratio,beforeCropper:r?Object(a.jsx)(Zo,{className:"art-finish-checkbox fill-input-train",value:p,onChange:F,optionList:va,children:Object(a.jsx)("span",{className:"field-title",children:d["input.art-finish.label"]})}):null,children:n?Object(a.jsx)(Sr,{defaultValue:m,onChange:w}):Object(a.jsx)("div",{})})}));function ei(){var e=Object(Kt.a)(["\n cursor: pointer;\n"]);return ei=function(){return e},e}function ti(){var e=Object(Kt.a)(["\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-sm);\n width: 100%;\n .name-input {\n flex: 3;\n min-width: 400px;\n }\n .set-id-input {\n flex: 1;\n min-width: 250px;\n }\n"]);return ti=function(){return e},e}var ni=Gt.b.div(ti()),ri=Gt.b.span(ei()),ai=Object(o.forwardRef)((function(e,t){var n=e.onTakePicker,r=vn(),i=On(Object(kr.useShallow)((function(e){var t=e.card;return{name:t.name,format:t.format,getUpdater:e.getUpdater}}))),c=i.name,l=i.format,s=i.getUpdater,u=Object(o.useRef)(null),d=Object(o.useRef)(null),f=Object(o.useMemo)((function(){return s("setId")}),[s]),b=Object(o.useMemo)((function(){return s("name",void 0,"debounce")}),[s]);return Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n,r=e.name,a=e.setId;"string"===typeof r&&(null===(t=u.current)||void 0===t||t.setValue(r)),"string"===typeof a&&(null===(n=d.current)||void 0===n||n.setValue(a))}}})),Object(a.jsxs)(ni,{className:"name-id-input",children:[Object(a.jsx)(Io,{ref:u,id:"name",defaultValue:c,addonBefore:Object(a.jsx)(Xt.a,{title:"Copy",children:Object(a.jsx)(ri,{onClick:function(){navigator.clipboard.writeText(Bt(c))},children:r["input.name.label"]})}),onChange:b,onTakePicker:n}),Object(a.jsx)(Io,{ref:d,id:"set-id",defaultValue:On.getState().card.setId,addonBefore:Object(a.jsxs)(Xo,{className:"input-label-with-button",children:[Object(a.jsx)("div",{className:"input-label",children:r["input.set-id.label"]}),Object(a.jsx)(an,{onClick:function(){var e;return null===(e=d.current)||void 0===e?void 0:e.setValue(function(e){return It("ABCDEFGHIJKLMNOPQRSTUVWXYZ",4)+"-"+("OCG"===e?"JP":"EN")+It("0000000000111111111122222222223456789",1)+It("0123456789",2)}(l))},Icon:Do.a,tooltipProps:{overlay:r["button.randomize.label"]}})]}),onChange:f,onTakePicker:n})]})}));function oi(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n column-gap: var(--spacing-sm);\n row-gap: var(--spacing-sm);\n .red-scale {\n color: var(--sub-red-scale);\n }\n .blue-scale {\n color: var(--sub-blue-scale);\n }\n .joined-row {\n position: 'relative';\n grid-column: span 2;\n .standalone-label {\n min-width: 0;\n width: unset;\n padding-left: var(--spacing-antd);\n }\n .pendulum-checkbox {\n /** Alignment **/\n width: var(--width-label);\n line-height: 32px;\n text-align: right;\n font-weight: 500;\n margin-right: 0;\n padding-right: var(--spacing);\n > span {\n padding-right: 0;\n }\n }\n .pendulum-checkbox-placeholder {\n display: inline-block;\n /** Alignment **/\n width: var(--width-label);\n }\n .pendulum-frame-input {\n margin-right: var(--spacing-lg);\n }\n .ant-checkbox-wrapper + .ant-checkbox-wrapper {\n margin-left: 0;\n }\n }\n"]);return oi=function(){return e},e}function ii(){var e=Object(Kt.a)(["\n display: inline-flex;\n cursor: pointer;\n box-shadow: var(--bs-input);\n vertical-align: bottom;\n box-shadow: var(--bs-button);\n border-radius: var(--br-lg);\n &:focus-visible {\n outline: 2px solid var(--focus);\n }\n .pendulum-frame-info-block {\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\n line-height: 2; // Alignment\n background-color: var(--main-level-4);\n min-width: 100px;\n overflow: hidden;\n border: var(--bw) solid var(--sub-level-1);\n .frame-info-block-label {\n padding: var(--spacing-px) var(--spacing-xs);\n }\n }\n .pendulum-frame-label {\n display: inline-block;\n background: var(--main-level-4);\n border: var(--bw) solid var(--sub-level-1);\n border-right: none;\n padding: var(--spacing-px) var(--spacing-xs);\n border-radius: var(--br-lg) 0 0 var(--br-lg);\n line-height: 2; // Alignment\n &:last-child {\n border-radius: var(--br-lg);\n border-right: var(--bw) solid var(--sub-level-1);\n }\n }\n"]);return ii=function(){return e},e}var ci=Object(o.forwardRef)((function(e,t){var n=e.frameList,r=e.pendulumFrame,i=e.onChange,c=e.onCancel,l=vn(),d=Object(o.useRef)("auto"===r?"spell":r),f=Object(o.useRef)(null),b=Object(o.useState)(0),p=Object(u.a)(b,2),m=p[0],h=p[1];return Object(o.useImperativeHandle)(t,(function(){return{focus:function(){var e;return null===(e=f.current)||void 0===e?void 0:e.focus()}}})),Object(a.jsxs)(Yo,Object(s.a)(Object(s.a)({className:"pendulum-frame-picker"},wt({stopPropagation:!0,optionLength:n.length,setFocus:h,onTrigger:function(){m>=0&&i(n[m].value)},onCancel:c})),{},{children:[Object(a.jsx)(Jr.a,{ref:f,className:"frame-auto-checkbox",checked:"auto"===r,onChange:function(e){i(e.target.checked?"auto":d.current)},children:l["input.frame.auto"]}),Object(a.jsx)(no,{className:"frame-radio",value:r,onChange:i,optionList:n})]}))})),li=Gt.b.div(ii()),si=Gt.b.div(oi()),ui=Object(o.forwardRef)((function(e,t){var n=e.showCreativeOption,r=e.showExtraDecorativeOption,i=e.onTakePicker,c=vn(),l=On(Object(kr.useShallow)((function(e){var t=e.card;return{frame:t.frame,isPendulum:t.isPendulum,pendulumFrame:t.pendulumFrame,pendulumScaleBlue:t.pendulumScaleBlue,pendulumScaleRed:t.pendulumScaleRed,setCard:e.setCard,getUpdater:e.getUpdater}}))),d=l.frame,f=l.isPendulum,b=l.pendulumFrame,p=l.pendulumScaleBlue,m=l.pendulumScaleRed,h=l.setCard,g=l.getUpdater,v=Object(o.useRef)(null),x=Object(o.useRef)(null),j=Object(o.useRef)(null),y=Object(o.useState)(!0),O=Object(u.a)(y,2),w=O[0],k=O[1],F=Object(o.useState)(!1),C=Object(u.a)(F,2),S=C[0],T=C[1],R=Object(o.useRef)("auto"===b?"spell":b),N=Object(o.useMemo)((function(){return g("pendulumScaleRed")}),[g]),L=Object(o.useMemo)((function(){return g("pendulumScaleBlue")}),[g]),M=Object(o.useMemo)((function(){return g("pendulumEffect",void 0,"debounce")}),[g]),E=Object(o.useMemo)((function(){return xa().filter((function(e){return r||"normal"===e.edition}))}),[r]);Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.pendulumEffect;n&&(null===(t=j.current)||void 0===t||t.setValue(n))}}}));var I=be[b];return Object(a.jsxs)(si,{className:"pendulum-input",children:[Object(a.jsxs)("div",{className:"joined-row pendulum-option",children:["link"!==d?Object(a.jsx)(Jr.a,{className:"pendulum-checkbox",onChange:function(e){return h((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isPendulum:n})}))},checked:f,children:c["input.pendulum.label"]}):Object(a.jsx)("div",{className:"pendulum-checkbox-placeholder"}),n&&Object(a.jsx)(Tr.a,{visible:S,onVisibleChange:T,trigger:["hover","click"],placement:"bottom",overlayClassName:"pendulum-frame-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(ci,{ref:x,frameList:E,pendulumFrame:b,onCancel:function(){var e;T(!1),null===(e=v.current)||void 0===e||e.focus()},onChange:function(e){var t="".concat(e);"auto"!==t&&(R.current=t),h((function(e){return Object(s.a)(Object(s.a)({},e),{},{pendulumFrame:t})}))}})}),children:Object(a.jsxs)(li,{ref:v,className:"pendulum-frame-input",tabIndex:0,onKeyDown:function(e){if("ArrowDown"===e.key||"Enter"===e.key||" "===e.key)return T(!0),setTimeout((function(){var e;null===(e=x.current)||void 0===e||e.focus()}),200),!1},children:[Object(a.jsxs)("span",{className:"pendulum-frame-label",children:[c["input.bottom-frame.label"]," ",Object(a.jsx)(Ra.a,{})]}),I?Object(a.jsx)(qr,Object(s.a)({className:"pendulum-frame-info-block"},I)):Object(a.jsx)(qr,{className:"pendulum-frame-info-block",nameKey:"input.frame.auto"})]})}),f&&n&&Object(a.jsx)(Jr.a,{onChange:function(e){return k(e.target.checked)},checked:w,children:c["input.mirror-scale.label"]})]}),f&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{children:Object(a.jsx)(Vt.a,{addonBefore:Object(a.jsx)("span",{children:c["input.scale.label"](Object(a.jsx)("span",{className:"blue-scale",children:c["input.scale.blue.label"]}))}),value:p,onChange:function(e){L(e),w&&N(e)}})}),Object(a.jsx)("div",{children:Object(a.jsx)(Vt.a,{addonBefore:Object(a.jsx)("span",{children:c["input.scale.label"](Object(a.jsx)("span",{className:"red-scale",children:c["input.scale.red.label"]}))}),value:m,onChange:function(e){w&&L(e),N(e)}})}),Object(a.jsx)("div",{className:"joined-row",children:Object(a.jsx)(Eo,{ref:j,id:"pendulum-effect",allowHotkey:!0,defaultValue:On.getState().card.pendulumEffect,onChange:M,onTakePicker:i,rows:5})})]})]})}));function di(){var e=Object(Kt.a)(['\n display: grid;\n grid-template-columns: 1fr max-content;\n grid-template-areas:\n "type-input input-helper"\n "condense-input help-button";\n gap: var(--spacing-sm);\n align-items: center;\n .formatting-help-button {\n grid-area: help-button;\n &:focus {\n box-shadow: 0 0 0 2px var(--focus);\n }\n }\n .input-kanji-helper {\n grid-area: input-helper;\n }\n .type-ability-input {\n grid-area: type-input;\n }\n .condense-input {\n grid-area: condense-input;\n\t\t.standalone-addon.ant-input-group-addon {\n\t\t\twidth: unset;\n\t\t}\n\t\t.ant-radio-button-wrapper {\n\t\t\tflex: 1 1 90px;\n\t\t}\n\t}\n &.variant-tcg {\n .type-ability-input {\n grid-column: span 2;\n }\n }\n']);return di=function(){return e},e}var fi=Gt.b.div(di()),bi=Object(o.forwardRef)((function(e,t){var n=e.onTakePicker,r=vn(),i=On(Object(kr.useShallow)((function(e){var t=e.card,n=t.frame,r=t.cardIcon,a=t.format,o=t.furiganaHelper,i=t.effectStyle,c=e.setCard,l=e.getUpdater;return{frame:n,cardIcon:r,format:a,furiganaHelper:o,condenseTolerant:null===i||void 0===i?void 0:i.condenseTolerant,setCard:c,getUpdater:l}}))),c=i.frame,l=i.cardIcon,u=i.format,d=i.furiganaHelper,f=i.condenseTolerant,b=i.setCard,p=i.getUpdater,m="ocg"===u?"\uff0f":"/",h=Object(o.useRef)(null),g=Object(o.useMemo)((function(){return p("typeAbility",(function(e){return"string"!==typeof e?[]:e.split(/\uff0f|\//).map((function(e){return"".concat(e).trim()})).filter((function(e){return"string"===typeof e&&e.length>0}))}),"debounce")}),[p]),v=Object(o.useCallback)((function(e){return b((function(t){return Object(s.a)(Object(s.a)({},t),{},{furiganaHelper:e.target.checked})}))}),[b]);Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.typeAbility;n&&(null===(t=h.current)||void 0===t||t.setValue(n.join(m)))}}}));var x="auto"===l?ft({frame:c})?"input.type.monster.label":"input.type.st.label":"st"===ya[l].value?"input.type.st.label":"input.type.monster.label",j="ocg"===u;return Object(a.jsxs)(fi,{className:"post-pendulum-input variant-".concat(u),children:[Object(a.jsx)(Io,{ref:h,addonBefore:r[x],id:"type-ability",defaultValue:On.getState().card.typeAbility.join(m),onChange:g,onTakePicker:n}),j&&Object(a.jsx)(Xt.a,{overlay:r["input.furigana-helper.tooltip"],overlayClassName:"long-tooltip-overlay",children:Object(a.jsx)(Jr.a,{className:"input-kanji-helper",onChange:v,checked:d,children:r["input.furigana-helper.label"]})}),Object(a.jsx)(no,{className:"condense-input",value:"".concat(f),onChange:function(e){return function(e){b((function(t){return Object(s.a)(Object(s.a)({},t),{},{effectStyle:Object(s.a)(Object(s.a)({},t.effectStyle),{},{condenseTolerant:e})})}))}(e)},optionList:ka,children:Object(a.jsxs)("span",{children:[r["input.condense.label"]," ",Object(a.jsx)(Rr,{content:r["input.condense.tooltip"]})]})}),Object(a.jsx)(Gr,{})]})}));function pi(){var e=Object(Kt.a)(["\n position: relative;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--spacing-px);\n &.custom-style-picker {\n background-color: var(--sub-level-4); // Mimic border color\n }\n .style-section {\n z-index: 1;\n position: relative;\n background-color: var(--main-level-3);\n }\n .style-picker-section {\n overflow: hidden;\n .shadow-checkbox .ant-checkbox {\n transform: translateY(1px);\n }\n > .ant-checkbox-wrapper {\n padding: var(--spacing-xs);\n }\n }\n .custom-style-expand {\n display: grid;\n grid-template-columns: 1fr max-content;\n column-gap: var(--spacing-xs);\n .ant-checkbox-wrapper > span {\n padding-right: 0;\n }\n }\n .radio-train {\n padding: var(--spacing-xs);\n padding-bottom: 0;\n .standalone-addon {\n flex: 1 1 auto;\n text-align: left;\n }\n .radio-train-input-group {\n flex: 0 0 auto;\n }\n .ant-radio-button-wrapper {\n height: 26px;\n line-height: 24px;\n }\n }\n"]);return pi=function(){return e},e}function mi(){var e=Object(Kt.a)(["\n display: inline-grid;\n grid-template-columns: 1fr 1fr 1fr 1fr;\n column-gap: var(--spacing-xxs);\n padding: var(--spacing-px);\n margin-right: var(--spacing-sm);\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br);\n background-color: var(--main-level-4);\n cursor: pointer;\n &:hover {\n border-color: var(--main-active);\n }\n .text-style-preview-section {\n width: 8px;\n height: 28px; // Alignment\n }\n"]);return mi=function(){return e},e}function hi(){var e=Object(Kt.a)(["\n color: var(--color);\n text-shadow: var(--ts);\n font-weight: 500;\n padding: 5px;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 3px;\n .color-list {\n display: flex;\n flex-wrap: nowrap;\n gap: 3px;\n }\n .color-block {\n height: 17px;\n width: 17px;\n cursor: pointer;\n position: relative;\n outline: none;\n border: var(--bw) solid var(--sub-level-4);\n &.static-block {\n cursor: default;\n height: 9px;\n width: 9px;\n margin: 4px 0;\n border: none;\n }\n }\n .active-dot {\n position: absolute;\n inset: var(--spacing-xs);\n background: rgb(0, 0, 0);\n border-radius: 50%;\n opacity: 1;\n }\n .color-input {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 3px;\n border-left: var(--bw-lg) solid var(--sub-level-4);\n padding-left: 3px;\n input {\n width: 58px;\n font-size: var(--fs-sm);\n line-height: 1;\n border: none;\n padding: 0 5px;\n }\n }\n"]);return hi=function(){return e},e}var gi=Gt.b.div(hi()),vi=[{hex:"#FFFFFF",rgb:[255,255,255]},{hex:"#000000",rgb:[0,0,0]},{hex:"#FF0000",rgb:[255,0,0]},{hex:"#FFFF00",rgb:[255,255,0]},{hex:"#00FF00",rgb:[0,255,0]},{hex:"#00FFFF",rgb:[0,255,255]},{hex:"#0000FF",rgb:[0,0,255]},{hex:"#FF00FF",rgb:[255,0,255]}],xi=function(e){var t=e.value,n=void 0===t?"":t,r=e.onChange,i=Object(o.useState)(n),c=Object(u.a)(i,2),l=c[0],s=c[1],d=Object(o.useState)((function(){return{hex:Pt.test(n)?n:"#000000",rgb:Dt(n,!1)}})),f=Object(u.a)(d,2),b=f[0],p=f[1];return Object(o.useEffect)((function(){var e=l.startsWith("#")?l:"#".concat(l);Pt.test(e)&&(s(e),p({hex:e,rgb:Dt(e,!1)}),null===r||void 0===r||r(e))}),[l]),Object(o.useEffect)((function(){s(n),p({hex:Pt.test(n)?n:"#000000",rgb:Dt(n,!1)})}),[n]),Object(a.jsxs)(gi,{children:[Object(a.jsx)("div",{className:"color-list",children:vi.map((function(e){var t=e.hex,n=e.rgb,o=(299*n[0]+587*n[1]+114*n[2])/1e3>=128?"#000000":"#FFFFFF";return Object(a.jsx)("div",{className:"color-block",title:t,style:{backgroundColor:t},onClick:function(){return null===r||void 0===r?void 0:r(t)},children:b.hex.toUpperCase()===t&&Object(a.jsx)("div",{className:"active-dot",style:{backgroundColor:o}})})}))}),Object(a.jsxs)("div",{className:"color-input",children:[Object(a.jsx)("div",{className:"color-block static-block",style:{backgroundColor:b.hex}}),Object(a.jsx)(Vt.a,{size:"small",value:l,onChange:function(e){s(e.target.value)}})]})]})},ji=Gt.b.div(mi()),yi=Gt.b.div(pi()),Oi={effectTextStyle:{keyName:"effectTextStyle",labelKey:"input.text-style.section.effect.label"},pendulumTextStyle:{keyName:"pendulumTextStyle",labelKey:"input.text-style.section.pendulum.label"},statTextStyle:{keyName:"statTextStyle",labelKey:"input.text-style.section.stat.label"},typeTextStyle:{keyName:"typeTextStyle",labelKey:"input.text-style.section.type.label"}},wi=function(){var e=vn(),t=On(Object(kr.useShallow)((function(e){var t=e.card,n=t.statTextStyle,r=t.typeTextStyle,a=t.effectTextStyle,o=t.pendulumTextStyle,i=e.setCard;e.getUpdater;return{statTextStyle:n,typeTextStyle:r,effectTextStyle:a,pendulumTextStyle:o,setCard:i}}))),n=t.statTextStyle,r=t.typeTextStyle,o=t.effectTextStyle,i=t.pendulumTextStyle,c=t.setCard,l=[{info:Oi.effectTextStyle,value:o},{info:Oi.pendulumTextStyle,value:i},{info:Oi.statTextStyle,value:n},{info:Oi.typeTextStyle,value:r}];return Object(a.jsx)(Tr.a,{trigger:["click"],placement:"bottomLeft",overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(yi,{className:"custom-style-picker",children:l.map((function(t){var n=t.info,r=t.value,o=n.keyName,i=n.labelKey,l=Object(u.a)(r,4),d=l[0],f=l[1],b=l[2],p=l[3];return Object(a.jsxs)("div",{className:"style-section",children:[Object(a.jsxs)("h3",{className:"custom-style-expand ".concat(d?"":"inactive"),children:[Object(a.jsx)("span",{children:e[i]}),Object(a.jsx)(Jr.a,{checked:d,onChange:function(e){c((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[n].concat(Object(wn.a)(r.slice(1)))))}))},children:e["input.text-style.custom.label"]})]}),d&&Object(a.jsxs)("div",{className:"style-picker-section",children:[Object(a.jsx)("h2",{children:Object(a.jsx)(Jr.a,{className:"shadow-checkbox",checked:b,onChange:function(e){c((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[].concat(Object(wn.a)(r.slice(0,2)),[n,r[3]])))}))},children:e["input.text-style.shadow.label"]})}),b&&Object(a.jsx)(xi,{value:p,onChange:function(e){return c((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[].concat(Object(wn.a)(r.slice(0,3)),[e])))}))}}),Object(a.jsx)("h2",{children:e["input.text-style.color.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:null!==f&&void 0!==f?f:"",onChangeComplete:function(e){c((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[r[0],e.hex].concat(Object(wn.a)(r.slice(2,4)))))}))}})]})]},o)}))})}),children:Object(a.jsx)(ji,{className:"text-style-preview",children:l.map((function(e){var t=e.info,n=e.value,r=t.keyName,o=Object(u.a)(n,4),i=o[0],c=o[1],l=o[2],s=o[3];return Object(a.jsx)("div",{className:"text-style-preview-section",style:{backgroundColor:0!==(null!==c&&void 0!==c?c:"").length&&i?c:"#000000",boxShadow:i&&l?"0 0 0 2px ".concat(s," inset"):""}},r)}))})})},ki=(n(391),i.a.forwardRef((function(e,t){var n=e.artworkCanvas,r=e.backgroundCanvas,i=e.onCropChange,c=e.onTainted,l=e.onSourceLoaded,d=vn(),f=On(Object(kr.useShallow)((function(e){var t=e.card;return{format:t.format,frame:t.frame,foil:t.foil,finish:t.finish,opacity:t.opacity,nameStyleType:t.nameStyleType,nameStyle:t.nameStyle,isPendulum:t.isPendulum,attribute:t.attribute,getUpdater:e.getUpdater,setCard:e.setCard}}))),b=f.format,p=f.frame,m=f.foil,h=f.finish,g=f.opacity,v=f.nameStyleType,x=f.nameStyle,w=f.isPendulum,k=f.attribute,F=f.getUpdater,C=f.setCard,S=kn().setting,T=S.showCreativeOption,R=S.showExtraDecorativeOption,N=Object(o.useRef)(null),L=ut({frame:p}),M=ft({frame:p}),E=Object(o.useState)(0),I=Object(u.a)(E,2),A=I[0],B=I[1],W=Object(o.useMemo)((function(){return function(e){return[{name:"normal",label:e.normal,color:"#747b95"},{name:"gold",label:e.gold,color:"#cfa65f"},{name:"platinum",label:e.platinum,color:"#b1b1b1"}]}({normal:d["input.foil.normal.label"],gold:d["input.foil.gold.label"],platinum:d["input.foil.platinum.label"]}).map((function(e){var t=e.color,n=e.name;return{label:e.label,value:n,props:{style:{color:t,fontWeight:"bold"}}}}))}),[d]),P=Object(o.useRef)(null),D=Object(o.useRef)(null),z=Object(o.useRef)(null),H=Object(o.useRef)(null),K=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(null),X=Object(o.useState)({id:"",setValue:function(){}}),V=Object(u.a)(X,2),U=V[0],q=V[1],J=Object(o.useMemo)((function(){return F("foil")}),[F]),$=Object(o.useMemo)((function(){return F("finish")}),[F]),_=Object(o.useCallback)((function(e){return C((function(t){return Object(s.a)(Object(s.a)({},t),{},{opacity:e})}))}),[C]),Z=Object(o.useMemo)((function(){return F("attribute")}),[F]),Q=Object(o.useCallback)((function(e,t){C((function(n){return Object(s.a)(Object(s.a)({},n),{},{nameStyleType:e,nameStyle:t})}))}),[C]),ee=Object(o.useMemo)((function(){return function(e,t){return O.map((function(n){var r=n.name,o=n.nameKey;return{label:r===y?Object(a.jsx)(j.a,{}):Object(a.jsx)(Xt.a,{overlay:t[o],children:Object(a.jsx)("img",{alt:t[o],src:"".concat("/ygocarder","/asset/image/attribute/attr-").concat(e,"-").concat(r.toLowerCase(),".png")})}),value:r}}))}(b,d)}),[b,d]);return Object(o.useEffect)((function(){var e;null===(e=N.current)||void 0===e||e.setValue({font:x.font})}),[x]),Object(o.useEffect)((function(){var e;null===(e=D.current)||void 0===e||e.setValue(g)}),[g]),Object(o.useImperativeHandle)(t,(function(){return{forceCardData:function(e){var t,n,r,a,o,i,c;B((function(e){return e+1}));var l=e.name,u=e.art,d=e.artCrop,f=e.background,b=e.backgroundCrop,p=e.opacity,m=e.setId,h=e.pendulumEffect,g=e.typeAbility,v=e.effect,x=e.atk,j=e.def,y=e.creator,O=e.password;null===(t=P.current)||void 0===t||t.setValue({art:u,artCrop:d}),null===(n=D.current)||void 0===n||n.setValue(Object(s.a)(Object(s.a)({},p),{},{background:f,backgroundCrop:b})),null===(r=z.current)||void 0===r||r.setValue({name:l,setId:m}),null===(a=H.current)||void 0===a||a.setValue({pendulumEffect:h}),null===(o=K.current)||void 0===o||o.setValue(v),null===(i=G.current)||void 0===i||i.setValue({typeAbility:g}),null===(c=Y.current)||void 0===c||c.setValue({atk:x,def:j,creator:y,password:O})}}})),Object(a.jsxs)("div",{className:["card-info-panel","ocg"===b?"input-ocg":"input-tcg"].join(" "),children:[Object(a.jsx)(la,{}),Object(a.jsx)("br",{}),Object(a.jsx)(ia,{}),Object(a.jsxs)("div",{className:"card-overlay-input",children:[Object(a.jsx)(Uo,{className:"format-radio",value:b,onChange:function(e){C((function(t){var n,r,a,o,i,c="".concat(e),l=on(t,c),s=l.name,u=l.setId,d=l.effect,f=l.typeAbility,b=l.password,p=l.creator,m=l.pendulumEffect;return null===(n=z.current)||void 0===n||n.setValue({name:s,setId:u}),null===(r=K.current)||void 0===r||r.setValue(d),null===(a=H.current)||void 0===a||a.setValue({pendulumEffect:m}),null===(o=G.current)||void 0===o||o.setValue({typeAbility:f}),null===(i=Y.current)||void 0===i||i.setValue({creator:p,password:b}),l}))},optionList:ha,children:Object(a.jsx)("span",{children:d["input.format.label"]})}),Object(a.jsx)(no,{className:"foil-radio",value:m,onChange:J,optionList:W,children:Object(a.jsx)("span",{children:d["input.foil.label"]})}),R&&Object(a.jsx)(lo,{className:"finish-checkbox",value:h,onChange:$,optionList:ga,children:Object(a.jsx)("span",{children:d["input.finish.label"]})})]}),T&&Object(a.jsxs)("div",{className:"card-layout-input",children:[Object(a.jsxs)("label",{className:"standalone-addon ant-input-group-addon",children:[d["input.layout.label"]," ",Object(a.jsx)(Rr,{content:d["input.layout.tooltip"]})]}),Object(a.jsx)(jo,{ref:D,defaultValue:g,receivingCanvas:r,onChange:_,onTainted:c,onCropChange:i,onSourceLoaded:l})]}),Object(a.jsx)(oo,{onSTFrameChange:function(e){var t;return null===(t=G.current)||void 0===t?void 0:t.setValue({typeAbility:e})}}),Object(a.jsxs)(Vo,{className:"name-style-id-input",children:[Object(a.jsx)(ai,{ref:z,onTakePicker:q}),Object(a.jsx)(Ja,{ref:N,frameInfo:be[p],defaultType:v,defaultValue:x,showExtraDecorativeOption:R,onChange:Q},A),Object(a.jsx)(To,{isLink:L,isMonster:M,showCreativeOption:T})]}),Object(a.jsxs)("div",{className:"main-info",children:[Object(a.jsxs)("div",{className:"main-info-first",children:[Object(a.jsx)(no,{className:"fill-input-train attribute-input",value:k,onChange:Z,optionList:ee,children:Object(a.jsx)("span",{children:d["input.attribute.label"]})}),(w||"link"!==p||T)&&Object(a.jsx)(ui,{ref:H,showCreativeOption:T,showExtraDecorativeOption:R,onTakePicker:q}),Object(a.jsx)(bi,{ref:G,onTakePicker:q}),Object(a.jsxs)("div",{children:[Object(a.jsxs)("div",{className:"card-effect-letter-helper",children:[Object(a.jsx)(ba,{className:"standalone-label",children:d["input.effect.label"]}),T?Object(a.jsx)(wi,{}):Object(a.jsx)("div",{}),Object(a.jsx)(Sa,{targetId:U.id,onPick:U.setValue})]}),Object(a.jsx)(Ao,{ref:K,onTakePicker:q})]}),Object(a.jsx)($o,{ref:Y,isMonster:M,showCreativeOption:T,onTakePicker:q})]}),Object(a.jsx)("div",{className:"main-info-second",children:Object(a.jsx)(Qo,{ref:P,receivingCanvas:n,isLink:L,showExtraDecorativeOption:R,onSourceLoaded:l,onTainted:c,onCropChange:i})})]})]})}))),Fi=n(413),Ci=n(421),Si=n(435);function Ti(){var e=Object(Kt.a)(["\n padding: 0;\n .button-label {\n padding: 4px 15px;\n height: 100%; // Alignment\n align-content: center;\n border-radius: var(--br-lg);\n line-height: 1.5;\n }\n .button-option {\n position: absolute;\n right: 0;\n top: 0;\n height: 100%;\n display: flex;\n align-items: center;\n padding: var(--spacing);\n border-left: var(--bw) solid var(--sub-secondary);\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\n .anticon {\n font-size: var(--fs-2xl);\n margin-left: 0;\n }\n &:hover {\n background: #399af9;\n }\n }\n"]);return Ti=function(){return e},e}function Ri(){var e=Object(Kt.a)(["\n &.active-resolution {\n background-color: var(--sub-active);\n }\n"]);return Ri=function(){return e},e}function Ni(){var e=Object(Kt.a)(["\n color: var(--color);\n padding: 1px 12px 5px 12px; // Alignment\n font-size: var(--fs-sm);\n border-bottom: var(--bw) solid var(--sub-level-4);\n cursor: default;\n &.ant-dropdown-menu-item.ant-dropdown-menu-item-disabled:hover {\n cursor: default;\n background: var(--main-level-3);\n }\n"]);return Ni=function(){return e},e}var Li=Object(Gt.b)(Fi.a.Item)(Ni()),Mi=Object(Gt.b)(Fi.a.Item)(Ri()),Ei=Object(Gt.b)(Lr.a)(Ti()),Ii=Object(o.forwardRef)((function(e,t){var n=e.isTainted,r=e.isInitializing,i=e.imageChangeCount,c=e.canvasMap,l=e.onDownloadError,s=vn(),d=kn(Object(kr.useShallow)((function(e){var t=e.setting;return{allowHotkey:t.allowHotkey,resolution:t.resolution,updateSetting:e.updateSetting}}))),f=d.allowHotkey,b=d.resolution,p=d.updateSetting,m=yr(!0,c,{imageChangeCount:i,isInitializing:r}).onExport,h=c.drawCanvasRef,g=Object(o.useRef)({currentPipeline:Promise.resolve(),pipelineRunning:!1}),v=Object(o.useState)(!1),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useCallback)((function(){y(!1)}),[]),w=function(e){var t=e.isTainted,n=e.isInitializing,r=e.drawCanvasRef,a=e.exportRef,i=e.onExport,c=e.onDownloadError,l=e.onDownloadComplete,s=On().card,u=kn((function(e){return e.setting.resolution})),d=s.opacity,f=s.name,b=s.isPendulum,p=Object(o.useRef)(!1),m=Object(o.useCallback)((function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,a=r.current,o=null===a||void 0===a?void 0:a.cloneNode(),i=null===a||void 0===a?void 0:a.getContext("2d"),s=null===o||void 0===o?void 0:o.getContext("2d");if(a&&i&&o&&s&&!t)try{n&&(o.width=n[0],o.height=n[1]),s.drawImage(a,0,0,a.width,a.height,0,0,o.width,o.height);var d=Bt(f),b=document.createElement("a");b.download=d?"".concat(d,".png"):"card.png",b.href=o.toDataURL("image/png"),b.click()}catch(p){c()}null===(e=document.querySelector("#export-canvas-guard"))||void 0===e||e.classList.remove("guard-on"),l()}),[r,t,f,u,l,c]);return Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){var t=Bt(f);e&&(document.title=t?"".concat(t," - Yu-Gi-Oh Carder"):"Yu-Gi-Oh Carder")}),500),function(){e=!1}}),[f]),Object(o.useEffect)((function(){var e,t=!0,o=function(e){return e.preventDefault(),"Leave right now may make you lose unsaved progress, proceed?"};return!1===n&&(localStorage.setItem("card-data",JSON.stringify(s)),localStorage.setItem("card-version",null!==(e="2.0.15")?e:"unknown"),Object(mn.a)(pn.a.mark((function e(){var n,c,l,u,f,h,g;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.current){e.next=14;break}return window.addEventListener("beforeunload",o),null===(n=document.getElementById("export-canvas"))||void 0===n||n.classList.remove("js-export-available"),null===(c=document.getElementById("export-canvas-guard"))||void 0===c||c.setAttribute("style",""),null===(l=document.getElementById("save-button-waiting"))||void 0===l||l.setAttribute("style","display: block"),a.current.pipelineRunning=!0,e.next=9,a.current.currentPipeline;case 9:if(!t){e.next=14;break}return a.current.currentPipeline=i({isPendulum:b,opacity:d,isRelevant:function(){return t}}),e.next=13,a.current.currentPipeline;case 13:t&&("string"===typeof(g=Rt(s))&&At("data",g),null===(u=document.getElementById("export-canvas"))||void 0===u||u.classList.add("js-export-available"),null===(f=document.getElementById("export-canvas-guard"))||void 0===f||f.setAttribute("style","display: none"),null===(h=document.getElementById("save-button-waiting"))||void 0===h||h.setAttribute("style","display: none"),window.removeEventListener("beforeunload",o),a.current.pipelineRunning=!1,p.current&&(p.current=!1,m()));case 14:case"end":return e.stop()}}),e)})))()),function(){window.removeEventListener("beforeunload",o),t=!1}})),{onSave:function(e){var t;null===(t=document.querySelector("#export-canvas-guard"))||void 0===t||t.classList.add("guard-on");var n=e?Object(wn.a)(e):void 0;setTimeout((function(){!1===a.current.pipelineRunning?m(n):p.current=!0}),200)}}}({isTainted:n,isInitializing:r,drawCanvasRef:h,exportRef:g,onExport:m,onDownloadError:l,onDownloadComplete:O}).onSave,k=function(e){j||(n?fn.a.error({message:"Your card is tainted, you must save manually",description:'Right click the card \u2192 Choose "Save image as..."'}):(y(!0),w(e)))};return Object(o.useImperativeHandle)(t,(function(){return{download:k}})),n?null:Object(a.jsxs)("div",{className:"save-button-container",children:[Object(a.jsx)("div",{id:"save-button-waiting"}),Object(a.jsxs)(Ei,{className:"save-button",id:"save-button-ready",onClick:function(){return k()},children:[Object(a.jsx)(Xt.a,{overlay:f?Object(a.jsx)(a.Fragment,{children:"Ctrl-S / \u2318-S"}):null,children:Object(a.jsx)("div",{className:"button-label",children:j?s["button.download.ongoing.label"]:s["button.download.label"]})}),Object(a.jsx)(Ci.a,{disabled:j,className:"save-button-dropdown",placement:"bottomRight",overlay:Object(a.jsxs)(Fi.a,{onClick:function(e){return e.domEvent.stopPropagation()},children:[Object(a.jsx)(Li,{disabled:!0,children:s["button.download.resolution.label"]}),[{width:549,height:800},{width:813,height:1185}].map((function(e){var t=e.width,n=e.height;return Object(a.jsxs)(Mi,{className:b[0]===t&&b[1]===n?"active-resolution":"",onClick:function(){p({resolution:[t,n]}),Wt()},children:[t," \xd7 ",n]},"".concat(t,"-").concat(n))}))]}),children:Object(a.jsx)("div",{className:"button-option",onClick:function(e){return e.stopPropagation()},children:Object(a.jsx)(Si.a,{})})})]})]})})),Ai=n(414),Bi=n(436),Wi=n(437);function Pi(){var e=Object(Kt.a)(["\n top: var(--spacing-xs);\n right: calc(var(--overlay-size) + 2 * var(--spacing-xs));\n"]);return Pi=function(){return e},e}function Di(){var e=Object(Kt.a)(["\n top: var(--spacing-xs);\n right: var(--spacing-xs);\n"]);return Di=function(){return e},e}function zi(){var e=Object(Kt.a)(["\n --overlay-size: 51px;\n position: absolute;\n z-index: 101;\n background: var(--main-primary);\n border-color: var(--main-active);\n color: var(--color-heavy);\n padding: var(--spacing);\n line-height: 1;\n font-size: var(--fs-3xl);\n text-align: center;\n width: var(--overlay-size);\n height: var(--overlay-size);\n border-radius: var(--br-lg);\n cursor: pointer;\n box-shadow: var(--bs-1);\n display: none;\n &:hover {\n background: var(--sub-primary);\n }\n"]);return zi=function(){return e},e}function Hi(){var e=Object(Kt.a)(["\n color: var(--main-danger);\n"]);return Hi=function(){return e},e}function Ki(){var e=Object(Kt.a)(["\n\tposition: fixed;\n\tright: var(--spacing);\n\tbottom: 0;\n\tfont-size: var(--fs-xs);\n\topacity: 0.5;\n\tpadding: var(--spacing-px) var(--spacing-xs);\n\tcolor: var(--color-dim);\n img {\n height: 10px;\n margin-left: 1px;\n }\n"]);return Ki=function(){return e},e}function Gi(){var e=Object(Kt.a)(["\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-image: linear-gradient(45deg, #333, #333);\n\tz-index: 4000;\n\tcolor: white;\n\ttext-shadow:\n\t\t0 1px #333,\n\t\t0 2px #111;\n\tfont-size: var(--fs-3xl);\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n"]);return Gi=function(){return e},e}function Yi(){var e=Object(Kt.a)(["\n width: var(--card-width);\n height: var(--card-height);\n margin-bottom: var(--spacing);\n transform: translateX(var(--translate-ratio)) translateY(var(--translate-ratio)) scale(var(--resize-ratio))\n translateZ(0);\n position: absolute;\n top: 0;\n left: 0;\n canvas {\n position: absolute;\n left: 0;\n z-index: 1;\n pointer-events: none;\n }\n &:hover {\n .reset-button,\n .lightbox-button {\n display: block;\n }\n #export-canvas.js-export-available {\n display: inline-block !important; // Override js-controlled inline style\n cursor: default;\n }\n #export-canvas-guard {\n display: flex;\n cursor: wait;\n transition: all 2s;\n }\n }\n #export-canvas {\n display: none;\n z-index: 100;\n pointer-events: all;\n }\n #export-canvas-guard {\n position: absolute;\n left: 0;\n display: none;\n align-items: center;\n justify-content: center;\n z-index: 101;\n // background-color: #ffffff08;\n width: var(--card-width);\n height: var(--card-height);\n .anticon {\n font-size: var(--fs-4xl);\n }\n .canvas-guard-alert {\n position: absolute;\n top: 0;\n right: 0;\n color: white;\n padding: var(--spacing-xs) var(--spacing);\n border-radius: 0 0 0 var(--br-lg);\n background-color: var(--main-active);\n box-shadow:\n 0 3px 6px rgba(0, 0, 0, 0.16),\n 0 3px 6px rgba(0, 0, 0, 0.23);\n }\n &.guard-on {\n display: flex !important; // Override js-controlled inline style\n }\n }\n .crop-canvas {\n position: relative;\n width: 416px;\n height: 416px;\n z-index: 0;\n visibility: hidden;\n }\n"]);return Yi=function(){return e},e}function Xi(){var e=Object(Kt.a)(["\n display: flex;\n column-gap: var(--spacing);\n border-radius: var(--br-lg);\n font-size: var(--fs-4xl);\n line-height: 1.5;\n margin: auto;\n max-width: var(--card-width);\n min-height: 59px;\n outline: none !important; // Avoid default state styling\n padding: var(--spacing);\n padding-right: 0;\n text-align: center;\n text-shadow: 0 1px 2px black;\n .anticon {\n cursor: pointer;\n }\n button {\n color: white;\n border-radius: var(--br-lg);\n outline: none !important; // Avoid default state styling\n cursor: pointer;\n }\n .save-button {\n flex: 1;\n font-size: var(--fs-xl);\n border: var(--bw) solid var(--sub-secondary);\n font-weight: 500;\n box-shadow: var(--bs-button);\n height: 39px; // Alignment\n line-height: 1;\n &:focus, &:active {\n color: white;\n }\n }\n #save-button-waiting {\n cursor: wait;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 1;\n }\n #save-button-ready {\n cursor: pointer;\n &:hover {\n background-color: var(--sub-info);\n box-shadow: none;\n }\n }\n .save-button-container {\n display: flex;\n flex: 1;\n font-size: var(--fs);\n line-height: 1.35;\n position: relative;\n }\n .imexport {\n flex: 0 0 210px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n column-gap: var(--spacing);\n button {\n font-size: var(--fs);\n background-color: var(--main-tertiary);\n border: var(--bw) solid var(--sub-tertiary);\n box-shadow: var(--bs-button);\n &:hover {\n background-color: var(--sub-tertiary);\n box-shadow: none;\n }\n }\n }\n"]);return Xi=function(){return e},e}var Vi=Gt.b.div(Xi()),Ui=Gt.b.div(Yi()),qi=Gt.b.div(Gi()),Ji=Gt.b.div(Ki()),$i=Gt.b.span(Hi()),_i=Gt.b.div(zi()),Zi=Object(Gt.b)(_i)(Di()),Qi=Object(Gt.b)(_i)(Pi()),ec=n(154);Object(ec.configure)({ignoreTags:[]});var tc={EXPORT:["ctrl+d","command+d"],IMPORT:["ctrl+e","command+e"],MERGE:["ctrl+g","command+g"],VIEW:["ctrl+b","command+b"],DOWNLOAD:["ctrl+s","command+s"]},nc=f,rc=d;var ac=function(){var e,t=kn(Object(kr.useShallow)((function(e){var t=e.setting,n=t.allowHotkey;return{softMode:t.reduceMotionColor,allowHotkey:n}}))),n=t.allowHotkey,r=t.softMode,i=gn(Object(kr.useShallow)((function(e){return{isInitiating:e.isInitiating,isLoading:e.isLoading,language:e.language,isMetadataReady:e.isMetadataReady,languageInfo:e.languageInfo,initiate:e.initiate,loadDefaultLanguage:e.loadDefaultLanguage}}))),c=i.isInitiating,l=i.isLoading,b=i.language,p=i.isMetadataReady,m=i.languageInfo,h=i.initiate,g=i.loadDefaultLanguage,v=Object(o.useState)(!0),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useState)(""),w=Object(u.a)(O,2),k=w[0],F=w[1],C=Object(o.useState)("external"),S=Object(u.a)(C,2),T=S[0],R=S[1],N=Object(o.useState)(0),L=Object(u.a)(N,2),M=L[0],E=L[1],I=Object(o.useState)(!1),A=Object(u.a)(I,2),B=A[0],W=A[1],P=Object(o.useRef)(null),D=Object(o.useRef)(null),z=Object(o.useRef)(null),H=Object(o.useRef)(null),K=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(null),X=Object(o.useRef)(null),V=Object(o.useRef)(null),U=Object(o.useRef)(null),q=Object(o.useRef)(null),J=Object(o.useRef)(null),$=Object(o.useRef)(null),_=Object(o.useRef)(null),Z=Object(o.useRef)(null),Q=Object(o.useRef)(null),ee=Object(o.useRef)(null),te=Object(o.useRef)(null),ne=Object(o.useState)({artworkCanvasRef:D,backgroundCanvasRef:z,drawCanvasRef:H,frameCanvasRef:K,cardIconCanvasRef:G,pendulumScaleCanvasRef:Y,pendulumEffectCanvasRef:X,typeCanvasRef:V,effectCanvasRef:U,nameCanvasRef:q,statCanvasRef:J,setIdCanvasRef:$,passwordCanvasRef:_,creatorCanvasRef:Z,stickerCanvasRef:Q,finishCanvasRef:ee,lightboxCanvasRef:te}),re=Object(u.a)(ne,1)[0],ae=Object(o.useRef)(null),oe=Object(o.useState)(0),ie=Object(u.a)(oe,2),ce=ie[0],le=ie[1];Object(o.useEffect)((function(){h()}),[h]),Object(o.useEffect)((function(){p&&g()}),[p,g]),Object(o.useEffect)((function(){["font-family","letter-spacing","--width-label"].forEach((function(e){var t,n;document.body.style.setProperty(e,null!==(t=null===(n=m.style)||void 0===n?void 0:n[e])&&void 0!==t?t:"")}))}),[m]),Object(o.useEffect)((function(){var e,t=null===(e=H.current)||void 0===e?void 0:e.getContext("2d"),n=On.getState().setCard;t&&(t.setTransform(1,0,0,1,0,0),t.imageSmoothingQuality="high",Nn(t)),!1===c&&wr.a.load({custom:{families:["Matrix-Bold","MatrixBoldSmallCaps","MatrixBook","MatrixRegularSmallCaps","RoGSanSrfStd-Bd","YuGiOhITCStoneSerifBSc","matrix","palatino-linotype-bold","stone-serif-bold","stone-serif-regular"],urls:["asset/font.css"]},active:function(){var e=function(){try{var e=window.localStorage.getItem("card-version"),t=window.localStorage.getItem("card-data"),n=new URLSearchParams(window.location.search).get("data");return n?jn(n):null!==t&&"2.0.15"===e?Et(JSON.parse(t)):ot()}catch(r){return console.error(r),ot()}}();n(e),y(!1)},fontinactive:function(e,t){console.error("TCG fontinactive",e,t),fn.a.error({message:xn()["error.load.font.tcg"](e)})},inactive:function(){F(xn()["error.load.font.all-tcg"]),y(!1)}})}),[c]);var se=function(e){var t=e.isLanguageInitiating,n=e.onActive,r=e.onBeforeLoad,a=e.onFontInactive,i=e.onInactive,c=On(Object(kr.useShallow)((function(e){return{format:e.card.format,font:e.card.nameStyle.font}}))),l=c.font,s=c.format,d=Object(o.useState)(""),f=Object(u.a)(d,2),b=f[0],p=f[1],m=Object(o.useRef)(!1),h=Object(o.useRef)(0);return Object(o.useEffect)((function(){("ocg"===s||"OCG"===l)&&!1===m.current&&h.current<=3&&!1===t&&(h.current+=1,p("".concat("/ygocarder","/asset/ocg-font.css")),r(),wr.a.load({custom:{families:["DFHSGothic-W3-WIN-RKSJ-H","DFKakuTaiHiStd-W4","FOT-Rodin Pro M","Yu-Gi-Oh! DF Leisho 3"],urls:["asset/ocg-font.css"]},active:function(){m.current=!0,n()},inactive:function(){m.current=!0,i()},fontinactive:a}))}),[s,l,t,n,r,a,i]),{styleContent:b}}({isLanguageInitiating:c,onBeforeLoad:function(){var e;y(!0);var t=null===(e=H.current)||void 0===e?void 0:e.getContext("2d");t&&(t.setTransform(1,0,0,1,0,0),t.imageSmoothingQuality="high",Nn(t))},onActive:function(){y(!1)},onInactive:function(){F(xn()["error.load.font.all-ocg"]),y(!1)},onFontInactive:function(e,t){console.error("OCG fontinactive",e,t),fn.a.error({message:xn()["error.load.font.ocg"](e)})}}).styleContent,ue=Object(o.useState)(!1),de=Object(u.a)(ue,2),fe=de[0],be=de[1];Object(o.useEffect)((function(){var e=document.body.classList;r?e.add("reduced-color-motion"):e.remove("reduced-color-motion")}),[r]);var pe=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&!n||W((function(t){return"boolean"===typeof e?e:!t}))}),[n]),me=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||n){null===e||void 0===e||e.preventDefault();var r=window.prompt(b["prompt.import.message"]),a=On.getState().setCard;if(r){var o,i=jn(r);a(i),le((function(e){return e+1})),null===(o=P.current)||void 0===o||o.forceCardData(i),Wt()}}}),[n,b]),he=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||n){null===e||void 0===e||e.preventDefault();var r=window.prompt(b["prompt.import.message"]),a=On.getState().setCard;if(r){var o,i=jn(r,On.getState().card);a(i),le((function(e){return e+1})),null===(o=P.current)||void 0===o||o.forceCardData(i),Wt()}}}),[n,b]),ge=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||n){null===e||void 0===e||e.preventDefault(),"internal"===T&&window.alert(b["prompt.export.offline-warning.message"]);var r=On.getState().card;window.prompt(b["prompt.export.message"],"".concat(Rt(r)))}}),[n,b,T]),ve=Object(o.useCallback)((function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r&&!n||(null===e||void 0===e||e.preventDefault(),null===(t=ae.current)||void 0===t||t.download())}),[n]),xe=Object(o.useMemo)((function(){return{IMPORT:function(e){return me(e,!0)},MERGE:function(e){return he(e,!0)},EXPORT:function(e){return ge(e,!0)},VIEW:function(){return pe(!0,!0)},DOWNLOAD:function(e){return ve(e,!0)}}}),[ve,ge,me,he,pe]),je=Object(o.useCallback)((function(){be(!0),alert(b["prompt.download.tainted.message"])}),[b]),ye=Object(o.useCallback)((function(){E((function(e){return e+1})),le((function(e){return e+1})),be(!1)}),[]),Oe=Object(o.useCallback)((function(e,t){le((function(e){return e+1})),R(t)}),[]),we=Object(o.useCallback)((function(){le((function(e){return e+1})),be(!0)}),[]),ke=l||j;return Object(a.jsx)(ec.HotKeys,{keyMap:tc,handlers:xe,children:Object(a.jsxs)("div",{id:"app",onDrop:function(){},className:"language-".concat(m.codeName),style:Object(s.a)({backgroundImage:'url("'.concat("/ygocarder",'/asset/image/texture/debut-dark.png"), linear-gradient(180deg, #00000022, #00000044)'),height:zt()?"-webkit-fill-available":"100vh"},{"--card-height":"".concat(f,"px"),"--card-width":"".concat(d,"px")}),children:[se&&Object(a.jsx)("link",{rel:"stylesheet",type:"text/css",href:se}),Object(a.jsxs)("div",{className:"app-container",style:{backgroundImage:'url("'.concat("/ygocarder",'/asset/image/texture/dark-denim-3.png")')},children:[ke&&Object(a.jsx)(qi,{className:"app-loading",children:k.length>0?Object(a.jsx)($i,{children:k}):null!==(e=m.initialMessage)&&void 0!==e?e:""}),Object(a.jsxs)("div",{className:"card-preview-panel ".concat(fe?"export-tainted":"export-normal"),children:[Object(a.jsxs)(Vi,{className:"data-button-panel",children:[Object(a.jsxs)("div",{className:"imexport",children:[Object(a.jsx)(Xt.a,{overlay:n?Object(a.jsx)(a.Fragment,{children:"Ctrl-D / \u2318-D"}):null,children:Object(a.jsx)("button",{onClick:ge,children:b["button.export.label"]})}),Object(a.jsx)(Xt.a,{overlay:n?Object(a.jsxs)("div",{className:"center",children:[Object(a.jsx)("div",{children:"Ctrl-E / \u2318-E"}),Object(a.jsxs)("div",{children:["Ctrl-G / \u2318-G",b["prompt.import.merge.tooltip"]]})]}):null,children:Object(a.jsx)("button",{onClick:me,children:b["button.import.label"]})})]}),Object(a.jsx)(Ii,{ref:ae,canvasMap:re,imageChangeCount:ce,isTainted:fe,isInitializing:j,onDownloadError:je}),fe&&Object(a.jsx)("div",{id:"save-button-tainted",className:"save-button-container",children:Object(a.jsxs)("span",{children:[b["alert.download.tainted-first-line"],Object(a.jsx)("br",{}),b["alert.download.tainted-second-line"]," ",Object(a.jsx)(sa,{})]})})]}),Object(a.jsx)("div",{className:"card-canvas-container",children:Object(a.jsxs)(Ui,{className:"card-canvas-group",children:[Object(a.jsx)(Xt.a,{title:b["button.reset.tooltip"],children:Object(a.jsx)(Qi,{className:"reset-button",onClick:function(){if(window.confirm(b["prompt.reset.message"])){var e,t=On.getState(),n=t.setCard,r=t.card,a=ot(),o="tcg"===r.format?a:on(a,"ocg");n(o),le((function(e){return e+1})),null===(e=P.current)||void 0===e||e.forceCardData(o)}},children:Object(a.jsx)(Bi.a,{})})}),Object(a.jsx)(Xt.a,{title:Object(a.jsxs)("div",{className:"center",children:[b["button.full-size.label"],n?Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("br",{}),"Ctrl-B / \u2318-B"]}):null]}),children:Object(a.jsx)(Zi,{className:"lightbox-button",onClick:function(){return pe()},children:Object(a.jsx)(Wi.a,{})})}),Object(a.jsx)("canvas",{id:"export-canvas",ref:H,width:rc,height:nc},M+.1),Object(a.jsx)("div",{id:"export-canvas-guard",onContextMenu:function(e){return e.preventDefault()}}),Object(a.jsx)("canvas",{id:"frameCanvas",ref:K,width:rc,height:nc},M),Object(a.jsx)("canvas",{id:"nameCanvas",ref:q,width:rc,height:148}),Object(a.jsx)("canvas",{id:"cardIconCanvas",ref:G,width:rc,height:222}),Object(a.jsx)("canvas",{id:"pendulumScaleCanvas",ref:Y,width:rc,height:889}),Object(a.jsx)("canvas",{id:"pendulumEffectCanvas",ref:X,width:rc,height:889}),Object(a.jsx)("canvas",{id:"typeCanvas",ref:V,width:rc,height:1037}),Object(a.jsx)("canvas",{id:"effectCanvas",ref:U,width:rc,height:1111}),Object(a.jsx)("canvas",{id:"statCanvas",ref:J,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"setIdCanvas",ref:$,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"passwordCanvas",ref:_,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"creatorCanvas",ref:Z,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"stickerCanvas",ref:Q,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"finishCanvas",ref:ee,width:rc,height:nc}),Object(a.jsx)("canvas",{className:"crop-canvas",ref:D}),Object(a.jsx)("canvas",{className:"crop-canvas",ref:z})]})})]}),!1===ke&&Object(a.jsx)(ki,{ref:P,artworkCanvas:D.current,backgroundCanvas:z.current,onSourceLoaded:ye,onCropChange:Oe,onTainted:we})]}),Object(a.jsx)(Ai.a,{width:"843px",wrapClassName:"card-lightbox-overlay",visible:B,forceRender:!0,onCancel:function(){return W(!1)},footer:null,children:Object(a.jsx)("canvas",{id:"lightbox-canvas",ref:te,width:rc,height:nc},M+.1)}),Object(a.jsxs)(Ji,{className:"by-me",children:["Made by Lauqerm ",Object(a.jsx)("img",{src:"https://i.imgur.com/RY6IRqn.png",alt:"avatar"})]})]})})},oc=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,438)).then((function(t){var n=t.getCLS,r=t.getFID,a=t.getFCP,o=t.getLCP,i=t.getTTFB;n(e),r(e),a(e),o(e),i(e)}))};l.a.render(Object(a.jsx)(i.a.StrictMode,{children:Object(a.jsx)(ac,{})}),document.getElementById("root")),oc()}},[[407,1,2]]]); +//# sourceMappingURL=main.386f4d58.chunk.js.map \ No newline at end of file diff --git a/static/js/main.386f4d58.chunk.js.map b/static/js/main.386f4d58.chunk.js.map new file mode 100644 index 0000000..cf29a9e --- /dev/null +++ b/static/js/main.386f4d58.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["model/canvas.ts","model/icon.tsx","model/name-preset.ts","model/coordinate-data.tsx","model/dictionary.ts","model/foil-finish.tsx","model/font-data-effect.tsx","model/font-data-name.ts","model/font-data-other.ts","model/format.tsx","model/frame.tsx","model/link.tsx","model/regex.tsx","model/index.tsx","util/categorize.tsx","util/condenser.ts","util/font.tsx","util/gradient.ts","util/navigation.ts","3rd/index.ts","util/codec.ts","util/index.tsx","component/loading/index.tsx","component/icon-button/index.tsx","service/format-change.tsx","service/use-i18n/processor.tsx","service/use-i18n/index.ts","service/use-card.ts","service/use-setting.ts","draw/canvas-util.ts","draw/image.ts","draw/letter.ts","draw/text-util.ts","draw/text-analyze.ts","draw/line.ts","draw/text-overhead.ts","draw/text.ts","draw/text-normalize.tsx","draw/predefined-section/effect.ts","draw/predefined-section/with-image.ts","draw/predefined-section/layout.ts","draw/predefined-section/name.ts","draw/predefined-section/type-ability.ts","draw/predefined-section/with-text.ts","service/use-master-seri/index.tsx","service/use-master-seri/prepare-style.ts","draw/predefined-section/password.ts","draw/predefined-section/creator.ts","component/image-cropper/index.tsx","component/link-marker/index.tsx","component/explanation/index.tsx","component/formatting-guide/index.tsx","component/frame-info-block/index.tsx","component/setting/index.tsx","component/app-header/index.tsx","component/index.tsx","page/input-panel/const.tsx","page/input-panel/char-picker/index.tsx","page/input-panel/name-style-picker/gradient-picker.tsx","page/input-panel/name-style-picker/style-picker.styled.tsx","page/input-panel/name-style-picker/grid-slider-input.tsx","page/input-panel/name-style-picker/predefined-option-grid.tsx","page/input-panel/name-style-picker/index.tsx","util/hook.ts","page/input-panel/input-train/input-train.styled.tsx","page/input-panel/input-train/radio-train.tsx","page/input-panel/input-train/frame-train.tsx","page/input-panel/input-train/checkbox-train.tsx","page/input-panel/layout-picker/background-input-group.tsx","page/input-panel/layout-picker/index.tsx","page/input-panel/input-group/card-icon-input-group.tsx","page/input-panel/input-text/util.ts","page/input-panel/input-text/card-text-area.tsx","page/input-panel/input-text/card-text-input.tsx","page/input-panel/input-group/effect-input-group.tsx","page/input-panel/input-checkbox-group.tsx","page/input-panel/input-panel.styled.tsx","page/input-panel/input-group/footer-input-group.tsx","page/input-panel/input-group/image-input-group.tsx","page/input-panel/input-group/name-set-input-group.tsx","page/input-panel/input-group/pendulum-input-group.tsx","page/input-panel/input-group/post-pendulum-input-group.tsx","page/input-panel/text-style-picker.tsx","page/input-panel/index.tsx","page/canvas-panel/download-button.tsx","service/use-card-export.ts","app.styled.tsx","app.tsx","service/use-ocg-font.ts","reportWebVitals.js","index.js"],"names":["CanvasConst","DEFAULT_BASE_FILL_COLOR","getDefaultCardOpacity","body","pendulum","text","name","baseFill","artBorder","nameBorder","boundless","CardArtCanvasCoordinateMap","normal","artFinishX","artFinishY","artWidth","artX","artY","ratio","type","extendedCard","extendedPendulum","truePendulum","fullCard","fullPendulum","getArtCanvasCoordinate","isPendulum","opacity","backgroundType","NO_ATTRIBUTE","AttributeList","nameKey","color","label","NO_ICON","IconList","CloseCircleOutlined","value","createPresetNameStyle","presetValue","hasGradient","hasOutline","hasShadow","pattern","PresetNameStyleMap","commonB","key","image","preset","fillStyle","commonW","skillDefault","lineWidth","lineColor","skillArial","font","lineOffsetX","rare","secretGradient","gradientAngle","gradientColor","secret","platinum2","ultra","ultra2","platinum","shadowColor","shadowOffsetY","shadowOffsetX","shadowBlur","gold","animeRed","lineOffsetY","animeSilver","animeGold","promo","PresetNameStyleList","Object","values","PatternMap","none","patternImage","blendMode","type1","type2","type3","type4","type5","overrideFill","type6","type7","type8","type9","PatternList","EffectCoordinateData","trueWidth","trueBaseline","trueEdge","PendulumEffectCoordinate","TypeAbilityCoordinateMap","tcg","small","medium","large","edgeAlignment","ocg","CreatorCoordinateMap","PasswordCoordinateMap","ocgKeywordDataList","shortForm","rubyForm","regexForm","rubyFormName","ocgKeywordDataMap","reduce","acc","cur","type3CommonInstruction","type8CommonInstruction","FinishMap","partInstructionMap","ArtFinishMap","art","DefaultFontSizeData","capitalLetterRatio","headTextFontRatio","headTextSpacing","largeSymbolRatio","letterSpacing","offsetY","ordinalFontOffsetY","ordinalFontRatio","squareBracketRatio","DefaultFontDeviation","DefaultFontData","DefaultEffectFontData","alphabetFont","furiganaFont","headTextHeightRatio","ordinalFont","symbolFont","symbolFontRatio","headTextGapRatio","DefaultTCGEffectFontData","fontStyle","fontList","DefaultTCGNormalFontData","DefaultOCGEffectFontData","metricMethod","EffectFontData","bulletSymbolWidth","fontSize","lineHeight","lineCount","TCGVanillaTypeStatFontList","PendulumEffectFontData","CondenseTolerantMap","veryStrict","strict","loose","veryLoose","relaxed","NameFontDataMap","Default","labelKey","fontData","letterDeviationMap","i","yOffset","yRatio","ì","í","î","ï","ĩ","ī","ĭ","į","ǐ","ȉ","ȋ","ɨ","ɩ","ᵹ","ᵼ","ᶖ","ḭ","ḯ","ỉ","ị","I","Ì","Í","Î","Ï","Ĩ","Ī","Ĭ","Į","İ","Ɩ","Ɨ","Ǐ","Ȉ","Ȋ","Ḭ","Ḯ","Ỉ","Ị","Arial","weight","OCG","headTextOverflow","headTextBold","numberFont","numberFontRatio","CreatorFontData","wordLetterSpacing","PasswordFontData","tcgTypeAbilityFontData","iconSymbolWidth","ocgTypeAbilityFontData","tcgToOCGLetterMap","ocgToTCGLetterMap","ocgNumberCircleMap","ocgToTCGTermMap","tcgToOCGTermMap","entries","ocgTerm","FrameInfoMap","labelColor","edition","labelBackgroundColor","labelBackgroundColorList","labelBackgroundImage","join","frameList","arrowPositionList","top","left","width","height","CapitalLetterRegex","RegExp","SquareBracketLetterRegex","WHOLE_WORD_SOURCE","WholeWordRegex","FragmentSplitRegex","NB_WORD_OPEN","NB_WORD_CLOSE","NB_LINE_OPEN","NB_LINE_CLOSE","NB_UNCOMPRESSED_START","NB_UNCOMPRESSED_END","NormalizeTextRegex","NON_BREAKABLE_SYMBOL_SOURCE","nonBreakableSymbolRegex","FLAVOR_CONDITION_SOURCE","TCGSymbolLetterRegex","OCG_KEYWORD_JOIN_REGEX","map","entry","OCG_KEYWORD_SOURCE","CHIISAI_KANA_JOINLIST","ChiisaiRegex","NOT_START_OF_LINE_SOURCE","NonCompressableRegex","OCGAlphabetRegex","OCGNumberRegex","NumberRegex","HiraganaRegex","KatakanaRegex","OCGDotRegex","ChoonpuRegex","NoSpaceRegex","OCGIncreasedLevel2WidthRegex","OCGIncreasedWidthRegex","OCGNoOverheadGapRegex","OCGOffsetMap","OCGLastOfLineOffsetMap","OCGBoxSpacingRatioMap","TCGOffsetMap","TCGLastOfLineOffsetMap","TCGBoxSpacingRatioMap","getBulletSpacing","format","RUBY_REGEX","BREAKABLE_LETTER","GAP_PER_WIDTH_RATIO","getDefaultCard","version","frame","foil","finish","artFinish","nameStyleType","nameStyle","headTextFillStyle","attribute","subFamily","cardIcon","star","starAlignment","artCrop","x","y","unit","aspect","hasBackground","background","backgroundCrop","linkMap","pendulumFrame","pendulumEffect","pendulumScaleRed","pendulumScaleBlue","typeAbility","effectStyle","condenseTolerant","effect","setId","atk","def","password","sticker","isFirstEdition","isSpeedCard","isDuelTerminalCard","creator","furiganaHelper","statTextStyle","typeTextStyle","effectTextStyle","pendulumTextStyle","getEmptyCard","OpacityList","subType","tooltipKey","DefaultColorList","checkXyz","card","checkLink","checkMonster","checkSpeedSkill","getCardIconFromFrame","checkLightHeader","checkLightFrame","includes","resolveNameStyle","isSpeedSkill","lightHeader","contextualFont","contextualColor","resultNameStyle","contextualOutline","strokeStyle","foilStyle","frameStyle","MAX_CONDENSER_THRESHOLD","createCondenser","minThreshold","maxThreshold","min","max","median","lastEffective","iterateCount","magnitude","magnitudeReductionRatio","reverseSearch","Math","searchDown","reset","getMedian","setMedian","newMedian","setLastEffective","forceMedian","getLastEffective","applyLastEffective","getIterateCount","condense","worker","effectiveMedian","condenser","finalMedian","satisfy","forcedMedian","createFontGetter","props","defaultWeight","defaultStyle","defaultSize","defaultFamily","style","size","sizeAsNumber","parseFloat","replaceAll","family","getFont","filter","part","getFontInfo","setWeight","nextWeight","this","setStyle","nextStyle","setSize","nextSize","calculatedSize","setFamily","nextFamily","stringifyPalette","palette","offset","parsePalette","stringifiedPalette","split","index","id","getNavigationProps","debug","optionLength","stopPropagation","setFocus","onTrigger","onCancel","onKeyPress","tabIndex","onFocus","console","info","onBlur","onKeyDown","e","preventDefault","JSONUncrush","n","substring","length","r","pop","JSONCrushSwap","o","replace","cardFieldShortenMap","_newKey","artFrame","passcode","picture","pictureCrop","compressCardData","shortenMap","serialize","condensedCard","normalizedCard","keys","forEach","fieldKey","fieldValue","Array","isArray","newFieldKey","newKey","JSON","stringify","decompressCardData","fullKey","shortenKey","shortendKey","legacyReverseCardDataShortener","normalizedCondensedCard","parse","decodeURIComponent","rebuildCardData","baseCard","migrateCardData","migratedCard","clone","kanjiHelper","undefined","randomCharacter","charSet","result","charactersLength","charAt","floor","random","insertUrlParam","window","history","pushState","searchParams","URLSearchParams","location","search","set","newurl","protocol","host","pathname","toString","path","normalizedCardName","forceRefocus","selector","document","querySelector","focus","HexColorRegex","hexToRGBA","hex","withAlpha","pureHex","rgbaList","parseInt","slice","isNaN","isMobileDevice","a","check","navigator","userAgent","vendor","opera","test","substr","mergeClass","args","Boolean","StyledLoadingFullViewContainer","styled","div","Loading","FullView","className","StyledIconButtonContainer","span","IconButton","Icon","onClick","iconProps","tooltipProps","containerProps","customOnClick","restContainerProps","changeCardFormat","targetFormat","termMap","newSetId","processLanguage","rawLanguageData","fallbackRawDictionary","normalizedRawDictionary","rawDictionary","getDictionaryEntry","applyTemplateNode","template","nodeMap","splitRegex","splittedString","Fragment","specializedDictionary","familyName","siteLink","author1","author2","artist1","artist2","artist3","artist4","settingIcon","openTag","closeTag","hotkey","hotkeyAlternative","separator","scaleType","dictionary","useI18N","create","get","defaultLanguageName","url","URL","href","initialParam","defaultLanguageFromURL","delete","replaceState","state","cachedLanguage","localStorage","getItem","error","languageMap","defaultLanguage","formalName","codeName","initialMessage","order","active","loadLanguageMetadata","fetch","process","headers","response","json","languageMetadataMap","Error","isMetadataReady","eng","loadLanguage","languageName","languageData","processedLanguage","changeLanguage","nextMeta","languageInfo","language","setItem","isLoading","isInitiating","initiate","loadDefaultLanguage","useLanguage","getLanguage","getState","decodeCardWithCompatibility","cardData","decodedCard","legacyRebuildCardData","notification","message","description","VariantConfigMap","debounce","wait","throttle","useCard","setCard","cardTransform","getUpdater","valueTransform","variant","returnFunction","current","target","variantConfig","useSetting","cachedStore","resolution","allowHotkey","reduceMotionColor","showCreativeOption","showExtraDecorativeOption","setting","updateSetting","transformerOrPayload","currentStore","newSetting","CanvasHeight","CanvasWidth","drawMarker","ctx","edge","baseline","xRatio","currentFillStyle","beginPath","rect","fillTextLeftWithSpacing","str","letterSpacingRatio","option","stroke","textAlign","charList","curLeft","char","fillText","strokeText","measureText","fillTextRightWithSpacing","curRight","c","clearCanvas","clearRect","getFinishIterator","finishMap","caller","Promise","resolve","finishType","finishInformation","instructionList","globalCompositeOperation","globalAlpha","DEFAULT_SHADOW_COLOR","DEFAULT_TEXT_COLOR","setTextStyle","blur","imageCacheMap","drawFrom","source","sx","sy","ready","normalizedX","normalizedY","drawImage","imageCached","cache","Image","src","addEventListener","once","drawAsset","drawFromWithSize","dw","dh","normalizedW","normalizedH","drawAssetWithSize","drawWithColor","canvas","sw","sh","dx","dy","cloneCanvasStyle","getContext","clonedCanvas","createElement","clonedCtx","willReadFrequently","rgbaColor","imageRasterData","getImageData","data","resetStyle","imageDataWithShadow","imageRasterDataWithShadow","combinedLayerData","combinedLayerRasterData","pixelCnt","destinationAlpha","putImageData","getLetterWidth","letter","isLastOfLine","boundWidth","boxSpacingRatioMap","offsetMap","lastOfLineOffsetMap","metric","actualBoundWidth","actualBoundingBoxLeft","actualBoundingBoxRight","kerningScaleRatio","spacingRatio","offsetRatio","letterBoxSpacing","standardMetricRatio","actualLetterWidth","drawLetter","deviation","letterMetric","textDrawer","deviationYOffset","letterWidth","scaledBoundingWidth","scaledBaseline","scaledEdge","boundingOffset","externalOffset","scale","tokenizeText","keepControlCharacter","regex","token","getTextWorker","fontSizeData","fontController","numberFontMemory","symbolFontMemory","ordinalFontMemory","furiganaFontMemory","largerTextFontMemory","applyNumberFont","stopApplyNumberFont","applyLargerText","fontRatio","stopApplyLargerText","applySymbolFont","stopApplySymbolFont","applyOrdinalFont","stopApplyOrdinalFont","applyFuriganaFont","bold","stopApplyFuriganaFont","applyAsymmetricScale","applyScale","xScale","yScale","resetScale","setTransform","reverseScale","scaleValue","drawBullet","spaceAfter","bulletRadius","arc","PI","fill","analyzeHeadText","footText","footTextWidth","headText","headTextLetterWidth","headTextGap","gapPadding","fitFootText","sentenceXRatio","noHeadText","condenseHeadText","alignCenterLetterSpacing","internalXRatio","alignCenterHeadTextWidth","alignEvenlyLetterSpacing","alignEvenlyHeadTextWidth","alignment","trueHeadTextWidth","headTextWidth","baseHalfGap","halfGap","headTextXRatio","getLostLeftWidth","prevGap","curGap","analyzeToken","rawToken","nextToken","previousTokenGap","textData","totalWidth","leftMostLetter","spaceCount","spaceAtEnd","rightGap","leftGap","currentFont","fontLevel","defaultGap","currentRightGap","offsetable","leftMostGap","fragmentList","cnt","isLeftmostFragment","fragment","fragmentWidth","rubyType","lostLeftWidth","normalizedWordSpacingRatio","remainFragment","currentLetter","nextRemainFragment","createLineList","paragraphList","additionalLineCount","currentLineList","currentLineCount","accumulatedLineCount","curr","baseXRatio","scaledWidth","tokenList","addedLineCount","wordList","currentLineWidth","currentGap","unCompressedFlag","tokenWidth","line","trim","push","isLast","actualLineWidth","fillHeadText","textWorker","externalHeadTextXRatio","overflow","baseLoneTokenRatio","finalizedRatio","currentEdge","drawLine","spaceWidth","iconPositionList","previousTokenRebalanceOffset","tokenEdge","tokenCnt","gapRatio","next2ndToken","analyzeTokenParameter","drawLetterParameter","tokenRightGap","totalTokenWidth","indent","fragmentEdge","fragmentCnt","nextFragment","next2ndFragment","vacantLeftWidth","isNextTokenOffsetable","nextLeftGap","lostRightWidth","totalVacantSpace","rebalancedSpace","nextTokenRebalanceOffset","footTextFragmentEdge","currentStrokeStyle","currentShadowColor","currentShadowOffsetX","currentShadowOffsetY","currentShadowBlur","fragmentNaiveWidth","currentPosition","drawLetterofWordParameter","letterOffset","round","normalizeCardText","multiline","dictionaryType","nonNullableText","normalizedText","letterSwapMap","textAfterJoinRow","textAfterDetectBlockWord","m","correspondingCircleSymbol","textAfterProcessing","keywordSubtitue","textAfterNormalizeBlockWord","currentDepth","getEffectFontAndCoordinate","isNormal","statInEffect","typeInEffect","coordinateKey","fontDataKey","sizeList","drawEffect","content","textStyle","effectSizeLevel","normalizedContent","tolerancePerSentence","materialReplacement","material","effectText","fullLineList","wholeLineRegex","exec","effectFlavorCondition","flavorConditionRegex","potentialFlavorConditionText","splitEffect","trueWidthStart","trueBaselineStart","lineListWithRatio","fullLineListWithRatio","totalContentWidth","lineSpaceCount","expectedSpaceWidth","analyzeLine","drawStarContent","onStarDraw","normalizedStarCount","leftEdge","resetShadow","all","coordinate","starWidth","drawSticker","toLowerCase","drawPredefinedMark","isLink","bordered","drawLinkRatingText","topToPendulumStructure","pendulumStructureHeight","leftToPendulumStructure","getLayoutDrawFunction","artworkCanvas","backgroundCanvas","bottomFrame","pendulumSize","isXyz","loopFinish","loopArtFinish","keepArtBorder","opacityBody","opacityName","opacityPendulum","opacityText","effectBoxY","hasFoil","frameBorderType","nameBorderType","applyArtFinish","resultAPI","calculateCardArtRedrawCoordination","imageCanvas","customOpacity","extraHeightRatio","customBackgroundType","normalizedOpacity","bodyOpacity","imageWidth","imageHeight","imageScaledRatio","sourceOffsetX","destinationOffsetX","sourceOffsetY","destinationOffsetY","offsetHeight","destinationX","destinationY","destinationWidth","destinationHeight","drawFrame","drawCardArt","drawBackground","boundary","backgroundWidth","backgroundHeight","redrawCoordination","backgroundSourceOffsetX","backgroundSourceOffsetY","backgroundOffsetHeight","backgroundDestinationX","backgroundDestinationY","backgroundDestinationWidth","backgroundDestinationHeight","drawAttribute","drawStar","normalizedCardIcon","drawPendulumScaleIcon","drawLinkArrowMap","isActive","baseLink","activeLink","drawStatBorder","drawNameBackground","drawEffectBackground","withPendulum","effectBoxX","drawFrameBorder","drawNameBorder","drawArtBorder","artFrameSource","drawPendulumBorder","foilType","drawEffectBorder","drawCardBorder","drawArtBorderFoil","drawEffectBorderFoil","drawLinkMapFoil","withBorder","drawNameFinish","drawAttributeFinish","drawArtFinish","drawArtOverlayFinish","drawArtBorderFinish","drawPendulumArtBorderFinish","drawBorderPendulumFinish","drawFrameFinish","drawFrameBackgroundFinish","drawOverlayFinish","overlayType","drawCardBorderFinish","getNameGradient","angleAsDegree","colorStopList","contentWidth","maxAscent","maxDescent","baseKAF","quarterSlot","KAF","originHeight","cx","cy","AD","sqrt","FDA","asin","AF","sin","AL","FL","cos","offsetX","topX","topY","botX","botY","gradient","createLinearGradient","addColorStop","drawName","cloneNode","cloneCtx","hasDefaultOutline","patternBlendMode","fontGetter","quoteConvertedValue","crudeTokenList","fontGetterForWidthCalculating","normalStyle","symbolStyle","textMetric","actualBoundingBoxAscent","actualBoundingBoxDescent","internalEffectiveMedian","lineJoin","defaultTextStyle","sizeMap","drawTypeAbilityText","drawTypeAbility","isMonster","willDrawTypeAbility","typeAbilityWithIcon","willDrawIcon","normalizedTypeAbilityText","defaultFillStyle","normalizedStyle","naturalWidth","drawScale","digitList","digit","accLeft","drawStatText","cursorEndOfATK","drawStat","statWidth","tokenizedText","prev","nextWidth","condenseRatio","_","arr","curText","nextEdge","useMasterSeriDrawer","canvasMap","drawCanvasRef","artworkCanvasRef","backgroundCanvasRef","frameCanvasRef","creatorCanvasRef","effectCanvasRef","nameCanvasRef","passwordCanvasRef","pendulumEffectCanvasRef","pendulumScaleCanvasRef","setIdCanvasRef","statCanvasRef","stickerCanvasRef","cardIconCanvasRef","typeCanvasRef","finishCanvasRef","lightboxCanvasRef","checkNormal","requireShadow","lightFooter","useMemo","levelColor","levelStyle","customEffectText","effectTextFillStyle","effectHasShadow","effectTextShadow","resolvedEffectTextStyle","customPendulumEffectText","pendulumEffectTextFillStyle","pendulumEffectHasShadow","pendulumEffectTextShadow","resolvedPendulumEffectTextStyle","customTypeText","typeTextFillStyle","typeHasShadow","typeTextShadow","resolvedTypeTextStyle","customStatText","statTextFillStyle","statHasShadow","statTextShadow","resolvedStatTextStyle","prepareStyle","normalizedSubFamily","toUpperCase","normalizedTypeAbility","isInitializing","imageChangeCount","readyToDraw","drawingPipeline","useRef","rerun","instructor","overlay","useEffect","hasArtBorder","fillBaseColor","w","h","fillRect","artHeight","withShadow","spacing","xOffset","drawSetId","endOfPassword","baselineOffset","isNumberPassword","internalTextData","internalTrueWidth","drawPasswordText","draw1stEdition","drawCreatorText","typeCtx","effectIndexSize","drawHistory","onExport","useCallback","exportProps","canvasRef","exportCtx","generateLayer","canvasLayer","delayQueue","setTimeout","toBlob","blob","createObjectURL","layer","onload","revokeObjectURL","onerror","sort","l","normalizeCrop","crop","cropWidth","cropHeight","scaleRatio","nextX","nextY","newWidth","naturalHeight","acceptableError","isRatioAcceptable","abs","ImageCropper","React","forwardRef","forwardedRef","title","backgroundColor","defaultExternalSource","receivingCanvas","children","beforeCropper","defaultCropInfo","onSourceLoaded","onSourceChange","onCropChange","onTainted","fileInputRef","useState","crossorigin","redrawSignal","setRedrawSignal","sourceType","setSourceType","inputMode","setInputMode","internalSource","setInternalSource","setLoading","setError","externalSource","setExternalSource","imgRef","completed","setCrop","isMigrated","setMigrated","currentCrop","completedCrop","pendingCrop","onLoad","img","internalId","pendingId","normalizedCrop","transform","zoomX","zoomY","cropUnit","pixelRatio","devicePixelRatio","expectedDrawWidth","drawWidth","expectedDrawHeight","drawHeight","drawCoordinateX","drawCoordinateY","imageSmoothingQuality","fitCropData","newValue","useImperativeHandle","hasImage","forceExternalSource","cropInfo","isDownloadable","DownloadOutlined","previewUrl","anchor","download","click","generateDownload","Group","onChange","Button","checked","ExclamationCircleOutlined","placeholder","maxLength","allowClear","ref","accept","files","reader","FileReader","readAsDataURL","alert","setValue","imageStyle","backgroundImage","onImageLoaded","onImageError","pixelCropData","percentCropData","onComplete","percentData","ruleOfThirds","LinkMarkChooser","defaultValue","choosenArrow","setChoosenArrow","rotateMap","literalChoosenArrow","normalizedIndex","newMap","Explanation","overlayClassName","rest","restIconProps","StyledCode","StyledContainer","StyledImageSection","StyledImageWithCaptionContainer","ImageWithCaption","caption","alt","FormattingHelpDrawer","modalOpen","setDrawerOpen","footer","visible","onClose","SettingFilled","BulbFilled","StyledFrameContainer","$withPillar","StyledFramePillar","FrameInfoBlock","rotate","keyframes","StyledSettingPanel","StyledSettingButtonContainer","$softMode","css","SettingButton","trigger","placement","Affiliation","rel","GithubFilled","StyledAppSettingContainer","AppHeader","TaintedCanvasWarning","StandaloneLabel","StyledDropdownOption","StyledDropdown","Container","Option","FormatButtonList","fontWeight","FinishButtonList","ArtFinishButtonList","getFrameButtonList","StarButtonList","IconTypeMap","fullLabelKey","icon","IconTypeList","StickerButtonList","CondenseThresholdButtonList","StyledCharPickerContainer","CharPicker","targetId","onPick","internalOnPick","inputTarget","getElementById","myValue","selection","createRange","position","selectionStart","startPos","endPos","selectionEnd","insertAtCursor","WrappedColorPicker","onSelect","onOffsetChange","onRemove","internalColor","setInternalColor","internalOffset","setInternalOffset","setInternalId","debouncedOnChange","setColor","setCurrentOffset","styles","default","picker","boxShadow","padding","disableAlpha","onChangeComplete","getPaletteInfo","newColorList","colorList","raw","TextGradientPicker","externalPalette","angle","externalAngle","memoizedOnChange","pickerRef","setAngle","intialPalette","currentControlId","setPalette","changePalette","nextColorList","newPalette","setPickerOnMount","relevant","targetColor","find","disabled","Number","paletteHeight","maxStops","minStops","stopRemovalDrop","onPaletteChange","onColorStopSelect","stopColor","nextId","StyledPickerButton","$active","StyledPatternContainer","StyledPatternOption","StyledPredefinedContainer","StyledPredefinedOption","GridSliderInput","fieldMap","labelMap","xField","yField","colorField","widthField","xValue","yValue","colorValue","widthValue","widthLabel","nextValue","keyList","axis","track","gridRow","thumb","zIndex","xmax","xmin","ymax","ymin","colors","PredefinedOptionGrid","containerRef","NameStylePicker","frameInfo","defaultType","undebouncedOnChange","optionGridRef","predefinedDropdownVisible","setPredefinedDropdownVisible","setType","setCnt","useRefresh","customStyleSignal","sendCustomStyleSignal","memoizedOnGradientChange","reduceColorMotion","shadowPickeRef","outlinePickeRef","currentValue","patternStyle","isStyleCustom","isStylePredefined","optionInputContainerId","applyAutoStyle","applyPredefinedStyle","applyCustomStyle","onVisibleChange","CaretDownOutlined","fontValue","InputTrainStyle","TrainGridStyle","StyledRadioTrainContainer","RadioTrain","activeValue","optionList","suffix","internalRef","isChecked","StyledFrameTrain","FrameTrain","onSTFrameChange","useShallow","changeFrame","frameValue","currentCard","nextFrame","isST","newTypeAbility","StyledCheckboxTrainContainer","CheckboxTrain","StyledImageCropper","BackgroundInputGroup","imageCropperRef","changeBackground","changeBackgroundCrop","StyledBoundlessOverlay","StyledLayoutPickerContainer","StyledBaseFillPickerContainer","LayoutPicker","backgroundInputVisible","setBackgroundInputVisible","backgroundInputHidden","setBackgroundInputHidden","setOpacity","backgroundInputRef","changeBackgroundType","changeHasBackground","noBackground","activable","destroyTooltipOnHide","fit","full","BorderOuterOutlined","step","StyledIconDropdown","StyledCheckboxStarTrain","CardIconInputGroup","isDarkSynchro","changeCardIcon","changeSubFamily","changeStar","changeStarAlignment","iconTypeData","iconDropdownText","IconDropdownLabel","IconDropdown","DropdownChildren","AlignLeftOutlined","AlignCenterOutlined","AlignRightOutlined","availableCommand","Set","resolveHotkey","allowNewLine","onResult","selectedText","keepInline","wrappedText","cursorOffset","placeCursorInInput","TextArea","Input","CardTextArea","onTakePicker","immediateValue","cursorData","setCursorData","internalOnChange","eventOrValue","normalizedValue","externalSetValue","getPickerRef","autoComplete","spellCheck","ev","ctrlKey","metaKey","currentTarget","has","joinedText","CardTextInput","EffectInputGroup","effectInputRef","changeEffect","rows","StyledCheckboxGroup","CardCheckboxGroup","onFirstEditionChange","onDuelTerminalCardChange","onSpeedCardChange","StyledPendulumFrameContainer","StyledInputLabelWithButton","StyledNameSetIdInputContainer","StyledFormatRadioTrain","StyledFooterInputContainer","FooterInputGroup","passwordInputRef","creatorInputRef","atkInputRef","defInputRef","changeATK","changeDEF","changePassword","onStickerChange","changeCreator","addonBefore","SyncOutlined","StyledImageRadioTrain","ImageInputGroup","changeLinkMap","changePicture","changeArtFinish","changeImageCrop","StyledNameInputContainer","StyledCopyButton","NameSetInputGroup","nameInputRef","setIdInputRef","changeSetId","changeName","clipboard","writeText","randomSetID","BottomFrameOptionGrid","recentCustomPendulumFrame","inputRef","StyledPendulumFrameInputContainer","StyledPendulumInputContainer","PendulumInputGroup","bottomFrameOptionGridRef","pendulumEffectInputRef","isMirrorScale","setMirrorScale","frameDropdownVisible","setFrameDropdownVisibleVisible","onRedScaleChange","onBlueScaleChange","changePendulumEffect","currentPendulumFrame","willBecomePendulum","StyledPostPendulumInputContainer","PostPendulumInputGroup","typeAbilitySeparator","typeAbilityInputRef","changeTypeAbility","toggleFuriganaHelper","typeLabel","isOCG","onCondenseTolerantChange","StyledInlineColorPickerContainer","InlineColorList","rgb","InlineColorPicker","currentText","setCurrentText","internalValue","setInternalValue","startsWith","dotColor","StyledTextStyleContainer","StyledTextStylePicker","TextStyleInfoMap","keyName","TextStylePicker","styleList","custom","shadow","applyStyle","applyShadow","shadowValue","CardInputPanel","stylePickerRef","stylePickerResetCount","setStylePickerResetCount","foilButtonList","getFoilList","imageInputGroupRef","layoutPickerRef","nameSetIdInputGroupRef","pendulumInputGroupRef","effectInputGroupRef","postPendulumInputGroupRef","footerInputGroupRef","pickerTarget","setPickerTarget","changeFoil","onFinishChange","changeOpacity","changeAttribute","changeNameStyle","attributeList","getAttributeList","forceCardData","formatValue","nextFormat","formatSwappedCard","StyledDownloadDropdownLabel","Menu","Item","StyledDownloadDropdownOption","StyledDownloadButton","DownloadButton","isTainted","onDownloadError","exportRef","currentPipeline","pipelineRunning","isDownloading","setDownloading","onDownloadComplete","onSave","pendingSave","drawCanvas","cloneCanvas","drawCanvasContext","cloneCanvasContext","normalizedName","link","toDataURL","classList","remove","confirmReload","setAttribute","isRelevant","add","removeEventListener","queuingSize","useCardExport","domEvent","MenuOutlined","StyledDataButtonPanelContainer","StyledCardCanvasGroupContainer","StyledAppLoading","StyledByMe","ErrorAlert","OverlayButton","LightboxButton","ResetButton","configure","ignoreTags","AppGlobalHotkeyMap","EXPORT","IMPORT","MERGE","VIEW","DOWNLOAD","App","softMode","isLanguageInitiating","isLanguageLoading","initiateI18N","setInitializing","canvasKey","setCanvasKey","lightboxVisible","setLightboxVisible","cardInputRef","downloadButtonRef","setImageChangeCount","styleName","setProperty","WebFont","load","families","urls","retrievedCard","localCardVersion","localCardData","cardURLData","retrieveSavedCard","fontinactive","fvd","inactive","ocgStyleFile","onActive","onBeforeLoad","onFontInactive","onInactive","styleContent","setStyleContent","ocgReady","loadAttempt","useOCGFont","setTainted","documentClassList","displayLightbox","status","fromHotkey","importData","event","prompt","mergeData","exportData","exportableCard","downloadFromHotkey","hotkeyHandlerMap","alertDownloadError","rerenderAllImage","rerenderCardImage","markTaintedImage","keyMap","handlers","onDrop","confirm","defaultCard","contextualDefaultCardData","ClearOutlined","ZoomInOutlined","onContextMenu","wrapClassName","forceRender","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode"],"mappings":"yeA2CaA,G,mCACF,KADEA,EAED,KAFCA,EAGe,IAHfA,EAIgB,IAJhBA,EAKgB,GAGhBC,EAA0B,UAC1BC,EAAwB,iBAAO,CACxCC,KAAM,IACNC,SAAU,IACVC,KAAM,IACNC,KAAM,IACNC,SAAUN,EACVO,WAAW,EACXC,YAAY,EACZC,WAAW,IAGFC,EAA6B,C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K,IAAK,CACDJ,aAAc,OACdC,SAAU,IACVF,UAAW,MAINY,EAAwD,CACjEF,IAAK,CACDT,aAAc,SACdC,SAAU,OACVF,UAAW,KAEfK,IAAK,CACDJ,aAAc,SACdC,SAAU,OACVF,UAAW,MCxFNa,EAAqB,CAC9B,CACIC,UAAW,2BACXC,SAAU,8FAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,KACXE,UAAW,gCACXD,SAAU,mDAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,KACXE,UAAW,oBACXD,SAAU,uCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,6CACXC,SAAU,gDAEd,CACID,UAAW,qBACXC,SAAU,8CAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,qCAEd,CACID,UAAW,iCACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,qBACXC,SAAU,yEAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,0DAEd,CACID,UAAW,qBACXC,SAAU,yEAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,uCACXC,SAAU,0CAEd,CACID,UAAW,qBACXC,SAAU,6DAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,2BACXC,SAAU,mEAEd,CACID,UAAW,SACXC,SAAU,qCAEd,CACID,UAAW,eACXC,SAAU,0DAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,kFAEd,CACID,UAAW,uCACXC,SAAU,0CAEd,CACID,UAAW,2BACXC,SAAU,sEAEd,CACID,UAAW,qBACXC,SAAU,uDAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,+BAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,iCACXC,SAAU,iDAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,2BACXC,SAAU,oDAEd,CACID,UAAW,2BACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,qCAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,yBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,uCACXC,SAAU,0CAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,MACXE,UAAW,qBACXD,SAAU,sEAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,gCAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,sCAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,0BAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,4CAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,0DAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,yBAEd,CACID,UAAW,YACXE,UAAW,qCACXD,SAAU,gEACVE,aAAc,iEAElB,CACIH,UAAW,WACXE,UAAW,oCACXD,SAAU,6CACVE,aAAc,8CAElB,CACIH,UAAW,KACXE,UAAW,8BACXD,SAAU,yDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,U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,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,KAEIC,GAA4C,CACrD,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IAEL,SAAK,SACL,SAAK,SACL,SAAK,SAEL,SAAK,IAKL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,KAWIC,GAA6C,CACtD,WAAO,SACP,WAAO,SACP,WAAO,SACP,WAAO,SACP,WAAO,SACP,WAAO,SACP,WAAO,SACP,WAAO,SACP,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Y,MAO7B,eAACnB,GAAD,CAAYvuC,UAAU,QAAtB,6BACoB,qBAAKmL,IAAI,kCAAkCspB,IAAI,oBEzcpE4e,GAZS,SAAAC,GAChBA,GAAeA,aAAuBC,UACtC,8BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QACzDJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCDpBQ,IAASC,OACL,cAAC,IAAMC,WAAP,UACI,cAAC,GAAD,MAEJ71C,SAASy5B,eAAe,SAM5Byb,O","file":"static/js/main.386f4d58.chunk.js","sourcesContent":["export const getBackgroundTypeList = (dictionary: {\r\n fit: string,\r\n full: string,\r\n}) => [\r\n {\r\n value: 'fit' as const,\r\n label: dictionary.fit,\r\n },\r\n {\r\n value: 'full' as const,\r\n label: dictionary.full,\r\n },\r\n];\r\nexport type BackgroundType = ReturnType[0]['value'];\r\n\r\n/**\r\n * @summary About x y headache.\r\n * \r\n * * Normal (True): Actual position / size on the card. If the coordinate / size is multiplied by a ratio, it is likely a normal value.\r\n * * Scaled: Position or size on a hypothesis (scaled) canvas. For example a 1000px wide canvas with scaleX of 0.5 can be treated as a 2000px wide canvas with scaleX of 1. So draw a point at x 50 in this hypothesis canvas will result an actual point at x = 25. If the coordinate / size is divided by a ratio, it is likely a scaled value.\r\n * * Inverse-scaled: Position or size on a hypothesis canvas. For example a letter that much has exactly 50px wide on every scale. So in a 1000px wide canvas with scaleX of 0.5 the letter actually has 100px width, and vice versa in a 1000px wide canvas with scaleX of 2.0, the letter will have 25px width only.\r\n */\r\nexport type MasterSeriesCanvas = {\r\n artworkCanvasRef: React.RefObject,\r\n backgroundCanvasRef: React.RefObject,\r\n drawCanvasRef: React.RefObject,\r\n frameCanvasRef: React.RefObject,\r\n cardIconCanvasRef: React.RefObject,\r\n pendulumScaleCanvasRef: React.RefObject,\r\n pendulumEffectCanvasRef: React.RefObject,\r\n typeCanvasRef: React.RefObject,\r\n effectCanvasRef: React.RefObject,\r\n nameCanvasRef: React.RefObject,\r\n statCanvasRef: React.RefObject,\r\n setIdCanvasRef: React.RefObject,\r\n passwordCanvasRef: React.RefObject,\r\n creatorCanvasRef: React.RefObject,\r\n stickerCanvasRef: React.RefObject,\r\n finishCanvasRef: React.RefObject,\r\n lightboxCanvasRef: React.RefObject,\r\n};\r\n\r\n/** Some coordination data must be rounded into nearest integer so it does not create those janky ghost pixels. */\r\nexport const CanvasConst = {\r\n width: 813,\r\n height: 1185,\r\n topToPendulumStructure: 210,\r\n pendulumStructureHeight: 912,\r\n leftToPendulumStructure: 52,\r\n};\r\n\r\nexport const DEFAULT_BASE_FILL_COLOR = '#404040';\r\nexport const getDefaultCardOpacity = () => ({\r\n body: 100,\r\n pendulum: 100,\r\n text: 100,\r\n name: 100,\r\n baseFill: DEFAULT_BASE_FILL_COLOR,\r\n artBorder: true,\r\n nameBorder: true,\r\n boundless: false,\r\n});\r\nexport type CardOpacity = ReturnType;\r\nexport const CardArtCanvasCoordinateMap = {\r\n normal: {\r\n artFinishX: 100,\r\n artFinishY: 219,\r\n artWidth: 614,\r\n artX: 100,\r\n artY: 219,\r\n ratio: 1,\r\n type: 'normal' as const,\r\n },\r\n pendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 1.325,\r\n type: 'pendulum' as const,\r\n },\r\n /** Normal distribution, with artwork extends under effect's box. */\r\n extendedCard: {\r\n artFinishX: 100,\r\n artFinishY: 219,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 0.775,\r\n type: 'extendedCard' as const,\r\n },\r\n /** Pendulum distribution, with artwork extends under pendulum effect's box and effect's box. */\r\n extendedPendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 0.775,\r\n type: 'extendedPendulum' as const,\r\n },\r\n /** Pendulum distribution, with artwork extends under pendulum effect's box. It is actually the \"default\" mode of pendulum cards in practices. But most of the time the artwork only cut the visible image part because it is very hard to find the full image of a card unless an official source provide it. */\r\n truePendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 1.057,\r\n type: 'truePendulum' as const,\r\n },\r\n /** Normal distribution with artwork span the entire card over the frame, use boundless mode to show frame above it. */\r\n fullCard: {\r\n artFinishX: 100,\r\n artFinishY: 219,\r\n artWidth: 758,\r\n artX: 28,\r\n artY: 28,\r\n ratio: 0.670,\r\n type: 'fullCard' as const,\r\n },\r\n /** Pendulum distribution with artwork span the entire card over the frame, use boundless mode to show frame above it. */\r\n fullPendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 758,\r\n artX: 28,\r\n artY: 28,\r\n ratio: 0.670,\r\n type: 'fullPendulum' as const,\r\n },\r\n};\r\nexport const getArtCanvasCoordinate = (\r\n isPendulum: boolean,\r\n opacity?: Partial,\r\n backgroundType?: BackgroundType,\r\n) => {\r\n const {\r\n boundless,\r\n body,\r\n pendulum,\r\n text,\r\n } = { ...getDefaultCardOpacity(), ...opacity };\r\n const normalizedBoundless = backgroundType === 'fit'\r\n ? false\r\n : boundless;\r\n\r\n if (backgroundType === 'full') return CardArtCanvasCoordinateMap.fullCard;\r\n const artType = normalizedBoundless || body < 100\r\n ? isPendulum\r\n ? 'fullPendulum'\r\n : 'fullCard'\r\n : isPendulum\r\n ? text < 100\r\n ? 'extendedPendulum'\r\n : pendulum < 100\r\n ? 'truePendulum'\r\n : 'pendulum'\r\n : text < 100\r\n ? 'extendedCard'\r\n : 'normal';\r\n\r\n return CardArtCanvasCoordinateMap[artType];\r\n};\r\n","import { CloseCircleOutlined } from '@ant-design/icons';\r\n\r\nexport const NO_ATTRIBUTE = 'NONE';\r\nexport const AttributeList = [\r\n {\r\n name: NO_ATTRIBUTE,\r\n nameKey: 'input.attribute.none',\r\n color: '#000000',\r\n },\r\n {\r\n name: 'DARK',\r\n nameKey: 'input.attribute.dark',\r\n label: 'Dark',\r\n color: '#b41dda',\r\n },\r\n {\r\n name: 'EARTH',\r\n nameKey: 'input.attribute.earth',\r\n label: 'Earth',\r\n color: '#8d8e8e',\r\n },\r\n {\r\n name: 'FIRE',\r\n nameKey: 'input.attribute.fire',\r\n label: 'Fire',\r\n color: '#e51b23',\r\n },\r\n {\r\n name: 'LIGHT',\r\n nameKey: 'input.attribute.light',\r\n label: 'Light',\r\n color: '#bfae32',\r\n },\r\n {\r\n name: 'WATER',\r\n nameKey: 'input.attribute.water',\r\n label: 'Water',\r\n color: '#008ecd',\r\n },\r\n {\r\n name: 'WIND',\r\n nameKey: 'input.attribute.wind',\r\n label: 'Wind',\r\n color: '#28ab35',\r\n },\r\n {\r\n name: 'DIVINE',\r\n nameKey: 'input.attribute.divine',\r\n label: 'Divine',\r\n color: '#ef6300',\r\n },\r\n {\r\n name: 'SPELL',\r\n nameKey: 'input.attribute.spell',\r\n label: 'Spell',\r\n color: '#1b8f83',\r\n },\r\n {\r\n name: 'TRAP',\r\n nameKey: 'input.attribute.trap',\r\n label: 'TRAP',\r\n color: '#c32a8c',\r\n },\r\n];\r\n\r\nexport const NO_ICON = 'NO ICON';\r\nexport const IconList = [\r\n {\r\n label: ,\r\n value: NO_ICON,\r\n nameKey: 'input.icon.none',\r\n },\r\n {\r\n label: 'Field',\r\n value: 'FIELD',\r\n nameKey: 'input.icon.field',\r\n },\r\n {\r\n label: 'Continuous',\r\n value: 'CONTINUOUS',\r\n nameKey: 'input.icon.continuous',\r\n },\r\n {\r\n label: 'Quick-Play',\r\n value: 'QUICK-PLAY',\r\n nameKey: 'input.icon.quick-play',\r\n },\r\n {\r\n label: 'Ritual',\r\n value: 'RITUAL',\r\n nameKey: 'input.icon.ritual',\r\n },\r\n {\r\n label: 'Equip',\r\n value: 'EQUIP',\r\n nameKey: 'input.icon.equip',\r\n },\r\n {\r\n label: 'Counter',\r\n value: 'COUNTER',\r\n nameKey: 'input.icon.counter',\r\n },\r\n];\r\n\r\nexport const StickerList = [\r\n 'no-sticker',\r\n 'gold',\r\n 'silver',\r\n 'beta',\r\n 'holo5',\r\n 'holo4',\r\n 'holo3',\r\n 'holo2',\r\n 'holo1',\r\n 'limited',\r\n 'unlimited',\r\n];","export type NameStyleType = 'auto' | 'custom' | 'predefined';\r\nexport type NameStyle = ReturnType;\r\nexport const getDefaultNameStyle = () => ({\r\n font: 'Default',\r\n fillStyle: '#000000',\r\n headTextFillStyle: '#000000',\r\n shadowColor: '#000000',\r\n shadowOffsetY: 0,\r\n shadowOffsetX: 0,\r\n shadowBlur: 0,\r\n hasShadow: false,\r\n lineColor: '#000000',\r\n lineWidth: 0,\r\n lineOffsetY: 0,\r\n lineOffsetX: 0,\r\n hasOutline: false,\r\n gradientAngle: 0,\r\n gradientColor: '0.000|#eef10b,0.5|#d78025,1.000|#7e20cf',\r\n hasGradient: false,\r\n preset: 'commonB' as PresetNameStyle,\r\n pattern: 'none',\r\n});\r\n\r\n/** Is it worth it? Store as array significantly reduces data size, but also make the code harder to ready. Maybe we should only apply it to simple fields. */\r\nexport type TextStyle = [\r\n custom: boolean,\r\n fillStyle: string,\r\n hasShadow: boolean,\r\n shadow: string,\r\n];\r\nexport const getDefaultTextStyle = (): TextStyle => [\r\n false,\r\n '#000000',\r\n false,\r\n '#000000',\r\n];\r\n\r\nconst createPresetNameStyle = (presetValue: Partial): Partial => ({\r\n hasGradient: false,\r\n hasOutline: false,\r\n hasShadow: false,\r\n pattern: 'none',\r\n ...presetValue\r\n});\r\nexport type PresetNameStyle = 'commonB' | 'commonW'\r\n| 'skillDefault' | 'skillArial'\r\n| 'rare' | 'secretGradient' | 'secret' | 'platinum2' | 'ultra' | 'ultra2' | 'platinum' | 'gold'\r\n| 'animeRed' | 'animeSilver' | 'animeGold'\r\n| 'promo';\r\nexport const PresetNameStyleMap: Record,\r\n}> = {\r\n commonB: {\r\n key: 'commonB',\r\n label: 'Common (Black)',\r\n image: 'asset/image/other/name-common-b.png',\r\n value: createPresetNameStyle({\r\n preset: 'commonB',\r\n fillStyle: '#000000',\r\n }),\r\n },\r\n commonW: {\r\n key: 'commonW',\r\n label: 'Common (White)',\r\n image: 'asset/image/other/name-common-w.png',\r\n value: createPresetNameStyle({\r\n preset: 'commonW',\r\n fillStyle: '#ffffff',\r\n }),\r\n },\r\n skillDefault: {\r\n key: 'skillDefault',\r\n label: 'Skill (Default)',\r\n image: 'asset/image/other/name-skill-default.png',\r\n value: createPresetNameStyle({\r\n preset: 'skillDefault',\r\n fillStyle: '#ffffff',\r\n lineWidth: 6,\r\n lineColor: '#000',\r\n hasOutline: true,\r\n }),\r\n },\r\n skillArial: {\r\n key: 'skillArial',\r\n label: 'Skill (Arial)',\r\n image: 'asset/image/other/name-skill-arial.png',\r\n value: createPresetNameStyle({\r\n preset: 'skillArial',\r\n font: 'Arial',\r\n fillStyle: '#ffffff',\r\n lineWidth: 6,\r\n lineColor: '#000',\r\n lineOffsetX: 1,\r\n hasOutline: true,\r\n }),\r\n },\r\n rare: {\r\n key: 'rare',\r\n label: 'Rare',\r\n image: 'asset/image/other/name-rare.png',\r\n value: createPresetNameStyle({\r\n preset: 'rare',\r\n fillStyle: '#cfc6de',\r\n }),\r\n },\r\n secretGradient: {\r\n key: 'secretGradient',\r\n label: 'Secret (Gradient)',\r\n image: 'asset/image/other/name-secret-gradient.png',\r\n value: createPresetNameStyle({\r\n preset: 'secretGradient',\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#7a71a6,1.000|#a8c1e5',\r\n hasGradient: true,\r\n }),\r\n },\r\n secret: {\r\n key: 'secret',\r\n label: 'Secret',\r\n image: 'asset/image/other/name-secret.png',\r\n value: createPresetNameStyle({\r\n preset: 'secret',\r\n fillStyle: '#8a8381',\r\n }),\r\n },\r\n platinum2: {\r\n key: 'platinum2',\r\n label: 'Platinum',\r\n image: 'asset/image/other/name-platinum.png',\r\n value: createPresetNameStyle({\r\n preset: 'platinum2',\r\n fillStyle: '#a49f9e',\r\n }),\r\n },\r\n ultra: {\r\n key: 'ultra',\r\n label: 'Ultra',\r\n image: 'asset/image/other/name-ultra.png',\r\n value: createPresetNameStyle({\r\n preset: 'ultra',\r\n fillStyle: '#dbb473',\r\n }),\r\n },\r\n ultra2: {\r\n key: 'ultra2',\r\n label: 'Ultra (Type 2)',\r\n image: 'asset/image/other/name-ultra-2.png',\r\n value: createPresetNameStyle({\r\n preset: 'ultra2',\r\n fillStyle: '#fee002',\r\n }),\r\n },\r\n platinum: {\r\n key: 'platinum',\r\n label: 'Foil Platinum',\r\n image: 'asset/image/other/name-foil-platinum.png',\r\n value: createPresetNameStyle({\r\n preset: 'platinum',\r\n fillStyle: '#CCCCCC',\r\n shadowColor: '#FFFFFF',\r\n shadowOffsetY: 1,\r\n shadowOffsetX: 0,\r\n shadowBlur: 1,\r\n hasShadow: true,\r\n }),\r\n },\r\n gold: {\r\n key: 'gold',\r\n label: 'Foil Gold',\r\n image: 'asset/image/other/name-foil-gold.png',\r\n value: createPresetNameStyle({\r\n preset: 'gold',\r\n fillStyle: '#b88c43',\r\n shadowColor: '#FCC400',\r\n shadowOffsetY: 1,\r\n shadowOffsetX: 0,\r\n shadowBlur: 1,\r\n hasShadow: true,\r\n }),\r\n },\r\n animeRed: {\r\n key: 'animeRed',\r\n label: 'Anime (Type Red)',\r\n image: 'asset/image/other/name-anime-red.png',\r\n value: createPresetNameStyle({\r\n preset: 'animeRed',\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#d81961,0.220|#b81654,0.270|#9e1348,0.330|#95093e,0.380|#95093e,0.450|#ba3264,0.530|#ff5e99,0.620|#ffa0c3,0.690|#ffffff,0.770|#ff5e99,0.870|#d81961,1.000|#b81654',\r\n hasGradient: true,\r\n hasOutline: true,\r\n hasShadow: true,\r\n lineColor: '#333333',\r\n lineOffsetX: 1,\r\n lineOffsetY: 0,\r\n lineWidth: 3,\r\n shadowBlur: 2,\r\n shadowColor: '#383838',\r\n shadowOffsetX: 2,\r\n shadowOffsetY: 3,\r\n }),\r\n },\r\n animeSilver: {\r\n key: 'animeSilver',\r\n label: 'Anime (Type Silver)',\r\n image: 'asset/image/other/name-anime-silver.png',\r\n value: createPresetNameStyle({\r\n preset: 'animeSilver',\r\n shadowColor: '#383838',\r\n shadowOffsetY: 3,\r\n shadowOffsetX: 2,\r\n shadowBlur: 2,\r\n hasShadow: true,\r\n lineColor: '#333333',\r\n lineWidth: 3,\r\n lineOffsetX: 1,\r\n lineOffsetY: 0,\r\n hasOutline: true,\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#cecbb8,0.220|#b0ad9b,0.270|#94917e,0.330|#797768,0.380|#797768,0.450|#d9d9d9,0.610|#ffffff,0.700|#ffffff,0.870|#d6d7c7,1.000|#c9cbb6',\r\n hasGradient: true,\r\n }),\r\n },\r\n animeGold: {\r\n key: 'animeGold',\r\n label: 'Anime (Type Gold)',\r\n image: 'asset/image/other/name-anime-gold.png',\r\n value: createPresetNameStyle({\r\n preset: 'animeGold',\r\n shadowColor: '#383838',\r\n shadowOffsetY: 3,\r\n shadowOffsetX: 2,\r\n shadowBlur: 2,\r\n hasShadow: true,\r\n lineColor: '#333333',\r\n lineWidth: 3,\r\n lineOffsetX: 1,\r\n lineOffsetY: 0,\r\n hasOutline: true,\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#eee317,0.220|#dbbe15,0.270|#d0920c,0.330|#b57f0b,0.380|#d0920c,0.450|#ffff6b,0.610|#ffffff,0.700|#ffffff,0.870|#e5dd2d,1.000|#e3da23',\r\n hasGradient: true,\r\n }),\r\n },\r\n promo: {\r\n key: 'promo',\r\n label: 'Promo',\r\n image: 'asset/image/other/name-promo.png',\r\n value: createPresetNameStyle({\r\n preset: 'promo',\r\n fillStyle: '#c7080b',\r\n shadowColor: '#333333',\r\n shadowOffsetY: 0,\r\n shadowOffsetX: 0,\r\n shadowBlur: 1,\r\n hasShadow: true,\r\n lineColor: '#8a1801',\r\n lineWidth: 3,\r\n lineOffsetX: 0,\r\n hasOutline: true,\r\n lineOffsetY: 0\r\n }),\r\n },\r\n};\r\nexport const PresetNameStyleList = Object.values(PresetNameStyleMap);\r\n\r\nexport const PatternMap: Record = {\r\n none: {\r\n key: 'none',\r\n patternImage: '',\r\n blendMode: 'source-atop',\r\n },\r\n type1: {\r\n key: 'type1',\r\n patternImage: 'finish-name-type1',\r\n blendMode: 'source-atop',\r\n },\r\n type2: {\r\n key: 'type2',\r\n patternImage: 'finish-name-type2',\r\n blendMode: 'source-atop',\r\n },\r\n type3: {\r\n key: 'type3',\r\n patternImage: 'finish-name-type3',\r\n blendMode: 'source-atop',\r\n },\r\n type4: {\r\n key: 'type4',\r\n patternImage: 'finish-name-type4',\r\n blendMode: 'source-atop',\r\n },\r\n type5: {\r\n key: 'type5',\r\n patternImage: 'finish-name-type5',\r\n blendMode: 'multiply',\r\n overrideFill: true,\r\n },\r\n type6: {\r\n key: 'type6',\r\n patternImage: 'finish-name-type6',\r\n blendMode: 'source-atop',\r\n },\r\n type7: {\r\n key: 'type7',\r\n patternImage: 'finish-name-type7',\r\n blendMode: 'lighter',\r\n overrideFill: true,\r\n },\r\n type8: {\r\n key: 'type8',\r\n patternImage: 'finish-name-type8',\r\n blendMode: 'source-atop',\r\n },\r\n type9: {\r\n key: 'type9',\r\n patternImage: 'finish-name-type9',\r\n blendMode: 'source-atop',\r\n },\r\n};\r\nexport const PatternList = Object.values(PatternMap);","export type CoordinateData = {\r\n edgeAlignment?: 'left' | 'right',\r\n trueWidth: number,\r\n trueBaseline: number,\r\n trueEdge: number,\r\n};\r\n\r\nexport const EffectCoordinateData: Record = {\r\n 'tcg': [\r\n { trueWidth: 684, trueBaseline: 890.23, trueEdge: 64.8 },\r\n ],\r\n 'tcg-stat': [\r\n { trueWidth: 684, trueBaseline: 890.23, trueEdge: 64.8 },\r\n ],\r\n 'tcg-type-stat': [\r\n { trueWidth: 684, trueBaseline: 919.8, trueEdge: 64.5 },\r\n ],\r\n 'tcg-type': [\r\n { trueWidth: 684, trueBaseline: 921.8, trueEdge: 64.5 },\r\n ],\r\n 'ocg': [\r\n { trueWidth: 684, trueBaseline: 895.23, trueEdge: 64.8 },\r\n ],\r\n 'ocg-stat': [\r\n { trueWidth: 684, trueBaseline: 891.23, trueEdge: 64.8 },\r\n ],\r\n 'ocg-type-stat': [\r\n { trueWidth: 684, trueBaseline: 918.5, trueEdge: 64.5 },\r\n ],\r\n 'ocg-type': [\r\n { trueWidth: 684, trueBaseline: 918.5, trueEdge: 64.5 },\r\n ],\r\n};\r\n\r\nexport const PendulumEffectCoordinate: CoordinateData[] = [\r\n { trueWidth: 555.47, trueBaseline: 746.29, trueEdge: 128.94 },\r\n { trueWidth: 555.47, trueBaseline: 746.29, trueEdge: 128.94 },\r\n];\r\n\r\nexport const TypeAbilityCoordinateMap: Record> = {\r\n tcg: {\r\n small: {\r\n trueBaseline: 919,\r\n trueEdge: 62.50,\r\n trueWidth: 684.5,\r\n },\r\n medium: {\r\n trueBaseline: 920,\r\n trueEdge: 62.50,\r\n trueWidth: 684.5,\r\n },\r\n large: {\r\n trueBaseline: 187.5,\r\n trueEdge: 732.00,\r\n edgeAlignment: 'right',\r\n trueWidth: 648.5,\r\n },\r\n },\r\n ocg: {\r\n small: {\r\n trueBaseline: 917,\r\n trueEdge: 63.70,\r\n trueWidth: 684.5,\r\n },\r\n medium: {\r\n trueBaseline: 917,\r\n trueEdge: 63.70,\r\n trueWidth: 684.5,\r\n },\r\n large: {\r\n trueBaseline: 190.5,\r\n trueEdge: 728.00,\r\n edgeAlignment: 'right',\r\n trueWidth: 642.5,\r\n },\r\n },\r\n};\r\n\r\nexport const CreatorCoordinateMap: Record = {\r\n ocg: {\r\n trueBaseline: 1146.5,\r\n trueEdge: 736,\r\n trueWidth: 435,\r\n },\r\n tcg: {\r\n trueBaseline: 1149.5,\r\n trueEdge: 733,\r\n trueWidth: 380,\r\n },\r\n};\r\n\r\nexport const PasswordCoordinateMap: Record = {\r\n ocg: {\r\n trueBaseline: 1148.931,\r\n trueEdge: 37.031,\r\n trueWidth: 255,\r\n },\r\n tcg: {\r\n trueBaseline: 1149.431,\r\n trueEdge: 37.031,\r\n trueWidth: 311,\r\n },\r\n};","/** Dicitionary that convert popular letters combination into a fragment block with (most of the time) corresponding furigana attached.\r\n * \r\n * This is created based on pure survey only. Also this is based on regex, so do not add too many entries into this one. Around 300 would be a nice limit to stop, after all this is just a helper. There are much more rules and block words in practice that we basically have no way to collect and implement.\r\n * \r\n * Each dicitionary entry has at most 4 fields.\r\n * * `shortForm`: Pure letters without decoration, act as the primary key in this dictionary.\r\n * * `regexForm`: Some words may blend inside fragment and will get falsely detected, especially English letter. For example \"銀翼のAXE-サリー\" OCG has letter X in its name, which maybe detected as Xyz Monster. Regex form will (try to) solve this problem.\r\n * * `rubyForm`: The full version of `shortForm`, with furigana and control characters attached.\r\n * * `rubyFormName`: In very rare case, the same `shortForm` has different treatment based on the section it belong in. This field (if existed) will be preferred when converting the name of the card.\r\n * \r\n * Overall we want to sort this list based on the length of the shortForm, so we match larger entry first. For example, the letter \"族\" appears both as a standalone letter and in the word \"種族\", we naturally want to match the word \"種族\" first.\r\n */\r\nexport const ocgKeywordDataList = [\r\n {\r\n shortForm: '特殊召喚',\r\n rubyForm: '{特|とく}{殊|しゅ}{召|しょう}{喚|かん}',\r\n },\r\n {\r\n shortForm: 'カード',\r\n rubyForm: '{カード}',\r\n },\r\n {\r\n shortForm: 'デュエル',\r\n rubyForm: '{デュエル}',\r\n },\r\n {\r\n shortForm: 'マッチ',\r\n rubyForm: '{マッチ}',\r\n },\r\n {\r\n shortForm: 'ターン',\r\n rubyForm: '{ターン}',\r\n },\r\n {\r\n shortForm: 'プレイヤー',\r\n rubyForm: '{プレイヤー}',\r\n },\r\n {\r\n shortForm: '自分',\r\n rubyForm: '{自|じ}{分|ぶん}',\r\n },\r\n {\r\n shortForm: '相手',\r\n rubyForm: '{相|あい}{手|て}',\r\n },\r\n {\r\n shortForm: 'LP',\r\n regexForm: '(? {\r\n acc[cur.shortForm] = cur;\r\n return acc;\r\n}, {} as Record);","type FinishInstruction = { opacity?: number, blendMode?: GlobalCompositeOperation };\r\nconst type3CommonInstruction: FinishInstruction[] = [{ blendMode: 'overlay', opacity: 1 }];\r\nconst type8CommonInstruction: FinishInstruction[] = [\r\n { blendMode: 'overlay', opacity: 0.65 },\r\n { blendMode: 'multiply', opacity: 0.55 },\r\n];\r\n\r\n/** @summary Web engine has less blend mode than photoshop (or any desktop image manipulators for that matter), the behavior of similar blend mode is also different, so we currently we cannot have a 1:1 conversion between photoshop layer into canvas. */\r\n\r\nexport type FinishInformation = {\r\n value: string,\r\n label: React.ReactNode,\r\n partInstructionMap: Record,\r\n};\r\nexport const FinishMap: Record = {\r\n type1: {\r\n value: 'type1',\r\n label: '1',\r\n partInstructionMap: {},\r\n },\r\n type2: {\r\n value: 'type2',\r\n label: '2',\r\n partInstructionMap: {},\r\n },\r\n type3: {\r\n value: 'type3',\r\n label: '3',\r\n partInstructionMap: {\r\n 'art-overlay': type3CommonInstruction,\r\n 'art-border': type3CommonInstruction,\r\n 'art-border-pendulum': type3CommonInstruction,\r\n 'border-pendulum': type3CommonInstruction,\r\n 'attribute': type3CommonInstruction,\r\n 'frame': type3CommonInstruction,\r\n },\r\n },\r\n type4: {\r\n value: 'type4',\r\n label: '4',\r\n partInstructionMap: {},\r\n },\r\n type5: {\r\n value: 'type5',\r\n label: '5',\r\n partInstructionMap: {},\r\n },\r\n type6: {\r\n value: 'type6',\r\n label: '6',\r\n partInstructionMap: {},\r\n },\r\n type7: {\r\n value: 'type7',\r\n label: '7',\r\n partInstructionMap: {\r\n 'total-overlay': [{ blendMode: 'screen', opacity: 0.175 }, { blendMode: 'color-dodge', opacity: 0.125 }],\r\n },\r\n },\r\n type8: {\r\n value: 'type8',\r\n label: '8',\r\n partInstructionMap: {\r\n 'art-border': type8CommonInstruction,\r\n 'art-border-pendulum': type8CommonInstruction,\r\n 'border-pendulum': type8CommonInstruction,\r\n 'frame': type8CommonInstruction,\r\n 'frame-background': type8CommonInstruction,\r\n 'name': type8CommonInstruction,\r\n 'star': type8CommonInstruction,\r\n },\r\n },\r\n type9: {\r\n value: 'type9',\r\n label: '9',\r\n partInstructionMap: {\r\n 'total-overlay': [{ blendMode: 'screen', opacity: 0.45 }],\r\n },\r\n },\r\n};\r\n\r\nexport const ArtFinishMap: Record = {\r\n type1: {\r\n value: 'type1',\r\n label: '1',\r\n partInstructionMap: {\r\n art: [{}],\r\n },\r\n },\r\n type2: {\r\n value: 'type2',\r\n label: '2',\r\n partInstructionMap: {\r\n art: [\r\n { opacity: 0.08, blendMode: 'darken' },\r\n { opacity: 0.28, blendMode: 'color-dodge' },\r\n { opacity: 0.48, blendMode: 'multiply' },\r\n ],\r\n },\r\n },\r\n type3: {\r\n value: 'type3',\r\n label: '3',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.66, blendMode: 'color-dodge' }, { opacity: 0.64, blendMode: 'multiply' }],\r\n },\r\n },\r\n type4: {\r\n value: 'type4',\r\n label: '4',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.31, blendMode: 'color-dodge' }, { opacity: 0.6, blendMode: 'multiply' }]\r\n },\r\n },\r\n type5: {\r\n value: 'type5',\r\n label: '5',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.19, blendMode: 'color-dodge' }, { opacity: 0.6, blendMode: 'multiply' }]\r\n },\r\n },\r\n type6: {\r\n value: 'type6',\r\n label: '6',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.25, blendMode: 'color-dodge' }, { opacity: 0.6, blendMode: 'multiply' }]\r\n },\r\n },\r\n type7: {\r\n value: 'type7',\r\n label: '7',\r\n partInstructionMap: {\r\n art: [{}],\r\n },\r\n },\r\n};\r\n\r\nexport type FoilDictionary = {\r\n normal: string,\r\n gold: string,\r\n platinum: string,\r\n};\r\nexport const getFoilList = (dictionary: FoilDictionary) => [\r\n {\r\n name: 'normal' as const,\r\n label: dictionary.normal,\r\n color: '#747b95',\r\n },\r\n {\r\n name: 'gold' as const,\r\n label: dictionary.gold,\r\n color: '#cfa65f',\r\n },\r\n {\r\n name: 'platinum' as const,\r\n label: dictionary.platinum,\r\n color: '#b1b1b1',\r\n },\r\n];\r\nexport type Foil = ReturnType[0]['name'];","export type FontGetter = {\r\n getFont: () => string,\r\n getFontInfo: () => {\r\n style: '' | 'italic' | 'small-caps',\r\n size: `${number}px`,\r\n sizeAsNumber: number,\r\n family: string,\r\n weight: '' | 'bold',\r\n },\r\n setWeight(nextWeight: '' | 'bold'): FontGetter,\r\n setStyle(nextStyle: '' | 'italic' | 'small-caps'): FontGetter,\r\n setSize(nextSize: number | `${number}px` | ((currentSize: number) => number | `${number}px`)): FontGetter,\r\n setFamily(nextFamily: string): FontGetter,\r\n};\r\n\r\nexport type FontSizeData = {\r\n bulletSymbolWidth: number,\r\n capitalLetterRatio?: number,\r\n fontSize: number,\r\n headTextFontRatio?: number,\r\n headTextSpacing?: number,\r\n iconSymbolWidth?: number,\r\n largeSymbolRatio?: number,\r\n letterSpacing?: number,\r\n lineCount: number,\r\n lineHeight: number,\r\n offsetY?: number,\r\n ordinalFontRatio?: number,\r\n ordinalFontOffsetY?: number,\r\n squareBracketRatio?: number,\r\n wordLetterSpacing?: number,\r\n};\r\nexport const DefaultFontSizeData = {\r\n capitalLetterRatio: 1,\r\n headTextFontRatio: 0.355,\r\n headTextSpacing: 0.5,\r\n largeSymbolRatio: 1.35,\r\n letterSpacing: 0,\r\n offsetY: 0,\r\n ordinalFontOffsetY: -2,\r\n ordinalFontRatio: 1 / 1.1,\r\n squareBracketRatio: 1,\r\n};\r\n\r\n/**\r\n * @summary For some weird reasons, letter sometime just got deviated from current baseline compare to other letters of the same font only in 1:1 scale. The only known case is with MatrixRegularSmallCaps font with font size bigger than around 85px. This deviation create a small but noticeable disruption in baseline, which currently we are unable to fix. We cannot fix this in canvas, and modify the font directly give no positive result.\r\n * \r\n * So for now we can only hardcode a list of problematic letters with their correpsonding treatment. This is just baffling.\r\n */\r\nexport const DefaultFontDeviation: Required = {\r\n yOffset: 0,\r\n yRatio: 1,\r\n};\r\nexport type FontDeviation = {\r\n yRatio?: number,\r\n yOffset?: number,\r\n};\r\n\r\nexport type MetricMethod = 'name' | 'standard' | 'compact' | 'creator' | 'furigana';\r\nexport type FontData = {\r\n alphabetFont: string,\r\n font: string,\r\n fontList: FontSizeData[],\r\n letterDeviationMap?: Record,\r\n fontStyle: string,\r\n furiganaFont: string,\r\n headTextBold?: boolean,\r\n headTextFillStyle?: string,\r\n headTextGapRatio?: number,\r\n headTextHeightRatio?: number,\r\n headTextOverflow?: 'normal' | 'condense',\r\n metricMethod?: MetricMethod,\r\n numberFont?: string,\r\n numberFontRatio?: number,\r\n ordinalFont: string,\r\n symbolFont: string,\r\n symbolFontRatio: number,\r\n weight?: 'bold',\r\n};\r\nexport const DefaultFontData = {\r\n headTextHeightRatio: 0.800,\r\n headTextOverflow: 'normal' as 'normal' | 'condense',\r\n headTextBold: true,\r\n headTextGapRatio: 0.03125,\r\n};\r\nexport type TextData = {\r\n fontData: FontData,\r\n fontLevel: number,\r\n currentFont: FontGetter,\r\n};\r\n\r\nconst DefaultEffectFontData = {\r\n alphabetFont: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n headTextFontRatio: 0.7,\r\n headTextHeightRatio: 0.815,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 1,\r\n headTextGapRatio: 0,\r\n};\r\nconst DefaultTCGEffectFontData: FontData = {\r\n ...DefaultEffectFontData,\r\n font: 'MatrixBook',\r\n headTextHeightRatio: 0.750,\r\n fontStyle: 'tcg',\r\n fontList: [],\r\n};\r\nexport const DefaultTCGNormalFontData: FontData = {\r\n ...DefaultEffectFontData,\r\n font: '\"stone-serif-regular\"',\r\n headTextHeightRatio: 0.750,\r\n fontStyle: 'tcg',\r\n fontList: [],\r\n};\r\nconst DefaultOCGEffectFontData: FontData = {\r\n ...DefaultEffectFontData,\r\n font: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n fontStyle: 'ocg',\r\n metricMethod: 'compact',\r\n fontList: [],\r\n};\r\n\r\nexport const EffectFontData: Record = {\r\n 'tcg': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 24.38, lineHeight: 24.7, lineCount: 8 },\r\n { bulletSymbolWidth: 23, fontSize: 19.94, lineHeight: 21.15, lineCount: 10 },\r\n ],\r\n },\r\n 'tcg-stat': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 25.2, lineHeight: 24.9, lineCount: 7 },\r\n ]\r\n },\r\n 'tcg-type-stat': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 25.2, lineHeight: 24.9, lineCount: 6 },\r\n { bulletSymbolWidth: 23, fontSize: 19.95, lineHeight: 21.5, lineCount: 7 },\r\n { bulletSymbolWidth: 23, fontSize: 18.8, lineHeight: 18.8, lineCount: 8 },\r\n { bulletSymbolWidth: 19, fontSize: 16.7, lineHeight: 16.7, lineCount: 9 },\r\n { bulletSymbolWidth: 19, fontSize: 15.0, lineHeight: 15.0, lineCount: 10 },\r\n ]\r\n },\r\n 'tcg-type': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 25.2, lineHeight: 24.9, lineCount: 7 },\r\n ]\r\n },\r\n 'ocg': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22, lineHeight: 26, lineCount: 7 },\r\n { bulletSymbolWidth: 16, fontSize: 22, lineHeight: 26, lineCount: 8 },\r\n ]\r\n },\r\n 'ocg-stat': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22.05, lineHeight: 25.8, lineCount: 7 },\r\n ]\r\n },\r\n 'ocg-type-stat': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22.05, lineHeight: 25.8, lineCount: 6 },\r\n ]\r\n },\r\n 'ocg-type': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22.05, lineHeight: 25.8, lineCount: 7 },\r\n ]\r\n },\r\n};\r\n\r\nexport const TCGVanillaTypeStatFontList = [\r\n { bulletSymbolWidth: 23, fontSize: 21.8, lineHeight: 24.9, lineCount: 6 },\r\n { bulletSymbolWidth: 23, fontSize: 17.28, lineHeight: 21.5, lineCount: 7 },\r\n { bulletSymbolWidth: 23, fontSize: 16.28, lineHeight: 18.8, lineCount: 8 },\r\n { bulletSymbolWidth: 19, fontSize: 14.46, lineHeight: 16.7, lineCount: 9 },\r\n { bulletSymbolWidth: 19, fontSize: 12.99, lineHeight: 15.0, lineCount: 10 },\r\n];\r\n\r\nexport const PendulumEffectFontData: Record = {\r\n tcg: {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 24.3, lineHeight: 24.35, lineCount: 5 },\r\n ],\r\n },\r\n ocg: {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 16,\r\n fontSize: 22.05,\r\n lineHeight: 25.2,\r\n headTextFontRatio: 0.4,\r\n lineCount: 5,\r\n },\r\n ],\r\n },\r\n};\r\n\r\nexport type CondenseType = 'veryStrict' | 'veryLoose' | 'strict' | 'loose' | 'relaxed';\r\nexport const CondenseTolerantMap: Record> = {\r\n veryStrict: {\r\n '1': 600,\r\n '2': 620,\r\n '3': 640,\r\n },\r\n strict: {\r\n '1': 645,\r\n '2': 665,\r\n '3': 685,\r\n },\r\n loose: {\r\n '1': 700,\r\n '2': 710,\r\n '3': 720,\r\n },\r\n veryLoose: {\r\n '1': 740,\r\n '2': 770,\r\n '3': 800,\r\n },\r\n relaxed: {\r\n '1': 800,\r\n '2': 850,\r\n '3': 900,\r\n },\r\n};\r\nexport const CondenseTolerantLabelMap: Record = {\r\n veryStrict: {\r\n label: '5',\r\n order: 1,\r\n },\r\n strict: {\r\n label: '4',\r\n order: 2,\r\n },\r\n loose: {\r\n label: '3',\r\n order: 3,\r\n },\r\n veryLoose: {\r\n label: '2',\r\n order: 4,\r\n },\r\n relaxed: {\r\n label: '1',\r\n order: 5,\r\n },\r\n};","import { FontData } from './font-data-effect';\r\n\r\nexport type NameFontData = {\r\n value: string,\r\n labelKey: string,\r\n fontData: FontData,\r\n};\r\nexport const NameFontDataMap: Record<'Default' | 'Arial' | 'OCG', NameFontData> = {\r\n Default: {\r\n value: 'Default',\r\n labelKey: 'input.name-style.font-type.default',\r\n fontData: {\r\n alphabetFont: 'MatrixRegularSmallCaps',\r\n font: 'MatrixRegularSmallCaps',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n fontStyle: 'tcg',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.775,\r\n headTextHeightRatio: 0.55,\r\n fontList: [{\r\n bulletSymbolWidth: 64,\r\n fontSize: 91.5,\r\n headTextFontRatio: 0.190,\r\n letterSpacing: 0.015,\r\n lineCount: 1,\r\n lineHeight: 91.5,\r\n offsetY: 0,\r\n }],\r\n letterDeviationMap: {\r\n i: { yOffset: 1, yRatio: 1.03 },\r\n ì: { yOffset: 1, yRatio: 1.03 },\r\n í: { yOffset: 1, yRatio: 1.03 },\r\n î: { yOffset: 1, yRatio: 1.03 },\r\n ï: { yOffset: 1, yRatio: 1.03 },\r\n ĩ: { yOffset: 1, yRatio: 1.03 },\r\n ī: { yOffset: 1, yRatio: 1.03 },\r\n ĭ: { yOffset: 1, yRatio: 1.03 },\r\n į: { yOffset: 1, yRatio: 1.03 },\r\n ǐ: { yOffset: 1, yRatio: 1.03 },\r\n ȉ: { yOffset: 1, yRatio: 1.03 },\r\n ȋ: { yOffset: 1, yRatio: 1.03 },\r\n ɨ: { yOffset: 1, yRatio: 1.03 },\r\n ɩ: { yOffset: 1, yRatio: 1.03 },\r\n ᵹ: { yOffset: 1, yRatio: 1.03 },\r\n ᵼ: { yOffset: 1, yRatio: 1.03 },\r\n ᶖ: { yOffset: 1, yRatio: 1.03 },\r\n ḭ: { yOffset: 1, yRatio: 1.03 },\r\n ḯ: { yOffset: 1, yRatio: 1.03 },\r\n ỉ: { yOffset: 1, yRatio: 1.03 },\r\n ị: { yOffset: 1, yRatio: 1.03 },\r\n I: { yOffset: 1, yRatio: 1.022 },\r\n Ì: { yOffset: 1, yRatio: 1.022 },\r\n Í: { yOffset: 1, yRatio: 1.022 },\r\n Î: { yOffset: 1, yRatio: 1.022 },\r\n Ï: { yOffset: 1, yRatio: 1.022 },\r\n Ĩ: { yOffset: 1, yRatio: 1.022 },\r\n Ī: { yOffset: 1, yRatio: 1.022 },\r\n Ĭ: { yOffset: 1, yRatio: 1.022 },\r\n Į: { yOffset: 1, yRatio: 1.022 },\r\n İ: { yOffset: 1, yRatio: 1.022 },\r\n Ɩ: { yOffset: 1, yRatio: 1.022 },\r\n Ɨ: { yOffset: 1, yRatio: 1.022 },\r\n Ǐ: { yOffset: 1, yRatio: 1.022 },\r\n Ȉ: { yOffset: 1, yRatio: 1.022 },\r\n Ȋ: { yOffset: 1, yRatio: 1.022 },\r\n Ḭ: { yOffset: 1, yRatio: 1.022 },\r\n Ḯ: { yOffset: 1, yRatio: 1.022 },\r\n Ỉ: { yOffset: 1, yRatio: 1.022 },\r\n Ị: { yOffset: 1, yRatio: 1.022 },\r\n },\r\n },\r\n },\r\n Arial: {\r\n value: 'Arial',\r\n labelKey: 'input.name-style.font-type.arial',\r\n fontData: {\r\n alphabetFont: 'Arial',\r\n font: 'Arial',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n fontStyle: 'tcg',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.775,\r\n headTextHeightRatio: 0.825,\r\n weight: 'bold',\r\n fontList: [{\r\n bulletSymbolWidth: 40.67,\r\n fontSize: 61,\r\n headTextFontRatio: 0.190,\r\n letterSpacing: -0.14,\r\n lineCount: 1,\r\n lineHeight: 61,\r\n offsetY: 3,\r\n }],\r\n },\r\n },\r\n OCG: {\r\n value: 'OCG',\r\n labelKey: 'input.name-style.font-type.ocg',\r\n fontData: {\r\n alphabetFont: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n font: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n headTextHeightRatio: 0.775,\r\n headTextOverflow: 'condense',\r\n headTextBold: true,\r\n metricMethod: 'name',\r\n numberFont: 'DFKakuTaiHiStd-W4',\r\n numberFontRatio: 1.00,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.775,\r\n fontStyle: 'ocg',\r\n fontList: [{\r\n bulletSymbolWidth: 42.67,\r\n fontSize: 64,\r\n headTextFontRatio: 0.175,\r\n headTextSpacing: 3,\r\n letterSpacing: -0.03,\r\n lineCount: 1,\r\n lineHeight: 64,\r\n offsetY: 0,\r\n }],\r\n }\r\n },\r\n};","import { FontData } from './font-data-effect';\r\n\r\nexport const tcgCreatorFontData: FontData = {\r\n font: 'stone-serif-regular',\r\n alphabetFont: 'stone-serif-regular',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: 'stone-serif-regular',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'tcg',\r\n fontList: [\r\n {\r\n offsetY: -1,\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 21.2,\r\n lineHeight: 21.2,\r\n lineCount: 1,\r\n letterSpacing: -0.01,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 20,\r\n lineHeight: 20,\r\n lineCount: 1,\r\n letterSpacing: -0.01,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n ],\r\n};\r\nexport const ocgCreatorFontData: FontData = {\r\n font: '\"FOT-Rodin Pro M\"',\r\n alphabetFont: '\"FOT-Rodin Pro M\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n metricMethod: 'creator',\r\n fontStyle: 'ocg',\r\n fontList: [{\r\n bulletSymbolWidth: 18,\r\n fontSize: 19.0,\r\n letterSpacing: 0.05,\r\n lineHeight: 20.5,\r\n lineCount: 1,\r\n headTextFontRatio: 0,\r\n wordLetterSpacing: 0.11,\r\n }],\r\n};\r\nexport const CreatorFontData: Record = {\r\n tcg: tcgCreatorFontData,\r\n ocg: ocgCreatorFontData,\r\n};\r\n\r\nexport const tcgPasswordFontData: FontData = {\r\n font: 'stone-serif-regular',\r\n alphabetFont: 'stone-serif-regular',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: 'stone-serif-regular',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'tcg',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 22.219,\r\n lineHeight: 22.219,\r\n lineCount: 1,\r\n letterSpacing: 0.1,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 21,\r\n lineHeight: 21,\r\n lineCount: 1,\r\n letterSpacing: 0,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n offsetY: 1,\r\n },\r\n ],\r\n};\r\nexport const ocgPasswordFontData: FontData = {\r\n font: '\"FOT-Rodin Pro M\"',\r\n alphabetFont: '\"FOT-Rodin Pro M\"',\r\n numberFont: 'stone-serif-regular',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'ocg',\r\n metricMethod: 'furigana',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 22.219,\r\n lineHeight: 22.219,\r\n lineCount: 1,\r\n letterSpacing: 0.1,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 19.0,\r\n headTextFontRatio: 0,\r\n largeSymbolRatio: 1.25,\r\n lineCount: 1,\r\n lineHeight: 20.5,\r\n ordinalFontOffsetY: 1,\r\n ordinalFontRatio: 1.25,\r\n },\r\n ],\r\n};\r\nexport const PasswordFontData: Record = {\r\n tcg: tcgPasswordFontData,\r\n ocg: ocgPasswordFontData,\r\n};\r\n\r\nexport const tcgTypeAbilityFontData: FontData = {\r\n font: 'YuGiOhITCStoneSerifBSc',\r\n alphabetFont: 'YuGiOhITCStoneSerifBSc',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: 'YuGiOhITCStoneSerifBSc',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'tcg',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 31.5,\r\n lineHeight: 31.5,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n capitalLetterRatio: 0.95,\r\n letterSpacing: 0.02,\r\n headTextFontRatio: 0.4,\r\n },\r\n {\r\n bulletSymbolWidth: 21.80,\r\n fontSize: 32.75,\r\n lineHeight: 32.75,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n capitalLetterRatio: 0.95,\r\n letterSpacing: -0.03,\r\n headTextFontRatio: 0.4,\r\n },\r\n {\r\n bulletSymbolWidth: 14.80,\r\n fontSize: 44.5,\r\n lineHeight: 44.5,\r\n lineCount: 1,\r\n iconSymbolWidth: 45,\r\n // Noticeable baseline mismatch when this ratio reach 0.9, some rounding magic fuckery is going on here\r\n capitalLetterRatio: 0.90001,\r\n squareBracketRatio: 0.94001,\r\n letterSpacing: -0.03,\r\n headTextFontRatio: 0.4,\r\n },\r\n ],\r\n};\r\nexport const ocgTypeAbilityFontData: FontData = {\r\n font: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n alphabetFont: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n headTextHeightRatio: 0.775,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'ocg',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 25.2,\r\n lineHeight: 25.2,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n headTextFontRatio: 0.300,\r\n },\r\n {\r\n bulletSymbolWidth: 21.80,\r\n fontSize: 26.5,\r\n lineHeight: 26.5,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n headTextFontRatio: 0.300,\r\n },\r\n {\r\n bulletSymbolWidth: 36.80,\r\n fontSize: 48,\r\n lineHeight: 48,\r\n lineCount: 1,\r\n iconSymbolWidth: 45,\r\n headTextFontRatio: 0.25,\r\n headTextSpacing: 3,\r\n letterSpacing: -0.07,\r\n squareBracketRatio: 1.02501,\r\n },\r\n ],\r\n};\r\nexport const getTypeAbilityFontData = (): Record => ({\r\n tcg: tcgTypeAbilityFontData,\r\n ocg: ocgTypeAbilityFontData,\r\n});","/** Normalize various variant of a general letter into a single version for easier manage. For example OCG has their own version of full-width alphabet characters and digits. */\r\nexport const tcgToOCGLetterMap: Record = {\r\n '0': '0',\r\n '1': '1',\r\n '2': '2',\r\n '3': '3',\r\n '4': '4',\r\n '5': '5',\r\n '6': '6',\r\n '7': '7',\r\n '8': '8',\r\n '9': '9',\r\n 'a': 'a',\r\n 'b': 'b',\r\n 'c': 'c',\r\n 'd': 'd',\r\n 'e': 'e',\r\n 'f': 'f',\r\n 'g': 'g',\r\n 'h': 'h',\r\n 'i': 'i',\r\n 'j': 'j',\r\n 'k': 'k',\r\n 'l': 'l',\r\n 'm': 'm',\r\n 'n': 'n',\r\n 'o': 'o',\r\n 'p': 'p',\r\n 'q': 'q',\r\n 'r': 'r',\r\n 's': 's',\r\n 't': 't',\r\n 'u': 'u',\r\n 'v': 'v',\r\n 'w': 'w',\r\n 'x': 'x',\r\n 'y': 'y',\r\n 'z': 'z',\r\n 'A': 'A',\r\n 'B': 'B',\r\n 'C': 'C',\r\n 'D': 'D',\r\n 'E': 'E',\r\n 'F': 'F',\r\n 'G': 'G',\r\n 'H': 'H',\r\n 'I': 'I',\r\n 'J': 'J',\r\n 'K': 'K',\r\n 'L': 'L',\r\n 'M': 'M',\r\n 'N': 'N',\r\n 'O': 'O',\r\n 'P': 'P',\r\n 'Q': 'Q',\r\n 'R': 'R',\r\n 'S': 'S',\r\n 'T': 'T',\r\n 'U': 'U',\r\n 'V': 'V',\r\n 'W': 'W',\r\n 'X': 'X',\r\n 'Y': 'Y',\r\n 'Z': 'Z',\r\n '「': '「',\r\n '」': '」',\r\n '、': '、',\r\n // '/': '/',\r\n ':': ':',\r\n // 'ー': 'ー',\r\n // '・': '・',\r\n // '・': '・',\r\n // ':': ':',\r\n '∀': 'Ɐ',\r\n 'ꓯ': 'Ɐ',\r\n 'ꓛ': 'Ɔ',\r\n 'ꓱ': 'Ǝ',\r\n 'ꓞ': 'Ⅎ',\r\n 'ꓨ': '⅁',\r\n 'ꓘ': 'Ʞ',\r\n 'ꓶ': 'Ꞁ',\r\n '⅂': 'Ꞁ',\r\n 'ꓒ': 'Ԁ',\r\n 'ꓕ': 'Ʇ',\r\n 'Ո': 'ꓵ',\r\n 'ꓥ': 'Ʌ',\r\n '<': '<',\r\n '>': '>',\r\n '!': '!',\r\n '(': '(',\r\n ')': ')',\r\n '&': '&',\r\n ''': '\\'',\r\n '@': '@',\r\n};\r\nexport const ocgToTCGLetterMap: Record = {\r\n '0': '0',\r\n '1': '1',\r\n '2': '2',\r\n '3': '3',\r\n '4': '4',\r\n '5': '5',\r\n '6': '6',\r\n '7': '7',\r\n '8': '8',\r\n '9': '9',\r\n 'a': 'a',\r\n 'b': 'b',\r\n 'c': 'c',\r\n 'd': 'd',\r\n 'e': 'e',\r\n 'f': 'f',\r\n 'g': 'g',\r\n 'h': 'h',\r\n 'i': 'i',\r\n 'j': 'j',\r\n 'k': 'k',\r\n 'l': 'l',\r\n 'm': 'm',\r\n 'n': 'n',\r\n 'o': 'o',\r\n 'p': 'p',\r\n 'q': 'q',\r\n 'r': 'r',\r\n 's': 's',\r\n 't': 't',\r\n 'u': 'u',\r\n 'v': 'v',\r\n 'w': 'w',\r\n 'x': 'x',\r\n 'y': 'y',\r\n 'z': 'z',\r\n 'A': 'A',\r\n 'B': 'B',\r\n 'C': 'C',\r\n 'D': 'D',\r\n 'E': 'E',\r\n 'F': 'F',\r\n 'G': 'G',\r\n 'H': 'H',\r\n 'I': 'I',\r\n 'J': 'J',\r\n 'K': 'K',\r\n 'L': 'L',\r\n 'M': 'M',\r\n 'N': 'N',\r\n 'O': 'O',\r\n 'P': 'P',\r\n 'Q': 'Q',\r\n 'R': 'R',\r\n 'S': 'S',\r\n 'T': 'T',\r\n 'U': 'U',\r\n 'V': 'V',\r\n 'W': 'W',\r\n 'X': 'X',\r\n 'Y': 'Y',\r\n 'Z': 'Z',\r\n // '。': '。',\r\n '「': '「',\r\n '」': '」',\r\n '、': '、',\r\n // '/': '/',\r\n ':': ':',\r\n // 'ー': 'ー',\r\n // '・': '・',\r\n // '・': '・',\r\n // ':': ':',\r\n '∀': 'Ɐ',\r\n 'ꓯ': 'Ɐ',\r\n 'ꓛ': 'Ɔ',\r\n 'ꓱ': 'Ǝ',\r\n 'ꓞ': 'Ⅎ',\r\n 'ꓨ': '⅁',\r\n 'ꓘ': 'Ʞ',\r\n 'ꓶ': 'Ꞁ',\r\n '⅂': 'Ꞁ',\r\n 'ꓒ': 'Ԁ',\r\n 'ꓕ': 'Ʇ',\r\n 'Ո': 'ꓵ',\r\n 'ꓥ': 'Ʌ',\r\n '<': '<',\r\n '>': '>',\r\n '!': '!',\r\n '(': '(',\r\n ')': ')',\r\n '&': '&',\r\n ''': '\\'',\r\n '@': '@',\r\n};\r\n\r\n// const MirrorableLetter = {\r\n// 'ꟻ': 'F',\r\n// '⅃': 'L',\r\n// 'ꟼ': 'P',\r\n// 'И': 'N',\r\n// 'Я': 'R',\r\n// };\r\n\r\nexport const ocgNumberCircleMap: Record = {\r\n '(1)': '①',\r\n '(2)': '②',\r\n '(3)': '③',\r\n '(4)': '④',\r\n '(5)': '⑤',\r\n '(6)': '⑥',\r\n '(7)': '⑦',\r\n '(8)': '⑧',\r\n '(9)': '⑨',\r\n '(10)': '⑩',\r\n '(11)': '⑪',\r\n '(12)': '⑫',\r\n '(13)': '⑬',\r\n '(14)': '⑭',\r\n '(15)': '⑮',\r\n '(16)': '⑯',\r\n '(17)': '⑰',\r\n '(18)': '⑱',\r\n '(19)': '⑲',\r\n '(20)': '⑳',\r\n '(1)': '①',\r\n '(2)': '②',\r\n '(3)': '③',\r\n '(4)': '④',\r\n '(5)': '⑤',\r\n '(6)': '⑥',\r\n '(7)': '⑦',\r\n '(8)': '⑧',\r\n '(9)': '⑨',\r\n '(10)': '⑩',\r\n '(11)': '⑪',\r\n '(12)': '⑫',\r\n '(13)': '⑬',\r\n '(14)': '⑭',\r\n '(15)': '⑮',\r\n '(16)': '⑯',\r\n '(17)': '⑰',\r\n '(18)': '⑱',\r\n '(19)': '⑲',\r\n '(20)': '⑳',\r\n};\r\n\r\n/** Automatically convert popular OCG terms into their TCG counterpart. Never introduce machine translation here :'( */\r\nexport const ocgToTCGTermMap: Record = {\r\n /** monster type */\r\n '水族': 'Aqua',\r\n '獣族': 'Beast',\r\n '獣戦士族': 'Beast-Warrior',\r\n '創造神族': 'Creator God',\r\n 'サイバース族': 'Cyberse',\r\n '恐竜族': 'Dinosaur',\r\n '幻神獣族': 'Divine-Beast',\r\n 'ドラゴン族': 'Dragon',\r\n '天使族': 'Fairy',\r\n '悪魔族': 'Fiend',\r\n '魚族': 'Fish',\r\n 'ギャラクシー族': 'Galaxy',\r\n '幻想魔族': 'Illusion',\r\n '昆虫族': 'Insect',\r\n '機械族': 'Machine',\r\n '植物族': 'Plant',\r\n 'サイキック族': 'Psychic',\r\n '炎族': 'Pyro',\r\n '爬虫類族': 'Reptile',\r\n '岩石族': 'Rock',\r\n '海竜族': 'Sea Serpent',\r\n '魔法使い族': 'Spellcaster',\r\n '雷族': 'Thunder',\r\n '戦士族': 'Warrior',\r\n '鳥獣族': 'Winged Beast',\r\n '幻竜族': 'Wyrm',\r\n 'アンデット族': 'Zombie',\r\n 'サイボーグ族': 'Cyborg',\r\n '天界戦士族': 'Celestial Warrior',\r\n 'ハイドラゴン族': 'High Dragon',\r\n '魔導騎士族': 'Magical Knight',\r\n 'オメガサイキック族': 'Omega Psychic',\r\n /** type */\r\n 'モンスター': 'Monster',\r\n '魔法カード': 'Spell Card',\r\n '罠カード': 'Trap Card',\r\n 'アクション': 'Action',\r\n /** subType */\r\n '通常': 'Normal',\r\n '効果': 'Effect',\r\n '儀式': 'Ritual',\r\n 'フュージョン': 'Fusion', // This is Fusion in Rush Duel, when we translate this map into TCG one these two entries will have the same \"Fusion\" key. We place this one above so it will got overwritten by the normal OCG text for Fusion in the master series.\r\n '融合': 'Fusion',\r\n 'シンクロ': 'Synchro',\r\n 'エクシーズ': 'Xyz',\r\n 'ペンデュラム': 'Pendulum',\r\n 'リンク': 'Link',\r\n 'マキシマム': 'Maximum',\r\n 'トークン': 'Token',\r\n '特殊召喚': 'Special Summon',\r\n 'ダークシンクロモンスター': 'Dark Synchro',\r\n /** ability */\r\n 'チューナー': 'Tuner',\r\n 'デュアル': 'Gemini',\r\n 'リバース': 'Flip',\r\n 'トゥーン': 'Toon',\r\n 'スピリット': 'Spirit',\r\n 'ユニオン': 'Union',\r\n /** creator */\r\n '©高橋和希 スタジオ・ダイス/集英社': '©1996 KAZUKI TAKAHASHI',\r\n '©スタジオ・ダイス/集英社・テレビ東京・KONAMI': '©2020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI',\r\n /** sample card */\r\n '{純|ジュン}{狐|こ}': 'Junko',\r\n [`自分フィールドの効果モンスター×2体以上\r\n①:このカードがモンスターゾーンに存在する限り、相手フィールドのモンスターが効果を発動する度に、その相手の表側表示モンスターにピュアカウンターを1つ置く(最大1つまで)。②:このカードはピュアカウンターが置かれているモンスターが発動した効果を受けない。③:このカードはピュアカウンターが置かれているモンスターとの戦闘では破壊されない。`]: `[2+ Effect Monsters on your field]\r\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter.`,\r\n '※公式のデュエルでは使用できません。': 'This card cannot be used in a Duel.',\r\n // eslint-disable-next-line quotes\r\n '①:1ターンに1度、800LPを払って発動できる。このカードのPスケールを1つ上げる。': \"Once per turn: You can pay 800 LP, increase this card's Pendulum Scale by 1.\",\r\n};\r\nexport const tcgToOCGTermMap = Object.entries(ocgToTCGTermMap).reduce((acc, cur) => {\r\n const [ocgTerm, tcgTerm] = cur;\r\n acc[tcgTerm] = ocgTerm;\r\n\r\n return acc;\r\n}, {\r\n /** Safe fallback, because the single quote maybe converted into curly single quote */\r\n 'Once per turn: You can pay 800 LP, increase this card’s Pendulum Scale by 1.': '①:1ターンに1度、800LPを払って発動できる。このカードのPスケールを1つ上げる。',\r\n} as Record);","export type FrameInfo = {\r\n name: string,\r\n nameKey: string,\r\n edition: 'normal' | 'extendend',\r\n labelColor: string,\r\n labelBackgroundColor?: string,\r\n labelBackgroundColorList?: string[],\r\n labelBackgroundImage?: string,\r\n};\r\nexport const FrameInfoMap: Record = {\r\n 'normal': {\r\n name: 'normal',\r\n nameKey: 'input.frame.normal',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#c49c5e',\r\n },\r\n 'effect': {\r\n name: 'effect',\r\n nameKey: 'input.frame.effect',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#b96c49',\r\n },\r\n 'fusion': {\r\n name: 'fusion',\r\n nameKey: 'input.frame.fusion',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#8948a4',\r\n },\r\n 'synchro': {\r\n name: 'synchro',\r\n nameKey: 'input.frame.synchro',\r\n labelColor: '#000',\r\n edition: 'normal',\r\n labelBackgroundColor: '#efefef',\r\n },\r\n 'xyz': {\r\n name: 'xyz',\r\n nameKey: 'input.frame.xyz',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#000000',\r\n },\r\n 'link': {\r\n name: 'link',\r\n nameKey: 'input.frame.link',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#0c8ac6',\r\n },\r\n 'ritual': {\r\n name: 'ritual',\r\n nameKey: 'input.frame.ritual',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#5e85c9',\r\n },\r\n 'spell': {\r\n name: 'spell',\r\n nameKey: 'input.frame.spell',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#1b8f83',\r\n },\r\n 'trap': {\r\n name: 'trap',\r\n nameKey: 'input.frame.trap',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#c32a8c',\r\n },\r\n 'token': {\r\n name: 'token',\r\n nameKey: 'input.frame.token',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#6f6c6b',\r\n },\r\n 'dark-synchro': {\r\n name: 'dark-synchro',\r\n nameKey: 'input.frame.dark-synchro',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#4d4543',\r\n },\r\n 'obelisk': {\r\n name: 'obelisk',\r\n nameKey: 'input.frame.obelisk',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#515eb0',\r\n },\r\n 'osiris': {\r\n name: 'osiris',\r\n nameKey: 'input.frame.osiris',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#bd5044',\r\n },\r\n 'ra': {\r\n name: 'ra',\r\n nameKey: 'input.frame.ra',\r\n labelColor: '#000',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#b9ad34',\r\n },\r\n 'raviel': {\r\n name: 'raviel',\r\n nameKey: 'input.frame.raviel',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#313c5f',\r\n },\r\n 'uria': {\r\n name: 'uria',\r\n nameKey: 'input.frame.uria',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#623320',\r\n },\r\n 'hamon': {\r\n name: 'hamon',\r\n nameKey: 'input.frame.hamon',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#534a19',\r\n },\r\n 'lg-dragon': {\r\n name: 'lg-dragon',\r\n nameKey: 'input.frame.lg-dragon',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#4e84a4',\r\n },\r\n 'speed-skill': {\r\n name: 'speed-skill',\r\n nameKey: 'input.frame.speed-skill',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#199cd5',\r\n },\r\n 'zarc': {\r\n name: 'zarc',\r\n nameKey: 'input.frame.zarc',\r\n labelColor: '#000',\r\n edition: 'extendend',\r\n labelBackgroundColorList: [\r\n 'rgba(185,108,73,1)',\r\n 'rgba(137,72,164,1)',\r\n 'rgba(239,239,239,1)',\r\n 'rgba(0,0,0,1)',\r\n ],\r\n labelBackgroundImage: `linear-gradient(90deg, ${[\r\n 'rgba(185,108,73,1) 23%',\r\n 'rgba(137,72,164,1) 27%',\r\n 'rgba(137,72,164,1) 48%',\r\n 'rgba(239,239,239,1) 52%',\r\n 'rgba(239,239,239,1) 73%',\r\n 'rgba(0,0,0,1) 77%',\r\n ].join(', ')})`,\r\n },\r\n};\r\nexport const frameList = Object.values(FrameInfoMap);","export const arrowPositionList = [\r\n { top: 175, left: 55, width: 100, height: 100 },\r\n { top: 165, left: 323, width: 170, height: 80 },\r\n { top: 175, left: 655, width: 100, height: 100 },\r\n { top: 442, left: 45, width: 70, height: 170 },\r\n { top: 0, left: 0, width: 0, height: 0 }, /** Middle */\r\n { top: 442, left: 700, width: 70, height: 170 },\r\n { top: 775, left: 55, width: 100, height: 100 },\r\n { top: 810, left: 323, width: 170, height: 80 },\r\n { top: 775, left: 655, width: 100, height: 100 },\r\n];","import { ocgKeywordDataList } from './dictionary';\r\n\r\nexport const ST_ICON_SYMBOL = '⦾';\r\n\r\nexport const CAPITAL_LETTER_SOURCE = '[A-ZA-Z]';\r\nexport const CapitalLetterRegex = new RegExp(CAPITAL_LETTER_SOURCE);\r\n\r\nexport const SQUARE_BRACKET_SOURCE = '[\\\\[\\\\]【】]';\r\nexport const SquareBracketLetterRegex = new RegExp(SQUARE_BRACKET_SOURCE);\r\n\r\nexport const WHOLE_WORD_SOURCE = '[#@∞a-za-zA-ZA-Z0-90-9!!+×##@∞‘“’”:;\\\\[\\\\]\\\\(\\\\)【】\\\\.,]+';\r\nexport const WholeWordRegex = new RegExp(WHOLE_WORD_SOURCE);\r\n\r\nexport const FragmentSplitRegex = new RegExp(`({[^{}]+?}|${WHOLE_WORD_SOURCE}|.)`);\r\n// export const FragmentSplitRegex = new RegExp('({[^{}]+?}|.)');\r\n\r\nexport const UNCOMPRESSED_SOURCE = '{{([^{}]+?)}}';\r\n\r\nexport const NB_WORD_OPEN = '⦉';\r\nexport const NB_WORD_CLOSE = '⦊';\r\nexport const NB_LINE_OPEN = '⟅';\r\nexport const NB_LINE_CLOSE = '⟆';\r\nexport const NB_UNCOMPRESSED_START = '⟬';\r\nexport const NB_UNCOMPRESSED_END = '⟭';\r\n/** Remove all control characters */\r\nexport const NormalizeTextRegex = new RegExp(`[${[\r\n NB_WORD_OPEN,\r\n NB_WORD_CLOSE,\r\n NB_LINE_OPEN,\r\n NB_LINE_CLOSE,\r\n NB_UNCOMPRESSED_START,\r\n NB_UNCOMPRESSED_END,\r\n].join('')}]|(\\\\|[^}]+})`, 'g');\r\n\r\nexport const NON_BREAKABLE_SYMBOL_SOURCE = `${NB_WORD_OPEN}|${NB_WORD_CLOSE}`;\r\nexport const nonBreakableSymbolRegex = new RegExp(NON_BREAKABLE_SYMBOL_SOURCE);\r\n\r\n/** Pretty hard to automatically detect condition clause inside flavor text. We must assume that the clause is always put inside a parentheses (as official cards do). */\r\nexport const FLAVOR_CONDITION_SOURCE = `(\\\\n^[\\\\r\\\\t\\\\f\\\\v \\\\u00a0\\\\u1680\\\\u2000-\\\\u200a\\\\u2028\\\\u2029\\\\u202f\\\\u205f\\\\u3000\\\\ufeff]*\\\\n${NB_WORD_OPEN}?\\\\([\\\\w\\\\W]+\\\\)${NB_WORD_CLOSE}?)\\\\s*$`;\r\n\r\n/** Small reminder: `g` flag turn regex into stateful, and cannot be reused without reset it first. */\r\nexport const TCG_LETTER_JOINLIST = '&A-Za-z0-9\\\\-/\\\\s\\\\(\\\\)!,.‘“’”:;<>\\\\[\\\\]\\\\\\\\';\r\nexport const TCG_SYMBOL_JOINLIST = '#★@∞';\r\nexport const TCGSymbolLetterRegex = new RegExp(`[${TCG_SYMBOL_JOINLIST}]`);\r\n\r\nexport const OCG_KEYWORD_JOIN_REGEX = ocgKeywordDataList.map(entry => entry.regexForm ?? entry.shortForm).join('|');\r\nexport const OCG_KEYWORD_SOURCE = `(${OCG_KEYWORD_JOIN_REGEX})(?![^{]*})`;\r\n\r\nexport const CHIISAI_KANA_JOINLIST = 'ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻';\r\nexport const ChiisaiRegex = new RegExp(`[${CHIISAI_KANA_JOINLIST}]`);\r\n\r\nexport const OCG_RUBY_SOURCE = '{[^{}]+?}';\r\nexport const NOT_START_OF_LINE_SOURCE = `.[${CHIISAI_KANA_JOINLIST})\\\\]}〕〉》」」』】〙〗〟'\"’”⦆»‐゠–〜?!‼⁇⁈⁉・、:;,。.。、]+`;\r\nexport const NOT_END_OF_LINE_SOURCE = '[(\\\\[{〔〈《「「『【〘〖〝\\'\"‘“⦅«●]+.';\r\nexport const NOT_SPLIT_SOURCE = '.[—...‥〳〴〵)]+[^\\\\s]';\r\nexport const OCG_BULLET_SOURCE = '[①-⑳]:.';\r\n\r\nexport const NON_COMPRESSABLE_SOURCE = '[①-⑳※]';\r\nexport const NonCompressableRegex = new RegExp(NON_COMPRESSABLE_SOURCE);\r\n\r\nexport const OCG_ALPHABET_SOURCE = '[A-Za-z]';\r\nexport const OCGAlphabetRegex = new RegExp(OCG_ALPHABET_SOURCE);\r\n\r\nexport const OCGNumberRegex = new RegExp('[0-9]');\r\nexport const NumberRegex = new RegExp('[0-9]');\r\n\r\nexport const HiraganaRegex = /[あいうえおかがきぎくぐけげこごさざしじすずせぜそぞただちぢつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもやゆよらりるれろわゐゑをんゔ]/;\r\n\r\nexport const KatakanaRegex = /[アイウエオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモヤユヨラリルレロワヰヱヲンヴヷヸヹヺ]/;\r\n\r\nexport const OCGDotRegex = new RegExp('[・]');\r\nexport const ChoonpuRegex = new RegExp('[ー]');\r\nexport const NoSpaceRegex = new RegExp('[―]');\r\n\r\nconst OCG_INCREASED_LEVEL_2_WIDTH_JOINLIST = ':';\r\nexport const OCGIncreasedLevel2WidthRegex = new RegExp(`[${OCG_INCREASED_LEVEL_2_WIDTH_JOINLIST}]`);\r\n\r\nconst OCG_INCREASED_WIDTH_JOINLIST = '。、';\r\nexport const OCGIncreasedWidthRegex = new RegExp(`[${OCG_INCREASED_WIDTH_JOINLIST}]`);\r\n\r\nconst OCG_NO_OVERHEAD_GAP_JOINLIST = ':';\r\nexport const OCGNoOverheadGapRegex = new RegExp(`[${OCG_NO_OVERHEAD_GAP_JOINLIST}]`);\r\n\r\nexport const OCGOffsetMap: Record = {\r\n '。': -0.2,\r\n '、': -0.2,\r\n '「': 0,\r\n '」': 0,\r\n ':': 0,\r\n '>': 0.25,\r\n '<': -0.25,\r\n};\r\nexport const OCGLastOfLineOffsetMap: Record = {\r\n '。': -0.5,\r\n ':': -0.25,\r\n};\r\nexport const OCGBoxSpacingRatioMap: Record = {\r\n '>': 0.125,\r\n '<': 0.125,\r\n};\r\nexport const TCGOffsetMap: Record = {\r\n '\\\\': -0.025,\r\n};\r\nexport const TCGLastOfLineOffsetMap: Record = {\r\n};\r\nexport const TCGBoxSpacingRatioMap: Record = {\r\n '\\\\': 0.3,\r\n};\r\n\r\nexport const OCG_REDUCED_AT_END_LINE_RATIO = 0.500;\r\n\r\nexport const BULLET_LETTER = '●';\r\nexport const getBulletSpacing = (format: string) => format === 'tcg' ? 7 : 1;\r\n\r\nexport const MAX_LINE_REVERSE_INDENT = 20;\r\nexport const START_OF_LINE_ALPHABET_OFFSET = 4;\r\n\r\nexport const RUBY_REGEX = /{[^{}]+?}/;\r\n/** If foot text consist of multiple letter and overflow mode is `condense`, head text will also condense but with a smaller rate (that mean they are less compressed), this is the bonus rate. So if foot text is compressed by 50%, head text only got compressed by 40%. */\r\nexport const RUBY_BONUS_RATIO = 0.1;\r\n\r\nexport const BREAKABLE_LETTER = '\\\\s\\\\-/';\r\n/** Default ratio to calculate the gap of a letter. We do not want head text to overlap, so a letter cannot give more space than half of it size. 40-50% is nice enough. */\r\nexport const LETTER_GAP_RATIO = -0.5;\r\nexport const GAP_PER_WIDTH_RATIO = -2.25;","import { BackgroundType, CardOpacity, getDefaultCardOpacity } from './canvas';\r\nimport { Foil } from './foil-finish';\r\nimport { CondenseType } from './font-data-effect';\r\nimport { NO_ICON } from './icon';\r\nimport { getDefaultNameStyle, getDefaultTextStyle, NameStyle, NameStyleType } from './name-preset';\r\n\r\nexport type Card = ReturnType;\r\nexport const getDefaultCard = () => ({\r\n version: 0,\r\n format: 'tcg',\r\n frame: 'fusion',\r\n foil: 'normal' as Foil,\r\n opacity: getDefaultCardOpacity() as Partial,\r\n finish: [] as string[],\r\n artFinish: 'normal',\r\n name: 'Junko',\r\n nameStyleType: 'auto' as NameStyleType,\r\n nameStyle: getDefaultNameStyle() as Partial,\r\n attribute: 'LIGHT',\r\n subFamily: NO_ICON,\r\n cardIcon: 'auto',\r\n star: 6,\r\n starAlignment: 'auto',\r\n art: 'https://i.imgur.com/h5kXZeC.png',\r\n artCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n } as Partial,\r\n hasBackground: false,\r\n background: '',\r\n backgroundType: 'fit' as BackgroundType,\r\n backgroundCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n } as Partial,\r\n linkMap: [\r\n '1',\r\n '3',\r\n '7',\r\n '9',\r\n ] as string[],\r\n isPendulum: false,\r\n pendulumFrame: 'auto',\r\n pendulumEffect: 'Once per turn: You can pay 800 LP, increase this card\\'s Pendulum Scale by 1.',\r\n pendulumScaleRed: '4',\r\n pendulumScaleBlue: '4',\r\n typeAbility: [\r\n 'Fairy',\r\n 'Fusion',\r\n 'Effect',\r\n ] as string[],\r\n effectStyle: {\r\n condenseTolerant: 'strict' as CondenseType,\r\n },\r\n effect: `[2+ Effect Monsters on your field]\r\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter.`,\r\n setId: 'YGOC-EN001',\r\n atk: '2000',\r\n def: '2000',\r\n password: '18111996',\r\n sticker: 'holo5',\r\n isFirstEdition: true,\r\n isSpeedCard: false,\r\n isDuelTerminalCard: false,\r\n creator: '©2020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI',\r\n furiganaHelper: true,\r\n statTextStyle: getDefaultTextStyle(),\r\n typeTextStyle: getDefaultTextStyle(),\r\n effectTextStyle: getDefaultTextStyle(),\r\n pendulumTextStyle: getDefaultTextStyle(),\r\n});\r\nexport const getEmptyCard = (): Card => ({\r\n version: 0,\r\n format: 'tcg',\r\n frame: 'effect',\r\n foil: 'normal',\r\n opacity: getDefaultCardOpacity(),\r\n finish: [],\r\n artFinish: 'normal',\r\n name: '',\r\n nameStyleType: 'auto',\r\n nameStyle: getDefaultNameStyle(),\r\n attribute: 'LIGHT',\r\n subFamily: NO_ICON,\r\n cardIcon: 'auto',\r\n star: 6,\r\n starAlignment: 'auto',\r\n art: 'https://i.imgur.com/jjtCuG5.png',\r\n artCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n },\r\n hasBackground: false,\r\n background: '',\r\n backgroundType: 'fit',\r\n backgroundCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n },\r\n linkMap: [],\r\n isPendulum: false,\r\n pendulumFrame: 'auto',\r\n pendulumEffect: '',\r\n pendulumScaleRed: '4',\r\n pendulumScaleBlue: '4',\r\n typeAbility: [],\r\n effectStyle: {\r\n condenseTolerant: 'strict',\r\n },\r\n effect: '',\r\n setId: '',\r\n atk: '0',\r\n def: '0',\r\n password: '',\r\n sticker: 'no-sticker',\r\n isFirstEdition: false,\r\n isSpeedCard: false,\r\n isDuelTerminalCard: false,\r\n creator: '',\r\n furiganaHelper: true,\r\n statTextStyle: getDefaultTextStyle(),\r\n typeTextStyle: getDefaultTextStyle(),\r\n effectTextStyle: getDefaultTextStyle(),\r\n pendulumTextStyle: getDefaultTextStyle(),\r\n});\r\n\r\nexport const OpacityList = [\r\n {\r\n type: 'body' as const,\r\n subType: 'artBorder' as const,\r\n label: 'Card',\r\n labelKey: 'input.opacity.body.label',\r\n tooltipKey: 'input.opacity.art-border.tooltip',\r\n },\r\n {\r\n type: 'name' as const,\r\n subType: 'nameBorder' as const,\r\n label: 'Name',\r\n labelKey: 'input.opacity.name.label',\r\n tooltipKey: 'input.opacity.name-border.tooltip',\r\n },\r\n {\r\n type: 'pendulum' as const,\r\n label: 'Pendulum',\r\n labelKey: 'input.opacity.pendulum.label',\r\n tooltipKey: null,\r\n },\r\n {\r\n type: 'text' as const,\r\n label: 'Effect',\r\n labelKey: 'input.opacity.effect.label',\r\n tooltipKey: null,\r\n },\r\n];\r\n\r\nexport const DefaultColorList = [\r\n '#4D4D4D', '#999999', '#FFFFFF', '#FF7F7F', '#FFD27F', '#FFFF7F',\r\n '#7FFF7F', '#7FBF7F', '#7FFFFF', '#7F7FFF', '#BF7FBF', '#FF7FFF',\r\n\r\n '#333333', '#808080', '#cccccc', '#7F0000', '#7F5200', '#7F7F00',\r\n '#007F00', '#004000', '#007F7F', '#00007F', '#400040', '#7F007F',\r\n\r\n '#000000', '#666666', '#B3B3B3', '#FF0000', '#FFA500', '#FFFF00',\r\n '#00FF00', '#008000', '#00FFFF', '#0000FF', '#800080', '#FF00FF',\r\n];\r\n\r\nexport * from './icon';\r\nexport * from './canvas';\r\nexport * from './coordinate-data';\r\nexport * from './dictionary';\r\nexport * from './foil-finish';\r\nexport * from './font-data-effect';\r\nexport * from './font-data-name';\r\nexport * from './font-data-other';\r\nexport * from './format';\r\nexport * from './frame';\r\nexport * from './link';\r\nexport * from './name-preset';\r\nexport * from './regex';","import { Card, Foil, frameList, NameStyle, NameStyleType, PresetNameStyleMap } from '../model';\r\n\r\nexport const checkNormal = (card: Pick) => {\r\n return card.frame === 'normal' && checkMonster(card);\r\n};\r\nexport const checkXyz = (card: Pick) => {\r\n return card.frame === 'xyz';\r\n};\r\nexport const checkDarkSynchro = (card: Pick) => {\r\n return card.frame === 'dark-synchro';\r\n};\r\nexport const checkLink = (card: Pick) => {\r\n return card.frame === 'link' && checkMonster(card);\r\n};\r\nexport const checkSpeedSkill = (card: Pick) => {\r\n return card.frame === 'speed-skill' && !checkMonster(card);\r\n};\r\nexport const checkMonster = (card: Pick) => {\r\n return card.frame !== 'spell' && card.frame !== 'trap' && card.frame !== 'speed-skill';\r\n};\r\n\r\nexport const getCardFrame = (frame: string) => {\r\n return frameList.find(entry => entry.name === frame.toLowerCase())?.name ?? 'effect';\r\n};\r\nexport const getCardIconFromFrame = (frame: string) => {\r\n if (frame === 'spell' || frame === 'trap') return 'st';\r\n if (frame === 'xyz') return 'rank';\r\n if (frame === 'dark-synchro') return 'negative-level';\r\n if (frame === 'speed-skill') return 'none';\r\n return 'level';\r\n};\r\n\r\nexport const checkLightHeader = (frame: string) => {\r\n return !checkMonster({ frame }) || checkLightFrame(frame);\r\n};\r\n\r\nexport const checkLightFrame = (frame: string) => {\r\n return ['link', 'xyz', 'dark-synchro', 'speed-skill', 'hamon', 'uria', 'raviel'].includes(frame);\r\n};\r\n\r\nexport const resolveNameStyle = ({\r\n format,\r\n frame,\r\n nameStyle,\r\n nameStyleType,\r\n foil,\r\n}: {\r\n nameStyleType: NameStyleType,\r\n nameStyle: Partial,\r\n frame: string,\r\n format: string,\r\n foil: Foil,\r\n}) => {\r\n /** Custom style will be kept as is */\r\n if (nameStyleType === 'custom') {\r\n return nameStyle;\r\n }\r\n\r\n const isSpeedSkill = checkSpeedSkill({ frame });\r\n const lightHeader = checkLightHeader(frame);\r\n\r\n let contextualFont = 'Default';\r\n if (format === 'ocg') contextualFont = 'OCG';\r\n if (isSpeedSkill && format === 'tcg') contextualFont = 'Arial';\r\n\r\n /** Predefined name style has dynamic font based on format unless explictly stated */\r\n let contextualColor = {\r\n fillStyle: lightHeader ? '#ffffff' : '#000000',\r\n headTextFillStyle: lightHeader ? '#ffffff' : '#000000',\r\n };\r\n if (nameStyleType === 'predefined') {\r\n const resultNameStyle = { ...PresetNameStyleMap[nameStyle.preset ?? 'commonB'].value };\r\n if (!PresetNameStyleMap[resultNameStyle.preset ?? 'commonB'].value.font) {\r\n resultNameStyle.font = contextualFont;\r\n }\r\n\r\n return {\r\n ...contextualColor,\r\n ...resultNameStyle,\r\n };\r\n }\r\n\r\n let contextualOutline = isSpeedSkill\r\n ? {\r\n hasOutline: true,\r\n lineWidth: 6,\r\n strokeStyle: '#000',\r\n }\r\n : {};\r\n\r\n const foilStyle = foil !== 'normal' ? PresetNameStyleMap[foil].value ?? {} : {};\r\n const frameStyle = frame === 'zarc' ? PresetNameStyleMap.animeGold.value : {};\r\n\r\n /** Auto name style has dynamic font, outline, color, fully affected by foil and frame */\r\n return {\r\n font: contextualFont,\r\n ...contextualColor,\r\n ...contextualOutline,\r\n ...foilStyle,\r\n ...frameStyle,\r\n };\r\n};","const MAX_CONDENSER_THRESHOLD = 1000;\r\n/** Simple iteration method\r\n * 1 The initial threshold is 1000, initial step is 100, max step count is 30.\r\n * 1. If current threshold satisfy the driver, or step count is already 0, return the current threshold.\r\n * 1. Step down the threshold, and keep stepdown until driver return satisfy signal, reduce step count by 1 for each step made.\r\n * 1. Otherwise if step value is less than 1, finish with the current threshold.\r\n * 1. Otherwise step up the threshold by 1 step, and cut down the step value tenfold. Repeat from step 2.\r\n * \r\n * Example, we want to reach satisfy target at 487:\r\n *\r\n```\r\nCurr Step Count Explain\r\n1000 100 30 Initial\r\n900 100 29 Down\r\n800 100 28 Down\r\n700 100 27 Down\r\n600 100 26 Down\r\n500 100 25 Down\r\n400 100 24 Down\r\n500 10 24 Up => Step / 10\r\n490 10 23 Down\r\n480 10 22 Down\r\n490 1 21 Up => Step / 10\r\n489 1 20 Down\r\n488 1 19 Down\r\n487 1 18 Down => Satisfy\r\n * ```\r\n */\r\nexport const createCondenser = (minThreshold = 0, maxThreshold = MAX_CONDENSER_THRESHOLD) => {\r\n let min = minThreshold;\r\n let max = maxThreshold;\r\n let median = max;\r\n let lastEffective = median;\r\n let iterateCount = 30;\r\n let magnitude = 100;\r\n let magnitudeReductionRatio = 10;\r\n\r\n const reverseSearch = () => {\r\n if (magnitude === 1) finish();\r\n else {\r\n median += magnitude;\r\n magnitude /= magnitudeReductionRatio;\r\n median -= magnitude;\r\n }\r\n\r\n return Math.min(median, max);\r\n };\r\n\r\n const searchDown = () => {\r\n median -= magnitude;\r\n iterateCount -= 1;\r\n\r\n return median;\r\n };\r\n\r\n const reset = (minThreshold = min, maxThreshold = max) => {\r\n min = minThreshold;\r\n max = maxThreshold;\r\n median = maxThreshold;\r\n iterateCount = 30;\r\n magnitude = 100;\r\n lastEffective = maxThreshold;\r\n };\r\n\r\n const getMedian = () => median;\r\n const setMedian = (newMedian: number) => median = newMedian;\r\n\r\n const setLastEffective = (forceMedian = median) => lastEffective = forceMedian;\r\n const getLastEffective = () => lastEffective;\r\n const applyLastEffective = () => {\r\n median = lastEffective;\r\n iterateCount = -1;\r\n return median;\r\n };\r\n\r\n const getIterateCount = () => iterateCount;\r\n const finish = () => iterateCount = -1;\r\n\r\n return {\r\n reset,\r\n searchDown,\r\n reverseSearch,\r\n finish,\r\n getMedian,\r\n setMedian,\r\n setLastEffective,\r\n getLastEffective,\r\n applyLastEffective,\r\n getIterateCount,\r\n };\r\n};\r\n\r\nexport const condense = (\r\n worker: (currentMedian: number) => boolean,\r\n minThreshold = 100,\r\n) => {\r\n let effectiveMedian = MAX_CONDENSER_THRESHOLD;\r\n const condenser = createCondenser();\r\n while (condenser.getIterateCount() >= 0) {\r\n if (condenser.getIterateCount() <= 0) {\r\n /** Support minThreshold here, we don't want to deal with 0. In practices, most text become unreadable when condense with ratio of 400 or lower. */\r\n const finalMedian = condenser.getMedian();\r\n\r\n effectiveMedian = finalMedian;\r\n break;\r\n } else {\r\n const satisfy = worker(condenser.getMedian());\r\n\r\n if (!satisfy && condenser.getMedian() > 0) {\r\n /** If overflow, lower the median and apply it */\r\n condenser.searchDown();\r\n } else {\r\n /** Return immediately if max threshold is enough to satisfy the driver */\r\n if (condenser.getMedian() === MAX_CONDENSER_THRESHOLD) break;\r\n else effectiveMedian = condenser.reverseSearch();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Ensure worker does not run with undesirable threshold (it may have side effect depend on the current ratio, for example, scale canvas). So we run worker with the final median one last time to make sure any side effects from it is affected by the ratio we gonna return.\r\n */\r\n const forcedMedian = Math.max(minThreshold, Math.min(effectiveMedian, MAX_CONDENSER_THRESHOLD));\r\n if (forcedMedian !== effectiveMedian) worker(forcedMedian);\r\n return forcedMedian;\r\n};","import { FontGetter } from 'src/model';\r\n\r\nexport const createFontGetter = (props?: {\r\n defaultWeight?: '' | 'bold',\r\n defaultStyle?: '' | 'italic' | 'small-caps',\r\n defaultSize?: number | `${number}px`,\r\n defaultFamily?: string,\r\n}): FontGetter => {\r\n const {\r\n defaultWeight = '',\r\n defaultStyle = '',\r\n defaultSize = '10px',\r\n defaultFamily = 'Arial',\r\n } = props ?? {};\r\n let weight = defaultWeight;\r\n let style = defaultStyle;\r\n let size: `${number}px` = typeof defaultSize === 'number' ? `${defaultSize}px` : defaultSize;\r\n let sizeAsNumber = typeof defaultSize === 'number' ? defaultSize : parseFloat(defaultSize.replaceAll('px', ''));\r\n let family = defaultFamily;\r\n\r\n return {\r\n getFont: () => `${[style, weight, size, family].filter(part => part !== '').join(' ')}, Arial`,\r\n getFontInfo: () => ({ style, size, family, sizeAsNumber, weight }),\r\n setWeight(nextWeight) {\r\n weight = nextWeight;\r\n return this;\r\n },\r\n setStyle(nextStyle) {\r\n style = nextStyle;\r\n return this;\r\n },\r\n setSize(nextSize) {\r\n const calculatedSize = typeof nextSize === 'function' ? nextSize(sizeAsNumber) : nextSize;\r\n size = typeof calculatedSize === 'number' ? `${calculatedSize}px` : calculatedSize;\r\n sizeAsNumber = typeof calculatedSize === 'number' ? calculatedSize : parseFloat(calculatedSize.replaceAll('px', ''));\r\n return this;\r\n },\r\n setFamily(nextFamily) {\r\n family = nextFamily;\r\n return this;\r\n },\r\n };\r\n};","import { ColorPoint } from 'react-linear-gradient-picker';\r\nimport { getDefaultNameStyle } from 'src/model';\r\n\r\nexport const getDefaultGradientPalette = (): ColorPoint[] => parsePalette(getDefaultNameStyle().gradientColor);\r\n\r\nexport const stringifyPalette = (palette?: ColorPoint[]) => (palette ?? [])\r\n .map(({ color, offset }) => `${offset}|${color}`).join(',');\r\nexport const parsePalette = (stringifiedPalette?: string): ColorPoint[] => stringifiedPalette\r\n ? stringifiedPalette.split(',')\r\n .map((entry, index) => {\r\n const [offset, color] = entry.split('|');\r\n\r\n return { color, offset, id: index + 1 };\r\n })\r\n : parsePalette(getDefaultNameStyle().gradientColor);","export const getNavigationProps = ({\r\n debug,\r\n optionLength,\r\n stopPropagation = false,\r\n setFocus,\r\n onTrigger,\r\n onCancel,\r\n onKeyPress,\r\n}: {\r\n debug?: string,\r\n optionLength: number,\r\n stopPropagation?: boolean,\r\n setFocus: (value: React.SetStateAction) => void,\r\n onTrigger: () => void,\r\n onCancel?: () => void,\r\n onKeyPress?: (ev: React.KeyboardEvent) => (void | boolean),\r\n}) => {\r\n return {\r\n tabIndex: 0,\r\n onFocus: () => {\r\n if (debug) console.info('Navigation Focus', debug);\r\n setFocus(0);\r\n },\r\n onBlur: () => {\r\n if (debug) console.info('Navigation Blur', debug);\r\n setFocus(-1);\r\n },\r\n onKeyDown: (e: React.KeyboardEvent) => {\r\n if (stopPropagation) e.stopPropagation();\r\n if (debug) console.info('Navigation Keydown', debug, e.key);\r\n if (onKeyPress?.(e) === false) return;\r\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\r\n e.preventDefault();\r\n setFocus(cur => Math.max(0, optionLength + cur + 1) % optionLength);\r\n }\r\n else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\r\n e.preventDefault();\r\n setFocus(cur => Math.max(0, optionLength + cur - 1) % optionLength);\r\n }\r\n else if (e.key === 'Enter' || e.key === ' ') {\r\n onTrigger();\r\n }\r\n else if (e.key === 'Escape') {\r\n onCancel?.();\r\n }\r\n },\r\n };\r\n};","// @ts-nocheck\r\n/* eslint-disable */\r\n// JSONCrush by Frank Force [MIT] https://github.com/KilledByAPixel/JSONCrush\r\n\"use strict\"\r\nexport const JSONCrush=(e,n=50)=>{for(var r=[],o=127;--o;)(48<=o&&57>=o||65<=o&&90>=o||97<=o&&122>=o||\"-_.!~*'()\".includes(String.fromCharCode(o)))&&r.push(String.fromCharCode(o));for(o=32;255>o;++o){var t=String.fromCharCode(o);\"\\\\\"==t||r.includes(t)||r.unshift(t)}e=e.replace(/\\u0001/g,\"\"),e=JSONCrushSwap(e),o=r.length,t=\"\";for(var i={},l=2;l=a||55296<=g&&56319>=g)){for(a=1,g=e.indexOf(h,f+l);0<=g;++a)g=e.indexOf(h,g+l);1o)break;n=r[o];var d=void 0;l=0,f=encodeURI(encodeURIComponent(n)).replace(/%../g,\"i\").length;for(let e in i)h=((h=i[e])-1)*encodeURI(encodeURIComponent(e)).replace(/%../g,\"i\").length-(h+1)*f,t.length||(h-=encodeURI(encodeURIComponent(\"\u0001\")).replace(/%../g,\"i\").length),0>=h?delete i[e]:h>l&&(d=e,l=h);if(!d)break;e=e.split(d).join(n)+n+d,t=n+t,l={};for(let r in i){for(i=r.split(d).join(n),f=0,h=e.indexOf(i);0<=h;++f)h=e.indexOf(i,h+i.length);1{var n=(e=e.substring(0,e.length-1)).split(\"\u0001\");if(e=n[0],1{const r=[['\"',\"'\"],[\"':\",\"!\"],[\",'\",\"~\"],[\"}\",\")\",\"\\\\\",\"\\\\\"],[\"{\",\"(\",\"\\\\\",\"\\\\\"]],o=(e,n)=>e.replace(new RegExp(`${(n[2]?n[2]:\"\")+n[0]}|${(n[3]?n[3]:\"\")+n[1]}`,\"g\"),e=>e===n[0]?n[1]:n[0]);if(n)for(n=0;n> = {\r\n version: 've',\r\n format: 'fm',\r\n frame: 'fr',\r\n foil: 'fo',\r\n opacity: {\r\n _newKey: 'op',\r\n body: 'opbd',\r\n pendulum: 'oppd',\r\n name: 'opnm',\r\n text: 'optx',\r\n boundless: 'opbl',\r\n /** legacy */\r\n artFrame: 'opaf',\r\n artBorder: 'opab',\r\n nameBorder: 'opnb',\r\n baseFill: 'opbf',\r\n },\r\n finish: 'fn',\r\n art: 'ar',\r\n artFinish: 'afn',\r\n artCrop: {\r\n _newKey: 'arc',\r\n x: 'arx',\r\n y: 'ary',\r\n width: 'arw',\r\n height: 'arh',\r\n unit: 'aru',\r\n aspect: 'ara',\r\n },\r\n hasBackground: 'hbg',\r\n background: 'bg',\r\n backgroundType: 'bgt',\r\n backgroundCrop: {\r\n _newKey: 'bgc',\r\n x: 'bgx',\r\n y: 'bgy',\r\n width: 'bgw',\r\n height: 'bgh',\r\n unit: 'bgu',\r\n aspect: 'bga',\r\n },\r\n name: 'na',\r\n nameStyleType: 'nst',\r\n effectStyle: {\r\n _newKey: 'es',\r\n condenseTolerant: 'cdtl',\r\n },\r\n nameStyle: {\r\n _newKey: 'ns',\r\n font: 'nsft',\r\n fillStyle: 'nsfs',\r\n headTextFillStyle: 'nshfs',\r\n shadowColor: 'nssc',\r\n shadowOffsetY: 'nssoy',\r\n shadowOffsetX: 'nssox',\r\n shadowBlur: 'nssb',\r\n hasShadow: 'nshs',\r\n lineColor: 'nslc',\r\n lineWidth: 'nslw',\r\n lineOffsetY: 'nsloy',\r\n lineOffsetX: 'nslox',\r\n hasOutline: 'nshl',\r\n gradientAngle: 'nsgd',\r\n gradientColor: 'nscg',\r\n hasGradient: 'nshg',\r\n preset: 'nspr',\r\n pattern: 'nspt',\r\n },\r\n attribute: 'at',\r\n subFamily: 'sf',\r\n star: 'st',\r\n starAlignment: 'sa',\r\n cardIcon: 'it',\r\n linkMap: 'lm',\r\n isPendulum: 'ip',\r\n pendulumFrame: 'pf',\r\n pendulumEffect: 'pe',\r\n pendulumScaleRed: 'rs',\r\n pendulumScaleBlue: 'bs',\r\n typeAbility: 'ta',\r\n effect: 'ef',\r\n setId: 'si',\r\n atk: 'atk',\r\n def: 'def',\r\n password: 'pw',\r\n sticker: 'sti',\r\n isFirstEdition: 'ife',\r\n isSpeedCard: 'isp',\r\n isDuelTerminalCard: 'idt',\r\n creator: 'cr',\r\n furiganaHelper: 'fh',\r\n effectTextStyle: 'ets',\r\n pendulumTextStyle: 'pts',\r\n statTextStyle: 'sts',\r\n typeTextStyle: 'tts',\r\n};\r\nconst legacyCardFieldShortenMap = {\r\n passcode: 'pc',\r\n picture: 'pt',\r\n pictureCrop: {\r\n _newKey: 'ptc',\r\n x: 'ptx',\r\n y: 'pty',\r\n width: 'ptw',\r\n height: 'pth',\r\n unit: 'ptu',\r\n aspect: 'pta',\r\n },\r\n};\r\nconst cardFieldShortenMap = {\r\n ...currentCardFieldShortenMap,\r\n ...legacyCardFieldShortenMap,\r\n};\r\n\r\nexport const compressCardData = (\r\n card: Record,\r\n shortenMap: Record = cardFieldShortenMap,\r\n serialize = true,\r\n) => {\r\n const condensedCard: Record = {};\r\n const normalizedCard = { ...card };\r\n\r\n Object.keys(normalizedCard).forEach(fieldKey => {\r\n const fieldValue = normalizedCard[fieldKey];\r\n\r\n if (typeof fieldValue === 'object' && fieldValue !== null && !Array.isArray(fieldValue)) {\r\n const newKey = shortenMap[fieldKey]?._newKey;\r\n\r\n if (newKey) {\r\n condensedCard[newKey] = compressCardData(fieldValue, shortenMap[fieldKey], false);\r\n }\r\n } else {\r\n const newFieldKey = shortenMap[fieldKey];\r\n\r\n if (typeof newFieldKey === 'string') condensedCard[newFieldKey] = fieldValue;\r\n }\r\n });\r\n\r\n if (serialize) return JSON.stringify(condensedCard);\r\n return condensedCard;\r\n};\r\n\r\nexport const decompressCardData = (\r\n condensedCard: Record,\r\n shortenMap: Record = cardFieldShortenMap,\r\n) => {\r\n const fullCard: Record = {};\r\n Object.keys(shortenMap).forEach(fullKey => {\r\n const shortenKey = shortenMap[fullKey];\r\n\r\n if (typeof shortenKey === 'object' && shortenKey !== null && !Array.isArray(shortenKey)) {\r\n const shortendKey = shortenKey?._newKey;\r\n\r\n if (shortendKey && condensedCard[shortendKey]) {\r\n fullCard[fullKey] = decompressCardData(condensedCard[shortendKey], shortenMap[fullKey]);\r\n }\r\n } else {\r\n if (condensedCard[shortenKey] != null) {\r\n fullCard[fullKey] = condensedCard[shortenKey];\r\n }\r\n }\r\n });\r\n return fullCard;\r\n};\r\nexport const legacyReverseCardDataShortener = (\r\n condensedCard: Record | string,\r\n shortenMap: Record = cardFieldShortenMap,\r\n) => {\r\n const normalizedCondensedCard = typeof condensedCard === 'string'\r\n ? JSON.parse(JSONUncrush(decodeURIComponent(condensedCard)))\r\n : condensedCard;\r\n\r\n const fullCard: Record = {};\r\n Object.keys(shortenMap).forEach(fullKey => {\r\n const shortenKey = shortenMap[fullKey];\r\n\r\n if (typeof shortenKey === 'object' && shortenKey !== null && !Array.isArray(shortenKey)) {\r\n const shortendKey = shortenKey?._newKey;\r\n\r\n if (shortendKey && normalizedCondensedCard[shortendKey]) {\r\n fullCard[fullKey] = legacyReverseCardDataShortener(normalizedCondensedCard[shortendKey], shortenMap[fullKey]);\r\n }\r\n } else {\r\n if (normalizedCondensedCard[shortenKey] != null) {\r\n fullCard[fullKey] = normalizedCondensedCard[shortenKey];\r\n }\r\n }\r\n });\r\n return fullCard;\r\n};\r\n\r\nexport const rebuildCardData = (\r\n card: Record | string,\r\n baseCard?: Card,\r\n) => {\r\n const normalizedCard = typeof card === 'string'\r\n ? JSON.parse(card)\r\n : card;\r\n const fullCard: Record = decompressCardData(normalizedCard);\r\n\r\n return migrateCardData(fullCard, baseCard);\r\n};\r\nexport const legacyRebuildCardData = (\r\n card: Record | string,\r\n isCondensed = false,\r\n) => {\r\n let fullCard: Record;\r\n if (isCondensed) {\r\n fullCard = legacyReverseCardDataShortener(card);\r\n } else {\r\n fullCard = typeof card === 'string'\r\n ? JSON.parse(card)\r\n : card;\r\n }\r\n\r\n return migrateCardData(fullCard);\r\n};\r\n\r\n/** Migrate old version of card data into the new version without information loss */\r\nexport const migrateCardData = (card: Record, baseCard = getEmptyCard()): Card => {\r\n const migratedCard = {\r\n ...baseCard,\r\n ...clone(card)\r\n };\r\n\r\n if (migratedCard.effectStyle == null) {\r\n migratedCard.effectStyle = {\r\n ...getEmptyCard().effectStyle\r\n };\r\n }\r\n\r\n if (migratedCard.version == null) migratedCard.version = 1;\r\n if (migratedCard.format == null) migratedCard.format = 'tcg';\r\n if (migratedCard.pendulumFrame == null) migratedCard.pendulumFrame = 'auto';\r\n if (migratedCard.finish == null) migratedCard.finish = [];\r\n\r\n if (migratedCard.artFinish == null) migratedCard.artFinish = 'normal';\r\n if ((migratedCard as any).picture && !card.art) migratedCard.art = (migratedCard as any).picture;\r\n delete (migratedCard as any).picture;\r\n\r\n if ((migratedCard as any).pictureCrop && !card.artCrop) migratedCard.artCrop = (migratedCard as any).pictureCrop;\r\n delete (migratedCard as any).pictureCrop;\r\n\r\n /** Seems like no image is fine for now. */\r\n // if ((migratedCard.art ?? '') === '') migratedCard.art = 'https://i.imgur.com/jjtCuG5.png';\r\n if ((migratedCard.art ?? '') === '') migratedCard.art = '';\r\n\r\n if (typeof (migratedCard.opacity as any).artFrame === 'boolean' && migratedCard.opacity.boundless == null) {\r\n migratedCard.opacity.boundless = !(migratedCard.opacity as any).artFrame;\r\n delete (migratedCard.opacity as any).artFrame;\r\n }\r\n migratedCard.opacity = { ...getDefaultCardOpacity(), ...migratedCard.opacity };\r\n\r\n if ((migratedCard.background ?? '') === '') migratedCard.background = '';\r\n if (migratedCard.hasBackground == null && (migratedCard.background || migratedCard.opacity.baseFill)) migratedCard.hasBackground = true;\r\n\r\n if ((migratedCard as any).kanjiHelper && !card.furiganaHelper) migratedCard.furiganaHelper = (migratedCard as any).kanjiHelper;\r\n delete (migratedCard as any).kanjiHelper;\r\n if (migratedCard.furiganaHelper === undefined) migratedCard.furiganaHelper = true;\r\n\r\n if ((migratedCard as any).passcode && !card.password) migratedCard.password = (migratedCard as any).passcode;\r\n delete (migratedCard as any).passcode;\r\n\r\n if (!migratedCard.effectTextStyle) migratedCard.effectTextStyle = getDefaultTextStyle();\r\n if (!migratedCard.pendulumTextStyle) migratedCard.pendulumTextStyle = getDefaultTextStyle();\r\n if (!migratedCard.typeTextStyle) migratedCard.typeTextStyle = getDefaultTextStyle();\r\n if (!migratedCard.statTextStyle) migratedCard.statTextStyle = getDefaultTextStyle();\r\n\r\n if (!migratedCard.starAlignment) migratedCard.starAlignment = 'auto';\r\n\r\n return migratedCard;\r\n};","export const randomCharacter = (charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', length = 1) => {\r\n let result = '';\r\n const charactersLength = charSet.length;\r\n for (let i = 0; i < length; i++) {\r\n result += charSet.charAt(Math.floor(Math.random() * charactersLength));\r\n }\r\n return result;\r\n};\r\n\r\nexport const randomSetID = (format: string) => {\r\n return randomCharacter('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 4)\r\n + '-'\r\n + (format === 'OCG' ? 'JP' : 'EN')\r\n /** Most set does not reach 200+ index, so 0, 1 and 2 has significantly higher chance to roll */\r\n + randomCharacter('0000000000111111111122222222223456789', 1)\r\n + randomCharacter('0123456789', 2);\r\n};\r\n\r\nexport const randomPassword = () => {\r\n return `${randomCharacter('0123456789', 8)}`;\r\n};\r\n\r\nexport const nextChar = (c: string) => {\r\n return String.fromCharCode(c.charCodeAt(0) + 1);\r\n};\r\n\r\nexport function insertUrlParam(key: string, value: string) {\r\n if (window.history.pushState) {\r\n let searchParams = new URLSearchParams(window.location.search);\r\n searchParams.set(key, value);\r\n let newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + searchParams.toString();\r\n window.history.pushState({ path: newurl }, '', newurl);\r\n }\r\n};\r\n\r\nexport const normalizedCardName = (name: string) => {\r\n return name.replaceAll(/\\{([^{}|]*)\\|+?[^{}|]*\\}/g, '$1');\r\n};\r\n\r\nexport const forceRefocus = (selector = '.radio-train-input-group') => {\r\n document.querySelector(selector)?.focus();\r\n};\r\n\r\nexport const HexColorRegex = /^#[a-fA-F0-9]{3}([a-fA-F0-9]{3})?$/;\r\nexport const hexToRGBA = (hex: string, withAlpha = true) => {\r\n try {\r\n const pureHex = hex.replace('#', '');\r\n let rgbaList = [0, 0, 0, 1];\r\n\r\n if (pureHex.length === 3 || pureHex.length === 4) {\r\n rgbaList = [\r\n parseInt(`${pureHex[0]}${pureHex[0]}`, 16),\r\n parseInt(`${pureHex[1]}${pureHex[1]}`, 16),\r\n parseInt(`${pureHex[2]}${pureHex[2]}`, 16),\r\n parseInt(`${pureHex[3] ?? 'f'}${pureHex[3] ?? 'f'}`, 16),\r\n ];\r\n }\r\n if (pureHex.length === 6 || pureHex.length === 8) {\r\n rgbaList = [\r\n parseInt(pureHex.slice(0, 2), 16),\r\n parseInt(pureHex.slice(2, 4), 16),\r\n parseInt(pureHex.slice(4, 6), 16),\r\n parseInt(pureHex.slice(6, 8) ?? 'ff', 16),\r\n ];\r\n }\r\n\r\n return rgbaList.map(entry => isNaN(entry) ? 255 : entry).slice(0, withAlpha ? 4 : 3);\r\n } catch (e) {\r\n return [0, 0, 0, 1].slice(0, withAlpha ? 4 : 3);\r\n }\r\n};\r\n\r\n/** Seriously, what the hell? */\r\nexport const isMobileDevice = () => {\r\n let check = false;\r\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0,4))) check = true;})(\r\n navigator.userAgent\r\n || navigator.vendor\r\n || (window as any).opera);\r\n return check;\r\n};\r\n\r\nexport function mergeClass(...args: (boolean | string | undefined | null)[]) {\r\n return args.filter(Boolean).join(' ');\r\n}\r\n\r\nexport * from './categorize';\r\nexport * from './condenser';\r\nexport * from './font';\r\nexport * from './gradient';\r\nexport * from './hook';\r\nexport * from './navigation';\r\nexport * from './codec';","import { Spin } from 'antd';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledLoadingFullViewContainer = styled.div`\r\n display: flex;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-image: linear-gradient(#fafafaaa, #fafafaaa);\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 999;\r\n`;\r\n\r\nexport const Loading = () => {\r\n return ;\r\n};\r\nLoading.FullView = () => {\r\n return \r\n \r\n ;\r\n};","import { Tooltip } from 'antd';\r\nimport { SyncOutlined } from '@ant-design/icons';\r\nimport { ExtractProps } from 'src/type';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledIconButtonContainer = styled.span`\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n margin-left: var(--spacing-xs);\r\n width: 24px;\r\n height: 24px;\r\n border: var(--bw) solid var(--sub-level-1);\r\n background-color: var(--main-level-4);\r\n border-radius: var(--br-lg);\r\n box-shadow: var(--bs-button);\r\n\tcursor: pointer;\r\n\t&:hover {\r\n\t\tbackground-color: var(--sub-level-4);\r\n\t}\r\n`;\r\n\r\nexport type IconButton = {\r\n Icon: typeof SyncOutlined,\r\n onClick: () => void,\r\n iconProps?: ExtractProps,\r\n tooltipProps: ExtractProps,\r\n containerProps?: React.HTMLAttributes,\r\n}\r\nexport const IconButton = ({\r\n Icon,\r\n onClick,\r\n iconProps,\r\n tooltipProps,\r\n containerProps,\r\n}: IconButton) => {\r\n const { className, onClick: customOnClick, onKeyDown, ...restContainerProps } = containerProps ?? {};\r\n\r\n return \r\n {\r\n onClick();\r\n customOnClick?.(e);\r\n }}\r\n onKeyDown={e => {\r\n onKeyDown?.(e);\r\n if (e.key === 'Enter') {\r\n onClick();\r\n }\r\n }}\r\n className={['icon-button', className ?? ''].join(' ')}\r\n >\r\n \r\n \r\n ;\r\n};","import { Card, ocgToTCGTermMap, tcgToOCGTermMap } from 'src/model';\r\n\r\nexport const changeCardFormat = (card: Card, targetFormat: string): Card => {\r\n const {\r\n creator,\r\n effect,\r\n format,\r\n isFirstEdition,\r\n name,\r\n password,\r\n pendulumEffect,\r\n setId,\r\n typeAbility,\r\n } = card;\r\n\r\n if (format === targetFormat) return card;\r\n\r\n const termMap = targetFormat === 'ocg' ? tcgToOCGTermMap : ocgToTCGTermMap;\r\n const newSetId = (targetFormat === 'ocg' && /-EN/.test(setId))\r\n ? setId.replace('-EN', '-JP')\r\n : targetFormat === 'tcg' && /-JP/.test(setId)\r\n ? setId.replace('-JP', '-EN')\r\n : setId;\r\n\r\n return {\r\n ...card,\r\n name: termMap[name] ?? name,\r\n format: targetFormat,\r\n effect: termMap[effect] ?? effect,\r\n pendulumEffect: termMap[pendulumEffect] ?? pendulumEffect,\r\n typeAbility: typeAbility.map(entry => termMap[entry] ?? entry),\r\n creator: termMap[creator] ?? creator,\r\n password: termMap[password] ?? password,\r\n setId: newSetId,\r\n isFirstEdition: targetFormat === 'ocg' ? false : isFirstEdition,\r\n };\r\n};","import React from 'react';\r\n\r\nexport type LanguageMetadata = {\r\n name: string,\r\n formalName: string,\r\n codeName: string,\r\n initialMessage: string,\r\n active: boolean,\r\n order: number,\r\n style?: React.CSSProperties & Record,\r\n};\r\nexport const getDefaultLanguageMetadata = () => ({\r\n name: 'Default',\r\n formalName: 'Default',\r\n codeName: 'def',\r\n initialMessage: '',\r\n order: 1000,\r\n active: false,\r\n});\r\nexport type RawLanguageData = LanguageMetadata & {\r\n rawDictionary: Record,\r\n};\r\nexport type LanguageData = ReturnType;\r\nexport type LanguageDataDictionary = LanguageData['dictionary'];\r\n\r\nexport const processLanguage = (rawLanguageData: RawLanguageData, fallbackRawDictionary: Record = {}) => {\r\n const normalizedRawDictionary = {\r\n ...fallbackRawDictionary,\r\n ...rawLanguageData.rawDictionary,\r\n };\r\n const getDictionaryEntry = (entry: string) => {\r\n return normalizedRawDictionary[entry] ?? '';\r\n };\r\n const applyTemplateNode = (template: string, nodeMap: Record) => {\r\n const splitRegex = new RegExp(`\\\\{(${Object.keys(nodeMap).join('|')})\\\\}`);\r\n /** Expectation: Odd slots belong to actual string, even slots belong to template node, we use index base */\r\n const splittedString = template.split(splitRegex);\r\n\r\n return <>\r\n {splittedString.map((entry, index) => {\r\n if (index % 2 === 0) return {entry};\r\n return nodeMap[entry];\r\n })}\r\n ;\r\n };\r\n const specializedDictionary = {\r\n 'error.load.font.tcg': (familyName: string) => {\r\n return getDictionaryEntry('error.load.font.tcg').replaceAll('{familyName}', familyName);\r\n },\r\n 'error.load.font.ocg': (familyName: string) => {\r\n return getDictionaryEntry('error.load.font.ocg').replaceAll('{familyName}', familyName);\r\n },\r\n 'contributor.disclaimer.line-1': (siteLink: React.ReactNode) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('contributor.disclaimer.line-1'),\r\n { siteLink },\r\n );\r\n },\r\n 'contributor.disclaimer.line-5': (author1: React.ReactNode, author2: React.ReactNode) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('contributor.disclaimer.line-5'),\r\n { author1, author2 },\r\n );\r\n },\r\n 'contributor.template-maker': (\r\n artist1: React.ReactNode,\r\n artist2: React.ReactNode,\r\n artist3: React.ReactNode,\r\n artist4: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('contributor.template-maker'),\r\n { artist1, artist2, artist3, artist4 },\r\n );\r\n },\r\n 'guide.format.introduction': (settingIcon: React.ReactNode) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.introduction'),\r\n { settingIcon },\r\n );\r\n },\r\n 'guide.format.section-1.content': (\r\n openTag: React.ReactNode,\r\n closeTag: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-1.content'),\r\n { openTag, closeTag, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-2.content': (\r\n openTag: React.ReactNode,\r\n closeTag: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-2.content'),\r\n { openTag, closeTag, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-3.content': (\r\n separator: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-3.content'),\r\n { separator, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-4.content': (\r\n separator: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-4.content'),\r\n { separator, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-5.content': (\r\n openTag: React.ReactNode,\r\n closeTag: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-5.content'),\r\n { openTag, closeTag, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'input.scale.label': (\r\n scaleType: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('input.scale.label'),\r\n { scaleType },\r\n );\r\n },\r\n };\r\n\r\n return {\r\n ...rawLanguageData,\r\n rawDictionary: normalizedRawDictionary,\r\n dictionary: {\r\n ...normalizedRawDictionary,\r\n ...specializedDictionary,\r\n } as typeof specializedDictionary & Record,\r\n };\r\n};","import { create } from 'zustand';\r\nimport {\r\n getDefaultLanguageMetadata,\r\n LanguageData,\r\n LanguageMetadata,\r\n processLanguage,\r\n RawLanguageData,\r\n} from './processor';\r\n\r\nexport type I18NStore = {\r\n languageInfo: LanguageMetadata,\r\n languageMetadataMap: Record,\r\n language: LanguageData['dictionary'],\r\n error: any,\r\n isLoading: boolean,\r\n isMetadataReady: boolean,\r\n isInitiating: boolean,\r\n initiate: () => Promise,\r\n loadLanguage: (language: string) => Promise,\r\n loadDefaultLanguage: () => Promise,\r\n changeLanguage: (language: string) => Promise,\r\n};\r\nexport const useI18N = create((set, get) => {\r\n const defaultLanguageName = (() => {\r\n /** Direct request from URL is preferred */\r\n const url = new URL(window.location.href);\r\n const initialParam = url.searchParams;\r\n const defaultLanguageFromURL = initialParam.get('language');\r\n /** Side effect: Remove default language after load */\r\n initialParam.delete('language');\r\n window.history.replaceState(window.history.state, '', url.href);\r\n if (defaultLanguageFromURL) return defaultLanguageFromURL;\r\n\r\n try {\r\n const cachedLanguage = window.localStorage.getItem('language');\r\n\r\n if (cachedLanguage) return cachedLanguage;\r\n return 'eng';\r\n } catch (e) {\r\n console.error('useSetting: Error when getting cached language', e);\r\n return 'eng';\r\n }\r\n })();\r\n const languageMap: Partial> = {};\r\n const defaultLanguage = processLanguage({\r\n ...getDefaultLanguageMetadata(),\r\n rawDictionary: {},\r\n });\r\n const loadLanguageMetadata = async () => {\r\n try {\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/asset/i18n/metadata.json`,\r\n {\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n }\r\n );\r\n const languageMetadataMap: Record = await response.json();\r\n\r\n if (!languageMetadataMap) throw (new Error('No metadata found'));\r\n\r\n set({\r\n languageMetadataMap,\r\n isMetadataReady: true,\r\n });\r\n } catch (e) {\r\n console.error('loadLanguageMetadata: Could not load language metadata, try to use English', e);\r\n set({\r\n languageMetadataMap: {\r\n eng: {\r\n name: 'English',\r\n formalName: 'English',\r\n codeName: 'eng',\r\n initialMessage: 'Loading fonts and scripts…',\r\n order: 1,\r\n active: true\r\n },\r\n },\r\n isMetadataReady: true,\r\n });\r\n }\r\n };\r\n const loadLanguage = async (languageName: string) => {\r\n if (languageMap[languageName]) return null;\r\n try {\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/asset/i18n/${languageName}.json`,\r\n {\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n }\r\n );\r\n const languageData: RawLanguageData = await response.json();\r\n\r\n if (!languageData.rawDictionary) throw (new Error('No dictionary found'));\r\n const processedLanguage = processLanguage(languageData, languageMap.eng?.rawDictionary);\r\n languageMap[languageName] = processedLanguage;\r\n\r\n return processedLanguage;\r\n } catch (e) {\r\n console.error('loadLanguage: Could not load language, revert back to default', e);\r\n return null;\r\n }\r\n };\r\n const changeLanguage = async (languageName: string) => {\r\n const nextMeta = get().languageMetadataMap[languageName];\r\n if (!nextMeta) return;\r\n\r\n /** Currently it is better to NOT show language loading process, just let everything magically replaced. */\r\n // set({ isLoading: true });\r\n const languageData = !languageMap[languageName]\r\n ? await loadLanguage(languageName)\r\n : languageMap[languageName];\r\n\r\n if (languageData) {\r\n set({\r\n languageInfo: get().languageMetadataMap[languageName],\r\n language: languageData.dictionary,\r\n });\r\n window.localStorage.setItem('language', languageName);\r\n set({\r\n isLoading: false,\r\n languageInfo: nextMeta,\r\n });\r\n } else {\r\n set({\r\n isLoading: false,\r\n languageInfo: get().languageMetadataMap.eng,\r\n language: defaultLanguage.dictionary,\r\n });\r\n }\r\n };\r\n\r\n return {\r\n languageMetadataMap: {},\r\n languageInfo: getDefaultLanguageMetadata(),\r\n language: defaultLanguage.dictionary,\r\n error: null,\r\n isInitiating: true,\r\n isLoading: true,\r\n isMetadataReady: false,\r\n initiate: async () => {\r\n loadLanguageMetadata();\r\n },\r\n loadDefaultLanguage: async () => {\r\n /** Load english first regardless, so it can act as a fallback language */\r\n await loadLanguage('eng');\r\n await changeLanguage(defaultLanguageName);\r\n set({\r\n isInitiating: false,\r\n });\r\n },\r\n loadLanguage,\r\n changeLanguage,\r\n };\r\n});\r\n\r\nexport const useLanguage = () => {\r\n const language = useI18N(({ language }) => language);\r\n\r\n return language;\r\n};\r\nexport const getLanguage = () => useI18N.getState().language;\r\nexport * from './processor';","import { Card, getDefaultCard, getEmptyCard } from 'src/model';\r\nimport { create } from 'zustand';\r\nimport debounce from 'lodash.debounce';\r\nimport throttle from 'lodash.throttle';\r\nimport { rebuildCardData, migrateCardData, legacyRebuildCardData } from 'src/util';\r\nimport { notification } from 'antd';\r\nimport { getLanguage } from './use-i18n';\r\n\r\nexport const decodeCardWithCompatibility = (\r\n cardData: Record | string | null,\r\n baseCard?: Card,\r\n): Card => {\r\n let decodedCard = getEmptyCard();\r\n if (!cardData) return decodedCard;\r\n try {\r\n decodedCard = rebuildCardData(cardData, baseCard);\r\n } catch (e) {\r\n console.error('decodedCard', cardData, e);\r\n try {\r\n decodedCard = legacyRebuildCardData(cardData, true) as Card;\r\n notification.info({\r\n message: getLanguage()['service.decode.outdated.message'],\r\n description: getLanguage()['service.decode.outdated.description'],\r\n });\r\n } catch (e) {\r\n console.error('cardData', cardData, e);\r\n notification.error({\r\n message: getLanguage()['service.decode.error.message'],\r\n description: getLanguage()['service.decode.error.description'],\r\n });\r\n }\r\n }\r\n return decodedCard;\r\n};\r\n\r\n/**\r\n * Acquire saved card when the session is just initialized. URL source is preferred over local storage source.\r\n */\r\nexport const retrieveSavedCard = () => {\r\n try {\r\n const localCardVersion = window.localStorage.getItem('card-version');\r\n const localCardData = window.localStorage.getItem('card-data');\r\n\r\n const cardURLData = (new URLSearchParams(window.location.search)).get('data');\r\n if (cardURLData) {\r\n return decodeCardWithCompatibility(cardURLData);\r\n } else if (localCardData !== null && localCardVersion === process.env.REACT_APP_VERSION) {\r\n return migrateCardData(JSON.parse(localCardData)) as Card;\r\n }\r\n return getDefaultCard();\r\n } catch (e) {\r\n console.error(e);\r\n return getDefaultCard();\r\n }\r\n};\r\n\r\nconst VariantConfigMap = {\r\n debounce: { type: 'debounce' as const, wait: 400 },\r\n throttle: { type: 'throttle' as const, wait: 1000 },\r\n};\r\nexport type CardStore = {\r\n card: Card,\r\n setCard: (cardTransform: Card | ((currentCard: Card) => Card)) => void,\r\n getUpdater: (\r\n key: string,\r\n valueTransform?: (value: any) => any,\r\n variant?: 'throttle' | 'debounce' | { type: 'throttle', wait: number } | { type: 'debounce', wait: number },\r\n ) => (e: any) => void,\r\n};\r\nexport const useCard = create((set, get) => {\r\n return {\r\n card: getDefaultCard(),\r\n setCard: cardTransform => {\r\n if (typeof cardTransform === 'function') set(cur => ({ card: cardTransform(cur.card) }));\r\n else set({ card: cardTransform });\r\n },\r\n getUpdater: (\r\n key: string,\r\n valueTransform: (value: any) => any = (value) => value,\r\n variant,\r\n ) => {\r\n const { setCard } = get();\r\n const returnFunction = (e: any) => {\r\n setCard(current => ({\r\n ...current,\r\n [key]: valueTransform(typeof e === 'string' || typeof e === 'number' || Array.isArray(e) ? e : e?.target?.value),\r\n }));\r\n };\r\n\r\n if (!variant) return returnFunction;\r\n const variantConfig = typeof variant === 'string'\r\n ? VariantConfigMap[variant] ?? undefined\r\n : variant;\r\n\r\n if (!variantConfig) return returnFunction;\r\n const { wait, type } = variantConfig;\r\n\r\n if (type === 'debounce') return debounce(returnFunction, wait);\r\n if (type === 'throttle') return throttle(returnFunction, wait);\r\n\r\n return returnFunction;\r\n }\r\n };\r\n});","import { CanvasConst } from 'src/model';\r\nimport { create } from 'zustand';\r\n\r\nexport type Setting = {\r\n resolution: [number, number],\r\n showCreativeOption: boolean,\r\n showExtraDecorativeOption: boolean,\r\n allowHotkey: boolean,\r\n reduceMotionColor: boolean,\r\n};\r\nexport type SettingStore = {\r\n setting: Setting,\r\n updateSetting: (transformerOrPayload: Partial | ((currentSetting: Setting) => Setting)) => void,\r\n};\r\nexport const useSetting = create((set) => {\r\n const {\r\n resolution,\r\n allowHotkey,\r\n reduceMotionColor,\r\n showCreativeOption,\r\n showExtraDecorativeOption,\r\n } = ((): Record => {\r\n try {\r\n const cachedStore = JSON.parse(window.localStorage.getItem('setting') ?? '{}');\r\n\r\n if (cachedStore && typeof cachedStore === 'object' && !Array.isArray(cachedStore)) return cachedStore;\r\n return {};\r\n } catch (e) {\r\n console.error('useSetting: Error when getting cached setting', e);\r\n return {};\r\n }\r\n })();\r\n\r\n return {\r\n setting: {\r\n resolution: Array.isArray(resolution) && typeof resolution[0] === 'number' && typeof resolution[1] === 'number'\r\n ? resolution as [number, number]\r\n : [CanvasConst.width, CanvasConst.height],\r\n allowHotkey: typeof allowHotkey === 'boolean' ? allowHotkey : true,\r\n reduceMotionColor: typeof reduceMotionColor === 'boolean' ? reduceMotionColor : false,\r\n showCreativeOption: typeof showCreativeOption === 'boolean' ? showCreativeOption : true,\r\n showExtraDecorativeOption: typeof showExtraDecorativeOption === 'boolean' ? showExtraDecorativeOption : true,\r\n },\r\n updateSetting: transformerOrPayload => {\r\n set(currentStore => {\r\n const newSetting = typeof transformerOrPayload === 'function'\r\n ? transformerOrPayload(currentStore.setting)\r\n : { ...currentStore.setting, ...transformerOrPayload };\r\n\r\n window.localStorage.setItem('setting', JSON.stringify(newSetting));\r\n\r\n return {\r\n setting: newSetting,\r\n };\r\n });\r\n }\r\n };\r\n});","import { CanvasConst, FinishInformation, FinishMap } from 'src/model';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\nconst { height: CanvasHeight, width: CanvasWidth } = CanvasConst;\r\n\r\nexport const randomDarkColor = () => '#000000'.replace(/0/g, () => (~~(Math.random() * 12 + 2)).toString(16));\r\n\r\n/** Draw a straight line with random color, used for measurement debug. It take true edge and width, but will draw based on the current scale ratio. */\r\nexport const drawMarker = ({\r\n ctx,\r\n color = randomDarkColor(), width,\r\n offset = 4,\r\n edge, baseline,\r\n xRatio,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n color?: string, width: number,\r\n offset?: number,\r\n edge: number, baseline: number,\r\n xRatio: number,\r\n}) => {\r\n const currentFillStyle = ctx.fillStyle;\r\n ctx.fillStyle = color;\r\n ctx.beginPath();\r\n ctx.rect(edge / xRatio, baseline + 1 + Math.random() * offset, width / xRatio, 2);\r\n // ctx.fill();\r\n ctx.fillStyle = currentFillStyle;\r\n};\r\n\r\n/**\r\n * @summary Letter spacing rules:\r\n * * It is based on the letter width (so each letter has different spacing), default is no spacing (0).\r\n * * Positive letter spacing will create a gap between each letter, and vice versa.\r\n * * Each letter distribute the gap evenly to their left and right side. So for example if letter spacing is 50% (0.5), it will have a gap equal to 25% (0.25) of its width.\r\n */\r\n\r\n/** Draw a left-aligned text with provided letter spacing. This function take true edge and baseline. It return the right side of the newly created text. */\r\nexport const fillTextLeftWithSpacing = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n str: string,\r\n letterSpacingRatio: number,\r\n edge: number,\r\n baseline: number,\r\n option?: {\r\n stroke?: boolean,\r\n }\r\n) => {\r\n if (!ctx || !str) return edge;\r\n\r\n const { stroke = false } = option ?? {};\r\n ctx.textAlign = 'left';\r\n const charList = str.split('');\r\n let curLeft = edge;\r\n\r\n charList.forEach(char => {\r\n ctx.fillText(char, curLeft, baseline);\r\n if (stroke) ctx.strokeText(char, curLeft, baseline);\r\n curLeft += ctx.measureText(char).width * (2 + letterSpacingRatio) / 2;\r\n });\r\n\r\n return curLeft;\r\n};\r\n/** Draw a right-aligned text with provided letter spacing. This function take true edge and baseline. It return the left side of the newly created text. */\r\nexport const fillTextRightWithSpacing = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n str: string,\r\n letterSpacing: number,\r\n edge: number,\r\n baseline: number,\r\n option?: {\r\n stroke?: boolean,\r\n }\r\n) => {\r\n if (!ctx || !str) return edge;\r\n\r\n const { stroke = false } = option ?? {};\r\n ctx.textAlign = 'right';\r\n const charList = str.split('');\r\n let curRight = edge;\r\n\r\n charList.forEach((c, index) => {\r\n const char = charList[charList.length - index - 1];\r\n ctx.fillText(char, curRight, baseline);\r\n if (stroke) ctx.strokeText(char, curRight, baseline);\r\n curRight -= ctx.measureText(char).width * (2 + letterSpacing) / 2;\r\n });\r\n return curRight;\r\n};\r\n\r\n/** Clear current canvas, it also ensure canvas existed so we do not need to check for afterward. */\r\nexport const clearCanvas = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n width = CanvasWidth,\r\n height = CanvasHeight,\r\n): ctx is CanvasRenderingContext2D => {\r\n if (ctx) {\r\n ctx.clearRect(0, 0, width, height);\r\n\r\n return true;\r\n };\r\n return false;\r\n};\r\n\r\n/** Each finish object may contain many parts, each part has its own set of instruction. This function will abstract all the looping logic so we can instantly apply a finish to some card's part. */\r\nexport const getFinishIterator = (\r\n finish: string[],\r\n finishMap: Record = FinishMap,\r\n) => {\r\n return async (\r\n ctx?: CanvasRenderingContext2D | null,\r\n name?: string,\r\n caller?: (finishType: string) => Promise,\r\n ) => {\r\n if (!ctx || !Array.isArray(finish) || finish.length <= 0) return Promise.resolve();\r\n for (const finishType of finish) {\r\n const finishInformation = finishMap[finishType];\r\n if (caller && finishMap[finishType]) {\r\n const { partInstructionMap } = finishInformation;\r\n const instructionList = name ? partInstructionMap[name] ?? [] : [];\r\n\r\n if (instructionList.length) {\r\n for (const { blendMode = 'source-over', opacity = 1 } of instructionList) {\r\n ctx.globalCompositeOperation = blendMode;\r\n ctx.globalAlpha = opacity;\r\n\r\n await caller(finishType);\r\n }\r\n } else {\r\n await caller(finishType);\r\n }\r\n ctx.globalAlpha = 1;\r\n ctx.globalCompositeOperation = 'source-over';\r\n }\r\n }\r\n ctx.globalAlpha = 1;\r\n ctx.globalCompositeOperation = 'source-over';\r\n };\r\n};\r\n\r\nconst DEFAULT_SHADOW_OFFSET_X = 0;\r\nconst DEFAULT_SHADOW_OFFSET_Y = 0;\r\nconst DEFAULT_SHADOW_BLUR = 0;\r\nconst DEFAULT_SHADOW_COLOR = '#000000';\r\nconst DEFAULT_TEXT_COLOR = '#000000';\r\n\r\nexport const setTextStyle = ({\r\n ctx,\r\n x = DEFAULT_SHADOW_OFFSET_X,\r\n y = DEFAULT_SHADOW_OFFSET_Y,\r\n blur = DEFAULT_SHADOW_BLUR,\r\n color = DEFAULT_TEXT_COLOR,\r\n shadowColor = DEFAULT_SHADOW_COLOR,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n} & CanvasTextStyle) => {\r\n ctx.shadowOffsetX = x;\r\n ctx.shadowOffsetY = y;\r\n ctx.shadowBlur = blur;\r\n ctx.shadowColor = shadowColor;\r\n ctx.fillStyle = color;\r\n\r\n return () => {\r\n ctx.shadowOffsetX = DEFAULT_SHADOW_OFFSET_X;\r\n ctx.shadowOffsetY = DEFAULT_SHADOW_OFFSET_Y;\r\n ctx.shadowBlur = DEFAULT_SHADOW_BLUR;\r\n ctx.shadowColor = DEFAULT_SHADOW_COLOR;\r\n ctx.fillStyle = DEFAULT_TEXT_COLOR;\r\n };\r\n};","import { CanvasTextStyle } from 'src/service';\r\nimport { hexToRGBA } from 'src/util';\r\nimport { setTextStyle } from './canvas-util';\r\n\r\nconst imageCacheMap: Record = {};\r\n\r\nexport const drawFrom = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n source: string,\r\n sx: number | ((image: HTMLImageElement) => number) = 0,\r\n sy: number | ((image: HTMLImageElement) => number) = 0,\r\n) => {\r\n if (!ctx || source === '') return new Promise(resolve => resolve(false));\r\n return new Promise(resolve => {\r\n /** @todo Do manual caching really needed? Need proper benchmark for this. */\r\n if (imageCacheMap[source]?.ready === true) {\r\n const image = imageCacheMap[source].image;\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n\r\n ctx.drawImage(image, normalizedX, normalizedY);\r\n resolve(true);\r\n } else {\r\n if (imageCacheMap[source]?.error) {\r\n resolve(true);\r\n return;\r\n }\r\n const imageCached = imageCacheMap[source] && (imageCacheMap[source].cache || imageCacheMap[source].ready);\r\n const image = imageCached\r\n ? imageCacheMap[source].image\r\n : new Image();\r\n\r\n if (!imageCached) image.src = process.env.PUBLIC_URL + source;\r\n image.addEventListener(\r\n 'load',\r\n () => {\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n\r\n ctx.drawImage(image, normalizedX, normalizedY);\r\n imageCacheMap[source].ready = true;\r\n imageCacheMap[source].error = false;\r\n resolve(true);\r\n },\r\n { once: true },\r\n );\r\n image.addEventListener(\r\n 'error',\r\n () => {\r\n imageCacheMap[source].error = true;\r\n resolve(false);\r\n },\r\n { once: true },\r\n );\r\n\r\n if (!imageCached) imageCacheMap[source] = {\r\n image: image,\r\n ready: false,\r\n error: false,\r\n cache: true,\r\n };\r\n };\r\n });\r\n};\r\nexport const drawAsset = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n source: string,\r\n sx: number | ((image: HTMLImageElement) => number) = 0,\r\n sy: number | ((image: HTMLImageElement) => number) = 0,\r\n) => {\r\n return await drawFrom(\r\n ctx,\r\n '/asset/image/' + source,\r\n sx, sy,\r\n );\r\n};\r\n\r\nexport const drawFromWithSize = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n source: string,\r\n sx: number | ((image: HTMLImageElement) => number),\r\n sy: number | ((image: HTMLImageElement) => number),\r\n dw: number | ((image: HTMLImageElement) => number),\r\n dh: number | ((image: HTMLImageElement) => number),\r\n) => {\r\n if (!ctx || source === '') return new Promise(resolve => resolve(false));\r\n return new Promise(resolve => {\r\n if (imageCacheMap[source]?.ready === true) {\r\n const image = imageCacheMap[source].image;\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n const normalizedW = typeof dw === 'number' ? dw : dw(image);\r\n const normalizedH = typeof dh === 'number' ? dh : dh(image);\r\n\r\n ctx.drawImage(image, normalizedX, normalizedY, normalizedW, normalizedH);\r\n resolve(true);\r\n } else {\r\n if (imageCacheMap[source]?.error) {\r\n resolve(true);\r\n return;\r\n }\r\n const imageCached = imageCacheMap[source] && (imageCacheMap[source].cache || imageCacheMap[source].ready);\r\n const image = imageCached\r\n ? imageCacheMap[source].image\r\n : new Image();\r\n\r\n if (!imageCached) image.src = process.env.PUBLIC_URL + source;\r\n image.addEventListener(\r\n 'load',\r\n () => {\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n const normalizedW = typeof dw === 'number' ? dw : dw(image);\r\n const normalizedH = typeof dh === 'number' ? dh : dh(image);\r\n \r\n ctx.drawImage(image, normalizedX, normalizedY, normalizedW, normalizedH);\r\n imageCacheMap[source].ready = true;\r\n imageCacheMap[source].error = false;\r\n resolve(true);\r\n },\r\n { once: true },\r\n );\r\n image.addEventListener(\r\n 'error',\r\n () => {\r\n imageCacheMap[source].error = true;\r\n resolve(false);\r\n },\r\n { once: true },\r\n );\r\n\r\n if (!imageCached) imageCacheMap[source] = {\r\n image: image,\r\n ready: false,\r\n error: false,\r\n cache: true,\r\n };\r\n };\r\n });\r\n};\r\nexport const drawAssetWithSize: typeof drawFromWithSize = async (\r\n ctx,\r\n source,\r\n sx, sy,\r\n dw, dh,\r\n) => {\r\n return await drawFromWithSize(\r\n ctx,\r\n '/asset/image/' + source,\r\n sx, sy,\r\n dw, dh,\r\n );\r\n};\r\n\r\nexport const drawWithColor = async (\r\n canvas: HTMLCanvasElement,\r\n source: string,\r\n color: string,\r\n sw: number, sh: number,\r\n dx: number, dy: number,\r\n cloneCanvasStyle?: CanvasTextStyle,\r\n) => {\r\n const ctx = canvas.getContext('2d');\r\n const clonedCanvas = document.createElement('canvas');\r\n clonedCanvas.width = sw;\r\n clonedCanvas.height = sh;\r\n const clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });\r\n\r\n if (!clonedCtx || !ctx) return;\r\n await drawAsset(clonedCtx, source, 0, 0);\r\n\r\n const rgbaColor = hexToRGBA(color);\r\n const imageRasterData = clonedCtx.getImageData(0, 0, sw, sh).data;\r\n\r\n /** In some rare case, this image need shadow (for example \"LINK\" text).\r\n * So we apply shadow into the clone node, then DRAW THE IMAGE AGAIN. This time image data will be a combined data from both the original image and the newly applied shadow.\r\n */\r\n const resetStyle = setTextStyle({ ctx: clonedCtx, ...cloneCanvasStyle });\r\n await drawAsset(clonedCtx, source, 0, 0);\r\n const imageDataWithShadow = clonedCtx.getImageData(0, 0, sw, sh);\r\n const imageRasterDataWithShadow = imageDataWithShadow.data;\r\n resetStyle();\r\n\r\n /** Because the new image data will replace the old one (no blending mode), it will erase the pixel of the current canvas underneath. To solve this we will draw the current canvas into the clone canvas first, before putting new image into it. */\r\n clonedCtx.clearRect(0, 0, sw, sh);\r\n clonedCtx.drawImage(canvas, dx, dy, sw, sh, 0, 0, sw, sh);\r\n\r\n const combinedLayerData = clonedCtx.getImageData(0, 0, sw, sh);\r\n const combinedLayerRasterData = combinedLayerData.data;\r\n\r\n for (let pixelCnt = 0; pixelCnt < combinedLayerRasterData.length; pixelCnt += 4) {\r\n /** If raster data at this pixel have the same coordinate with raster data from the original image, draw it with manipulated color. */\r\n if (imageRasterData[pixelCnt + 3] > 0) {\r\n /** Change ratio based on the original color value, compare to pitch black #000000 */\r\n combinedLayerRasterData[pixelCnt + 0] = rgbaColor[0] * (1 - imageRasterData[pixelCnt + 0] / 255);\r\n combinedLayerRasterData[pixelCnt + 1] = rgbaColor[1] * (1 - imageRasterData[pixelCnt + 1] / 255);\r\n combinedLayerRasterData[pixelCnt + 2] = rgbaColor[2] * (1 - imageRasterData[pixelCnt + 2] / 255);\r\n combinedLayerRasterData[pixelCnt + 3] = 255;\r\n }\r\n /** If raster data at this pixel have the same coordinate with raster data from the image with shadow, draw the shadow. */\r\n else if (imageRasterDataWithShadow[pixelCnt + 3] > 0) {\r\n const destinationAlpha = imageRasterDataWithShadow[pixelCnt + 3] / 255;\r\n\r\n combinedLayerRasterData[pixelCnt + 0] = (1 - destinationAlpha) * combinedLayerRasterData[pixelCnt + 0]\r\n + destinationAlpha * imageRasterDataWithShadow[pixelCnt + 0];\r\n combinedLayerRasterData[pixelCnt + 1] = (1 - destinationAlpha) * combinedLayerRasterData[pixelCnt + 1]\r\n + destinationAlpha * imageRasterDataWithShadow[pixelCnt + 1];\r\n combinedLayerRasterData[pixelCnt + 2] = (1 - destinationAlpha) * combinedLayerRasterData[pixelCnt + 2]\r\n + destinationAlpha * imageRasterDataWithShadow[pixelCnt + 2];\r\n combinedLayerRasterData[pixelCnt + 3] = 255;\r\n }\r\n /** Otherwise all other pixel belong to the background canvas, and is untouched. */\r\n }\r\n\r\n ctx.putImageData(combinedLayerData, dx, dy);\r\n};","import {\r\n ChiisaiRegex,\r\n ChoonpuRegex,\r\n DefaultFontDeviation,\r\n FontDeviation,\r\n HiraganaRegex,\r\n KatakanaRegex,\r\n MetricMethod,\r\n NoSpaceRegex,\r\n OCGBoxSpacingRatioMap,\r\n OCGDotRegex,\r\n OCGIncreasedLevel2WidthRegex,\r\n OCGIncreasedWidthRegex,\r\n OCGLastOfLineOffsetMap,\r\n OCGNumberRegex,\r\n OCGOffsetMap,\r\n OCG_REDUCED_AT_END_LINE_RATIO,\r\n TCGBoxSpacingRatioMap,\r\n TCGLastOfLineOffsetMap,\r\n TCGOffsetMap,\r\n nonBreakableSymbolRegex,\r\n} from 'src/model';\r\n\r\n/**\r\n * Return the width of a letter. This function return true width of a scalable letter, but will return the inverse-scaled width of a non-scalable letter (based on the `xRatio` property). For example:\r\n * * Canvas does not scaled: Letter \"A\" return 50px, while letter \"①\" (non-scalable) return 50px.\r\n * * Canvas scaled down by 0.5: Letter \"A\" return 50px, while letter \"①\" (non-scalable) return 100px.\r\n *\r\n * Each letter has 3 main values:\r\n * * `width`: The width of a character based on font size, for example all kanji with the same font size will have the same width, because each letter is designed within a consistent box.\r\n * * `actualBoundWidth`: The width of actual image of a character based on its shape, for example letter of the sokuon \"ァ\" will have actualBoundingWidth much smaller than the kanji letter \"道\", even though they have the same font-size (and therefore same width).\r\n * * `boundWidth`: It is actualBoundWidth + small padding at left and right so that the letter does not stick closely to each other.\r\n * \r\n * `metricMethod` dictate the ratio and calculation method of a letter, used for different use-cases.\r\n * \r\n * DO NOT apply font weight to the canvas while calling this function, as the result will become inconsistent.\r\n */\r\nexport const getLetterWidth = ({\r\n ctx,\r\n letter,\r\n isLastOfLine = false,\r\n debug,\r\n fontStyle,\r\n xRatio,\r\n metricMethod = 'standard',\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n letter: string,\r\n isLastOfLine?: boolean,\r\n fontStyle: string,\r\n xRatio: number,\r\n metricMethod?: MetricMethod,\r\n debug?: string,\r\n}) => {\r\n if (nonBreakableSymbolRegex.test(letter)) return {\r\n width: 0,\r\n boundWidth: 0,\r\n };\r\n\r\n const boxSpacingRatioMap = fontStyle === 'tcg'\r\n ? TCGBoxSpacingRatioMap\r\n : OCGBoxSpacingRatioMap;\r\n const offsetMap = fontStyle === 'tcg'\r\n ? TCGOffsetMap\r\n : OCGOffsetMap;\r\n const lastOfLineOffsetMap = fontStyle === 'tcg'\r\n ? TCGLastOfLineOffsetMap\r\n : OCGLastOfLineOffsetMap;\r\n const metric = ctx.measureText(letter);\r\n const {\r\n width,\r\n actualBoundingBoxLeft,\r\n actualBoundingBoxRight,\r\n } = metric;\r\n const actualBoundWidth = actualBoundingBoxLeft + actualBoundingBoxRight;\r\n let kerningScaleRatio = 1;\r\n if (metricMethod === 'name') {\r\n kerningScaleRatio = 1 + (1 - xRatio) * 8;\r\n }\r\n const spacingRatio = metricMethod === 'name' || metricMethod === 'compact' || metricMethod === 'furigana'\r\n ? 0.046875\r\n : 0;\r\n let boundWidth = actualBoundWidth;\r\n let offsetRatio = (isLastOfLine\r\n ? lastOfLineOffsetMap[letter]\r\n : offsetMap[letter]) ?? 0;\r\n\r\n if (fontStyle === 'tcg') {\r\n let letterBoxSpacing = (boxSpacingRatioMap[letter] ?? 0) * width;\r\n\r\n return {\r\n width,\r\n actualBoundWidth,\r\n boundWidth: width + 2 * letterBoxSpacing,\r\n metric,\r\n offsetRatio,\r\n };\r\n }\r\n\r\n let letterBoxSpacing = (boxSpacingRatioMap[letter] ?? 0) * width\r\n + (metricMethod === 'furigana'\r\n ? 0\r\n : Math.min(\r\n width * 0.075,\r\n Math.max(0.450, width * spacingRatio) * kerningScaleRatio,\r\n ));\r\n let letterRatio = 1;\r\n let endLineRatio = 1;\r\n let standardMetricRatio = 1.000;\r\n if (OCGDotRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana'\r\n ? actualBoundWidth\r\n : actualBoundWidth * (metricMethod === 'creator' ? 1.750 : 2.500);\r\n standardMetricRatio = 0.600;\r\n }\r\n else if (ChoonpuRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.75);\r\n letterBoxSpacing = 2;\r\n }\r\n else if (ChiisaiRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.7);\r\n }\r\n else if (OCGNumberRegex.test(letter)) {\r\n boundWidth = width;\r\n }\r\n else if (OCGIncreasedLevel2WidthRegex.test(letter)) {\r\n boundWidth = actualBoundWidth * 2;\r\n }\r\n else if (OCGIncreasedWidthRegex.test(letter)) {\r\n boundWidth = actualBoundWidth * 1.250 * (isLastOfLine ? OCG_REDUCED_AT_END_LINE_RATIO : 1);\r\n }\r\n else if (HiraganaRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.750);\r\n }\r\n else if (KatakanaRegex.test(letter)) {\r\n boundWidth = Math.max(actualBoundWidth, width * 0.690)\r\n * (metricMethod === 'creator' ? 0.97500 : 1.000);\r\n }\r\n else if (NoSpaceRegex.test(letter)) {\r\n boundWidth = width;\r\n letterBoxSpacing = 0;\r\n }\r\n else {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.750);\r\n }\r\n letterBoxSpacing = metricMethod === 'furigana' ? 0 : letterBoxSpacing;\r\n\r\n const actualLetterWidth = width * letterRatio * endLineRatio;\r\n\r\n if (debug) console.info(`getLetterWidth ${debug}`, letter, metric, letterRatio, endLineRatio, '|', actualLetterWidth);\r\n return {\r\n width,\r\n actualBoundWidth,\r\n boundWidth: metricMethod === 'standard'\r\n ? width * standardMetricRatio\r\n : boundWidth + letterBoxSpacing * 2,\r\n metric,\r\n offsetRatio,\r\n };\r\n};\r\n\r\nexport type TextDrawer = (props: {\r\n ctx: CanvasRenderingContext2D,\r\n letter: string,\r\n scaledEdge: number,\r\n scaledBaseline: number,\r\n}) => void;\r\n/** \r\n * Draw the letter with a provided worker. It take true edge as paramter, but will pass scaled edge to the worker.\r\n */\r\nexport const drawLetter = ({\r\n ctx,\r\n baseline,\r\n edge,\r\n letter,\r\n xRatio,\r\n deviation = {},\r\n letterMetric,\r\n textDrawer,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n letter: string,\r\n letterMetric?: ReturnType,\r\n edge: number,\r\n baseline: number,\r\n xRatio: number,\r\n deviation?: FontDeviation,\r\n textDrawer?: TextDrawer,\r\n}) => {\r\n const {\r\n boundWidth,\r\n metric = ctx.measureText(letter),\r\n offsetRatio = 0,\r\n } = letterMetric ?? {};\r\n const {\r\n yOffset: deviationYOffset = DefaultFontDeviation.yOffset,\r\n yRatio = DefaultFontDeviation.yRatio,\r\n } = xRatio < 1 ? {} : deviation;\r\n\r\n const letterWidth = metric.width * xRatio;\r\n const scaledBoundingWidth = boundWidth ? boundWidth * xRatio : letterWidth;\r\n const worker = textDrawer ?? (({\r\n ctx,\r\n letter,\r\n scaledBaseline,\r\n scaledEdge,\r\n }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n });\r\n\r\n const boundingOffset = (letterWidth - scaledBoundingWidth) / 2;\r\n const externalOffset = scaledBoundingWidth * offsetRatio;\r\n ctx.scale(1, yRatio);\r\n worker({\r\n ctx,\r\n letter,\r\n scaledEdge: edge / xRatio - boundingOffset - externalOffset,\r\n scaledBaseline: (baseline + deviationYOffset) / yRatio,\r\n });\r\n ctx.scale(1, 1 / yRatio);\r\n};","import {\r\n BREAKABLE_LETTER,\r\n DefaultFontSizeData,\r\n FontData,\r\n FontSizeData,\r\n NB_WORD_CLOSE,\r\n NB_WORD_OPEN,\r\n} from 'src/model';\r\nimport { createFontGetter } from 'src/util';\r\n\r\nexport const tokenizeText = (text: string, keepControlCharacter = false) => {\r\n const regex = keepControlCharacter\r\n ? new RegExp(`([${BREAKABLE_LETTER}])|(${NB_WORD_OPEN}[\\\\w\\\\W]+?${NB_WORD_CLOSE})|(.+?)`)\r\n : new RegExp(`([${BREAKABLE_LETTER}])|${NB_WORD_OPEN}([\\\\w\\\\W]+?)${NB_WORD_CLOSE}|(.+?)`);\r\n\r\n return text\r\n .split(regex)\r\n .filter(token => token != null && token !== '');\r\n};\r\n\r\nexport const getTextWorker = (\r\n ctx: CanvasRenderingContext2D,\r\n fontData: FontData,\r\n fontSizeData: FontSizeData,\r\n fontController: ReturnType,\r\n) => {\r\n const {\r\n fontSize,\r\n ordinalFontRatio = DefaultFontSizeData.ordinalFontRatio,\r\n headTextFontRatio = DefaultFontSizeData.headTextFontRatio,\r\n } = fontSizeData;\r\n const {\r\n font,\r\n ordinalFont,\r\n symbolFont,\r\n symbolFontRatio,\r\n numberFont = font,\r\n numberFontRatio = 1,\r\n furiganaFont,\r\n } = fontData;\r\n\r\n let numberFontMemory = fontController.getFontInfo();\r\n const applyNumberFont = () => {\r\n numberFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(numberFont).setSize(fontSize * numberFontRatio).getFont();\r\n };\r\n const stopApplyNumberFont = () => {\r\n ctx.font = fontController\r\n .setFamily(numberFontMemory.family)\r\n .setSize(numberFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n let symbolFontMemory = fontController.getFontInfo();\r\n const applySymbolFont = () => {\r\n symbolFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(symbolFont).setSize(fontSize * symbolFontRatio).getFont();\r\n };\r\n const stopApplySymbolFont = () => {\r\n ctx.font = fontController\r\n .setFamily(symbolFontMemory.family)\r\n .setSize(symbolFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n let ordinalFontMemory = fontController.getFontInfo();\r\n const applyOrdinalFont = () => {\r\n ordinalFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(ordinalFont).setSize(fontSize * ordinalFontRatio).getFont();\r\n };\r\n const stopApplyOrdinalFont = () => {\r\n ctx.font = fontController\r\n .setFamily(ordinalFontMemory.family)\r\n .setSize(ordinalFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n const resetScale = () => {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n };\r\n\r\n const applyAsymmetricScale = (xRatio = 1, yRatio = 1) => {\r\n ctx.scale(xRatio, yRatio);\r\n };\r\n\r\n let furiganaFontMemory = fontController.getFontInfo();\r\n const applyFuriganaFont = (bold = false) => {\r\n furiganaFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(furiganaFont).setWeight(bold ? 'bold' : '').setSize(fontSize * headTextFontRatio).getFont();\r\n };\r\n const stopApplyFuriganaFont = () => {\r\n ctx.font = fontController\r\n .setFamily(furiganaFontMemory.family)\r\n .setWeight(furiganaFontMemory.weight)\r\n .setSize(furiganaFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n const applyScale = (xScale = 1, yScale = xScale) => {\r\n ctx.scale(xScale, yScale);\r\n };\r\n\r\n const reverseScale = (scaleValue = 1) => {\r\n ctx.scale(1 / scaleValue, 1 / scaleValue);\r\n };\r\n\r\n let largerTextFontMemory = fontController.getFontInfo();\r\n const applyLargerText = (fontRatio = 1) => {\r\n largerTextFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setSize(fontSize * fontRatio).getFont();\r\n };\r\n const stopApplyLargerText = () => {\r\n ctx.font = fontController.setSize(largerTextFontMemory.size).getFont();\r\n };\r\n\r\n return {\r\n applyNumberFont, stopApplyNumberFont,\r\n applyLargerText, stopApplyLargerText,\r\n applySymbolFont, stopApplySymbolFont,\r\n applyOrdinalFont, stopApplyOrdinalFont,\r\n applyFuriganaFont, stopApplyFuriganaFont,\r\n\r\n applyAsymmetricScale,\r\n applyScale,\r\n resetScale,\r\n reverseScale,\r\n };\r\n};\r\n\r\n/** We do not actually use the ● letter for bullet, instead we a draw a black circle with fixed size. Bullets not only does not condense, but also does not actually scale with font-size. They are the same size even if we use smaller font to add more lines (\"Agave Dragon\" TCG), this in turn prevent us from reducing the font size too small.\r\n * \r\n * In TCG the space behind bullet is fixed, so multiple lines with bullet at the start will align perfectly, it is not seems to be the case in OCG.\r\n*/\r\nexport const drawBullet = (ctx: CanvasRenderingContext2D, edge: number, baseline: number, width: number, spaceAfter: number) => {\r\n const bulletRadius = (width - spaceAfter) / 2;\r\n ctx.beginPath();\r\n ctx.arc(edge + bulletRadius, baseline - bulletRadius - 1, bulletRadius, 0, 2 * Math.PI, false);\r\n ctx.fill();\r\n ctx.lineWidth = 1;\r\n ctx.strokeStyle = '#003300';\r\n ctx.stroke();\r\n};\r\n\r\n/**\r\n * This function analyze head text of a token, and return various information: its width (same calculation rule with `analyzeToken`), alignment type, gap as well as drawing information (letter spacing and customized condense ratio).\r\n * \r\n * @summary All ruby (head text) rules:\r\n * * A token may or may not has head text.\r\n * * Head text take space above foot text, if foot text still has space left, the token has negative gap. On the other hand if head text is too long it may growth out of foot text's vertical boundary (overflowing), in this case the token has positive gap.\r\n * * Head text with positive gap may take negative gap from the previous token. Read knoweledge diagram for a visual presentation. They take available gap in such a way that head text never overlap with each other, and foot text also does not overlap with each other.\r\n * * Foot text may got pushed around a bit so empty space is distributed uniformly (\"Beyond the Pendulum\" OCG). The current implementation cannot achieve such effect automatically, but only to a degree.\r\n * * Head text above a single letter is always center-aligned. Head text above multiple letters is align using space-around distribution if it does not overflow, and center otherwise.\r\n * * Head text that is way too long compare to its foot text underneath will be condensed and has negative letter spacing (\"PenduLuMoon\" OCG), in some cases make it completely unreadable.\r\n * * Head text of the first token of a line can \"spill\" out of line's boundary. (\"Beyond the Pendulum\" OCG) Even if this is the case, all foot text must be perfectly aligned vertically.\r\n * * Head text above a single letter will not be condensed (\"Recette de Poisson (Fish Recipe)\" OCG) unless forced to by special syntax.\r\n * * Head text above multiple-letters foot text condeses with a slower rate than normal (\"CXyz N.As.Ch. Knight\" OCG).\r\n * * Head text above a whole line will be condensed so it does not overflow (\"Amaze Attraction Viking Vortex\" OCG).\r\n * * Those letters do not have gap, and therefore do not allow head text to overflow over them: Bullet ●, ordinal letter lie ⑤ (\"Pendulum Dimension\" OCG).\r\n * */\r\nexport const analyzeHeadText = ({\r\n footText, footTextWidth,\r\n headText, headTextLetterWidth,\r\n headTextGap,\r\n headTextSpacing,\r\n gapPadding,\r\n debug,\r\n fitFootText,\r\n sentenceXRatio,\r\n xRatio,\r\n}: {\r\n headText: string,\r\n headTextLetterWidth: number,\r\n footText: string,\r\n footTextWidth: number,\r\n headTextGap: number,\r\n headTextSpacing: number,\r\n gapPadding: number,\r\n debug?: string,\r\n fitFootText: boolean,\r\n sentenceXRatio: number,\r\n xRatio: number,\r\n}) => {\r\n const noHeadText = headText.length === 0;\r\n const condenseHeadText = headTextLetterWidth / footTextWidth * sentenceXRatio;\r\n let alignCenterLetterSpacing = headTextSpacing;\r\n let internalXRatio = 0;\r\n /** We use width ratio between head text (letters only) and foot text to determine that it is too long or not. For each ratio threshold, a different treatment is applied. */\r\n if (condenseHeadText <= 0.95) {\r\n /** Most case fall to this category */\r\n alignCenterLetterSpacing = headTextSpacing;\r\n }\r\n else if (condenseHeadText <= 1.175) {\r\n /** If the head text is a bit too long, we force all head text's letters to stay close together. Example like \"EX\" - Extra Deck in OCG. */\r\n alignCenterLetterSpacing = headTextSpacing >= 0\r\n ? 0\r\n : headTextSpacing * 3;\r\n }\r\n else if (condenseHeadText <= 1.560) {\r\n /** If the head text is too long, we start to introduce negative spacing. Example like \"S\" - Synchro in OCG. */\r\n alignCenterLetterSpacing = headTextSpacing >= 0\r\n ? headTextSpacing * -1/4\r\n : headTextSpacing * 3;\r\n }\r\n else {\r\n /** If the head text is way too long, not only we introduce negative spacing, but also condense the actual letter. \"P\" - Pendulum is a notorious example. */\r\n internalXRatio = 0.66;\r\n alignCenterLetterSpacing = headTextSpacing >= 0\r\n ? headTextSpacing * -1/4\r\n : headTextSpacing * 2;\r\n }\r\n if (fitFootText || (xRatio > 0 && xRatio < 1)) {\r\n alignCenterLetterSpacing = headTextSpacing;\r\n }\r\n\r\n const alignCenterHeadTextWidth = headTextLetterWidth * ((xRatio && !fitFootText)\r\n ? xRatio\r\n : (!internalXRatio || fitFootText) ? 1 : internalXRatio)\r\n + alignCenterLetterSpacing * (headText.length - 1);\r\n const alignEvenlyLetterSpacing = noHeadText ? 0 : (footTextWidth - headTextLetterWidth) / headText.length;\r\n const alignEvenlyHeadTextWidth = footTextWidth;\r\n\r\n const alignment = footText.length === 1 || (gapPadding * 2 + alignCenterHeadTextWidth > footTextWidth)\r\n ? 'center' as const\r\n : 'space-around' as const;\r\n const letterSpacing = alignment === 'center'\r\n ? alignCenterLetterSpacing\r\n : alignEvenlyLetterSpacing;\r\n const trueHeadTextWidth = alignment === 'center'\r\n ? gapPadding * 2 + alignCenterHeadTextWidth\r\n : alignEvenlyHeadTextWidth;\r\n const headTextWidth = fitFootText\r\n ? Math.min(trueHeadTextWidth, footTextWidth)\r\n : trueHeadTextWidth;\r\n const baseHalfGap = alignment === 'center'\r\n ? (alignCenterHeadTextWidth - footTextWidth) / 2\r\n : 0;\r\n const halfGap = Math.max(\r\n headTextGap,\r\n fitFootText ? Math.min(baseHalfGap, 0) : baseHalfGap,\r\n );\r\n\r\n if (debug) console.info(\r\n `analyzeHeadText ${debug}`,\r\n alignment,\r\n letterSpacing,\r\n '|',\r\n headText, headTextWidth, trueHeadTextWidth,\r\n footText, footTextWidth,\r\n halfGap,\r\n );\r\n return {\r\n gapPadding,\r\n letterSpacing,\r\n trueHeadTextWidth,\r\n headTextWidth,\r\n /**\r\n * Simple visualization:\r\n * * Center: `[gap][letter + spacing][gap]`\r\n * * Space-around: `[half-gap][letter][gap][letter][half-gap]`\r\n */\r\n alignment,\r\n /** \r\n * * Positive gap will take space from other.\r\n * * Negative app allow other to use their space.\r\n */\r\n halfGap,\r\n headTextXRatio: alignment === 'center' ? internalXRatio : 0,\r\n };\r\n};\r\n\r\n/**\r\n * Calculate the lost width from the left side of a token becaues of gap. This width is scalar and therefore ALWAYS positive. Visit knowledge diagram for a clearer visualization.\r\n * \r\n * * If the previous gap is positive (push to their right):\r\n * * If current gap is positive (push to the left): No space is lost, they simply stand next to each other.\r\n * * If current gap is negative (previous token pull them): Current token lose some width, but no more than what the previous token can take.\r\n * * If the previous gap is negative (pull the next token to them):\r\n * * If current gap is positive (push to the left): Current token lose some width, but no more than what the previous token can give.\r\n * * If current gap is negative (previous token pull them): No space is lost, they do not interfere with each other.\r\n */\r\nexport const getLostLeftWidth = (prevGap: number, curGap: number) => {\r\n return prevGap >= 0\r\n ? curGap >= 0\r\n ? 0\r\n : Math.max(prevGap * -1, curGap) * -1\r\n : curGap >= 0\r\n ? Math.max(prevGap, curGap * -1) * -1\r\n : 0;\r\n};","import {\r\n FontData,\r\n BULLET_LETTER,\r\n TCGSymbolLetterRegex,\r\n OCGAlphabetRegex,\r\n MAX_LINE_REVERSE_INDENT,\r\n START_OF_LINE_ALPHABET_OFFSET,\r\n FragmentSplitRegex,\r\n WholeWordRegex,\r\n DefaultFontSizeData,\r\n ST_ICON_SYMBOL,\r\n TextData,\r\n NoSpaceRegex,\r\n LETTER_GAP_RATIO,\r\n NB_UNCOMPRESSED_START,\r\n NB_UNCOMPRESSED_END,\r\n SquareBracketLetterRegex,\r\n CapitalLetterRegex,\r\n NumberRegex,\r\n OCGNoOverheadGapRegex,\r\n GAP_PER_WIDTH_RATIO,\r\n RUBY_REGEX,\r\n DefaultFontData,\r\n RUBY_BONUS_RATIO,\r\n NON_BREAKABLE_SYMBOL_SOURCE,\r\n NonCompressableRegex,\r\n} from 'src/model';\r\nimport { getTextWorker, analyzeHeadText, tokenizeText, getLostLeftWidth } from './text-util';\r\nimport { createFontGetter } from 'src/util';\r\nimport { getLetterWidth } from './letter';\r\n\r\n/** \r\n * Return information of a token.\r\n * @returns\r\n * * `totalWidth`: The width of the token based on xRatio. In the same fashion with `getLetterWidth`, we get the true width for scalable letter, and inverse-scaled width of a non-scalable letter. `totalWidth` does no include whitespaces since they are not calculate traditionally.\r\n * * `leftMostLetter`: The left most letter of a token (not counting control characters), there is a special treatment based on what is the left most letter of a token (mainly indentation).\r\n * * `spaceCount`: Number of whitespaces in a token, their width will be calculated afterward.\r\n * * `spaceAtEnd`: Whether or not the token end with a space, for example most of English word requires a whitespace between words, while Japanese does not. We also does not allow a line to end with a whitespace unless it is the last line.\r\n * * `rightGap`, `leftGap`: Gap of a token based on its overhead letters. The token may consist of multiple letters each with their own gap, so it is easy to see that right and left gap of a token is respectively left gap of the leftmost letter and right gap of the rightmost letter.\r\n */\r\nexport const analyzeToken = ({\r\n ctx,\r\n token: rawToken, nextToken,\r\n xRatio,\r\n previousTokenGap = 0,\r\n letterSpacing = DefaultFontSizeData.letterSpacing,\r\n format,\r\n textData,\r\n // debug = false,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n token: string,\r\n nextToken: string | undefined,\r\n xRatio: number,\r\n previousTokenGap?: number,\r\n letterSpacing?: number,\r\n format: string,\r\n // debug?: boolean,\r\n textData: {\r\n fontData: FontData,\r\n fontLevel: number,\r\n currentFont: ReturnType,\r\n },\r\n}) => {\r\n if (!ctx || !rawToken) return {\r\n totalWidth: 0,\r\n leftMostLetter: '',\r\n spaceCount: 0,\r\n spaceAtEnd: false,\r\n rightGap: 0,\r\n leftGap: 0,\r\n };\r\n const {\r\n currentFont,\r\n fontData,\r\n fontLevel,\r\n } = textData;\r\n const {\r\n metricMethod,\r\n headTextGapRatio = DefaultFontData.headTextGapRatio,\r\n headTextOverflow = DefaultFontData.headTextOverflow,\r\n fontStyle,\r\n } = fontData;\r\n const fontSizeData = fontData.fontList[fontLevel];\r\n const {\r\n bulletSymbolWidth,\r\n capitalLetterRatio,\r\n fontSize,\r\n iconSymbolWidth = bulletSymbolWidth,\r\n largeSymbolRatio = DefaultFontSizeData.largeSymbolRatio,\r\n headTextSpacing = DefaultFontSizeData.headTextSpacing,\r\n squareBracketRatio,\r\n wordLetterSpacing,\r\n } = fontSizeData;\r\n const defaultGap = fontSize * LETTER_GAP_RATIO;\r\n const {\r\n applyScale, reverseScale,\r\n applyLargerText, stopApplyLargerText,\r\n applyFuriganaFont, stopApplyFuriganaFont,\r\n applyOrdinalFont, stopApplyOrdinalFont,\r\n applySymbolFont, stopApplySymbolFont,\r\n applyNumberFont, stopApplyNumberFont,\r\n } = getTextWorker(ctx, fontData, fontSizeData, currentFont);\r\n const token = rawToken.replaceAll(new RegExp(NON_BREAKABLE_SYMBOL_SOURCE, 'g'), '');\r\n const letterSpacingRatio = 1 + letterSpacing / 2;\r\n let leftMostLetter = '';\r\n let totalWidth = 0;\r\n let spaceCount = 0;\r\n let spaceAtEnd = false;\r\n const isLastOfLine = nextToken === undefined;\r\n /** The right gap of a token will influence the left gap of the next token */\r\n let currentRightGap = previousTokenGap ?? 0;\r\n /** Whether or not it is affected by rebalance calculation */\r\n let offsetable = false;\r\n let leftMostGap = 0;\r\n\r\n const fragmentList = token.split(FragmentSplitRegex).filter(entry => entry != null && entry !== '');\r\n for (let cnt = 0; cnt < fragmentList.length; cnt++) {\r\n const isLeftmostFragment = cnt === 0;\r\n const fragment = fragmentList[cnt];\r\n\r\n /** S/T symbol is unscalable (it does not condense no matter the ratio) */\r\n if (fragment === ST_ICON_SYMBOL) {\r\n currentRightGap = 0;\r\n const fragmentWidth = iconSymbolWidth / xRatio;\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** Bullet symbol is unscalable (\"Agave Dragon\" OCG/TCG) */\r\n else if (fragment === BULLET_LETTER) {\r\n currentRightGap = 0;\r\n const fragmentWidth = bulletSymbolWidth / xRatio;\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** Copyright symbol © is unscalable (creator text) */\r\n else if (/[©]/.test(fragment)) {\r\n currentRightGap = 0;\r\n applyLargerText(largeSymbolRatio);\r\n const fragmentWidth = ctx.measureText(fragment).width / xRatio;\r\n stopApplyLargerText();\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** OCG Ordinal symbol is unscalable */\r\n else if (NonCompressableRegex.test(fragment)) {\r\n currentRightGap = 0;\r\n applyOrdinalFont();\r\n const fragmentWidth = ctx.measureText(fragment).width / xRatio;\r\n stopApplyOrdinalFont();\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n spaceCount += 1;\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** Process ruby syntax */\r\n else if (RUBY_REGEX.test(fragment)) {\r\n const [footText, rubyType, headText = ''] = fragment.replaceAll(/{|}/g, '').split(/(\\|+)/);\r\n const fitFootText = rubyType === '||';\r\n /** Calculate foot text's width */\r\n const {\r\n totalWidth: footTextWidth,\r\n } = analyzeToken({ ctx, token: footText, nextToken, xRatio, letterSpacing, previousTokenGap: 0, format, textData });\r\n\r\n /** Calculate head text's width */\r\n applyFuriganaFont();\r\n const headTextLetterWidth = headText\r\n .split('')\r\n .map(letter => getLetterWidth({ ctx, letter, fontStyle, metricMethod: 'furigana', xRatio: 1 }).boundWidth)\r\n .reduce((acc, cur) => acc + cur, 0);\r\n stopApplyFuriganaFont();\r\n\r\n /** Calculate gap */\r\n const { halfGap: baseHalfGap, headTextWidth } = analyzeHeadText({\r\n headText,\r\n headTextLetterWidth: headTextLetterWidth / xRatio,\r\n footText,\r\n footTextWidth,\r\n headTextGap: defaultGap / xRatio,\r\n headTextSpacing,\r\n gapPadding: headTextGapRatio * fontSize / xRatio,\r\n fitFootText,\r\n sentenceXRatio: xRatio,\r\n xRatio: (headTextOverflow === 'condense' && footText.length > 1) ? Math.min(1, xRatio + RUBY_BONUS_RATIO) : 0,\r\n });\r\n const halfGap = headText.length === 0\r\n ? Math.max(defaultGap, footTextWidth / GAP_PER_WIDTH_RATIO)\r\n : baseHalfGap;\r\n const leftGap = halfGap;\r\n const rightGap = halfGap;\r\n const boundWidth = Math.max(headTextWidth, footTextWidth);\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n currentRightGap = rightGap;\r\n totalWidth += boundWidth - lostLeftWidth;\r\n spaceCount += 1;\r\n\r\n if (isLeftmostFragment) {\r\n offsetable = true;\r\n leftMostGap = leftGap;\r\n leftMostLetter = footText[0];\r\n }\r\n }\r\n /** Process whole word. Because the font has contextual kerning, the width when we draw the whole word will be different compare to the width when we draw each letter next to each other, sometimes the different may become noticeable (for example in the word \"AWA\", there is a very noticeable distance between these letters), so we try to simulate that behavior. */\r\n else if (WholeWordRegex.test(fragment)) {\r\n /** Whole word may have their own spacing ratio */\r\n const normalizedWordSpacingRatio = wordLetterSpacing\r\n ? 1 + wordLetterSpacing / 2\r\n : letterSpacingRatio;\r\n ctx.letterSpacing = `${(normalizedWordSpacingRatio - 1) * currentFont.getFontInfo().sizeAsNumber}px`;\r\n\r\n let remainFragment = fragment;\r\n let fragmentWidth = 0;\r\n /** A simple algorithm to simulate contextual kerning, for each letter, we do these steps:\r\n * * Split the current word into two part: The first letter and the rest of the word.\r\n * * Calculate the width of a letter, then calculate the width of the remaining word.\r\n * * By subtract them, we will have the actual width of a letter, when put into the word and affected by contextual kerning.\r\n */\r\n while (remainFragment !== '') {\r\n let currentLetter = remainFragment[0];\r\n let nextRemainFragment = remainFragment.slice(1);\r\n let actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n /** Square brackets (\"[\" and \"]\") may have different scaling */\r\n if (SquareBracketLetterRegex.test(currentLetter)) {\r\n applyScale(squareBracketRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n reverseScale(squareBracketRatio);\r\n }\r\n /** Captial letters may have different scaling */\r\n else if (CapitalLetterRegex.test(currentLetter)) {\r\n applyScale(capitalLetterRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n reverseScale(capitalLetterRatio);\r\n }\r\n /** Number letters may use different font, for the sake of simplicity, we assume that the font does not affect (too much) to the letter's width. In short, we assume that the letter \"8\" in font X have the same width with the letter \"8\" in font Y, just different shape. */\r\n else if (NumberRegex.test(currentLetter)) {\r\n applyNumberFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n stopApplyNumberFont();\r\n }\r\n /** Special symbol in TCG card (\"Evil☆Twin\") may use different font, again we assume the letter have similar size. */\r\n else if (TCGSymbolLetterRegex.test(currentLetter) && fontStyle === 'tcg') {\r\n applySymbolFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n stopApplySymbolFont();\r\n }\r\n /** No special treatment for the usual letters */\r\n else {\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n }\r\n fragmentWidth += actualLetterWidth;\r\n remainFragment = nextRemainFragment;\r\n }\r\n\r\n const leftGap = Math.max(defaultGap, fragmentWidth / GAP_PER_WIDTH_RATIO);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n totalWidth += fragmentWidth - lostLeftWidth;\r\n currentRightGap = rightGap;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = leftGap;\r\n leftMostLetter = fragment[0];\r\n }\r\n ctx.letterSpacing = '0px';\r\n }\r\n /** Special symbol in TCG card (\"Evil☆Twin\") may use different font */\r\n else if (TCGSymbolLetterRegex.test(fragment) && fontStyle === 'tcg') {\r\n applySymbolFont();\r\n const fragmentWidth = ctx.measureText(fragment).width * letterSpacingRatio;\r\n stopApplySymbolFont();\r\n\r\n const leftGap = Math.max(defaultGap, fragmentWidth / GAP_PER_WIDTH_RATIO);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n totalWidth += fragmentWidth - lostLeftWidth;\r\n currentRightGap = rightGap;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = leftGap;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n else {\r\n const { boundWidth } = getLetterWidth({ ctx, letter: fragment, isLastOfLine, fontStyle, metricMethod, xRatio });\r\n const fragmentWidth = boundWidth * letterSpacingRatio;\r\n const leftGap = Math.max(defaultGap, fragmentWidth / GAP_PER_WIDTH_RATIO);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n totalWidth += fragmentWidth - lostLeftWidth;\r\n currentRightGap = rightGap;\r\n if (\r\n (format === 'ocg' || (format === 'tcg' && /\\s+/.test(fragment)))\r\n && NoSpaceRegex.test(fragment) === false\r\n ) {\r\n spaceCount += 1;\r\n if (cnt === fragmentList.length - 1) spaceAtEnd = true;\r\n }\r\n if (isLeftmostFragment) {\r\n leftMostGap = leftGap;\r\n leftMostLetter = fragment[0];\r\n }\r\n if (OCGNoOverheadGapRegex.test(fragment)) {\r\n leftMostGap = 0;\r\n currentRightGap = 0;\r\n }\r\n }\r\n }\r\n\r\n return {\r\n totalWidth,\r\n spaceCount,\r\n spaceAtEnd,\r\n leftMostLetter,\r\n rightGap: currentRightGap,\r\n leftGap: leftMostGap,\r\n offsetable,\r\n };\r\n};\r\n\r\n/**\r\n * Analyze a line again after we split it with suitable ratio. Text in line are justify-aligned, so we will calculate the sum of width of all tokens, then distribute the remaining space to the amount of whitespaces in the line, that means each whitespace will have additional width add into them so that the line fit perfectly into the available space.\r\n * \r\n * Special treatment for last line of a paragraph, because the last line may not be filled entirely unlike all the lines above, we will decide a threshold for them, if the remaining space is too large, we do not distribute them and just left the line as-is.\r\n */\r\nexport const analyzeLine = ({\r\n ctx,\r\n line,\r\n width,\r\n xRatio: baseXRatio,\r\n format,\r\n isLast,\r\n textData,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n line: string,\r\n width: number,\r\n xRatio: number,\r\n format: string,\r\n isLast: boolean,\r\n textData: TextData,\r\n}) => {\r\n const tokenList = tokenizeText(line);\r\n let totalContentWidth = 0;\r\n let lineSpaceCount = 0;\r\n let currentGap = 0;\r\n\r\n for (let cnt = 0, xRatio = baseXRatio; cnt < tokenList.length; cnt++) {\r\n const token = tokenList[cnt];\r\n const nextToken = tokenList[cnt + 1];\r\n /** Non-compressable mode */\r\n if (token === NB_UNCOMPRESSED_START) {\r\n xRatio = 1;\r\n continue;\r\n }\r\n else if (token === NB_UNCOMPRESSED_END) {\r\n xRatio = baseXRatio;\r\n continue;\r\n }\r\n const {\r\n spaceCount,\r\n totalWidth,\r\n spaceAtEnd,\r\n leftGap,\r\n rightGap,\r\n leftMostLetter,\r\n } = analyzeToken({ ctx, token, nextToken, xRatio, previousTokenGap: currentGap / xRatio, textData, format });\r\n /** Check `createLineList` function about first token indentation. */\r\n const indent = (\r\n (cnt === 0 && leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT, leftGap * xRatio) * -1 : 0)\r\n +\r\n (cnt === 0 && OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET * xRatio : 0)\r\n );\r\n\r\n currentGap = rightGap * xRatio;\r\n totalContentWidth += totalWidth * xRatio + indent;\r\n lineSpaceCount += spaceCount - (spaceAtEnd && nextToken === undefined ? 1 : 0);\r\n }\r\n const expectedSpaceWidth = lineSpaceCount > 0 ? (width - totalContentWidth) / lineSpaceCount : 0;\r\n const spaceWidth = isLast\r\n ? format === 'tcg'\r\n ? expectedSpaceWidth > 1.500 ? 0 : expectedSpaceWidth\r\n : expectedSpaceWidth > 3.650 ? 0 : expectedSpaceWidth\r\n : expectedSpaceWidth;\r\n\r\n return {\r\n tokenList,\r\n spaceWidth,\r\n };\r\n};","import {\r\n OCGAlphabetRegex,\r\n MAX_LINE_REVERSE_INDENT,\r\n START_OF_LINE_ALPHABET_OFFSET,\r\n TextData,\r\n NB_UNCOMPRESSED_END,\r\n NB_UNCOMPRESSED_START,\r\n} from 'src/model';\r\nimport { tokenizeText } from './text-util';\r\nimport { analyzeToken } from './text-analyze';\r\n\r\n/** Turn a paragraph into a list of lines with provided ratio (median). Basically we test with some ratio until reach a desirable list. Each line contains the information about its content, its actual width and whether or not it is the last line of a paragraph. Easy to see that actual width of all tokens on a line is always smaller or equal to the hypothesis width of the line. */\r\nexport const createLineList = ({\r\n ctx,\r\n median,\r\n paragraphList,\r\n additionalLineCount = 0,\r\n width,\r\n format,\r\n textData,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n median: number,\r\n width: number,\r\n paragraphList: string[],\r\n additionalLineCount?: number,\r\n format: string,\r\n textData: TextData,\r\n}) => {\r\n const { fontData, fontLevel } = textData;\r\n const { letterSpacing } = fontData.fontList[fontLevel];\r\n const currentLineList: { line: string, isLast: boolean, effectiveMedian: number, actualLineWidth: number }[] = [];\r\n const currentLineCount = paragraphList.reduce((accumulatedLineCount, curr) => {\r\n // Calculate hypothesis canvas width with the provided median ratio\r\n const baseXRatio = (median <= 100 ? 100 : median) / 1000;\r\n const scaledWidth = width / baseXRatio;\r\n const tokenList = tokenizeText(curr, true);\r\n let addedLineCount = 1;\r\n let wordList: string[] = [];\r\n let currentLineWidth = 0;\r\n let currentGap = 0;\r\n let unCompressedFlag = 0;\r\n\r\n for (let cnt = 0, xRatio = baseXRatio; cnt < tokenList.length; cnt++) {\r\n const token = tokenList[cnt];\r\n const nextToken = tokenList[cnt + 1];\r\n /** Because NB_UNCOMPRESS control letters may affect multiple lines, but we want to reduce the dependencies between each line as much as possible (in other words, each line should not know about the line below or above it).\r\n * To solve this, we will automatically add a NB_UNCOMPRESS_END letter to the end of a sentence, if it has an unclosed NB_UNCOMPRESS_START letter somewhere. Then we will add a NB_UNCOMPRESS_START letter immediately at the start of the next line.\r\n * Control letters do not get draw so this will not affect the calculation result.\r\n */\r\n if (token === NB_UNCOMPRESSED_START) {\r\n unCompressedFlag += 1;\r\n xRatio = 1;\r\n } else if (token === NB_UNCOMPRESSED_END) {\r\n unCompressedFlag -= 1;\r\n xRatio = baseXRatio;\r\n }\r\n let {\r\n leftMostLetter,\r\n totalWidth,\r\n rightGap,\r\n leftGap,\r\n } = analyzeToken({ ctx, token, nextToken, xRatio, previousTokenGap: currentGap, format, letterSpacing, textData });\r\n\r\n /** First token of a line may have the head text overflow to the left of the paragraph. On one hand we ensure that the foot text of that token does not overflow, on the other hand we also ensure that the head text cannot overflow too far so it overlap with the section's border (if any).\r\n */\r\n const indent = cnt === 0\r\n ? (leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT / xRatio, leftGap) * -1 : 0)\r\n + (OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET : 0)\r\n : 0;\r\n let tokenWidth = totalWidth / (unCompressedFlag > 0 ? baseXRatio : 1) + indent;\r\n /** Last token is not allowed to become overflow (no known cases said otherwise). */\r\n if (currentLineWidth + tokenWidth > scaledWidth) {\r\n let line = wordList.join('').trim();\r\n if (unCompressedFlag > 0) line = line + NB_UNCOMPRESSED_END;\r\n if (unCompressedFlag < 0) line = NB_UNCOMPRESSED_START + line;\r\n unCompressedFlag = 0;\r\n currentLineList.push({\r\n line,\r\n effectiveMedian: median,\r\n isLast: false,\r\n actualLineWidth: currentLineWidth,\r\n });\r\n /** If the next token is gonna made the line become overflow, we will create a new line with it becoming the first token. We also re-calulate the width of that token since now the right side of it is not the \"previous token\" anymore, but the edge of a new line. */\r\n let {\r\n totalWidth,\r\n rightGap,\r\n leftGap,\r\n } = analyzeToken({ ctx, token, nextToken, xRatio, previousTokenGap: 0, format, textData });\r\n /** Of course we also re-calculate overflow possibility. */\r\n const indent = (leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT / xRatio, leftGap) * -1 : 0)\r\n + (OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET : 0);\r\n let tokenWidth = totalWidth + indent;\r\n currentLineWidth = tokenWidth;\r\n currentGap = rightGap;\r\n wordList = [token];\r\n addedLineCount += 1;\r\n } else {\r\n currentLineWidth += tokenWidth;\r\n currentGap = rightGap;\r\n wordList.push(token);\r\n }\r\n }\r\n\r\n /** If no more tokens left in the sentence, wrap them into the last line. */\r\n let line = wordList.join('').trim();\r\n if (unCompressedFlag > 0) line = line + NB_UNCOMPRESSED_END;\r\n if (unCompressedFlag < 0) line = NB_UNCOMPRESSED_START + line;\r\n unCompressedFlag = 0;\r\n currentLineList.push({\r\n line,\r\n effectiveMedian: median,\r\n isLast: true,\r\n actualLineWidth: currentLineWidth,\r\n });\r\n\r\n return accumulatedLineCount + addedLineCount;\r\n }, 0) + (additionalLineCount ?? 0);\r\n\r\n return { currentLineList, currentLineCount };\r\n};","import {\r\n analyzeHeadText,\r\n getTextWorker,\r\n} from './text-util';\r\nimport { getLetterWidth } from './letter';\r\nimport { RUBY_BONUS_RATIO } from 'src/model';\r\n\r\n/** Fill head text, by furigana rules, they have their own scaling space so they do not necessarily respect current ratio of the foot text. This function receive true coordinations.\r\n * \r\n * Head text has four cases of compression:\r\n * * Case 1: They do not condense at all, this is the default case for single-letter foot text.\r\n * * Case 2: They condense with a smaller rate compare to foot text, this is the default case for multiple-letters foot text.\r\n * * Case 3: They condense because the head text is way wider than the foot text, especially in the case of single-letter foot text.\r\n * * Case 4: They condense because overflow mode is explicitly set to `condense` by compressable ruby syntax. This prevent them from growth out of foot text's boundary, and has the highest priority, but only apply in the case of multiple-letters foot text.\r\n*/\r\nexport const fillHeadText = ({\r\n ctx,\r\n fontSize,\r\n edge, baseline,\r\n headText, headTextLetterWidth,\r\n footText, footTextWidth,\r\n headTextGap,\r\n headTextSpacing,\r\n headTextHeightRatio,\r\n headTextBold,\r\n headTextGapRatio,\r\n xRatio,\r\n fontStyle,\r\n textWorker,\r\n fitFootText,\r\n headTextOverflow,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n fontSize: number,\r\n headText: string, headTextLetterWidth: number,\r\n footText: string, footTextWidth: number,\r\n edge: number, baseline: number,\r\n headTextGap: number,\r\n headTextSpacing: number,\r\n headTextHeightRatio: number,\r\n headTextBold: boolean,\r\n headTextGapRatio: number,\r\n xRatio: number,\r\n fontStyle: string,\r\n textWorker: ReturnType,\r\n fitFootText: boolean,\r\n headTextOverflow: 'normal' | 'condense',\r\n}) => {\r\n const { applyFuriganaFont, stopApplyFuriganaFont, resetScale, applyScale } = textWorker;\r\n /** Custom ratio for case 2 */\r\n const externalHeadTextXRatio = (headTextOverflow === 'condense' && footText.length > 1)\r\n ? Math.min(1, xRatio + RUBY_BONUS_RATIO)\r\n : 0;\r\n const {\r\n gapPadding,\r\n letterSpacing,\r\n trueHeadTextWidth,\r\n halfGap,\r\n alignment,\r\n headTextXRatio,\r\n } = analyzeHeadText({\r\n headText, headTextLetterWidth,\r\n footText, footTextWidth: footTextWidth * xRatio,\r\n headTextGap, headTextSpacing: headTextSpacing * xRatio,\r\n gapPadding: fontSize * headTextGapRatio,\r\n fitFootText,\r\n sentenceXRatio: xRatio,\r\n xRatio: externalHeadTextXRatio,\r\n });\r\n const overflow = trueHeadTextWidth > footTextWidth * xRatio;\r\n\r\n if (headText.length === 0) return {\r\n trueHeadTextWidth,\r\n halfGap,\r\n };\r\n\r\n /** Custom ratio for case 4 */\r\n const baseLoneTokenRatio = fitFootText\r\n ? Math.min(1, footTextWidth * xRatio / trueHeadTextWidth)\r\n : 1;\r\n\r\n /** Priority: Case 4 => Case 3 and 2, in practice, case 2 and 3 are usually mutual exclusive, because case 2 currently only apply in card's name, while all case 3 only happens in card's effect. */\r\n const finalizedRatio = fitFootText\r\n ? baseLoneTokenRatio\r\n : (externalHeadTextXRatio && alignment === 'center')\r\n ? externalHeadTextXRatio\r\n : headTextXRatio;\r\n\r\n let currentEdge = edge;\r\n resetScale();\r\n if (fitFootText || finalizedRatio) {\r\n applyScale(finalizedRatio, 1);\r\n currentEdge = edge / finalizedRatio;\r\n }\r\n\r\n if (alignment === 'center') {\r\n currentEdge += gapPadding;\r\n /** Adjust head text's drawing position to fit case. */\r\n if (!overflow) {\r\n currentEdge += (footTextWidth * xRatio - trueHeadTextWidth) / 2;\r\n } else if (finalizedRatio > baseLoneTokenRatio) {\r\n currentEdge += (footTextWidth * xRatio / finalizedRatio - trueHeadTextWidth) / 2 / finalizedRatio;\r\n }\r\n } else {\r\n currentEdge += letterSpacing / 2;\r\n }\r\n\r\n for (const letter of headText) {\r\n /** `getLetterWidth` does not run properly in the case of bold font, so we must turn it off when calculating text width, before turn in on again and draw the actual text. */\r\n applyFuriganaFont();\r\n const { width, boundWidth } = getLetterWidth({ ctx, letter, fontStyle, metricMethod: 'furigana', xRatio: 1 });\r\n const boundingOffset = (width - boundWidth) / 2;\r\n stopApplyFuriganaFont();\r\n\r\n applyFuriganaFont(headTextBold);\r\n ctx.fillText(letter, currentEdge - boundingOffset, baseline - fontSize * headTextHeightRatio);\r\n stopApplyFuriganaFont();\r\n currentEdge += (boundWidth + letterSpacing);\r\n }\r\n if (fitFootText || finalizedRatio) {\r\n resetScale();\r\n }\r\n applyScale(xRatio, 1);\r\n\r\n return {\r\n trueHeadTextWidth,\r\n halfGap,\r\n };\r\n};","import {\r\n BULLET_LETTER,\r\n CapitalLetterRegex,\r\n DefaultFontData,\r\n DefaultFontSizeData,\r\n FragmentSplitRegex,\r\n LETTER_GAP_RATIO,\r\n MAX_LINE_REVERSE_INDENT,\r\n NB_UNCOMPRESSED_END,\r\n NB_UNCOMPRESSED_START,\r\n NoSpaceRegex,\r\n NonCompressableRegex,\r\n NumberRegex,\r\n OCGAlphabetRegex,\r\n OCGNoOverheadGapRegex,\r\n RUBY_BONUS_RATIO,\r\n RUBY_REGEX,\r\n START_OF_LINE_ALPHABET_OFFSET,\r\n ST_ICON_SYMBOL,\r\n SquareBracketLetterRegex,\r\n TCGSymbolLetterRegex,\r\n TextData,\r\n WholeWordRegex,\r\n getBulletSpacing,\r\n} from 'src/model';\r\nimport {\r\n drawBullet,\r\n getLostLeftWidth,\r\n analyzeHeadText,\r\n getTextWorker,\r\n tokenizeText,\r\n} from './text-util';\r\nimport { analyzeToken } from './text-analyze';\r\nimport { TextDrawer, drawLetter, getLetterWidth } from './letter';\r\nimport { fillHeadText } from './text-overhead';\r\nimport { drawMarker } from './canvas-util';\r\n\r\n/**\r\n * This is the heart and soul of drawer, please test this thoroughly for each change.\r\n * \r\n * @summary Text hierachy\r\n * * Letter: Individual (1) letter. E.g. \"a\", \"1\", \"み\", \"装\", \"-\", \"①\"\r\n * * Fragment: Multiple letters with decorate control characters. E.g. \"{無|む}\", \"Damage\"\r\n * * Token: Multiple fragments with group control characters (NB_WORD_OPEN and NB_WORD_CLOSE) or a whole word, splitted by space or other breakable letters. E.g. \"⦉{相|あい}{手|て}⦊\"\r\n * * Sentence: Sequence of tokens. E.g. \"Cannot be destroyed by battle or card effects\"\r\n * * Paragraph: Consecutive sentences without new line characters (\"\\n\").\r\n * * Block: Whole text in a section.\r\n * \r\n * Line: Line is a special unit, when a sentence hit the end of current text box, it wrap to new line without using the actual new line character. In this case the sentence is broke down into multiple lines. Line can be manully enforced with line control characters (NB_LINE_OPEN and NB_LINE_CLOSE), or created from text split function.\r\n * **/\r\nexport const drawLine = ({\r\n ctx,\r\n tokenList,\r\n trueEdge, trueBaseline,\r\n spaceWidth = 0,\r\n xRatio: baseXRatio, yRatio = 1,\r\n textData,\r\n format,\r\n textDrawer,\r\n debug = false,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n format: string,\r\n tokenList: string[],\r\n xRatio: number,\r\n yRatio?: number,\r\n trueEdge: number,\r\n trueBaseline: number,\r\n spaceWidth?: number,\r\n textData: TextData,\r\n textDrawer?: TextDrawer,\r\n debug?: boolean,\r\n}) => {\r\n const {\r\n currentFont,\r\n fontData,\r\n fontLevel,\r\n } = textData;\r\n const fontSizeData = fontData.fontList[fontLevel];\r\n const {\r\n headTextFillStyle,\r\n headTextBold = DefaultFontData.headTextBold,\r\n headTextHeightRatio = DefaultFontData.headTextHeightRatio,\r\n headTextOverflow = DefaultFontData.headTextOverflow,\r\n headTextGapRatio = DefaultFontData.headTextGapRatio,\r\n metricMethod,\r\n fontStyle,\r\n letterDeviationMap = {},\r\n } = fontData;\r\n const {\r\n bulletSymbolWidth,\r\n capitalLetterRatio = DefaultFontSizeData.capitalLetterRatio,\r\n fontSize,\r\n headTextSpacing = DefaultFontSizeData.headTextSpacing,\r\n iconSymbolWidth = bulletSymbolWidth,\r\n largeSymbolRatio = DefaultFontSizeData.largeSymbolRatio,\r\n letterSpacing = DefaultFontSizeData.letterSpacing,\r\n ordinalFontOffsetY = DefaultFontSizeData.ordinalFontOffsetY,\r\n squareBracketRatio = DefaultFontSizeData.squareBracketRatio,\r\n wordLetterSpacing,\r\n } = fontSizeData;\r\n const textWorker = getTextWorker(ctx, fontData, fontSizeData, currentFont);\r\n const {\r\n stopApplyFuriganaFont, applyFuriganaFont,\r\n stopApplyLargerText, applyLargerText,\r\n stopApplyNumberFont, applyNumberFont,\r\n stopApplyOrdinalFont, applyOrdinalFont,\r\n applyScale, reverseScale,\r\n applySymbolFont, stopApplySymbolFont,\r\n applyAsymmetricScale, resetScale,\r\n } = textWorker;\r\n\r\n const letterSpacingRatio = 1 + letterSpacing / 2;\r\n const baseline = trueBaseline / yRatio;\r\n let previousTokenGap = 0;\r\n let iconPositionList: { edge: number, size: number, baseline: number }[] = [];\r\n let previousTokenRebalanceOffset = 0;\r\n let tokenEdge = trueEdge;\r\n\r\n /** To reach a acceptable degree of calculation, we usually need to look ahead 1 or 2 next tokens, same with fragments. */\r\n /** To prevent cascading calculation, we disconnect the relationship between fragments and tokens. We use all information to calculate an empty space for each token, then fragments of that token is drawn inside that empty space assuming they would fit. In other words, drawing fragments of a token DOES NOT interfere with the next token. That means in theory we can skip all fragments of a token to draw the next token right away.\r\n */\r\n for (let tokenCnt = 0, xRatio = baseXRatio; tokenCnt < tokenList.length; tokenCnt++) {\r\n const token = tokenList[tokenCnt];\r\n /** Turn on/off non-condenseable mode */\r\n if (token === NB_UNCOMPRESSED_START) {\r\n xRatio = 1;\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n continue;\r\n }\r\n else if (token === NB_UNCOMPRESSED_END) {\r\n xRatio = baseXRatio;\r\n ctx.scale(xRatio, 1);\r\n continue;\r\n }\r\n const gapRatio = LETTER_GAP_RATIO * xRatio;\r\n const defaultGap = fontSize * gapRatio;\r\n const nextToken = tokenList[tokenCnt + 1];\r\n const next2ndToken = tokenList[tokenCnt + 2];\r\n const analyzeTokenParameter = {\r\n ctx,\r\n xRatio,\r\n letterSpacing,\r\n format,\r\n textData,\r\n };\r\n const drawLetterParameter = {\r\n ctx,\r\n baseline,\r\n xRatio,\r\n textDrawer,\r\n };\r\n const fragmentList = token.split(FragmentSplitRegex).filter(entry => entry != null && entry !== '');\r\n /** Analyze current token again, this will dictate the width of a token, no matter what is actually drawn. We expect to draw nothing but the calculation must stay correct. */\r\n const {\r\n leftMostLetter,\r\n leftGap,\r\n rightGap: tokenRightGap,\r\n totalWidth: totalTokenWidth,\r\n spaceCount,\r\n } = analyzeToken({\r\n token, nextToken, previousTokenGap: previousTokenGap / xRatio, ...analyzeTokenParameter,\r\n });\r\n\r\n /** Again, first token indentation. */\r\n const indent = tokenCnt === 0\r\n ? (leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT, leftGap * xRatio) * -1 : 0)\r\n + (OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET : 0)\r\n : 0;\r\n let fragmentEdge = tokenEdge + indent;\r\n let currentRightGap = previousTokenGap;\r\n\r\n /** Draw all the fragments of a token. */\r\n for (let fragmentCnt = 0; fragmentCnt < fragmentList.length; fragmentCnt++) {\r\n const fragment = fragmentList[fragmentCnt];\r\n const nextFragment = fragmentList[fragmentCnt + 1] ?? nextToken;\r\n const next2ndFragment = fragmentList[tokenCnt + 2] ?? next2ndToken;\r\n\r\n /** These fragments do not have any visual */\r\n if (token === NB_UNCOMPRESSED_START || token === NB_UNCOMPRESSED_END) {}\r\n /** We do not actually draw S/T Icon here, but we record its position and leave a suitable space for it. */\r\n else if (fragment === ST_ICON_SYMBOL) {\r\n iconPositionList.push({ edge: fragmentEdge, size: iconSymbolWidth, baseline });\r\n fragmentEdge += iconSymbolWidth * letterSpacingRatio;\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** Bullet symbol ● is not condenseable, and has specialized draw worker. */\r\n else if (fragment === BULLET_LETTER) {\r\n resetScale();\r\n drawBullet(ctx, fragmentEdge, trueBaseline, bulletSymbolWidth, getBulletSpacing(format));\r\n fragmentEdge += bulletSymbolWidth * letterSpacingRatio;\r\n applyAsymmetricScale(xRatio, yRatio);\r\n\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** Copyright symbol © is not condenseable and use larger font. */\r\n else if (/[©]/.test(fragment)) {\r\n resetScale();\r\n applyLargerText(largeSymbolRatio);\r\n drawLetter({\r\n ...drawLetterParameter,\r\n letter: fragment,\r\n edge: fragmentEdge * xRatio,\r\n baseline: trueBaseline + (format === 'tcg' ? 1 : 2),\r\n });\r\n fragmentEdge += ctx.measureText(fragment).width * letterSpacingRatio;\r\n stopApplyLargerText();\r\n applyAsymmetricScale(xRatio, yRatio);\r\n\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** OCG Ordinal symbol is not condenseable and use different font. */\r\n else if (NonCompressableRegex.test(fragment)) {\r\n resetScale();\r\n applyOrdinalFont();\r\n drawLetter({\r\n ...drawLetterParameter,\r\n letter: fragment,\r\n edge: fragmentEdge * xRatio,\r\n baseline: trueBaseline + ordinalFontOffsetY,\r\n });\r\n fragmentEdge += ctx.measureText(fragment).width * letterSpacingRatio;\r\n stopApplyOrdinalFont();\r\n applyAsymmetricScale(xRatio, yRatio);\r\n\r\n fragmentEdge += spaceWidth;\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** Fragment with overhead text. */\r\n else if (RUBY_REGEX.test(fragment)) {\r\n const [footText, rubyType, headText = ''] = fragment.replaceAll(/{|}/g, '').split(/(\\|+)/);\r\n const fitFootText = rubyType === '||';\r\n /** We do not support nested overhead text. */\r\n const { totalWidth: footTextWidth } = analyzeToken({\r\n token: footText, nextToken: nextFragment,\r\n previousTokenGap: 0,\r\n ...analyzeTokenParameter,\r\n });\r\n\r\n /** Calculate letter width first before deciding the spacing. */\r\n applyFuriganaFont();\r\n const headTextLetterWidth = headText\r\n .split('')\r\n .map(letter => getLetterWidth({ ctx, letter, fontStyle, metricMethod: 'furigana', xRatio: 1 }).boundWidth)\r\n .reduce((acc, cur) => acc + cur, 0);\r\n stopApplyFuriganaFont();\r\n\r\n /** Notice what is scaled and what is not in those params. It is a headache to work with sometime. */\r\n const {\r\n headTextWidth,\r\n halfGap: baseHalfGap,\r\n } = analyzeHeadText({\r\n headText,\r\n headTextLetterWidth,\r\n footText,\r\n footTextWidth: footTextWidth * xRatio,\r\n headTextGap: defaultGap,\r\n headTextSpacing: headTextSpacing * xRatio,\r\n gapPadding: fontSize * headTextGapRatio,\r\n fitFootText,\r\n sentenceXRatio: xRatio,\r\n xRatio: (headTextOverflow === 'condense' && footText.length > 1) ? Math.min(1, xRatio + RUBY_BONUS_RATIO) : 0,\r\n });\r\n const halfGap = headText.length === 0\r\n ? Math.max(defaultGap, footTextWidth * gapRatio)\r\n : baseHalfGap;\r\n const rightGap = halfGap;\r\n const leftGap = halfGap;\r\n /** Lost left width because of negative gap of the previous fragment OR token */\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n const vacantLeftWidth = leftGap > 0 ? leftGap - lostLeftWidth : 0;\r\n\r\n const {\r\n offsetable: isNextTokenOffsetable,\r\n leftGap: nextUncompressedLeftGap\r\n } = analyzeToken({\r\n token: nextFragment, nextToken: next2ndFragment,\r\n previousTokenGap: rightGap / xRatio,\r\n ...analyzeTokenParameter,\r\n });\r\n const nextLeftGap = nextUncompressedLeftGap * xRatio;\r\n const lostRightWidth = getLostLeftWidth(rightGap, nextLeftGap);\r\n const vacantRightWidth = rightGap > 0 ? rightGap - lostRightWidth : 0;\r\n const totalVacantSpace = vacantLeftWidth + vacantRightWidth;\r\n let rebalancedSpace = 0;\r\n let nextTokenRebalanceOffset = 0;\r\n\r\n /** Rebalance tactic here. In essential, we try to calculate the empty space of a fragment. These spaces are because the head text is too long compare to the foot text underneath. Then we divide those spaces in such a way that the foot text has roughly equal space each side so they looks more pleasant. */\r\n if (totalVacantSpace > 0 && nextLeftGap >= -2 && isNextTokenOffsetable) {\r\n rebalancedSpace = (totalVacantSpace + Math.max(nextLeftGap, 0) * 2) / 3;\r\n nextTokenRebalanceOffset = Math.max(nextLeftGap, 0) - rebalancedSpace;\r\n } else {\r\n // rebalancedSpace = totalVacantSpace / 2;\r\n rebalancedSpace = vacantLeftWidth;\r\n }\r\n const footTextFragmentEdge = fragmentEdge\r\n + (halfGap < 0 ? -lostLeftWidth : (indent ? -indent : rebalancedSpace))\r\n + previousTokenRebalanceOffset;\r\n previousTokenRebalanceOffset = nextTokenRebalanceOffset;\r\n\r\n /** Draw actual foot text here */\r\n drawLine({\r\n ctx,\r\n format,\r\n textData,\r\n tokenList: tokenizeText(footText),\r\n trueBaseline: baseline,\r\n trueEdge: footTextFragmentEdge,\r\n xRatio,\r\n yRatio,\r\n spaceWidth: 0,\r\n textDrawer,\r\n debug: false,\r\n });\r\n\r\n /** Head text may have different text style than foot text, so we store the current style before start drawing head text. */\r\n const currentFillStyle = ctx.fillStyle;\r\n const currentStrokeStyle = ctx.strokeStyle;\r\n const currentShadowColor = ctx.shadowColor;\r\n const currentShadowOffsetX = ctx.shadowOffsetX;\r\n const currentShadowOffsetY = ctx.shadowOffsetY;\r\n const currentShadowBlur = ctx.shadowBlur;\r\n if (headTextFillStyle) {\r\n ctx.fillStyle = headTextFillStyle;\r\n ctx.strokeStyle = '';\r\n ctx.shadowColor = '';\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowBlur = 0;\r\n }\r\n /** Draw head text here, remember head text and foot text most of the time do not align at all. */\r\n const headTextFragmentEdge = fragmentEdge - lostLeftWidth;\r\n fillHeadText({\r\n ctx,\r\n fontSize,\r\n edge: headTextFragmentEdge, baseline,\r\n headText, headTextLetterWidth,\r\n footText, footTextWidth,\r\n headTextGap: defaultGap,\r\n headTextSpacing,\r\n headTextHeightRatio,\r\n headTextBold,\r\n headTextGapRatio,\r\n xRatio,\r\n fontStyle,\r\n textWorker,\r\n fitFootText,\r\n headTextOverflow,\r\n });\r\n /** Restore foot text's original style */\r\n ctx.fillStyle = currentFillStyle;\r\n ctx.strokeStyle = currentStrokeStyle;\r\n ctx.shadowColor = currentShadowColor;\r\n ctx.shadowOffsetX = currentShadowOffsetX;\r\n ctx.shadowOffsetY = currentShadowOffsetY;\r\n ctx.shadowBlur = currentShadowBlur;\r\n\r\n fragmentEdge += Math.max(footTextWidth * xRatio, headTextWidth) - lostLeftWidth + spaceWidth;\r\n currentRightGap = rightGap;\r\n }\r\n /** Draw \"whole words\". */\r\n else if (WholeWordRegex.test(fragment)) {\r\n const normalizedWordSpacingRatio = wordLetterSpacing\r\n ? 1 + wordLetterSpacing / 2\r\n : letterSpacingRatio;\r\n ctx.letterSpacing = `${(normalizedWordSpacingRatio - 1) * currentFont.getFontInfo().sizeAsNumber}px`;\r\n\r\n /**\r\n * A problem here: We cannot calculate the gap of a fragment unless knowing its actual width, so that means we must calculate it first, then calculate the gap, then go back and calculate the actual width all over again when we draw. These are doable but it make this ugly long code become needlessly more ugly and long. So we just naively measure the word without any kind of special treatment, take the gap based on it and call it a day.\r\n * \r\n * Even if the actual width of the fragment is different than when we measure it naively, the gap ratio itself have a bit of room for error (around 50%), so most of the time we can avoid any overlap unless in extreme condensing situation.\r\n */\r\n const fragmentNaiveWidth = ctx.measureText(fragment).width * xRatio;\r\n const leftGap = Math.max(defaultGap, fragmentNaiveWidth * gapRatio);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n fragmentEdge -= lostLeftWidth;\r\n\r\n /** Read the comment in `analyzeToken` function, we repeat exactly the treatment there, the different is we actually draw the letter along the way. */\r\n let remainFragment = fragment;\r\n let currentPosition = fragmentEdge;\r\n while (remainFragment !== '') {\r\n let currentLetter = remainFragment[0];\r\n let nextRemainFragment = remainFragment.slice(1);\r\n let actualLetterWidth = 0;\r\n const drawLetterofWordParameter = {\r\n ...drawLetterParameter,\r\n deviation: letterDeviationMap[currentLetter],\r\n letter: currentLetter,\r\n edge: currentPosition,\r\n };\r\n if (SquareBracketLetterRegex.test(currentLetter)) {\r\n applyScale(squareBracketRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter({\r\n ...drawLetterofWordParameter,\r\n edge: currentPosition / squareBracketRatio,\r\n baseline: baseline / squareBracketRatio,\r\n });\r\n reverseScale(squareBracketRatio);\r\n } else if (CapitalLetterRegex.test(currentLetter)) {\r\n applyScale(capitalLetterRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n const letterOffset = (actualLetterWidth > ctx.measureText(currentLetter).width * capitalLetterRatio)\r\n ? Math.round(actualLetterWidth * (1 - capitalLetterRatio)) / 2\r\n : 0;\r\n drawLetter({\r\n ...drawLetterofWordParameter,\r\n edge: currentPosition / capitalLetterRatio + letterOffset,\r\n baseline: baseline / capitalLetterRatio\r\n });\r\n reverseScale(capitalLetterRatio);\r\n } else if (NumberRegex.test(currentLetter)) {\r\n applyNumberFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter(drawLetterofWordParameter);\r\n stopApplyNumberFont();\r\n } else if (TCGSymbolLetterRegex.test(currentLetter) && fontStyle === 'tcg') {\r\n applySymbolFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter(drawLetterofWordParameter);\r\n stopApplySymbolFont();\r\n } else {\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter(drawLetterofWordParameter);\r\n }\r\n currentPosition += actualLetterWidth * xRatio;\r\n remainFragment = nextRemainFragment;\r\n }\r\n\r\n fragmentEdge = currentPosition;\r\n currentRightGap = rightGap;\r\n previousTokenRebalanceOffset = 0;\r\n ctx.letterSpacing = '0px';\r\n }\r\n /** Some specific letter (\"Evil★Twin's Trouble Sunny\" TCG) requires different font. */\r\n else if (TCGSymbolLetterRegex.test(fragment) && fontStyle === 'tcg') {\r\n const letter = fragment;\r\n applySymbolFont();\r\n\r\n const letterWidth = ctx.measureText(letter).width * letterSpacingRatio * xRatio;\r\n const leftGap = Math.max(defaultGap, letterWidth * gapRatio);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n fragmentEdge -= lostLeftWidth;\r\n drawLetter({ ...drawLetterParameter, letter, edge: fragmentEdge });\r\n fragmentEdge += letterWidth;\r\n\r\n stopApplySymbolFont();\r\n\r\n currentRightGap = rightGap;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** All other fragments */\r\n else {\r\n const letter = fragment;\r\n const letterMetric = getLetterWidth({\r\n ctx,\r\n letter,\r\n fontStyle,\r\n metricMethod,\r\n isLastOfLine: nextFragment === undefined,\r\n xRatio,\r\n });\r\n const letterWidth = letterMetric.boundWidth * letterSpacingRatio * xRatio;\r\n const leftGap = Math.max(defaultGap, letterWidth * gapRatio);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n fragmentEdge -= lostLeftWidth;\r\n drawLetter({\r\n ...drawLetterParameter,\r\n letter,\r\n edge: fragmentEdge,\r\n deviation: letterDeviationMap[letter],\r\n letterMetric,\r\n });\r\n fragmentEdge += letterWidth;\r\n if (\r\n (format === 'ocg' || (format === 'tcg' && /\\s+/.test(letter)))\r\n && NoSpaceRegex.test(letter) !== true\r\n ) {\r\n fragmentEdge += spaceWidth;\r\n }\r\n if (!OCGNoOverheadGapRegex.test(letter)) currentRightGap = rightGap;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n }\r\n\r\n /** Make space for the next token, as we can see it does not involve any variables from the fragment drawing process. */\r\n previousTokenGap = tokenRightGap * xRatio;\r\n if (debug) drawMarker({ ctx, baseline, edge: tokenEdge, width: totalTokenWidth * xRatio, xRatio });\r\n tokenEdge += totalTokenWidth * xRatio + spaceCount * spaceWidth + indent;\r\n }\r\n\r\n return {\r\n tokenEdge,\r\n iconPositionList,\r\n };\r\n};","import {\r\n NB_LINE_OPEN,\r\n NB_LINE_CLOSE,\r\n OCG_RUBY_SOURCE,\r\n OCG_KEYWORD_SOURCE,\r\n ocgKeywordDataMap,\r\n WHOLE_WORD_SOURCE,\r\n NOT_END_OF_LINE_SOURCE,\r\n NOT_START_OF_LINE_SOURCE,\r\n NOT_SPLIT_SOURCE,\r\n OCG_BULLET_SOURCE,\r\n tcgToOCGLetterMap,\r\n ocgToTCGLetterMap,\r\n UNCOMPRESSED_SOURCE,\r\n ocgNumberCircleMap,\r\n NB_WORD_OPEN,\r\n NB_WORD_CLOSE,\r\n FLAVOR_CONDITION_SOURCE,\r\n NB_UNCOMPRESSED_START,\r\n NB_UNCOMPRESSED_END\r\n} from 'src/model';\r\n\r\nexport const splitEffect = (effect: string, isNormal = false) => {\r\n let effectText = effect;\r\n\r\n let fullLineList = [];\r\n const wholeLineRegex = new RegExp(`^(${NB_LINE_OPEN}([^${NB_LINE_CLOSE}]*)${NB_LINE_CLOSE}\\\\s*)`);\r\n let materialReplacement;\r\n let material;\r\n do {\r\n materialReplacement = wholeLineRegex.exec(effectText)?.[1];\r\n material = wholeLineRegex.exec(effectText)?.[2];\r\n\r\n if (material && materialReplacement) {\r\n fullLineList.push(material);\r\n effectText = effectText.replace(materialReplacement, '');\r\n }\r\n } while (materialReplacement && material);\r\n\r\n let effectFlavorCondition = '';\r\n const flavorConditionRegex = new RegExp(FLAVOR_CONDITION_SOURCE, 'm');\r\n const potentialFlavorConditionText = flavorConditionRegex.exec(effect)?.[1];\r\n if (potentialFlavorConditionText && isNormal) {\r\n effectFlavorCondition = potentialFlavorConditionText;\r\n effectText = effectText.replace(potentialFlavorConditionText, '');\r\n } else effectFlavorCondition = '';\r\n\r\n return {\r\n fullLineList,\r\n effectText,\r\n effectFlavorCondition,\r\n };\r\n};\r\n\r\nexport const normalizeCardText = (\r\n text: string,\r\n format: string,\r\n option?: { multiline?: boolean, furiganaHelper?: boolean, dictionaryType?: 'rubyForm' | 'rubyFormName' },\r\n) => {\r\n const {\r\n multiline = true,\r\n furiganaHelper = true,\r\n dictionaryType = 'rubyForm',\r\n } = option ?? {};\r\n const nonNullableText = text ?? '';\r\n\r\n /** Normalize the text based on format, by swapping letters to their corresponding form. For example full-width captial A \"A\" will become normal capital \"A\" after normalized. */\r\n let normalizedText = '';\r\n let letterSwapMap = format === 'ocg'\r\n ? tcgToOCGLetterMap\r\n : ocgToTCGLetterMap;\r\n for (const letter of nonNullableText) {\r\n normalizedText += letterSwapMap[letter] ?? letter;\r\n }\r\n\r\n /** OCG text sometimes enter new line follow letter \"、\" or \"。\", we will automatically join them. It is debatable whether this feature is need or not. */\r\n // const textAfterJoinRow = normalizedText.replace(/(、|。|。|、)\\n(?!●)/g, '$1');\r\n const textAfterJoinRow = normalizedText;\r\n\r\n /** Translate non-wrappable line syntax into internal control characters, beware that \"Qliphort Scout\" does use square brackets in its flavor text, so the regex must exclude that case. */\r\n const textAfterSplitBlockRow = multiline\r\n ? textAfterJoinRow\r\n .replace(/^\\[([\\w\\W]*?)\\](?=(\\n|$))/gm, `${NB_LINE_OPEN}$1${NB_LINE_CLOSE}`)\r\n : textAfterJoinRow;\r\n\r\n /** Various contextual swaps */\r\n const textAfterSwapLetter = textAfterSplitBlockRow\r\n .replace(/(^|[-\\u2014\\s([\"])'/g, '$1\\u2018') /** Turn straight single quote ' into contextual curly quote ‘ */\r\n .replace(/'/g, '\\u2019') /** Close open curly quote ’ */\r\n .replace(/(^|[-\\u2014/[(\\u2018\\s])\"/g, '$1\\u201c') /** Turn straight double quote \" into contextual curly double quote “ */\r\n .replace(/\"/g, '\\u201d') /** Close open curly double quote ” */\r\n .replace(/--/g, '\\u2014') /** Turn double dash \"--\" into em-dash \"—\" */\r\n .replace(/● /g, '●') /** Remove direct whitespace after bullet, bullet have their own fixed space that we will draw later */\r\n /** Convert ordinal shorthand syntax, for example \"(15)\" will become \"⑮\", used in OCG effect */\r\n .replace(/(\\([0-90-9]{1,2}\\))/g, m => {\r\n const correspondingCircleSymbol = ocgNumberCircleMap[m];\r\n\r\n return correspondingCircleSymbol ?? m;\r\n });\r\n\r\n const textAfterDetectBlockWord = textAfterSwapLetter\r\n /** Convert non-compressable syntax into internal control characters */\r\n .replaceAll(new RegExp(UNCOMPRESSED_SOURCE, 'g'), m => m.replaceAll('{{', NB_UNCOMPRESSED_START).replaceAll('}}', NB_UNCOMPRESSED_END))\r\n /** Convert ruby syntax into internal control characters */\r\n .replaceAll(new RegExp(OCG_RUBY_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`);\r\n\r\n /** Apply dictionary */\r\n const textAfterDictionaryMatch = format === 'tcg' || furiganaHelper === false\r\n ? textAfterDetectBlockWord\r\n : textAfterDetectBlockWord\r\n .replaceAll(new RegExp(OCG_KEYWORD_SOURCE, 'g'), m => {\r\n const keywordSubtitue = ocgKeywordDataMap[m][dictionaryType] ?? ocgKeywordDataMap[m].rubyForm;\r\n\r\n return `${NB_WORD_OPEN}${keywordSubtitue}${NB_WORD_CLOSE}`;\r\n });\r\n /** Analyze various typography rules in OCG card (mainly Kinsoku Shorit)\r\n * * Some letters cannot stand at the start of the line, so they form a block with the token before them.\r\n * * Some letters cannot stand at the end of a line, so they form a block with the token next to them.\r\n * * Some letters cannot be splitted into two lines, so they form a block with both tokens around them.\r\n * * Ordinal letters must always followed by a colon \":\", and cannot stand at the end of a line.\r\n */\r\n const textAfterProcessing = textAfterDictionaryMatch\r\n .replaceAll(new RegExp(WHOLE_WORD_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(NOT_END_OF_LINE_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(NOT_START_OF_LINE_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(NOT_SPLIT_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(OCG_BULLET_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`);\r\n\r\n /** Eliminate overlapping group control characters, we perform a simple algorithm to reduce various overlapping forms into non-overlapping ones.\r\n * * `((()))` => `()`\r\n * * `(()())` => `()`\r\n * * `((()()))` => `()`\r\n * * `()()()` => `()()()`\r\n */\r\n let textAfterNormalizeBlockWord = [];\r\n let currentDepth = 0;\r\n for (const letter of textAfterProcessing) {\r\n if (letter === NB_WORD_OPEN) {\r\n if (currentDepth === 0) textAfterNormalizeBlockWord.push(letter);\r\n currentDepth += 1;\r\n } else if (letter === NB_WORD_CLOSE) {\r\n currentDepth -= 1;\r\n if (currentDepth === 0) textAfterNormalizeBlockWord.push(letter);\r\n } else textAfterNormalizeBlockWord.push(letter);\r\n }\r\n /** Non-wrappable line syntax has higher priority than non-wrappable word syntax, so we re-arrange control characters to fit such case. */\r\n const finalizedText = textAfterNormalizeBlockWord.join('')\r\n .replaceAll(`${NB_LINE_CLOSE}${NB_WORD_CLOSE}`, `${NB_WORD_CLOSE}${NB_LINE_CLOSE}`)\r\n .replaceAll(`${NB_WORD_OPEN}${NB_LINE_OPEN}`, `${NB_LINE_OPEN}${NB_WORD_OPEN}`)\r\n .replaceAll(`${NB_UNCOMPRESSED_START}${NB_WORD_CLOSE}`, `${NB_WORD_CLOSE}${NB_UNCOMPRESSED_START}`)\r\n .replaceAll(`${NB_WORD_OPEN}${NB_UNCOMPRESSED_END}`, `${NB_UNCOMPRESSED_END}${NB_WORD_OPEN}`)\r\n .replaceAll(`${NB_LINE_OPEN}${NB_LINE_CLOSE}`, '')\r\n .replaceAll(`${NB_WORD_OPEN}${NB_WORD_CLOSE}`, '');\r\n\r\n return finalizedText;\r\n};","import { CanvasTextStyle } from 'src/service';\r\nimport {\r\n CanvasConst,\r\n CondenseType,\r\n EffectFontData,\r\n CoordinateData,\r\n EffectCoordinateData,\r\n CondenseTolerantMap,\r\n FontData,\r\n TCGVanillaTypeStatFontList,\r\n DefaultTCGNormalFontData,\r\n} from '../../model';\r\nimport { condense, createFontGetter } from '../../util';\r\nimport { setTextStyle } from '../canvas-util';\r\nimport { createLineList } from '../line';\r\nimport { drawLine } from '../text';\r\nimport { analyzeLine } from '../text-analyze';\r\nimport { normalizeCardText, splitEffect } from '../text-normalize';\r\nimport { tokenizeText } from '../text-util';\r\n\r\n/** Sections inside effect box (stats and type) will affect the amount of line and applicaable font size use for the text. */\r\nexport const getEffectFontAndCoordinate = ({\r\n format,\r\n isNormal,\r\n statInEffect,\r\n typeInEffect,\r\n}: {\r\n format: string,\r\n statInEffect: boolean,\r\n typeInEffect: boolean,\r\n isNormal: boolean,\r\n}) => {\r\n const coordinateKey = [format, typeInEffect ? 'type' : '', statInEffect ? 'stat' : '']\r\n .filter(entry => entry !== '').join('-');\r\n const fontDataKey = [format, typeInEffect ? 'type' : '', statInEffect ? 'stat' : '']\r\n .filter(entry => entry !== '').join('-');\r\n\r\n let fontData = EffectFontData[fontDataKey];\r\n if (statInEffect && typeInEffect && isNormal && format === 'tcg') {\r\n fontData = DefaultTCGNormalFontData;\r\n fontData.fontList = TCGVanillaTypeStatFontList;\r\n }\r\n\r\n return {\r\n fontData,\r\n sizeList: EffectCoordinateData[coordinateKey],\r\n };\r\n};\r\n\r\nconst {\r\n width: CanvasWidth,\r\n} = CanvasConst;\r\nexport const drawEffect = ({\r\n ctx,\r\n content,\r\n isNormal = false,\r\n fontData = EffectFontData.tcg,\r\n textStyle,\r\n sizeList = EffectCoordinateData['tcg-type'],\r\n condenseTolerant = 'strict',\r\n format,\r\n furiganaHelper,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n content: string,\r\n isNormal?: boolean,\r\n fontData?: FontData,\r\n textStyle?: CanvasTextStyle,\r\n sizeList?: CoordinateData[],\r\n condenseTolerant?: CondenseType,\r\n format: string,\r\n furiganaHelper: boolean,\r\n}) => {\r\n let effectSizeLevel = 0;\r\n if (!ctx || !content) return effectSizeLevel;\r\n\r\n const normalizedContent = normalizeCardText(content.trim(), format, { furiganaHelper });\r\n const tolerancePerSentence: Record = format === 'tcg'\r\n ? CondenseTolerantMap[condenseTolerant] ?? CondenseTolerantMap['strict']\r\n : {\r\n '1': 800,\r\n '2': 800,\r\n '3': 800,\r\n };\r\n const {\r\n effectText,\r\n effectFlavorCondition,\r\n fullLineList,\r\n } = splitEffect(normalizedContent, isNormal);\r\n\r\n const additionalLineCount = (fullLineList.length ?? 0) + (effectFlavorCondition.length > 0 ? 1 : 0);\r\n const paragraphList = effectText ? effectText.split('\\n') : [];\r\n\r\n const { font, fontList } = fontData;\r\n const yRatio = 1;\r\n /** We basically go through each font size, then iterating the content multiple time with different condense ratio until the text is both fit inside the max amount of lines AND the ratio is larger than the current limit threshold. */\r\n while (effectSizeLevel < fontList.length) {\r\n const fontSizeData = fontList[effectSizeLevel];\r\n const {\r\n fontSize,\r\n lineHeight,\r\n lineCount,\r\n } = fontSizeData;\r\n const {\r\n trueEdge,\r\n trueWidth: trueWidthStart,\r\n trueBaseline: trueBaselineStart,\r\n } = sizeList[effectSizeLevel] ?? sizeList[sizeList.length - 1];\r\n const width = (isNormal && format === 'tcg') ? trueWidthStart - 2 : trueWidthStart;\r\n\r\n const currentFont = createFontGetter();\r\n ctx.font = currentFont\r\n .setStyle(isNormal && format === 'tcg' ? 'italic' : '')\r\n .setWeight(format === 'tcg' ? '' : '')\r\n .setSize(fontSize)\r\n .setFamily(font)\r\n .getFont();\r\n ctx.textAlign = 'left';\r\n const textData = {\r\n fontData,\r\n fontLevel: effectSizeLevel,\r\n currentFont,\r\n };\r\n // [CREATE SENTENCE ON EACH LINE]\r\n let lineListWithRatio: { line: string, isLast: boolean, effectiveMedian: number }[] = [];\r\n\r\n // [FIND SUITABLE CONDENSE RATIO]\r\n const effectiveMedian = condense(\r\n median => {\r\n const { currentLineList, currentLineCount } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList,\r\n additionalLineCount,\r\n format, textData,\r\n width,\r\n });\r\n lineListWithRatio = currentLineList;\r\n\r\n if (currentLineCount > lineCount) return false;\r\n return true;\r\n },\r\n 200,\r\n );\r\n\r\n // [START DRAWING]\r\n /** Usually effect only consist of 1 or 2 paragraphs, but in TCG they try to put each bullet clause in a new line, resulting many more. Still we don't know if having different tolerance based on amount of paragraph is correct or not, since it is very hard to survey the condensation of a real card. */\r\n const resetStyle = setTextStyle({ ctx, ...textStyle });\r\n const tolerantValue = tolerancePerSentence[`${paragraphList.length}`] ?? tolerancePerSentence['3'];\r\n if (\r\n (effectiveMedian < tolerantValue)\r\n && (effectSizeLevel < fontList.length - 1)\r\n ) {\r\n effectSizeLevel += 1;\r\n } else {\r\n ctx.clearRect(0, 0, CanvasWidth, 1111);\r\n\r\n let trueBaseline = trueBaselineStart + lineHeight;\r\n /** Naturally, non-brekable lines have their own condense ratio. */\r\n const fullLineListWithRatio = fullLineList.map(line => {\r\n return {\r\n line,\r\n isLast: true,\r\n effectiveMedian: condense(\r\n median => {\r\n const { currentLineCount } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [line],\r\n format, textData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n return true;\r\n },\r\n )\r\n };\r\n });\r\n\r\n /** Draw each line based on their token list and corresponding ratio. */\r\n [\r\n ...fullLineListWithRatio,\r\n ...lineListWithRatio,\r\n ].forEach(({\r\n line,\r\n isLast,\r\n effectiveMedian,\r\n }) => {\r\n const xRatio = effectiveMedian / 1000;\r\n const { tokenList, spaceWidth } = analyzeLine({ ctx, line, xRatio, format, isLast, textData, width });\r\n\r\n ctx.scale(xRatio, yRatio);\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge, trueBaseline,\r\n spaceWidth,\r\n textData,\r\n format,\r\n });\r\n trueBaseline += lineHeight;\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n });\r\n\r\n /** Condition clause of flavor text in TCG cards do not use italic font style (\"Summoned Skull\" TCG). */\r\n if (effectFlavorCondition.length > 0) {\r\n const internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [effectFlavorCondition],\r\n format, textData,\r\n width,\r\n });\r\n\r\n if (currentLineCount > 1) return false;\r\n return true;\r\n },\r\n );\r\n const xRatio = internalEffectiveMedian / 1000;\r\n\r\n ctx.scale(xRatio, yRatio);\r\n ctx.font = currentFont.setStyle('').getFont();\r\n let tokenList = tokenizeText(effectFlavorCondition);\r\n /** We use two new line character to identify condition clause among flavor text. Because in normal case the user will try to put in many new lines to ensure that the condition clause is placed at bottom of the card text.\r\n * \r\n * But this method has a caveat: For example if current line limit is 6, and the flavor text already take 5 lines. If user put the condition clause at line 6, it is indistinguishable from a normal paragraph, and therefore drawn with italic font. But if user put a new line between, it will force the draw function to increase the line limit into 7.\r\n * \r\n * To combat this, we perform a simple remove that additional new line, that means if conditional clause is present, two new lines in textare actually result only one new line. This does not create much hassle since user rarely notice this behavior.\r\n * */\r\n tokenList = tokenList[0] === '\\n'\r\n ? tokenList.slice(1)\r\n : tokenList;\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge, trueBaseline,\r\n textData,\r\n format,\r\n });\r\n trueBaseline += lineHeight;\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n }\r\n break;\r\n }\r\n resetStyle();\r\n }\r\n\r\n return effectSizeLevel;\r\n};","\r\nimport { CanvasConst } from 'src/model';\r\nimport { drawAsset, drawAssetWithSize, drawWithColor } from '../image';\r\nimport { clearCanvas, setTextStyle } from '../canvas-util';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\nconst {\r\n width: CanvasWidth,\r\n} = CanvasConst;\r\n\r\nexport const drawStarContent = async ({\r\n ctx,\r\n cardIcon,\r\n text,\r\n star,\r\n starAlignment = 'auto',\r\n style,\r\n onStarDraw,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n cardIcon: string,\r\n text: string | null,\r\n star: string | number,\r\n starAlignment: string,\r\n style?: CanvasTextStyle,\r\n onStarDraw: (coordinate: [number, number]) => Promise,\r\n}) => {\r\n const starWidth = 50;\r\n const startSpacing = 4;\r\n let normalizedStarCount = typeof star === 'string'\r\n ? star === '' ? 0 : 1\r\n : typeof star === 'number' ? star : 0;\r\n let totalWidth = starWidth * normalizedStarCount + startSpacing * (normalizedStarCount - 1);\r\n const baseline = 145;\r\n\r\n let alignment = 'right';\r\n if (['rank', 'negative-level'].includes(cardIcon)) alignment = 'left';\r\n alignment = starAlignment === 'auto'\r\n ? alignment\r\n : starAlignment;\r\n if (normalizedStarCount > 12) alignment = 'center';\r\n\r\n if (text && alignment === 'center') {\r\n normalizedStarCount = 0;\r\n totalWidth = 0;\r\n }\r\n\r\n /** Level / Rank 13 is center-aligned. */\r\n const leftEdge = alignment === 'center'\r\n ? (CanvasWidth + totalWidth) / 2\r\n : alignment === 'left'\r\n ? 85.9125 + totalWidth\r\n : 728.775;\r\n\r\n let offset = 0 - (starWidth + startSpacing);\r\n\r\n if (ctx && text && cardIcon !== 'st') {\r\n const fontSize = 50;\r\n const resetShadow = setTextStyle({ ctx, ...style });\r\n ctx.textAlign = alignment === 'left' || alignment === 'right'\r\n ? alignment\r\n : 'left';\r\n ctx.font = `bold ${fontSize}px RoGSanSrfStd-Bd`;\r\n const offset = alignment === 'center'\r\n ? ctx.measureText(text).width / -2\r\n : alignment === 'left'\r\n ? startSpacing\r\n : (starWidth + startSpacing * 2) * -1;\r\n ctx.fillText(text, leftEdge + offset, baseline + fontSize * 0.9);\r\n ctx.textAlign = 'left';\r\n resetShadow();\r\n }\r\n\r\n return await Promise.all([...Array(normalizedStarCount)]\r\n .map(async () => {\r\n offset += (starWidth + startSpacing);\r\n let coordinate: [number, number] = [\r\n leftEdge - (starWidth + offset),\r\n baseline,\r\n ];\r\n await drawAsset(ctx, `subfamily/subfamily-${cardIcon}.png`, ...coordinate);\r\n return await onStarDraw(coordinate);\r\n })\r\n );\r\n};\r\n\r\nexport const drawSticker = async ({\r\n ctx,\r\n sticker,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n sticker: string,\r\n}) => {\r\n if (!clearCanvas(ctx)) return;\r\n\r\n if (sticker === 'no-sticker') return Promise.resolve();\r\n return drawAsset(ctx, `sticker/sticker-${sticker.toLowerCase()}.png`, 739.1438, 1110.938);\r\n};\r\n\r\n/** Duel terminal mark and Speed card mark. They overlap if draw together, so we make them mutually exclusive. Maybe it is not worth the effort. */\r\nexport const drawPredefinedMark = async ({\r\n ctx,\r\n type,\r\n isPendulum,\r\n isLink,\r\n isDuelTerminalCard,\r\n isSpeedCard,\r\n bordered,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n type: string,\r\n isPendulum: boolean,\r\n isLink: boolean,\r\n isDuelTerminalCard: boolean,\r\n isSpeedCard: boolean,\r\n bordered: boolean,\r\n}) => {\r\n if (!ctx) return;\r\n\r\n if (isDuelTerminalCard) {\r\n const coordinate: [number, number, number, number] = isPendulum\r\n ? [250, 1087, 180, 20]\r\n : isLink\r\n ? [151, 848, 216, 24]\r\n : [80, 843, 270, 30];\r\n\r\n await drawAssetWithSize(ctx, `text/text-duel-terminal-${type}${bordered ? '-bordered' : ''}.png`, ...coordinate);\r\n }\r\n if (isSpeedCard) {\r\n const coordinate: [number, number, number, number] = isPendulum\r\n ? [250, 1090, 176.4, 18]\r\n : isLink\r\n ? [151, 855, 215.6, 22]\r\n : [80, 850, 245, 25];\r\n\r\n await drawAssetWithSize(ctx, `text/text-speed-duel-${type}${bordered ? '-bordered' : ''}.png`, ...coordinate);\r\n }\r\n};\r\n\r\nexport const drawLinkRatingText = async (\r\n canvas: HTMLCanvasElement,\r\n linkMap: string[],\r\n cloneCanvasStyle: CanvasTextStyle,\r\n) => {\r\n const ctx = canvas.getContext('2d');\r\n\r\n if (!ctx || !Array.isArray(linkMap)) return;\r\n\r\n const color = cloneCanvasStyle.color ?? '#000000';\r\n await drawWithColor(\r\n canvas,\r\n 'link/link-text.png',\r\n color,\r\n 120, 30,\r\n 600, 1080,\r\n cloneCanvasStyle,\r\n );\r\n // await drawAsset(ctx, 'link/link-text.png', 600, 1080);\r\n ctx.textAlign = 'right';\r\n ctx.scale(1.2, 1);\r\n ctx.font = 'bold 26.55px RoGSanSrfStd-Bd';\r\n ctx.fillText(`${linkMap.length}`, 622.75, 1105);\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.textAlign = 'left';\r\n};","import {\r\n arrowPositionList,\r\n BackgroundType,\r\n CanvasConst,\r\n CardOpacity,\r\n Foil,\r\n getArtCanvasCoordinate,\r\n NO_ATTRIBUTE,\r\n} from 'src/model';\r\nimport { drawAsset, drawAssetWithSize, drawWithColor } from '../image';\r\nimport { getCardIconFromFrame } from 'src/util';\r\nimport { drawStarContent } from './with-image';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\nconst {\r\n topToPendulumStructure,\r\n pendulumStructureHeight,\r\n leftToPendulumStructure,\r\n} = CanvasConst;\r\n/** Various function used to draw the layout of a card is abstracted to this factory. */\r\nexport const getLayoutDrawFunction = ({\r\n canvas,\r\n artworkCanvas,\r\n backgroundCanvas,\r\n format,\r\n hasBackground,\r\n frame, bottomFrame,\r\n backgroundType,\r\n cardIcon,\r\n attribute,\r\n star,\r\n foil,\r\n pendulumSize,\r\n opacity,\r\n isLink, isSpeedSkill, isXyz,\r\n isPendulum,\r\n loopFinish,\r\n loopArtFinish,\r\n}: {\r\n canvas: HTMLCanvasElement,\r\n artworkCanvas: HTMLCanvasElement | null,\r\n backgroundCanvas: HTMLCanvasElement | null,\r\n format: string,\r\n frame: string, bottomFrame: string,\r\n hasBackground: boolean,\r\n backgroundType: BackgroundType,\r\n cardIcon: string,\r\n attribute: string,\r\n star: number | string,\r\n foil: Foil,\r\n pendulumSize: string,\r\n opacity: CardOpacity,\r\n isXyz: boolean, isSpeedSkill: boolean, isLink: boolean,\r\n isPendulum: boolean,\r\n loopFinish: (\r\n ctx?: CanvasRenderingContext2D | null,\r\n name?: string,\r\n caller?: (finishType: string) => Promise,\r\n ) => Promise,\r\n loopArtFinish: (\r\n ctx?: CanvasRenderingContext2D | null,\r\n name?: string,\r\n caller?: (finishType: string) => Promise,\r\n ) => Promise,\r\n}) => {\r\n const ctx = canvas.getContext('2d');\r\n const {\r\n artBorder: keepArtBorder,\r\n nameBorder,\r\n body: opacityBody,\r\n name: opacityName,\r\n pendulum: opacityPendulum,\r\n text: opacityText,\r\n boundless,\r\n } = opacity;\r\n const {\r\n artX,\r\n artY,\r\n artFinishX,\r\n artFinishY,\r\n artWidth,\r\n } = getArtCanvasCoordinate(isPendulum, opacity);\r\n const artBorder = opacityBody > 0 ? true : keepArtBorder;\r\n const artBoxY = 170, artBoxX = 60;\r\n const effectBoxY = 860, effectBoxX = 35;\r\n const backgroundEffectBoxY = effectBoxY + 24, backgroundEffectBoxX = effectBoxX + 19;\r\n\r\n const hasFoil = foil !== 'normal';\r\n const frameBorderType = isXyz || isSpeedSkill\r\n ? frame\r\n : 'normal';\r\n const nameBorderType = frameBorderType;\r\n const applyArtFinish = !boundless && artBorder;\r\n\r\n const resultAPI = {\r\n /** Calculate new art coordination for creative mode, some configurations may result in the art getting drawn at different location compare to default one used by `drawArtwork` function. A lots of calculation is involved here since we:\r\n * \r\n * * Trying to draw only a portion of the image.\r\n * * The source image has totally different size compare to the destination boundary.\r\n * * Various anchor points must be located based on the current card layout. Kinda regret making this feature, but they work pretty well so.\r\n */\r\n calculateCardArtRedrawCoordination(\r\n imageCanvas: HTMLCanvasElement,\r\n customOpacity?: CardOpacity,\r\n extraHeightRatio = 1,\r\n customBackgroundType?: BackgroundType,\r\n ) {\r\n const normalizedOpacity = customOpacity ?? opacity;\r\n const {\r\n body: bodyOpacity\r\n } = normalizedOpacity;\r\n const {\r\n artX,\r\n artY,\r\n artWidth,\r\n } = getArtCanvasCoordinate(isPendulum, normalizedOpacity, customBackgroundType);\r\n const { width: imageWidth, height: imageHeight } = imageCanvas;\r\n const imageScaledRatio = artWidth / imageWidth;\r\n const sourceOffsetX = bodyOpacity < 100\r\n ? (leftToPendulumStructure - artX) / imageScaledRatio\r\n : 0;\r\n const destinationOffsetX = sourceOffsetX * imageScaledRatio;\r\n const sourceOffsetY = bodyOpacity < 100\r\n ? (topToPendulumStructure - artY) / imageScaledRatio\r\n : 0;\r\n const destinationOffsetY = sourceOffsetY * imageScaledRatio;\r\n const offsetHeight = bodyOpacity < 100\r\n ? imageHeight - (pendulumStructureHeight / imageScaledRatio)\r\n : 0;\r\n\r\n const destinationX = artX + destinationOffsetX;\r\n const destinationY = artY + destinationOffsetY;\r\n const destinationWidth = artWidth - destinationOffsetX * 2;\r\n const destinationHeight = artWidth / (imageWidth / imageHeight) * extraHeightRatio - offsetHeight * imageScaledRatio;\r\n\r\n return {\r\n imageScaledRatio,\r\n sourceOffsetX,\r\n sourceOffsetY,\r\n destinationOffsetX,\r\n destinationOffsetY,\r\n offsetHeight,\r\n destinationX,\r\n destinationY,\r\n destinationWidth,\r\n destinationHeight,\r\n };\r\n },\r\n\r\n /** Main frame consists of top half and bottom half (for pendulum-like) card. */\r\n drawFrame: async () => {\r\n if (!ctx) return;\r\n\r\n ctx.globalAlpha = opacityBody / 100;\r\n await drawAsset(ctx, `frame/frame-${frame}.png`, 0, 0);\r\n await drawAsset(ctx, `frame-pendulum/frame-pendulum-${bottomFrame}.png`, 0, 0);\r\n ctx.globalAlpha = 1;\r\n },\r\n /** Draw card artwork is synchronous because the image is already loaded from cropper's canvas. */\r\n drawCardArt: () => {\r\n if (!artworkCanvas || !ctx) return;\r\n const { width: imageWidth, height: imageHeight } = artworkCanvas;\r\n\r\n if (imageHeight <= 0) return;\r\n ctx.drawImage(\r\n artworkCanvas,\r\n 0, 0,\r\n imageWidth, imageHeight,\r\n artX, artY,\r\n artWidth, artWidth / (imageWidth / imageHeight),\r\n );\r\n },\r\n drawBackground: (\r\n boundary?: 'pendulum',\r\n ) => {\r\n if (!backgroundCanvas || !ctx || !hasBackground) return;\r\n const { width: backgroundWidth, height: backgroundHeight } = backgroundCanvas;\r\n\r\n if (backgroundHeight <= 0) return;\r\n if (boundary === 'pendulum') {\r\n let redrawCoordination = resultAPI.calculateCardArtRedrawCoordination(backgroundCanvas);\r\n\r\n if (backgroundType === 'full') {\r\n redrawCoordination = resultAPI.calculateCardArtRedrawCoordination(\r\n backgroundCanvas,\r\n { ...opacity, body: 0 },\r\n undefined,\r\n 'full',\r\n );\r\n } else if (backgroundType === 'fit') {\r\n redrawCoordination = resultAPI.calculateCardArtRedrawCoordination(\r\n backgroundCanvas,\r\n opacity,\r\n undefined,\r\n 'fit'\r\n );\r\n }\r\n\r\n const {\r\n sourceOffsetX: backgroundSourceOffsetX, sourceOffsetY: backgroundSourceOffsetY,\r\n offsetHeight: backgroundOffsetHeight,\r\n destinationX: backgroundDestinationX, destinationY: backgroundDestinationY,\r\n destinationWidth: backgroundDestinationWidth, destinationHeight: backgroundDestinationHeight,\r\n } = redrawCoordination;\r\n ctx.drawImage(\r\n backgroundCanvas,\r\n backgroundSourceOffsetX, backgroundSourceOffsetY,\r\n backgroundWidth - backgroundSourceOffsetX * 2, backgroundHeight - backgroundOffsetHeight,\r\n backgroundDestinationX, backgroundDestinationY,\r\n backgroundDestinationWidth, backgroundDestinationHeight,\r\n );\r\n return;\r\n }\r\n\r\n const {\r\n artX,\r\n artY,\r\n artWidth,\r\n } = getArtCanvasCoordinate(\r\n isPendulum,\r\n { ...opacity, boundless: true },\r\n backgroundType,\r\n );\r\n ctx.drawImage(\r\n backgroundCanvas,\r\n 0, 0,\r\n backgroundWidth, backgroundHeight,\r\n artX, artY,\r\n artWidth, artWidth / (backgroundWidth / backgroundHeight)\r\n );\r\n },\r\n drawAttribute: async () => {\r\n await drawAsset(ctx, `attribute/attr-${format}-${attribute.toLowerCase()}.png`, 678, 55);\r\n },\r\n drawStar: async ({ style, starAlignment }: { style?: CanvasTextStyle, starAlignment: string }) => {\r\n const normalizedCardIcon = cardIcon === 'auto' ? getCardIconFromFrame(frame) : cardIcon;\r\n await drawStarContent({\r\n ctx,\r\n cardIcon: normalizedCardIcon,\r\n text: typeof star === 'string' ? star : null,\r\n star,\r\n starAlignment,\r\n style,\r\n onStarDraw: async coordinate => {\r\n return normalizedCardIcon === 'st'\r\n ? Promise.resolve()\r\n : await loopFinish(\r\n ctx,\r\n 'star',\r\n async type => drawAsset(ctx, `finish/finish-${type}-star.png`, ...coordinate),\r\n );\r\n },\r\n });\r\n },\r\n drawPendulumScaleIcon: async () => {\r\n await drawAsset(ctx, `frame-pendulum/pendulum-scale-${pendulumSize}.png`, 0, 750);\r\n },\r\n /** Individual arrows has two state (active/inactive) and two different parts (base and core) */\r\n drawLinkArrowMap: async (linkMap: string[]) => {\r\n await Promise.all([1, 2, 3, 4, 6, 7, 8, 9]\r\n .map(async entry => {\r\n const { left, top, height, width } = arrowPositionList[entry - 1];\r\n const isActive = linkMap.includes(`${entry}`);\r\n const baseLink = `link/link-inactive-${entry}`;\r\n const activeLink = `link/link-active-${entry}`;\r\n const coordinate = [left, top, width, height] as const;\r\n\r\n await drawAssetWithSize(ctx, `${baseLink}-base${boundless ? '-full' : ''}.png`, ...coordinate);\r\n await drawAssetWithSize(ctx, `${baseLink}-core.png`, ...coordinate);\r\n if (isActive) {\r\n await drawAssetWithSize(ctx, `${activeLink}-base.png`, ...coordinate);\r\n return drawAssetWithSize(ctx, `${activeLink}-core.png`, ...coordinate);\r\n } else return;\r\n })\r\n );\r\n },\r\n drawStatBorder: async (color: string) => {\r\n await drawWithColor(\r\n canvas,\r\n 'frame/frame-stat-border.png',\r\n color,\r\n 813, 20,\r\n 0, 1070,\r\n );\r\n },\r\n\r\n /** @summary BACKGROUND section */\r\n\r\n drawNameBackground: async () => {\r\n if (!ctx) return;\r\n\r\n ctx.globalAlpha = opacityName / 100;\r\n await drawAsset(ctx, `background/background-name-${frame}.png`, 0, 0);\r\n ctx.globalAlpha = 1;\r\n },\r\n /** Background is based on bottom frame. This function draws both background for pendulum part and normal effect part. */\r\n drawEffectBackground: async (withPendulum = false) => {\r\n if (!ctx) return;\r\n\r\n ctx.globalAlpha = opacityText / 100;\r\n await drawAsset(\r\n ctx,\r\n `background/background-text-${bottomFrame}.png`,\r\n backgroundEffectBoxX, backgroundEffectBoxY,\r\n );\r\n if (withPendulum) {\r\n ctx.globalAlpha = opacityPendulum / 100;\r\n await drawAsset(ctx, `background/background-pendulum-${bottomFrame}.png`, 55, 738);\r\n }\r\n ctx.globalAlpha = 1;\r\n },\r\n\r\n /** @summary BORDER section */\r\n\r\n drawFrameBorder: async () => {\r\n return drawAsset(ctx, `frame/frame-border-${frameBorderType}.png`, 0, 0);\r\n },\r\n drawNameBorder: async () => {\r\n return nameBorder\r\n ? drawAsset(ctx, `frame/name-border-${nameBorderType}.png`, 0, 0)\r\n : Promise.resolve();\r\n },\r\n drawArtBorder: async () => {\r\n if (artBorder) {\r\n let artFrameSource = '';\r\n if (isXyz || isSpeedSkill) {\r\n artFrameSource = `frame/art-border-${frame}.png`;\r\n } else if (isLink || ['zarc', 'hamon', 'uria', 'raviel'].includes(frame)) {\r\n artFrameSource = 'frame/art-border-special.png';\r\n } else {\r\n artFrameSource = 'frame/art-border.png';\r\n }\r\n await drawAsset(ctx, artFrameSource, artBoxX, artBoxY);\r\n }\r\n },\r\n drawPendulumBorder: async (artBorder: boolean, foilType: Foil) => {\r\n await drawAsset(\r\n ctx,\r\n `frame-pendulum/border-pendulum-${pendulumSize}`\r\n + `-${foilType}`\r\n + (artBorder ? '' : '-artless')\r\n + '.png',\r\n 30, 185,\r\n );\r\n },\r\n /** Usually we can draw foil on top of effect border, but speed skill's effect border is thicker so foil cannot cover it properly, in this case we will not draw the effect border knowing foil will be applied. In fact the effect border of speed skill is kinda buggy and not align really well, but we can't really do anything about it. Speed skill is also just a non-standard frame. */\r\n drawEffectBorder: async () => {\r\n if (!hasFoil && bottomFrame === 'speed-skill') {\r\n await drawAsset(ctx, 'frame/effect-border-speed-skill.png', effectBoxX, effectBoxY);\r\n } else {\r\n await drawAsset(ctx, 'frame/effect-border.png', effectBoxX, effectBoxY);\r\n }\r\n },\r\n drawCardBorder: async () => {\r\n await drawAsset(ctx, `frame/card-border${hasFoil ? `-${foil}` : ''}.png`, 0, 0);\r\n },\r\n\r\n /** @summary FOIL section */\r\n\r\n drawArtBorderFoil: async () => {\r\n if (artBorder) await drawAsset(ctx, `frame/art-border-${foil}.png`, artBoxX, artBoxY);\r\n },\r\n drawEffectBorderFoil: async () => {\r\n await drawAsset(ctx, `frame/effect-border-${foil}.png`, effectBoxX, effectBoxY);\r\n },\r\n drawLinkMapFoil: async (withBorder = artBorder) => {\r\n await drawAsset(ctx, `link/link-overlay-arrow-${foil}${withBorder ? '' : '-artless'}.png`, 0, 175);\r\n },\r\n\r\n /** @summary FINISH section */\r\n\r\n drawNameFinish: async () => {\r\n if (artBorder || nameBorder) await loopFinish(\r\n ctx,\r\n 'name',\r\n async type => {\r\n return drawAsset(ctx, `finish/finish-${type}-name.png`, 0, 0);\r\n },\r\n );\r\n },\r\n drawAttributeFinish: async () => {\r\n if (attribute !== NO_ATTRIBUTE) {\r\n await loopFinish(ctx, 'attribute', async type => drawAsset(ctx, `finish/finish-${type}-attribute.png`, 678, 55));\r\n }\r\n },\r\n drawArtFinish: async () => {\r\n if (applyArtFinish) await loopArtFinish(\r\n ctx,\r\n 'art',\r\n async finishType => await drawAsset(\r\n ctx,\r\n `finish/art-finish-${finishType}${isPendulum ? `-pendulum-${pendulumSize}` : ''}.png`,\r\n artFinishX, artFinishY,\r\n ),\r\n );\r\n },\r\n /**\r\n * * ArtFinish: Controlled by `artFinish` attribute.\r\n * * ArtOverlayFinish: Controlled by `finish` attribute, and therfore support multiple layers.\r\n * \r\n * * OverlayFinish type `art`: Apply only when art border is present, for example a dark finish will darken all the card EXCEPT the artwork. But when art border is no longer present (for example full-art card), it will darken the whole card.\r\n * * OverlayFinish type `unart`: Apply only when art border is not present.\r\n */\r\n drawArtOverlayFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'art-overlay',\r\n async type => {\r\n return drawAsset(\r\n ctx,\r\n 'finish/finish'\r\n + `-${type}`\r\n + `-${applyArtFinish ? 'art' : 'unart'}`\r\n + '-overlay'\r\n + (isPendulum ? `-pendulum-${pendulumSize}` : '')\r\n + '.png',\r\n artFinishX, artFinishY,\r\n );\r\n },\r\n );\r\n },\r\n drawArtBorderFinish: async () => {\r\n if (artBorder) {\r\n await loopFinish(\r\n ctx,\r\n 'art-border',\r\n async finishType => drawAsset(ctx, `finish/finish-${finishType}-art-border.png`, 0, 0),\r\n );\r\n }\r\n },\r\n drawPendulumArtBorderFinish: async () => {\r\n if (artBorder) await loopFinish(\r\n ctx,\r\n 'art-border-pendulum',\r\n finishType => drawAsset(ctx, `finish/finish-${finishType}-art-border-pendulum-${pendulumSize}.png`, 0, 0)\r\n );\r\n },\r\n drawBorderPendulumFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'border-pendulum',\r\n async finishType => drawAsset(ctx, `finish/finish-${finishType}-border-pendulum-${pendulumSize}.png`, 0, 0)\r\n );\r\n },\r\n drawFrameFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'frame',\r\n async type => {\r\n return drawAsset(ctx, `finish/finish-${type}-frame${isPendulum ? `-pendulum-${pendulumSize}` : ''}.png`, 0, 0);\r\n },\r\n );\r\n },\r\n drawFrameBackgroundFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'frame-background',\r\n async type => {\r\n return drawAsset(ctx, `finish/finish-${type}-frame-background${isPendulum ? `-pendulum-${pendulumSize}` : ''}.png`, 0, 0);\r\n },\r\n );\r\n },\r\n /** Unlike total overlay, this finish layer lies below card text (name, effect, etc...) */\r\n drawOverlayFinish: async () => {\r\n await loopFinish(ctx, 'overlay', async overlayType => drawAsset(ctx, `finish/finish-${overlayType}-overlay.png`, 0, 0));\r\n },\r\n drawCardBorderFinish: async () => {\r\n await loopFinish(ctx, 'card-border', async type => drawAsset(ctx, `finish/finish-${type}-card-border.png`, 0, 0));\r\n },\r\n };\r\n\r\n return resultAPI;\r\n};","import {\r\n DefaultFontSizeData,\r\n NormalizeTextRegex,\r\n NameFontDataMap,\r\n NameStyle,\r\n PatternMap,\r\n TCG_LETTER_JOINLIST,\r\n getDefaultNameStyle,\r\n} from 'src/model';\r\nimport { parsePalette, createFontGetter, condense } from 'src/util';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { drawAsset, drawAssetWithSize } from '../image';\r\n\r\nconst getNameGradient = (\r\n ctx: CanvasRenderingContext2D,\r\n angleAsDegree: number,\r\n colorStopList: { offset: string, color: string }[],\r\n edge: number,\r\n contentWidth: number,\r\n baseline: number,\r\n maxAscent: number,\r\n maxDescent: number,\r\n) => {\r\n /** Use the knowledge diagram to understand more about the geometry for this, but basically we want to create a rectangle to put the gradient in, this rectangle can be rotated, but no matter what the rotation angle is, it must be large just enought to contains all the card name inside, no more no less.\r\n * \r\n * This is deceptively hard because each letters has their own \"hanging\" or \"protruding\" part, magnified by the fact that the gradient is rotable. */\r\n const baseKAF = angleAsDegree % 360;\r\n const quarterSlot = `${Math.floor(baseKAF / 90)}`;\r\n const KAF = baseKAF % 90;\r\n const originWidth = contentWidth;\r\n const originHeight = maxAscent + maxDescent;\r\n // Testing only\r\n // const originWidth = 16;\r\n // const originHeight = 8;\r\n // const edge = 0, baseline = 4, maxDescent = 4, maxAscent = 4;\r\n const cx = edge + originWidth / 2;\r\n const cy = baseline + (maxDescent - maxAscent) / 2;\r\n\r\n let width = originWidth, height = originHeight;\r\n if (quarterSlot === '1' || quarterSlot === '3') { width = originHeight; height = originWidth }\r\n\r\n /**\r\n * The coordinate system is put in the middle of the card name, with its origin lies exactly at the center, thanks to the information about its bounding from parameters.\r\n * \r\n * We avoid want to obtuse angle, so we only calculate one quarter, then mirror it vertically and horizontally to fill all fours.\r\n */\r\n const AD = Math.sqrt(width ** 2 / 4 + height ** 2 / 4);\r\n if (AD > 0) {\r\n const KAD = Math.asin((width / 2) / AD) * 180 / Math.PI;\r\n const DAF = KAD - KAF;\r\n const FDA = 90 - DAF;\r\n const AF = Math.sin(FDA / 180 * Math.PI) * AD;\r\n const AL = Math.sin(KAF / 180 * Math.PI) * AF;\r\n const FL = Math.cos(KAF / 180 * Math.PI) * AF;\r\n let offsetX = AL;\r\n let offsetY = FL;\r\n if (quarterSlot === '1') { offsetX = FL; offsetY = -AL }\r\n if (quarterSlot === '2') { offsetX = -AL; offsetY = -FL }\r\n if (quarterSlot === '3') { offsetX = -FL; offsetY = AL }\r\n\r\n const topX = cx + offsetX;\r\n const topY = cy - offsetY;\r\n const botX = cx - offsetX;\r\n const botY = cy + offsetY;\r\n // console.info('metric', {\r\n // quarterSlot, baseKAF,\r\n // '\\n', width, height, cx, cy,\r\n // '\\n', KAF, KAD, DAF, FDA,\r\n // '\\n', AD, AF, AL, FL,\r\n // '\\n', maxAscent, maxDescent, baseline,\r\n // '\\n', topX, topY, botX, botY,\r\n // });\r\n const gradient = ctx.createLinearGradient(topX, topY, botX, botY);\r\n colorStopList.forEach(({ color, offset }) => gradient.addColorStop(parseFloat(offset), color));\r\n\r\n return gradient;\r\n }\r\n return undefined;\r\n};\r\n\r\n/**\r\n * Draw card name, while the foot text is affected by every custom method, head text ONLY affected by its own color.\r\n */\r\nexport const drawName = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n edge: number,\r\n trueBaseline: number,\r\n width: number,\r\n style: Partial,\r\n option: {\r\n frame: string,\r\n cloneNode: HTMLCanvasElement | null | undefined,\r\n format: string,\r\n isSpeedSkill?: boolean,\r\n furiganaHelper: boolean,\r\n },\r\n) => {\r\n const { isSpeedSkill, format, cloneNode, frame, furiganaHelper } = option;\r\n const cloneCtx = cloneNode?.getContext('2d');\r\n if (ctx && cloneCtx && value) {\r\n const {\r\n font,\r\n fillStyle,\r\n headTextFillStyle,\r\n shadowBlur,\r\n hasShadow,\r\n shadowColor,\r\n shadowOffsetX,\r\n shadowOffsetY,\r\n hasOutline: hasDefaultOutline,\r\n lineColor,\r\n lineWidth,\r\n lineOffsetX,\r\n lineOffsetY,\r\n hasGradient,\r\n gradientAngle,\r\n gradientColor,\r\n pattern,\r\n } = { ...getDefaultNameStyle(), ...style };\r\n const { patternImage, blendMode: patternBlendMode } = PatternMap[pattern ?? ''] ?? {};\r\n const hasOutline = hasDefaultOutline;\r\n\r\n ctx.textAlign = 'left';\r\n if (hasShadow) {\r\n ctx.shadowColor = shadowColor;\r\n ctx.shadowOffsetY = shadowOffsetY;\r\n ctx.shadowOffsetX = shadowOffsetX;\r\n ctx.shadowBlur = shadowBlur;\r\n }\r\n if (hasDefaultOutline) {\r\n ctx.lineWidth = lineWidth;\r\n ctx.strokeStyle = lineColor;\r\n }\r\n const fontData = {\r\n ...(NameFontDataMap[font as keyof typeof NameFontDataMap] ?? NameFontDataMap.Default).fontData,\r\n headTextFillStyle,\r\n };\r\n const fontGetter = createFontGetter({\r\n defaultFamily: fontData.font,\r\n defaultSize: fontData.fontList[0].fontSize,\r\n defaultWeight: fontData.weight,\r\n });\r\n const textData = {\r\n fontLevel: 0,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n const quoteConvertedValue = normalizeCardText(\r\n value,\r\n format,\r\n { multiline: false, furiganaHelper, dictionaryType: 'rubyFormName' },\r\n );\r\n\r\n /** Calculate the bounding box that contains all card name's graphic, and passing it to gradient calculator. Beware - gradient does not apply to head text. */\r\n const crudeTokenList = format === 'ocg'\r\n ? [quoteConvertedValue]\r\n : quoteConvertedValue.split(new RegExp(`([^${TCG_LETTER_JOINLIST}])`, 'g'));\r\n const fontGetterForWidthCalculating = createFontGetter({\r\n defaultFamily: fontData.font,\r\n defaultSize: fontData.fontList[0].fontSize,\r\n defaultWeight: fontData.weight,\r\n });\r\n const normalStyle = fontGetterForWidthCalculating.getFont();\r\n const symbolStyle = fontGetterForWidthCalculating\r\n .setSize(cur => cur * fontData.symbolFontRatio)\r\n .setStyle('small-caps')\r\n .setFamily(fontData.symbolFont)\r\n .getFont();\r\n let maxAscent = 0;\r\n let maxDescent = 0;\r\n crudeTokenList.forEach((cur, index) => {\r\n ctx.font = index % 2 === 0 ? normalStyle : symbolStyle;\r\n\r\n const textMetric = ctx.measureText(cur.replaceAll(NormalizeTextRegex, ''));\r\n maxAscent = Math.max(maxAscent, textMetric.actualBoundingBoxAscent);\r\n maxDescent = Math.max(maxDescent, textMetric.actualBoundingBoxDescent);\r\n }, 0);\r\n\r\n ctx.font = normalStyle;\r\n /** Calculate fitting ratio like normal */\r\n let actualLineWidth = 0;\r\n const internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [quoteConvertedValue],\r\n format, textData,\r\n width,\r\n });\r\n\r\n if (currentLineCount > 1) return false;\r\n actualLineWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n\r\n ctx.scale(xRatio, yRatio);\r\n\r\n /** Calculate gradient and offset based on card's frame. */\r\n const offsetY = fontData.fontList[0].offsetY ?? DefaultFontSizeData.offsetY;\r\n const tokenList = tokenizeText(quoteConvertedValue);\r\n const gradient = actualLineWidth > 0 && hasGradient\r\n ? getNameGradient(\r\n ctx,\r\n gradientAngle,\r\n parsePalette(gradientColor),\r\n edge,\r\n actualLineWidth,\r\n trueBaseline,\r\n maxAscent, maxDescent,\r\n )\r\n : undefined;\r\n\r\n\r\n /** First iteration: Draw the card name with color, shadow and gradient */\r\n ctx.fillStyle = gradient ?? fillStyle;\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge: edge, trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline - (isSpeedSkill ? offsetY : 0));\r\n },\r\n });\r\n\r\n /** Second iteration, draw pattern, we follow these steps:\r\n * * We create a second, temporary canvas node.\r\n * * We fill the node with pattern. The pattern is not skewed, but maybe scaled to fit exactly the bounding box of the card name (we reuse the same information when calculate gradient).\r\n * * We place the temporary node above the card name's canvas, using suitable blend mode, this way we essential \"coating\" the pattern on top of the text, without damaging it's surrounding.\r\n */\r\n if (patternImage && cloneNode) {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n /** Some patterns are partially transparent, so we need to draw the current frame under it first. */\r\n await drawAsset(cloneCtx, `frame/frame-${frame}.png`, 0, 0);\r\n await drawAsset(cloneCtx, `background/background-name-${frame}.png`, 0, 0);\r\n cloneCtx.globalCompositeOperation = patternBlendMode;\r\n await drawAssetWithSize(\r\n cloneCtx, `finish-name/${patternImage}.png`,\r\n edge, trueBaseline - maxAscent,\r\n width,\r\n maxAscent + maxDescent,\r\n );\r\n ctx.globalCompositeOperation = 'source-in';\r\n ctx.drawImage(cloneNode, 0, 0);\r\n ctx.scale(xRatio, yRatio);\r\n ctx.globalCompositeOperation = 'source-over';\r\n\r\n /** Again, foot text is not affected by pattern, so we draw the whole name again but without the foot text part.\r\n * \r\n * Because head text is not affected by shadow and outline, and their color is always solid. When placed on top of the head text with pattern, they will cover the pattern perfectly.\r\n */\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge: edge, trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: () => {},\r\n });\r\n }\r\n\r\n /** Third iteration, we apply \"outline\" to card name. We use stroke method to simulate outline behavior. This is not ideal (like at all), but current canvas has no way to do it properly. */\r\n if (hasOutline) {\r\n ctx.globalCompositeOperation = 'destination-over';\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge: edge, trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.lineJoin = 'round';\r\n ctx.strokeText(\r\n letter,\r\n scaledEdge + lineOffsetX,\r\n scaledBaseline + lineOffsetY - (isSpeedSkill ? offsetY : 0),\r\n );\r\n },\r\n });\r\n }\r\n ctx.globalCompositeOperation = 'source-over';\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n const defaultTextStyle = getDefaultNameStyle();\r\n ctx.fillStyle = defaultTextStyle.fillStyle;\r\n ctx.shadowColor = defaultTextStyle.shadowColor;\r\n ctx.shadowOffsetY = defaultTextStyle.shadowOffsetY;\r\n ctx.shadowOffsetX = defaultTextStyle.shadowOffsetX;\r\n ctx.shadowBlur = defaultTextStyle.shadowBlur;\r\n ctx.lineWidth = defaultTextStyle.lineWidth;\r\n ctx.strokeStyle = defaultTextStyle.lineColor;\r\n ctx.lineJoin = 'miter';\r\n ctx.globalCompositeOperation = 'source-over';\r\n }\r\n};","import { clearCanvas, setTextStyle } from '../canvas-util';\r\nimport { condense, createFontGetter , checkLightFrame, checkSpeedSkill } from 'src/util';\r\nimport { ST_ICON_SYMBOL, FontData, TypeAbilityCoordinateMap, getTypeAbilityFontData, NO_ICON } from 'src/model';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { drawAssetWithSize } from '../image';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\n/** Small and medium size are used for type / ability text in effect box. Large type is used for \"Spell/Trap type\" under card's name. */\r\nconst sizeMap: Record = {\r\n small: 0,\r\n medium: 1,\r\n large: 2,\r\n};\r\nexport const drawTypeAbilityText = ({\r\n ctx,\r\n value,\r\n format,\r\n metricMethod,\r\n size,\r\n furiganaHelper,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n value: string,\r\n format: string,\r\n metricMethod?: FontData['metricMethod'],\r\n size: 'small' | 'medium' | 'large',\r\n furiganaHelper: boolean,\r\n}) => {\r\n const {\r\n edgeAlignment = 'left',\r\n trueEdge,\r\n trueBaseline,\r\n trueWidth: width,\r\n } = TypeAbilityCoordinateMap[format]?.[size] ?? TypeAbilityCoordinateMap['tcg']['medium'];\r\n const fontData = getTypeAbilityFontData()[format];\r\n if (metricMethod) fontData.metricMethod = metricMethod;\r\n const { font } = fontData;\r\n const fontLevel = sizeMap[size];\r\n const fontSizeData = fontData.fontList[fontLevel];\r\n const fontGetter = createFontGetter({\r\n defaultFamily: font,\r\n defaultSize: `${fontSizeData.fontSize}px`,\r\n });\r\n const textData = {\r\n fontLevel,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n let actualLineWidth = 0;\r\n\r\n ctx.font = fontGetter.getFont();\r\n ctx.textAlign = 'left';\r\n const normalizedText = normalizeCardText(value, format, { multiline: false, furiganaHelper });\r\n const internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [normalizedText],\r\n format, textData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n actualLineWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n ctx.scale(xRatio, yRatio);\r\n const result = drawLine({\r\n ctx,\r\n tokenList: tokenizeText(normalizedText),\r\n xRatio, yRatio,\r\n trueEdge: edgeAlignment === 'left' ? trueEdge : (trueEdge - actualLineWidth * xRatio),\r\n trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n },\r\n });\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n return {\r\n ...result,\r\n xRatio,\r\n };\r\n};\r\n\r\nexport const drawTypeAbility = async ({\r\n ctx,\r\n typeAbility,\r\n subFamily,\r\n format,\r\n frame,\r\n size,\r\n isMonster,\r\n textStyle,\r\n furiganaHelper,\r\n}: {\r\n ctx?: CanvasRenderingContext2D | null,\r\n typeAbility: string,\r\n subFamily: string,\r\n format: string,\r\n frame: string,\r\n size: 'small' | 'medium' | 'large',\r\n isMonster: boolean,\r\n textStyle: CanvasTextStyle,\r\n furiganaHelper: boolean,\r\n}) => {\r\n if (!clearCanvas(ctx)) return;\r\n\r\n const willDrawTypeAbility = typeAbility.length > 0;\r\n const willDrawIcon = subFamily !== NO_ICON && size === 'large';\r\n const typeAbilityWithIcon = typeAbility\r\n + (willDrawIcon ? ST_ICON_SYMBOL : '');\r\n const normalizedTypeAbilityText = willDrawTypeAbility\r\n ? format === 'tcg'\r\n ? size === 'large'\r\n ? `[  ${typeAbilityWithIcon}  ]`\r\n : `[${typeAbilityWithIcon}]`\r\n : `【${typeAbilityWithIcon}】`\r\n : '';\r\n if (!willDrawTypeAbility) return;\r\n\r\n /** Special treatment for speed skill */\r\n const defaultFillStyle = checkLightFrame(frame) && !checkSpeedSkill({ frame }) && size === 'large'\r\n ? '#ffffff'\r\n : '#000000';\r\n const normalizedStyle = { color: defaultFillStyle, ...textStyle };\r\n const resetStyle = setTextStyle({ ctx, ...normalizedStyle });\r\n const { iconPositionList, xRatio } = drawTypeAbilityText({\r\n ctx,\r\n format,\r\n size,\r\n value: normalizedTypeAbilityText,\r\n metricMethod: !isMonster ? 'compact' : undefined,\r\n furiganaHelper,\r\n });\r\n resetStyle();\r\n\r\n let offsetY = format === 'ocg' ? -4 : 0;\r\n let offsetX = format === 'ocg' ? -3 : 0;\r\n\r\n if (willDrawIcon) {\r\n const { edge, baseline } = iconPositionList[0];\r\n await drawAssetWithSize(\r\n ctx,\r\n `subfamily/subfamily-${subFamily.toLowerCase()}.png`,\r\n image => edge + image.naturalWidth * 0.175 * xRatio + offsetX,\r\n image => baseline - image.naturalWidth * 0.8 + offsetY,\r\n image => image.naturalWidth,\r\n image => image.naturalWidth,\r\n );\r\n } else {\r\n /** Currently, draw icon in place of monster type is undesirable, as the icon seems out of place and user may not know how to turn them off properly if they want to. */\r\n // await Promise.all(iconPositionList.map(({ edge, baseline, size }) => {\r\n // const iconSize = size * 0.9;\r\n\r\n // return drawAssetWithSize(\r\n // ctx,\r\n // `subfamily/subfamily-${subFamily.toLowerCase()}.png`,\r\n // () => edge + size * 0.125,\r\n // baseline - size * 0.850,\r\n // () => iconSize,\r\n // () => iconSize,\r\n // );\r\n // }));\r\n }\r\n};","import { fillTextLeftWithSpacing, fillTextRightWithSpacing } from '../canvas-util';\r\n\r\nexport const drawScale = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n edge: number,\r\n baseline: number,\r\n) => {\r\n if (ctx && value) {\r\n const fontSize = 60.5;\r\n ctx.font = `${fontSize}px MatrixBoldSmallCaps`;\r\n ctx.textAlign = 'left';\r\n\r\n const digitScaleRatio = 0.65;\r\n const digitList = `${value}`.split('');\r\n let totalWidth = 0;\r\n\r\n digitList.forEach(digit => {\r\n totalWidth += ctx.measureText(digit).width * (digit === '1' ? digitScaleRatio : 1);\r\n });\r\n let accLeft = edge - totalWidth / 2;\r\n\r\n digitList.forEach(digit => {\r\n ctx.fillText(digit, digit === '1' ? accLeft - 3 : accLeft, baseline + fontSize);\r\n accLeft += ctx.measureText(digit).width * (digit === '1' ? digitScaleRatio : 1);\r\n });\r\n }\r\n};\r\n\r\nexport const draw1stEdition = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n edge = 99,\r\n baselineOffset = 0,\r\n option = { stroke: false },\r\n) => {\r\n if (!ctx) return;\r\n\r\n const { stroke = false } = option ?? {};\r\n ctx.font = 'bold 23.7px palatino-linotype-bold';\r\n\r\n let left = edge;\r\n ctx.fillText('1', left, 1150.93 + baselineOffset);\r\n if (stroke) ctx.strokeText('1', left, 1150.93);\r\n left += ctx.measureText('1').width - 2;\r\n\r\n ctx.font = 'bold 17.78px palatino-linotype-bold';\r\n ctx.fillText('st', left, 1143.53 + baselineOffset);\r\n if (stroke) ctx.strokeText('st', left, 1143.53);\r\n left += ctx.measureText('st').width;\r\n\r\n ctx.font = 'bold 22.22px palatino-linotype-bold';\r\n ctx.fillText(' Edition', left, 1150.93 + baselineOffset);\r\n if (stroke) ctx.strokeText(' Edition', left, 1150.93);\r\n};\r\n\r\nexport const drawStatText = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n edge: number,\r\n baseline: number,\r\n) => {\r\n if (!ctx) return;\r\n\r\n ctx.scale(1, 0.98);\r\n ctx.font = 'bold 35.73px Matrix-Bold';\r\n const cursorEndOfATK = fillTextLeftWithSpacing(ctx, value, 0.075, edge, baseline / 0.98);\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.scale(1, 1.01);\r\n ctx.font = 'bold 34.74px Matrix-Bold';\r\n fillTextLeftWithSpacing(ctx, '/', 0.15, cursorEndOfATK + 5, baseline / 1.01);\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n};\r\n\r\n/** Stats have two special case: \"?\" stat (\"Slifer the Sky Dragon\" TCG) and \"∞\" stat (\"Divine Serpent Geh\" Anime) */\r\nexport const drawStat = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string | number,\r\n edge: number,\r\n baseline: number,\r\n) => {\r\n if (!ctx || value == null) return;\r\n\r\n const statWidth = 73.97;\r\n if (value === '∞') {\r\n ctx.textAlign = 'right';\r\n ctx.font = 'bold 37px matrix';\r\n ctx.fillText(value, edge + statWidth, baseline);\r\n } else\r\n if (value === '?') {\r\n ctx.textAlign = 'right';\r\n ctx.font = 'bold 34px matrix';\r\n ctx.fillText(value, edge + statWidth, baseline);\r\n } else {\r\n ctx.textAlign = 'left';\r\n const tokenizedText = `${value}`.split('?');\r\n\r\n let totalWidth = tokenizedText.reduce((prev, curr, index) => {\r\n ctx.font = '37px MatrixBoldSmallCaps';\r\n let nextWidth = prev + ctx.measureText(curr).width;\r\n\r\n if (index < tokenizedText.length - 1) {\r\n ctx.font = '37px matrix';\r\n nextWidth += ctx.measureText('?').width;\r\n }\r\n\r\n return nextWidth;\r\n }, 0);\r\n\r\n if (totalWidth > 0) {\r\n const condenseRatio = Math.min(statWidth / totalWidth, 1);\r\n\r\n ctx.scale(condenseRatio, 1);\r\n tokenizedText.reduce((prev, _, index, arr) => {\r\n const curText = arr[arr.length - 1 - index];\r\n let nextEdge = prev;\r\n ctx.font = '37px MatrixBoldSmallCaps';\r\n nextEdge -= ctx.measureText(curText).width * condenseRatio;\r\n ctx.fillText(curText, nextEdge / condenseRatio, baseline);\r\n\r\n if (index < tokenizedText.length - 1) {\r\n ctx.font = 'bold 37px matrix';\r\n nextEdge -= ctx.measureText('?').width * condenseRatio;\r\n ctx.fillText('?', nextEdge / condenseRatio, baseline);\r\n }\r\n\r\n return nextEdge;\r\n }, edge + statWidth);\r\n ctx.scale(1 / condenseRatio, 1);\r\n }\r\n }\r\n};\r\n\r\nexport const drawSetId = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n option: { isPendulum: boolean, isLink: boolean, withShadow: boolean, format: string, lightFooter: boolean }\r\n) => {\r\n if (!ctx) return;\r\n\r\n const { isPendulum, isLink, withShadow, format, lightFooter } = option;\r\n let spacing = 0.175;\r\n let offsetY = 0;\r\n let xOffset = 0;\r\n ctx.fillStyle = (lightFooter && !isPendulum) ? '#ffffff' : '#000000';\r\n ctx.shadowColor = withShadow\r\n ? lightFooter ? '#000000' : '#ffffff'\r\n : '#000000';\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowBlur = withShadow && !isPendulum ? 3 : 0;\r\n ctx.font = `${withShadow ? 'bold' : ''} 22px stone-serif-regular`;\r\n if (format === 'ocg') {\r\n spacing = 0.145;\r\n offsetY = -1;\r\n xOffset = -3;\r\n }\r\n\r\n if (isPendulum) {\r\n fillTextLeftWithSpacing(ctx, value, spacing, 66.65 + xOffset, 1105.01 + offsetY);\r\n } else if (isLink) {\r\n fillTextRightWithSpacing(ctx, value, spacing, 666.56 + xOffset, 872.94 + offsetY);\r\n } else {\r\n fillTextRightWithSpacing(ctx, value, spacing, 728.78 + xOffset, 871.50 + offsetY);\r\n }\r\n};","import { useCallback, useEffect, useMemo, useRef } from 'react';\r\nimport {\r\n clearCanvas,\r\n draw1stEdition,\r\n drawCreatorText,\r\n drawEffect,\r\n drawName,\r\n drawScale,\r\n drawStat,\r\n drawStatText,\r\n drawSetId,\r\n drawSticker,\r\n getFinishIterator,\r\n drawTypeAbility,\r\n getEffectFontAndCoordinate,\r\n drawAsset,\r\n getLayoutDrawFunction,\r\n drawLinkRatingText,\r\n drawPredefinedMark,\r\n setTextStyle,\r\n drawPasswordText,\r\n} from 'src/draw';\r\nimport {\r\n CanvasConst,\r\n MasterSeriesCanvas,\r\n NO_ATTRIBUTE,\r\n getArtCanvasCoordinate,\r\n getDefaultCardOpacity,\r\n PendulumEffectFontData,\r\n PendulumEffectCoordinate,\r\n FinishMap,\r\n ArtFinishMap,\r\n CardOpacity,\r\n CardArtCanvasCoordinateMap,\r\n DEFAULT_BASE_FILL_COLOR,\r\n} from 'src/model';\r\nimport {\r\n checkLightHeader,\r\n checkLink,\r\n checkMonster,\r\n checkNormal,\r\n checkSpeedSkill,\r\n checkXyz,\r\n resolveNameStyle,\r\n} from 'src/util';\r\nimport { useCard } from '../use-card';\r\nimport { prepareStyle } from './prepare-style';\r\n\r\nconst {\r\n height: CanvasHeight,\r\n width: CanvasWidth,\r\n} = CanvasConst;\r\ntype DrawerProp = {\r\n imageChangeCount: number,\r\n pendulumSize?: 'medium',\r\n isInitializing: boolean,\r\n};\r\nexport const useMasterSeriDrawer = (active: boolean, canvasMap: MasterSeriesCanvas, props: DrawerProp) => {\r\n const {\r\n card,\r\n } = useCard();\r\n const {\r\n drawCanvasRef,\r\n artworkCanvasRef,\r\n backgroundCanvasRef,\r\n frameCanvasRef,\r\n creatorCanvasRef,\r\n effectCanvasRef,\r\n nameCanvasRef,\r\n passwordCanvasRef,\r\n pendulumEffectCanvasRef,\r\n pendulumScaleCanvasRef,\r\n setIdCanvasRef,\r\n statCanvasRef,\r\n stickerCanvasRef,\r\n cardIconCanvasRef,\r\n typeCanvasRef,\r\n finishCanvasRef,\r\n lightboxCanvasRef,\r\n } = canvasMap;\r\n const {\r\n format,\r\n hasBackground, backgroundType,\r\n frame, foil, finish, artFinish, opacity,\r\n name, nameStyle, nameStyleType,\r\n effectTextStyle, pendulumTextStyle, typeTextStyle, statTextStyle,\r\n effect,\r\n effectStyle,\r\n typeAbility,\r\n isPendulum, pendulumFrame, pendulumEffect, pendulumScaleBlue, pendulumScaleRed,\r\n atk, def, linkMap,\r\n attribute,\r\n cardIcon, subFamily, star, starAlignment,\r\n setId,\r\n password, creator, sticker,\r\n isFirstEdition, isDuelTerminalCard, isSpeedCard,\r\n furiganaHelper,\r\n } = card;\r\n\r\n const bottomFrame = pendulumFrame === 'auto'\r\n ? isPendulum\r\n ? 'spell'\r\n : frame\r\n : pendulumFrame;\r\n\r\n const condenseTolerant = effectStyle?.condenseTolerant;\r\n\r\n const isNormal = checkNormal(card);\r\n const isXyz = checkXyz(card);\r\n const isLink = checkLink(card);\r\n const isMonster = checkMonster(card);\r\n const isSpeedSkill = checkSpeedSkill(card);\r\n\r\n const { body = 100, boundless } = opacity;\r\n const requireShadow = !!(body < 50 || boundless);\r\n const lightFooter = ['xyz', 'dark-synchro', 'speed-skill', 'hamon', 'uria', 'raviel'].includes(bottomFrame);\r\n const lightHeader = checkLightHeader(frame);\r\n const {\r\n levelStyle,\r\n resolvedEffectTextStyle,\r\n resolvedPendulumEffectTextStyle,\r\n resolvedStatTextStyle,\r\n resolvedTypeTextStyle,\r\n } = useMemo(() => {\r\n return prepareStyle({\r\n lightFooter,\r\n lightHeader,\r\n requireShadow,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n statTextStyle,\r\n typeTextStyle,\r\n });\r\n }, [\r\n lightFooter,\r\n lightHeader,\r\n requireShadow,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n statTextStyle,\r\n typeTextStyle,\r\n ]);\r\n\r\n const normalizedSubFamily = subFamily.toUpperCase();\r\n const normalizedTypeAbility = typeAbility.map(text => text.trim()).join(format === 'ocg' ? '/' : '/');\r\n const statInEffect = pendulumFrame !== 'auto' || isPendulum\r\n ? !!(atk || def || (isLink && linkMap.length))\r\n : isMonster;\r\n const typeInEffect = cardIcon === 'auto'\r\n ? isMonster || isSpeedSkill\r\n : cardIcon !== 'st' || isLink;\r\n\r\n const {\r\n isInitializing,\r\n imageChangeCount,\r\n pendulumSize = 'medium',\r\n } = props;\r\n const readyToDraw = active && isInitializing === false;\r\n\r\n const loopFinish = useMemo(() => getFinishIterator(finish, FinishMap), [finish]);\r\n const loopArtFinish = useMemo(() => getFinishIterator([artFinish], ArtFinishMap), [artFinish]);\r\n\r\n const drawingPipeline = useRef Promise }>>({\r\n frame: {\r\n name: 'frame',\r\n order: 1,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n attribute: {\r\n name: 'attribute',\r\n order: 2,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n sticker: {\r\n name: 'sticker',\r\n order: 3,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n name: {\r\n name: 'name',\r\n order: 4,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n typeAbility: {\r\n name: 'typeAbility',\r\n order: 5,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n overlay: {\r\n name: 'overlay',\r\n order: 6,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n });\r\n\r\n /** DRAW CARD STRUCTURE */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = frameCanvasRef.current?.getContext('2d');\r\n const artworkCanvas = artworkCanvasRef.current;\r\n const backgroundCanvas = backgroundCanvasRef.current;\r\n\r\n drawingPipeline.current.frame.rerun += 1;\r\n drawingPipeline.current.frame.instructor = async () => {\r\n if (!frameCanvasRef.current || !clearCanvas(ctx)) return;\r\n\r\n const normalizedOpacity = { ...getDefaultCardOpacity(), ...opacity };\r\n const {\r\n artBorder: keepArtBorder,\r\n body: opacityBody,\r\n boundless,\r\n baseFill,\r\n } = normalizedOpacity;\r\n\r\n const fillBaseColor = (x: number, y: number, w: number, h: number) => {\r\n ctx.fillStyle = hasBackground ? baseFill : DEFAULT_BASE_FILL_COLOR;\r\n ctx.fillRect(x, y, w, h);\r\n };\r\n const hasArtBorder = opacityBody > 0 ? true : keepArtBorder;\r\n\r\n /** Base colored background so the card is not see-through even with transparent artwork */\r\n fillBaseColor(0, 0, CanvasWidth, CanvasHeight);\r\n\r\n const {\r\n drawFrame,\r\n drawCardArt,\r\n drawBackground,\r\n drawPendulumScaleIcon,\r\n drawLinkArrowMap,\r\n drawStar,\r\n drawAttribute,\r\n\r\n drawNameBackground,\r\n drawEffectBackground,\r\n\r\n drawFrameBorder,\r\n drawNameBorder,\r\n drawArtBorder,\r\n drawPendulumBorder,\r\n drawBorderPendulumFinish,\r\n drawEffectBorder,\r\n drawCardBorder,\r\n drawStatBorder,\r\n\r\n drawAttributeFinish,\r\n drawArtBorderFoil,\r\n drawEffectBorderFoil,\r\n drawLinkMapFoil,\r\n\r\n drawNameFinish,\r\n drawArtFinish,\r\n drawArtOverlayFinish,\r\n drawArtBorderFinish,\r\n drawPendulumArtBorderFinish,\r\n drawFrameFinish,\r\n drawFrameBackgroundFinish,\r\n drawOverlayFinish,\r\n drawCardBorderFinish,\r\n\r\n calculateCardArtRedrawCoordination,\r\n } = getLayoutDrawFunction({\r\n canvas: frameCanvasRef.current,\r\n artworkCanvas, backgroundCanvas,\r\n format,\r\n frame, bottomFrame,\r\n hasBackground,\r\n backgroundType,\r\n attribute,\r\n cardIcon, star,\r\n foil,\r\n pendulumSize,\r\n opacity: normalizedOpacity,\r\n isLink, isSpeedSkill, isXyz,\r\n isPendulum,\r\n loopFinish,\r\n loopArtFinish,\r\n });\r\n\r\n /** Start with artwork at the bottom, then main frame, then outer card border. */\r\n if (backgroundCanvas && ctx) drawBackground();\r\n if (artworkCanvas && ctx && !boundless) drawCardArt();\r\n await drawFrame();\r\n await drawCardBorder();\r\n await drawCardBorderFinish();\r\n\r\n /** @summary Draw NON-PENDULUM card layout */\r\n if (!isPendulum) {\r\n if (!boundless) {\r\n await drawNameBackground();\r\n await drawEffectBackground();\r\n await drawEffectBorder();\r\n /** Foil DOES NOT contains shadow, so it relies on the shadow of the border below. */\r\n await drawEffectBorderFoil();\r\n }\r\n await drawArtBorder();\r\n await drawArtBorderFoil();\r\n await drawArtBorderFinish();\r\n }\r\n\r\n /** @summary Draw PENDULUM-LIKE card layout. Does not apply to Link frame since it contains link arrows. */\r\n if (isPendulum && !isLink && !boundless) {\r\n /** Since pendulum art boundary is wider, we cannot relies on the artwork under frame, instead we must draw the artwork again, this time with different size. */\r\n if (artworkCanvas && ctx && artworkCanvas.height > 0) {\r\n const { width: artWidth, height: artHeight } = artworkCanvas;\r\n const {\r\n sourceOffsetX, sourceOffsetY,\r\n offsetHeight,\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n } = calculateCardArtRedrawCoordination(artworkCanvas);\r\n\r\n /** To avoid stacking transprency, we clear the area before redrawing */\r\n fillBaseColor(\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n );\r\n\r\n drawBackground('pendulum');\r\n ctx.drawImage(\r\n artworkCanvas,\r\n sourceOffsetX, sourceOffsetY,\r\n artWidth - sourceOffsetX * 2, artHeight - offsetHeight,\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n );\r\n }\r\n\r\n await drawNameBackground();\r\n await drawEffectBackground(true);\r\n }\r\n\r\n /** We must draw art finish first because pendulum's border have those little corners that spread into the artwork. */\r\n await drawArtFinish();\r\n await drawArtOverlayFinish();\r\n\r\n /** Scale and pendulum border frame, these will be covered by extended artwork so we doesn't draw them if the artwork is boundless */\r\n if (isPendulum && !isLink && !boundless) {\r\n await drawPendulumScaleIcon();\r\n /** Draw normal border first so we got the shadow ready. Again foiled border DOES NOT have shadow by their own. */\r\n await drawPendulumBorder(hasArtBorder, 'normal');\r\n await drawPendulumBorder(hasArtBorder, foil);\r\n await drawPendulumArtBorderFinish();\r\n if (hasArtBorder) await drawBorderPendulumFinish();\r\n }\r\n\r\n if (!boundless) {\r\n await drawFrameFinish();\r\n await drawNameFinish();\r\n }\r\n if (hasArtBorder) await drawFrameBackgroundFinish();\r\n\r\n /** Boundless art behavior here. If rigid frame is off, card image will extends beyond the current art border (on top of it). The extended card image is still below name, level, attribute, effect (both card and pendulum) and other predefined texts. */\r\n if (boundless) {\r\n if (isLink) {\r\n /** For link layout, the artwork is above the art border, but still below the link arrows */\r\n await drawArtBorderFinish();\r\n } else if (isPendulum) {\r\n /** We want to fill the area inside pendulum border only, so that the outside frame remains intact. */\r\n const extraHeightRatio = CardArtCanvasCoordinateMap.fullCard.ratio\r\n / CardArtCanvasCoordinateMap.extendedPendulum.ratio;\r\n /** Fill area with base color before start draw overlay artwork. In this case we do not want to fill everywhere, we just need to fill exactly the area contains inside pendulum border frame. */\r\n if (artworkCanvas && ctx && artworkCanvas.height > 0) {\r\n const {\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n } = calculateCardArtRedrawCoordination(\r\n artworkCanvas,\r\n { ...getDefaultCardOpacity(), ...opacity, body: 100, boundless: false },\r\n extraHeightRatio,\r\n );\r\n \r\n fillBaseColor(\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n );\r\n drawBackground('pendulum');\r\n }\r\n if (hasArtBorder) {\r\n await drawPendulumBorder(hasArtBorder, 'normal');\r\n await drawPendulumBorder(hasArtBorder, foil);\r\n }\r\n await drawPendulumArtBorderFinish();\r\n }\r\n await drawNameBackground();\r\n await drawNameFinish();\r\n await drawNameBorder();\r\n if (artworkCanvas && ctx) drawCardArt();\r\n await drawArtOverlayFinish();\r\n\r\n /** Redraw various part here because the extended artwork may overlap with those */\r\n if (isPendulum && !isLink) {\r\n await drawEffectBackground(true);\r\n await drawPendulumScaleIcon();\r\n await drawPendulumBorder(false, 'normal');\r\n await drawPendulumBorder(false, foil);\r\n await drawBorderPendulumFinish();\r\n } else {\r\n await drawEffectBackground();\r\n await drawEffectBorder();\r\n await drawEffectBorderFoil();\r\n }\r\n await drawFrameFinish();\r\n }\r\n\r\n if (statInEffect) await drawStatBorder(resolvedStatTextStyle.color ?? '#000000');\r\n\r\n /** Individual arrows has two state (active/inactive) and two different parts (base and core) */\r\n if (!isPendulum && isLink) {\r\n await drawLinkArrowMap(linkMap);\r\n await drawLinkMapFoil(false);\r\n const resetStyle = setTextStyle({ ctx, ...resolvedStatTextStyle });\r\n await drawLinkRatingText(frameCanvasRef.current, linkMap ?? [], resolvedStatTextStyle);\r\n resetStyle();\r\n }\r\n\r\n await drawAttribute();\r\n await drawAttributeFinish();\r\n if (!isLink) await drawStar({ style: levelStyle, starAlignment });\r\n if (!boundless) await drawNameBorder();\r\n await drawFrameBorder();\r\n await drawPredefinedMark({\r\n ctx,\r\n type: (lightFooter && !isPendulum) ? 'white' : 'black',\r\n bordered: (opacityBody < 50 || boundless) && !isPendulum,\r\n isDuelTerminalCard, isSpeedCard,\r\n isLink, isPendulum,\r\n });\r\n await drawOverlayFinish();\r\n };\r\n }, [\r\n readyToDraw,\r\n artworkCanvasRef,\r\n backgroundCanvasRef,\r\n frameCanvasRef,\r\n frame,\r\n format,\r\n hasBackground,\r\n backgroundType,\r\n attribute,\r\n bottomFrame,\r\n foil,\r\n star,\r\n starAlignment,\r\n cardIcon,\r\n isDuelTerminalCard,\r\n isLink,\r\n isPendulum,\r\n isSpeedCard,\r\n isSpeedSkill,\r\n isXyz,\r\n lightFooter,\r\n linkMap,\r\n resolvedStatTextStyle,\r\n loopArtFinish,\r\n loopFinish,\r\n opacity,\r\n pendulumSize,\r\n statInEffect,\r\n levelStyle,\r\n imageChangeCount, // Special dependency, do not remove even though it is not used in the effect itself\r\n ]);\r\n\r\n /** DRAW SCALE */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = pendulumScaleCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx)) return;\r\n if (isPendulum) {\r\n drawScale(ctx, pendulumScaleBlue ?? 0, 84.4, 790);\r\n drawScale(ctx, pendulumScaleRed ?? 0, 728.0, 790);\r\n }\r\n }, [readyToDraw, isPendulum, pendulumScaleBlue, pendulumScaleRed, pendulumScaleCanvasRef]);\r\n\r\n /** DRAW NAME */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n drawingPipeline.current.name.rerun += 1;\r\n drawingPipeline.current.name.instructor = async () => {\r\n const ctx = nameCanvasRef.current?.getContext('2d');\r\n const cloneNode = nameCanvasRef.current?.cloneNode() as HTMLCanvasElement | undefined;\r\n\r\n if (!clearCanvas(ctx) || !cloneNode) return;\r\n\r\n await drawName(\r\n ctx,\r\n name,\r\n format === 'tcg' ? 60 : 68, 116,\r\n attribute === NO_ATTRIBUTE\r\n ? (format === 'tcg' ? 688 : 674)\r\n : (format === 'tcg' ? 608 : 598),\r\n resolveNameStyle({ format, frame, nameStyle, nameStyleType, foil }),\r\n { isSpeedSkill, format, cloneNode, frame, furiganaHelper },\r\n );\r\n };\r\n }, [\r\n readyToDraw,\r\n attribute,\r\n foil,\r\n format,\r\n frame,\r\n furiganaHelper,\r\n isSpeedSkill,\r\n name,\r\n nameCanvasRef,\r\n nameStyle,\r\n nameStyleType,\r\n ]);\r\n\r\n /** DRAW STAT (ATK / DEF) */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = statCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx) || !statInEffect) return;\r\n\r\n const resetStyle = setTextStyle({ ctx, ...resolvedStatTextStyle });\r\n drawStatText(ctx, 'ATK', 432.10, 1106.494);\r\n drawStat(ctx, atk, 508.824, 1106.494);\r\n if (!isLink) {\r\n drawStatText(ctx, 'DEF', 600.85, 1106.494);\r\n drawStat(ctx, def, 673.865, 1106.494);\r\n }\r\n resetStyle();\r\n }, [readyToDraw, atk, def, isLink, isMonster, resolvedStatTextStyle, statCanvasRef, statInEffect]);\r\n\r\n /** DRAW SET ID */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = setIdCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx)) return;\r\n\r\n drawSetId(\r\n ctx,\r\n setId,\r\n {\r\n isLink, isPendulum,\r\n withShadow: requireShadow && !isPendulum,\r\n format,\r\n lightFooter,\r\n }\r\n );\r\n }, [readyToDraw, format, isLink, isPendulum, lightFooter, setIdCanvasRef, setId, isSpeedSkill, bottomFrame, requireShadow]);\r\n\r\n /** DRAW FIRST EDITION NOTICE AND PASSWORD */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = passwordCanvasRef.current?.getContext('2d');\r\n if (!clearCanvas(ctx)) return;\r\n\r\n const endOfPassword = drawPasswordText({\r\n ctx,\r\n value: password,\r\n lightFooter,\r\n alignment: 'left',\r\n format,\r\n hasShadow: bottomFrame === 'zarc' || requireShadow,\r\n });\r\n if (isFirstEdition && !isDuelTerminalCard) {\r\n ctx.fillStyle = lightFooter ? '#ffffff' : '#000000';\r\n\r\n draw1stEdition(\r\n ctx,\r\n Math.max(endOfPassword + 14.813, 142.2) - (format === 'ocg' ? 10 : 0),\r\n isSpeedSkill ? -2 : -1,\r\n );\r\n }\r\n }, [\r\n readyToDraw,\r\n isDuelTerminalCard,\r\n isFirstEdition,\r\n password,\r\n passwordCanvasRef,\r\n lightFooter,\r\n format,\r\n requireShadow,\r\n isSpeedSkill,\r\n bottomFrame,\r\n ]);\r\n\r\n /** DRAW CREATOR TEXT */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n\r\n drawCreatorText({\r\n ctx: creatorCanvasRef.current?.getContext('2d'),\r\n format,\r\n value: creator,\r\n alignment: 'right',\r\n baselineOffset: isSpeedSkill ? -2 : 0,\r\n hasShadow: requireShadow,\r\n lightFooter,\r\n });\r\n }, [readyToDraw, isPendulum, lightFooter, creator, creatorCanvasRef, format, requireShadow, isSpeedSkill]);\r\n\r\n /** DRAW STICKER */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n\r\n drawingPipeline.current.sticker.rerun += 1;\r\n drawingPipeline.current.sticker.instructor = async () => {\r\n return await drawSticker({\r\n ctx: stickerCanvasRef.current?.getContext('2d'),\r\n sticker,\r\n });\r\n };\r\n }, [readyToDraw, sticker, stickerCanvasRef]);\r\n\r\n /** DRAW CARD EFFECT + TYPE ABILITY */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n\r\n const ctx = effectCanvasRef.current?.getContext('2d');\r\n const typeCtx = typeCanvasRef.current?.getContext('2d');\r\n\r\n drawingPipeline.current.typeAbility.rerun += 1;\r\n drawingPipeline.current.typeAbility.instructor = async () => {\r\n if (!clearCanvas(ctx) || !clearCanvas(typeCtx)) return;\r\n\r\n const effectIndexSize = drawEffect({\r\n ctx,\r\n content: effect,\r\n isNormal,\r\n condenseTolerant,\r\n format,\r\n furiganaHelper,\r\n ...getEffectFontAndCoordinate({\r\n format,\r\n statInEffect,\r\n typeInEffect,\r\n isNormal,\r\n }),\r\n textStyle: resolvedEffectTextStyle,\r\n });\r\n await drawTypeAbility({\r\n ctx: typeCtx,\r\n format,\r\n frame,\r\n furiganaHelper,\r\n isMonster,\r\n textStyle: resolvedTypeTextStyle,\r\n size: !typeInEffect\r\n ? 'large'\r\n : effectIndexSize === 0 ? 'medium' : 'small',\r\n subFamily: normalizedSubFamily,\r\n typeAbility: normalizedTypeAbility,\r\n });\r\n };\r\n }, [\r\n readyToDraw,\r\n typeInEffect,\r\n statInEffect,\r\n condenseTolerant,\r\n effect,\r\n effectCanvasRef,\r\n format,\r\n frame,\r\n furiganaHelper,\r\n isMonster,\r\n isNormal,\r\n resolvedTypeTextStyle,\r\n resolvedEffectTextStyle,\r\n normalizedSubFamily,\r\n normalizedTypeAbility,\r\n typeCanvasRef,\r\n ]);\r\n\r\n /** DRAW PENDULUM EFFECT */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = pendulumEffectCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx)) return;\r\n if (isPendulum) {\r\n drawEffect({\r\n ctx,\r\n content: pendulumEffect,\r\n isNormal: false,\r\n fontData: PendulumEffectFontData[format],\r\n textStyle: resolvedPendulumEffectTextStyle,\r\n sizeList: PendulumEffectCoordinate,\r\n condenseTolerant,\r\n format,\r\n furiganaHelper,\r\n });\r\n }\r\n }, [readyToDraw, condenseTolerant, format, isPendulum, pendulumEffectCanvasRef, pendulumEffect, furiganaHelper, resolvedPendulumEffectTextStyle]);\r\n\r\n /** DRAW TOTAL OVERLAY */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = finishCanvasRef.current?.getContext('2d');\r\n\r\n drawingPipeline.current.overlay.rerun += 1;\r\n drawingPipeline.current.overlay.instructor = async () => {\r\n if (!clearCanvas(ctx)) return;\r\n await loopFinish(\r\n ctx,\r\n 'total-overlay',\r\n overlayType => drawAsset(ctx, `finish/finish-${overlayType}-total-overlay.png`, 0, 0),\r\n );\r\n };\r\n }, [readyToDraw, finishCanvasRef, loopFinish, name]);\r\n\r\n const drawHistory = useRef>({});\r\n const onExport = useCallback(async (exportProps: {\r\n isPendulum: boolean,\r\n opacity: Partial,\r\n // isRelevant: () => boolean,\r\n }) => {\r\n const {\r\n // isRelevant,\r\n isPendulum = false,\r\n opacity,\r\n } = exportProps;\r\n const canvasRef = drawCanvasRef.current;\r\n const exportCtx = canvasRef?.getContext('2d');\r\n /** Delay queue and relevant checker is used for potential performance improvement, but currently performance is not a making a hard impact to the app. */\r\n const generateLayer = (\r\n canvasLayer: React.RefObject,\r\n exportCtx: CanvasRenderingContext2D | null | undefined,\r\n delayQueue: number = 0,\r\n ) => {\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n if (!canvasLayer.current || !exportCtx) resolve(false);\r\n else {\r\n try {\r\n canvasLayer.current.toBlob(blob => {\r\n if (!blob) resolve(false);\r\n else {\r\n const url = URL.createObjectURL(blob);\r\n if (!url) resolve(false);\r\n else {\r\n const layer = new Image();\r\n layer.src = url;\r\n layer.onload = () => {\r\n exportCtx.drawImage(layer, 0, 0);\r\n URL.revokeObjectURL(url);\r\n resolve(true);\r\n };\r\n layer.onerror = () => {\r\n URL.revokeObjectURL(url);\r\n resolve(false);\r\n };\r\n }\r\n }\r\n });\r\n } catch (e) {\r\n console.error(e);\r\n resolve(false);\r\n }\r\n }\r\n }, delayQueue * 25);\r\n });\r\n };\r\n\r\n if (canvasRef && exportCtx) {\r\n exportCtx.clearRect(0, 0, CanvasConst.width, CanvasConst.height);\r\n await Promise.all(Object\r\n .values(drawingPipeline.current)\r\n .sort((l, r) => l.order - r.order)\r\n .map(({ instructor, rerun, name }) => {\r\n if (\r\n (rerun !== 0 && drawHistory.current[name] !== rerun)\r\n || !drawHistory.current[name]\r\n ) {\r\n drawHistory.current[name] = rerun;\r\n\r\n return instructor();\r\n }\r\n return Promise.resolve();\r\n }));\r\n // await generateLayer(frameCanvas, exportCtx);\r\n const artworkCanvas = artworkCanvasRef.current;\r\n if (artworkCanvas && exportCtx) {\r\n const { artX, artY, artWidth } = getArtCanvasCoordinate(isPendulum, opacity);\r\n const { width: imageWidth, height: imageHeight } = artworkCanvas;\r\n\r\n if (imageHeight > 0) {\r\n exportCtx.drawImage(\r\n artworkCanvas,\r\n 0, 0,\r\n imageWidth, imageHeight,\r\n artX, artY,\r\n artWidth, artWidth / (imageWidth / imageHeight),\r\n );\r\n }\r\n }\r\n /** It is not worth to use promise all here, just let them go sequentially to avoid too much blob generating call. */\r\n await generateLayer(frameCanvasRef, exportCtx, 0);\r\n await generateLayer(nameCanvasRef, exportCtx, 0);\r\n await generateLayer(cardIconCanvasRef, exportCtx, 0);\r\n await generateLayer(pendulumScaleCanvasRef, exportCtx, 0);\r\n await generateLayer(pendulumEffectCanvasRef, exportCtx, 0);\r\n await generateLayer(typeCanvasRef, exportCtx, 0);\r\n await generateLayer(effectCanvasRef, exportCtx, 0);\r\n await generateLayer(statCanvasRef, exportCtx, 0);\r\n await generateLayer(setIdCanvasRef, exportCtx, 0);\r\n await generateLayer(passwordCanvasRef, exportCtx, 0);\r\n await generateLayer(creatorCanvasRef, exportCtx, 0);\r\n await generateLayer(stickerCanvasRef, exportCtx, 0);\r\n await generateLayer(finishCanvasRef, exportCtx, 0);\r\n\r\n lightboxCanvasRef.current?.getContext('2d')?.drawImage(canvasRef, 0, 0);\r\n }\r\n }, [\r\n artworkCanvasRef, \r\n cardIconCanvasRef, \r\n creatorCanvasRef, \r\n drawCanvasRef, \r\n effectCanvasRef, \r\n finishCanvasRef, \r\n lightboxCanvasRef, \r\n nameCanvasRef, \r\n passwordCanvasRef, \r\n pendulumEffectCanvasRef, \r\n pendulumScaleCanvasRef, \r\n setIdCanvasRef, \r\n frameCanvasRef, \r\n statCanvasRef, \r\n stickerCanvasRef, \r\n typeCanvasRef,\r\n ]);\r\n\r\n return {\r\n drawingPipeline,\r\n onExport,\r\n };\r\n};\r\n\r\nexport * from './prepare-style';","import { TextStyle } from 'src/model';\r\n\r\nexport type CanvasTextStyle = {\r\n x?: number,\r\n y?: number,\r\n blur?: number,\r\n color?: string,\r\n shadowColor?: string,\r\n};\r\n\r\nexport const prepareStyle = ({\r\n lightFooter,\r\n lightHeader,\r\n requireShadow,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n statTextStyle,\r\n typeTextStyle,\r\n}: {\r\n requireShadow: boolean,\r\n lightHeader: boolean,\r\n lightFooter: boolean,\r\n effectTextStyle: TextStyle,\r\n pendulumTextStyle: TextStyle,\r\n statTextStyle: TextStyle,\r\n typeTextStyle: TextStyle,\r\n}) => {\r\n const levelColor = { color: lightHeader ? '#ffffff' : '#000000' };\r\n const levelStyle = requireShadow\r\n ? {\r\n blur: 2,\r\n y: 1,\r\n shadowColor: lightHeader ? '#000000' : '#ffffff',\r\n ...levelColor,\r\n }\r\n : levelColor;\r\n\r\n const [customEffectText, effectTextFillStyle, effectHasShadow, effectTextShadow] = effectTextStyle;\r\n const resolvedEffectTextStyle: CanvasTextStyle = customEffectText\r\n ? {\r\n ...(effectHasShadow ? { y: 0, blur: 4, shadowColor: effectTextShadow } : {}),\r\n color: effectTextFillStyle,\r\n }\r\n : {};\r\n\r\n const [customPendulumEffectText, pendulumEffectTextFillStyle, pendulumEffectHasShadow, pendulumEffectTextShadow] = pendulumTextStyle;\r\n const resolvedPendulumEffectTextStyle: CanvasTextStyle = customPendulumEffectText\r\n ? {\r\n ...(pendulumEffectHasShadow ? { y: 0, blur: 4, shadowColor: pendulumEffectTextShadow } : {}),\r\n color: pendulumEffectTextFillStyle,\r\n }\r\n : {};\r\n\r\n const [customTypeText, typeTextFillStyle, typeHasShadow, typeTextShadow] = typeTextStyle;\r\n const resolvedTypeTextStyle: CanvasTextStyle = customTypeText\r\n ? {\r\n ...(typeHasShadow ? { y: 1, blur: 1, shadowColor: typeTextShadow } : {}),\r\n color: typeTextFillStyle,\r\n }\r\n : {};\r\n\r\n const [customStatText, statTextFillStyle, statHasShadow, statTextShadow] = statTextStyle;\r\n const resolvedStatTextStyle: CanvasTextStyle = customStatText\r\n ? {\r\n ...(statHasShadow ? { y: 1, blur: 1, shadowColor: statTextShadow } : {}),\r\n color: statTextFillStyle,\r\n }\r\n : {};\r\n\r\n return {\r\n levelStyle,\r\n resolvedEffectTextStyle,\r\n resolvedPendulumEffectTextStyle,\r\n resolvedTypeTextStyle,\r\n resolvedStatTextStyle,\r\n };\r\n};","import { PasswordFontData, PasswordCoordinateMap, DefaultFontSizeData } from 'src/model';\r\nimport { condense, createFontGetter } from 'src/util';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { clearCanvas } from '../canvas-util';\r\n\r\nexport const drawPasswordText = ({\r\n ctx,\r\n value,\r\n format,\r\n alignment,\r\n baselineOffset = 0,\r\n lightFooter,\r\n hasShadow,\r\n}: {\r\n ctx?: CanvasRenderingContext2D | null,\r\n value: string,\r\n format: string,\r\n alignment: 'left' | 'right',\r\n baselineOffset?: number,\r\n lightFooter: boolean,\r\n hasShadow?: boolean,\r\n}) => {\r\n if (!clearCanvas(ctx)) return 0;\r\n\r\n ctx.fillStyle = lightFooter ? '#ffffff' : '#000000';\r\n ctx.shadowColor = hasShadow\r\n ? lightFooter ? '#000000' : '#ffffff'\r\n : '#000000';\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowBlur = hasShadow ? 3 : 0;\r\n\r\n const { trueEdge, trueBaseline, trueWidth: width } = PasswordCoordinateMap[format] ?? PasswordCoordinateMap['tcg'];\r\n const isNumberPassword = /^[0-9]*$/.test(value);\r\n const fontData = PasswordFontData[format];\r\n const { font } = fontData;\r\n const normalizedText = normalizeCardText(value, format, { multiline: false, furiganaHelper: false });\r\n\r\n /** Calculation */\r\n let textData = {\r\n fontLevel: !isNumberPassword ? 1 : 0,\r\n fontData,\r\n currentFont: createFontGetter(),\r\n };\r\n let actualLineWidth = 0;\r\n let internalEffectiveMedian = 1000;\r\n let fontSizeData = fontData.fontList[0];\r\n for (let fontLevel = 0; fontLevel < fontData.fontList.length; fontLevel++) {\r\n fontSizeData = fontData.fontList[fontLevel];\r\n const fontGetter = createFontGetter({\r\n defaultFamily: font,\r\n defaultSize: `${fontSizeData.fontSize}px`,\r\n defaultWeight: hasShadow ? 'bold' : '',\r\n });\r\n let internalTextData = {\r\n fontLevel,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n let internalTrueWidth = 0;\r\n ctx.font = fontGetter.getFont();\r\n ctx.textAlign = 'left';\r\n internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [normalizedText],\r\n format, textData: internalTextData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n internalTrueWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n\r\n actualLineWidth = internalTrueWidth;\r\n textData = internalTextData;\r\n if (internalEffectiveMedian >= 1000) break;\r\n }\r\n\r\n /** Drawing */\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n ctx.scale(xRatio, yRatio);\r\n const result = drawLine({\r\n ctx,\r\n tokenList: tokenizeText(normalizedText),\r\n xRatio, yRatio,\r\n trueEdge: alignment === 'left' ? trueEdge : (trueEdge - actualLineWidth * xRatio),\r\n trueBaseline: trueBaseline + (fontSizeData.offsetY ?? DefaultFontSizeData.offsetY) + baselineOffset,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n },\r\n });\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n return result.tokenEdge;\r\n};","import { CreatorFontData, CreatorCoordinateMap, DefaultFontSizeData } from 'src/model';\r\nimport { condense, createFontGetter } from 'src/util';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { clearCanvas } from '../canvas-util';\r\n\r\nexport const drawCreatorText = ({\r\n ctx,\r\n value,\r\n format,\r\n alignment,\r\n baselineOffset = 0,\r\n lightFooter,\r\n hasShadow,\r\n}: {\r\n ctx?: CanvasRenderingContext2D | null,\r\n value: string,\r\n format: string,\r\n alignment: 'left' | 'right',\r\n baselineOffset?: number,\r\n lightFooter: boolean,\r\n hasShadow?: boolean,\r\n}) => {\r\n if (!clearCanvas(ctx)) return;\r\n\r\n ctx.fillStyle = lightFooter ? '#ffffff' : '#000000';\r\n ctx.shadowColor = hasShadow\r\n ? lightFooter ? '#000000' : '#ffffff'\r\n : '#000000';\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowBlur = hasShadow ? 3 : 0;\r\n\r\n const { trueEdge, trueBaseline, trueWidth: width } = CreatorCoordinateMap[format] ?? CreatorCoordinateMap['tcg'];\r\n const fontData = CreatorFontData[format];\r\n const { font } = fontData;\r\n const normalizedText = normalizeCardText(value, format, { multiline: false, furiganaHelper: false });\r\n\r\n /** Calculation */\r\n let textData = {\r\n fontLevel: 0,\r\n fontData,\r\n currentFont: createFontGetter(),\r\n };\r\n let actualLineWidth = 0;\r\n let internalEffectiveMedian = 1000;\r\n let fontSizeData = fontData.fontList[0];\r\n for (let fontLevel = 0; fontLevel < fontData.fontList.length; fontLevel++) {\r\n fontSizeData = fontData.fontList[fontLevel];\r\n const fontGetter = createFontGetter({\r\n defaultFamily: font,\r\n defaultSize: `${fontSizeData.fontSize}px`,\r\n defaultWeight: hasShadow ? 'bold' : '',\r\n });\r\n let internalTextData = {\r\n fontLevel,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n let internalTrueWidth = 0;\r\n ctx.font = fontGetter.getFont();\r\n ctx.textAlign = 'left';\r\n internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [normalizedText],\r\n format, textData: internalTextData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n internalTrueWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n\r\n actualLineWidth = internalTrueWidth;\r\n textData = internalTextData;\r\n if (internalEffectiveMedian >= 1000) break;\r\n }\r\n\r\n /** Drawing */\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n ctx.scale(xRatio, yRatio);\r\n const result = drawLine({\r\n ctx,\r\n tokenList: tokenizeText(normalizedText),\r\n xRatio, yRatio,\r\n trueEdge: alignment === 'left' ? trueEdge : (trueEdge - actualLineWidth * xRatio),\r\n trueBaseline: trueBaseline + (fontSizeData.offsetY ?? DefaultFontSizeData.offsetY) + baselineOffset,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n },\r\n });\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n return result;\r\n};","import { Input, Radio, Tooltip } from 'antd';\r\nimport React, { useState, useCallback, useRef, useEffect, useImperativeHandle } from 'react';\r\nimport ReactCrop from 'react-image-crop';\r\nimport { DownloadOutlined, ExclamationCircleOutlined } from '@ant-design/icons';\r\nimport { Loading } from '../loading';\r\nimport { IconButton } from '../icon-button';\r\nimport 'react-image-crop/dist/ReactCrop.css';\r\nimport './image-cropper.scss';\r\nimport { useLanguage } from 'src/service';\r\n\r\nfunction generateDownload(canvas: HTMLCanvasElement | null, crop: ReactCrop.Crop | null) {\r\n if (!crop || !canvas) return;\r\n canvas.toBlob(\r\n (blob) => {\r\n if (blob !== null) {\r\n const previewUrl = window.URL.createObjectURL(blob);\r\n\r\n const anchor = document.createElement('a');\r\n anchor.download = 'crop-preview.png';\r\n anchor.href = URL.createObjectURL(blob);\r\n anchor.click();\r\n\r\n window.URL.revokeObjectURL(previewUrl);\r\n }\r\n },\r\n 'image/png',\r\n 1\r\n );\r\n}\r\n\r\n/**\r\n * Historic reason: cropData initially used `px` as unit, but this create a hard link between cropData and size of the cropper (NOT the actual image). This means the cropData only match a specific cropper size, and will become incorrect if the size change (which is happening when we got to v2).\r\n * \r\n * So from now on every cropData with `px` unit in it (old data) will be converted into the new one that use `%` data, which is more tricky to calculate but remove the link entirely.\r\n */\r\nconst normalizeCrop = (crop: Partial, image: HTMLImageElement | null, ratio: number) => {\r\n if (!image) return crop;\r\n const { width: cropWidth, height: cropHeight, x = 0, y = 0, unit } = crop;\r\n\r\n /** Migrate old unit */\r\n if (unit === 'px') {\r\n const oldHeightToWidthRatio = 300 / 375;\r\n const newHeightToWidthRatio = 400 / 300;\r\n const { width: imageWidth, height: imageHeight } = image;\r\n\r\n const isHeightRestricted = (imageHeight / imageWidth) >= oldHeightToWidthRatio;\r\n const scaleRatio = isHeightRestricted ? newHeightToWidthRatio : 1;\r\n const nextX = Math.min((x ?? 0) * scaleRatio, imageWidth);\r\n const nextY = Math.min((y ?? 0) * scaleRatio, imageHeight);\r\n const newWidth = Math.min((cropWidth ?? 0) * scaleRatio, imageWidth);\r\n\r\n return {\r\n unit: '%' as 'px' | '%',\r\n x: nextX / imageWidth * 100,\r\n y: nextY / imageHeight * 100,\r\n width: newWidth / imageWidth * 100,\r\n height: newWidth / (ratio ?? 1) / imageHeight * 100,\r\n aspect: ratio,\r\n };\r\n }\r\n\r\n if (x < 0) return { ...crop, x: 0 };\r\n if (y < 0) return { ...crop, y: 0 };\r\n const { naturalHeight, naturalWidth } = image;\r\n const width = cropWidth ?? 0;\r\n const height = cropHeight ?? 0;\r\n /** Avoid recalculate if current ratio is in acceptable limit, so we don't cascade calculation error */\r\n const acceptableError = (naturalHeight > naturalWidth ? naturalHeight : naturalWidth) * 0.05;\r\n const isRatioAcceptable = Math.abs(height * naturalHeight * ratio - width * naturalWidth) <= acceptableError;\r\n\r\n return {\r\n ...crop,\r\n x: x < 0 ? 0 : x,\r\n y: y < 0 ? 0 : y,\r\n height: isRatioAcceptable\r\n ? height\r\n : width * image.naturalWidth /** Restore original size */\r\n / ratio /** Get height with corresponding aspect ratio */\r\n / image.naturalHeight /** Convert back to percent */,\r\n aspect: ratio,\r\n };\r\n};\r\n\r\nexport type ImageCropperRef = {\r\n hasImage: () => boolean,\r\n forceExternalSource: (artLink: string, cropInfo: Partial) => void,\r\n}\r\nexport type ImageCropper = {\r\n title?: React.ReactNode,\r\n backgroundColor?: string,\r\n className?: string,\r\n defaultExternalSource?: string,\r\n receivingCanvas?: HTMLCanvasElement | null,\r\n children?: React.ReactNode,\r\n beforeCropper?: React.ReactNode,\r\n defaultCropInfo: Partial,\r\n ratio: number,\r\n onSourceChange?: (source: string) => void,\r\n onSourceLoaded?: () => void,\r\n onCropChange?: (cropInfo: Partial, sourceType: 'internal' | 'external') => void,\r\n onTainted: () => void,\r\n}\r\nexport const ImageCropper = React.forwardRef(({\r\n title,\r\n backgroundColor,\r\n className,\r\n defaultExternalSource = '',\r\n receivingCanvas,\r\n children,\r\n beforeCropper,\r\n defaultCropInfo,\r\n ratio,\r\n onSourceLoaded = () => { },\r\n onSourceChange = () => { },\r\n onCropChange = () => { },\r\n onTainted = () => { },\r\n}: ImageCropper, forwardedRef) => {\r\n const language = useLanguage();\r\n const fileInputRef = useRef(null);\r\n const [\r\n crossorigin,\r\n // setCrossOrigin,\r\n ] = useState<'anonymous' | 'use-credentials' | undefined>('anonymous');\r\n const [redrawSignal, setRedrawSignal] = useState(0);\r\n const [sourceType, setSourceType] = useState<'internal' | 'external'>('external');\r\n const [inputMode, setInputMode] = useState<'internal' | 'external'>('external');\r\n const [internalSource, setInternalSource] = useState('');\r\n const [isLoading, setLoading] = useState(false);\r\n const [error, setError] = useState(null);\r\n const [externalSource, setExternalSource] = useState(defaultExternalSource);\r\n const imgRef = useRef(null);\r\n const [crop, setCrop] = useState({\r\n current: defaultCropInfo,\r\n completed: null as ReactCrop.Crop | null,\r\n });\r\n // const [completedCrop, setCompletedCrop] = useState(null);\r\n const [isMigrated, setMigrated] = useState(defaultCropInfo.unit === '%');\r\n const {\r\n current: currentCrop,\r\n completed: completedCrop,\r\n } = crop;\r\n\r\n const applyOfflineSource = (e: React.ChangeEvent) => {\r\n if (e.target.files && e.target.files.length > 0) {\r\n setLoading(true);\r\n const reader = new FileReader();\r\n reader.addEventListener('load', () => {\r\n if (typeof reader.result === 'string') {\r\n setInternalSource(reader.result);\r\n setSourceType('internal');\r\n setInputMode('internal');\r\n setLoading(false);\r\n }\r\n });\r\n reader.readAsDataURL(e.target.files[0]);\r\n } else alert(language['image-cropper.not-found-warning']);\r\n };\r\n\r\n const pendingCrop = useRef({\r\n source: '',\r\n crop: null as Partial | null,\r\n });\r\n const onLoad = useCallback((img: HTMLImageElement) => {\r\n setLoading(false);\r\n setError(null);\r\n onSourceLoaded();\r\n imgRef.current = img;\r\n /** @todo Check if we really need timeout delay here */\r\n if (img.src === pendingCrop.current.source && pendingCrop.current.crop) {\r\n const internalId = pendingId.current;\r\n setTimeout(() => {\r\n if (internalId !== pendingId.current || !pendingCrop.current.crop) return;\r\n const normalizedCrop = normalizeCrop(pendingCrop.current.crop, img, ratio);\r\n setCrop({\r\n completed: normalizedCrop,\r\n current: normalizedCrop,\r\n });\r\n setMigrated(true);\r\n pendingCrop.current = {\r\n source: '',\r\n crop: null,\r\n };\r\n }, 250);\r\n } else {\r\n setTimeout(() => {\r\n setCrop(cur => {\r\n const normalizedCrop = normalizeCrop(cur.current, img, ratio);\r\n\r\n return {\r\n completed: normalizedCrop,\r\n current: normalizedCrop,\r\n };\r\n });\r\n setMigrated(true);\r\n }, 250);\r\n }\r\n }, [onSourceLoaded, ratio]);\r\n\r\n const applyOnlineSource = (e: React.ChangeEvent) => {\r\n const source = e.target.value;\r\n\r\n setLoading(true);\r\n setSourceType('external');\r\n setInputMode('external');\r\n onSourceChange(source);\r\n setExternalSource(source);\r\n };\r\n\r\n useEffect(() => {\r\n const image = imgRef.current;\r\n if (!completedCrop || !receivingCanvas || !image) return;\r\n\r\n const { aspect: ratio } = completedCrop;\r\n\r\n /** Increase image size for a bit */\r\n receivingCanvas.style.transform = 'scale(2)';\r\n const ctx = receivingCanvas.getContext('2d');\r\n if (!ctx || typeof ratio !== 'number' || ratio <= 0) return;\r\n\r\n const { naturalHeight, naturalWidth } = image;\r\n const zoomX = naturalWidth / image.width;\r\n const zoomY = naturalHeight / image.height;\r\n const cropUnit = completedCrop.unit ?? 'px';\r\n const pixelRatio = window.devicePixelRatio;\r\n\r\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\r\n /** Snap sizing into whole pixel for a more crispy image. */\r\n let expectedDrawWidth = Math.floor((completedCrop.width ?? 0) * (cropUnit === 'px' ? zoomX : naturalWidth / 100));\r\n let drawWidth = Math.min(naturalWidth, expectedDrawWidth);\r\n let expectedDrawHeight = Math.floor(expectedDrawWidth / ratio);\r\n let drawHeight = Math.min(naturalHeight, expectedDrawHeight);\r\n let drawCoordinateX = Math.min(\r\n naturalWidth,\r\n Math.floor((completedCrop.x ?? 0) * (cropUnit === 'px' ? zoomX : naturalWidth / 100))\r\n );\r\n let drawCoordinateY = Math.min(\r\n naturalHeight,\r\n Math.floor((completedCrop.y ?? 0) * (cropUnit === 'px' ? zoomY : naturalHeight / 100))\r\n );\r\n ctx.imageSmoothingQuality = 'high';\r\n if (drawWidth <= 0 || drawHeight <= 0) return;\r\n\r\n let fitCropData: Partial | undefined = undefined;\r\n /** If the crop section is overflowed (mainly because change of ratio), we try to snap it back to the cropper. */\r\n if (\r\n // Size overflow\r\n (drawCoordinateX + drawWidth) > naturalWidth\r\n || (drawCoordinateY + drawHeight) > naturalHeight\r\n // Edge overflow\r\n || drawCoordinateX < 0\r\n || drawCoordinateY < 0\r\n // Ratio overflow\r\n || Math.abs((expectedDrawWidth - drawWidth) / drawWidth) > 0.01\r\n || Math.abs((expectedDrawHeight - drawHeight) / drawHeight) > 0.01\r\n ) {\r\n /** Try to maximize new crop section's area */\r\n const prominentSide = ratio * naturalHeight > naturalWidth ? 'width' : 'height';\r\n /** Automatically center current crop section. @todo For the best UX, it should actually be proportional based on the x and y before the snap. */\r\n if (prominentSide === 'width') {\r\n drawWidth = naturalWidth;\r\n drawHeight = drawWidth / ratio;\r\n drawCoordinateX = 0;\r\n drawCoordinateY = (naturalHeight - drawHeight) / 2;\r\n fitCropData = {\r\n unit: '%',\r\n aspect: ratio,\r\n height: drawHeight / naturalHeight * 100,\r\n width: drawWidth / naturalWidth * 100,\r\n x: 0,\r\n y: drawCoordinateY / naturalHeight * 100,\r\n };\r\n } else {\r\n drawWidth = naturalHeight * ratio;\r\n drawHeight = naturalHeight;\r\n drawCoordinateX = (naturalWidth - drawWidth) / 2;\r\n drawCoordinateY = 0;\r\n fitCropData = {\r\n unit: '%',\r\n aspect: ratio,\r\n height: drawHeight / naturalHeight * 100,\r\n width: drawWidth / naturalWidth * 100,\r\n x: drawCoordinateX / naturalWidth * 100,\r\n y: 0,\r\n };\r\n }\r\n }\r\n // const boundingWidth = Math.ceil(receivingCanvas.getBoundingClientRect().width);\r\n // const boundingHeight = Math.ceil(receivingCanvas.getBoundingClientRect().height);\r\n\r\n receivingCanvas.width = (drawWidth ?? 0);\r\n receivingCanvas.height = (drawHeight ?? 0);\r\n\r\n ctx.drawImage(\r\n image,\r\n drawCoordinateX,\r\n drawCoordinateY,\r\n drawWidth,\r\n drawHeight,\r\n 0,\r\n 0,\r\n drawWidth,\r\n drawHeight,\r\n );\r\n if (sourceType === 'internal' && (internalSource ?? '').length <= 0) { }\r\n else if (ratio === completedCrop.aspect) {\r\n onCropChange(completedCrop, sourceType);\r\n }\r\n if (fitCropData) {\r\n setCrop(cur => ({ ...cur, current: fitCropData }));\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [completedCrop, receivingCanvas, redrawSignal]);\r\n\r\n useEffect(() => {\r\n setCrop(cur => {\r\n if (imgRef.current != null && cur.current) {\r\n const newValue = normalizeCrop(cur.current, imgRef.current, ratio);\r\n return {\r\n current: newValue,\r\n completed: newValue,\r\n };\r\n }\r\n return cur;\r\n });\r\n }, [ratio]);\r\n\r\n const pendingId = useRef(0);\r\n useImperativeHandle(forwardedRef, () => ({\r\n hasImage: () => (typeof internalSource === 'string' && internalSource.length > 0 && sourceType === 'internal')\r\n || (typeof externalSource === 'string' && externalSource.length > 0 && sourceType === 'external'),\r\n forceExternalSource: (source, cropInfo) => {\r\n const currentSource = sourceType === 'internal' ? internalSource : externalSource;\r\n if (currentSource !== source) {\r\n setLoading(true);\r\n setSourceType('external');\r\n setInputMode('external');\r\n onSourceChange(source);\r\n setExternalSource(source);\r\n }\r\n setMigrated(cropInfo.unit === '%');\r\n pendingId.current += 1;\r\n pendingCrop.current = {\r\n source,\r\n crop: cropInfo,\r\n };\r\n setRedrawSignal(cur => cur + 1);\r\n }\r\n }));\r\n\r\n const isDownloadable = receivingCanvas && !isLoading && completedCrop?.width && completedCrop?.height;\r\n return (\r\n
\r\n
\r\n {children}\r\n
\r\n
\r\n \r\n {title} (isDownloadable && receivingCanvas) && generateDownload(receivingCanvas, completedCrop)}\r\n />\r\n \r\n {\r\n const value = e.target.value;\r\n setInputMode(value);\r\n if (\r\n ((internalSource ?? '').length > 0 && value === 'internal')\r\n || ((externalSource ?? '').length > 0 && value === 'external')\r\n ) setSourceType(value);\r\n }}\r\n value={inputMode}\r\n >\r\n \r\n {language['image-cropper.source.online.tooltip']}\r\n \r\n \r\n {language['image-cropper.offline-warning']}\r\n
}>\r\n \r\n {language['image-cropper.source.offline.tooltip']} \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n {error\r\n ?
\r\n {language['image-cropper.not-found-warning']}\r\n
\r\n :
\r\n {language['image-cropper.online-tip']}\r\n
}\r\n
\r\n
\r\n fileInputRef.current?.setValue('')}\r\n />\r\n
\r\n {language['image-cropper.offline-warning']}\r\n
\r\n
\r\n
\r\n {beforeCropper}\r\n
\r\n {isLoading && }\r\n {\r\n pendingCrop.current = {\r\n source: '',\r\n crop: null,\r\n };\r\n setError('Image error');\r\n setLoading(false);\r\n if (sourceType === 'external' && (externalSource ?? '') === '' && receivingCanvas) {\r\n const { width, height } = receivingCanvas;\r\n const ctx = receivingCanvas.getContext('2d');\r\n\r\n ctx?.clearRect(0, 0, width, height);\r\n if (completedCrop) onCropChange(completedCrop, sourceType);\r\n onSourceLoaded();\r\n } else {\r\n onTainted();\r\n }\r\n // setCrossOrigin(undefined);\r\n }}\r\n crop={currentCrop}\r\n onChange={(pixelCropData, percentCropData) => {\r\n const image = imgRef.current;\r\n if (pendingCrop.current.crop) return;\r\n if (!isMigrated) {\r\n setMigrated(true);\r\n setCrop(cur => {\r\n return {\r\n ...cur,\r\n current: normalizeCrop(pixelCropData, image, ratio)\r\n };\r\n });\r\n } else {\r\n setCrop(cur => {\r\n return {\r\n ...cur,\r\n current: normalizeCrop(percentCropData, image, ratio)\r\n };\r\n });\r\n }\r\n }}\r\n onComplete={(_, percentData) => {\r\n if (!pendingCrop.current.crop) setCrop(cur => ({ ...cur, completed: percentData }));\r\n }}\r\n ruleOfThirds={true}\r\n crossorigin={crossorigin}\r\n />\r\n
\r\n \r\n );\r\n});\r\n","import { Tooltip } from 'antd';\r\nimport { useEffect, useState } from 'react';\r\nimport { CloseCircleOutlined } from '@ant-design/icons';\r\nimport { useLanguage } from 'src/service';\r\nimport './link-marker.scss';\r\n\r\nexport type LinkMarkChooser = {\r\n defaultValue?: string[],\r\n onChange?: (value: string[]) => void,\r\n};\r\nexport const LinkMarkChooser = ({\r\n defaultValue = [],\r\n onChange = () => {},\r\n}: LinkMarkChooser) => {\r\n const [choosenArrow, setChoosenArrow] = useState(defaultValue);\r\n const rotateMap = [-45, 0, 45, -90, 0, 90, -135, 180, 135];\r\n const language = useLanguage();\r\n\r\n const literalChoosenArrow = JSON.stringify(choosenArrow);\r\n useEffect(() => {\r\n onChange(choosenArrow);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [literalChoosenArrow]);\r\n\r\n return
\r\n
\r\n {language['link-picker.label']}\r\n
\r\n
\r\n {[...Array(9)].map((_, index) => {\r\n const normalizedIndex = `${index + 1}`;\r\n\r\n if (normalizedIndex === '5') return \r\n
{\r\n setChoosenArrow([]);\r\n }}>\r\n \r\n
\r\n
;\r\n\r\n return
{\r\n setChoosenArrow(cur => {\r\n let newMap = [...cur];\r\n\r\n if (newMap.includes(normalizedIndex)) newMap = newMap.filter(entry => entry !== normalizedIndex);\r\n else newMap.push(normalizedIndex);\r\n\r\n return newMap;\r\n });\r\n }}\r\n >\r\n
\r\n
;\r\n })}\r\n
\r\n
;\r\n};","import { Popover } from 'antd';\r\nimport { ExclamationCircleOutlined } from '@ant-design/icons';\r\nimport { ExtractProps } from 'src/type';\r\nimport './explanation.scss';\r\n\r\nexport type Explanation = {\r\n iconProps?: ExtractProps,\r\n} & ExtractProps;\r\nexport const Explanation = ({\r\n overlayClassName,\r\n iconProps,\r\n ...rest\r\n}: Explanation) => {\r\n const { className, ...restIconProps } = iconProps ?? {};\r\n\r\n return \r\n \r\n ;\r\n};","import { Button, Drawer } from 'antd';\r\nimport { useState } from 'react';\r\nimport styled from 'styled-components';\r\nimport { BulbFilled, SettingFilled } from '@ant-design/icons';\r\nimport './formatting-guide.scss';\r\nimport { useLanguage } from 'src/service';\r\n\r\nconst StyledCode = styled.span`\r\n background: var(--main-level-1);\r\n padding: var(--spacing-px) var(--spacing-xxs);\r\n border: var(--bw) solid #4e84a4;\r\n border-radius: var(--br);\r\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\r\n`;\r\nconst StyledContainer = styled.div`\r\n white-space: pre-line;\r\n`;\r\nconst StyledImageSection = styled.div`\r\n display: grid;\r\n grid-template-columns: 615fr 703fr;\r\n gap: var(--spacing-sm);\r\n padding: var(--spacing-sm) 0;\r\n overflow: hidden;\r\n .panel-box {\r\n min-width: 0;\r\n position: relative;\r\n overflow: hidden;\r\n }\r\n`;\r\nconst StyledImageWithCaptionContainer = styled.div`\r\n min-width: 0;\r\n position: relative;\r\n overflow: hidden;\r\n .caption {\r\n position: absolute;\r\n right: 0;\r\n bottom: 0;\r\n padding: var(--spacing-px) var(--spacing-sm);\r\n background: var(--main-level-5);\r\n border-radius: var(--br-lg) 0 0 0;\r\n box-shadow: var(--bs-block);\r\n }\r\n > img {\r\n max-width: 100%;\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br-lg);\r\n }\r\n`;\r\nexport type ImageWithCaption = {\r\n caption?: React.ReactNode,\r\n containerProps?: React.HTMLAttributes,\r\n} & React.ImgHTMLAttributes;\r\nexport const ImageWithCaption = ({\r\n caption,\r\n containerProps,\r\n alt,\r\n ...rest\r\n}: ImageWithCaption) => {\r\n const { className } = containerProps ?? {};\r\n\r\n return \r\n {alt}\r\n
{caption}
\r\n
;\r\n};\r\n\r\nexport const FormattingHelpDrawer = () => {\r\n const [modalOpen, setDrawerOpen] = useState(false);\r\n const language = useLanguage();\r\n\r\n return <>\r\n {language['guide.format.label']} {\r\n setDrawerOpen(false);\r\n }}\r\n >{language['guide.format.close']}
}\r\n className=\"formattting-guide-overlay\"\r\n onClose={() => {\r\n setDrawerOpen(false);\r\n }}\r\n >\r\n \r\n

\r\n {language['guide.format.introduction']()}.\r\n

\r\n

{language['guide.format.section-1.label']}

\r\n {language['guide.format.section-1.content'](\r\n {'['},\r\n {']'},\r\n {'Ctrl-1'},\r\n {'⌘-1'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-2.label']}

\r\n {language['guide.format.section-2.content'](\r\n {'{'},\r\n {'}'},\r\n {'Ctrl-2'},\r\n {'⌘-2'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-3.label']}

\r\n {language['guide.format.section-3.content'](\r\n {'|'},\r\n {'Ctrl-3'},\r\n {'⌘-3'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-4.label']}

\r\n {language['guide.format.section-4.content'](\r\n {'||'},\r\n {'Ctrl-4'},\r\n {'⌘-4'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-5.label']}

\r\n {language['guide.format.section-5.content'](\r\n {'{{'},\r\n {'}}'},\r\n {'Ctrl-5'},\r\n {'⌘-5'},\r\n )}\r\n \r\n \r\n \r\n \r\n
\r\n \r\n {\r\n setDrawerOpen(true);\r\n }}\r\n >\r\n {language['guide.format.label']} \r\n \r\n ;\r\n};","import { FrameInfo } from 'src/model';\r\nimport { useLanguage } from 'src/service';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledFrameContainer = styled.div<{ $withPillar: boolean }>`\r\n display: grid;\r\n ${({ $withPillar }) => $withPillar ? 'grid-template-columns: max-content 1fr;' : 'grid-template-columns: 1fr;'}\r\n > label {\r\n cursor: pointer;\r\n padding: 0 var(--spacing-xxs);\r\n text-align: center;\r\n }\r\n`;\r\nconst StyledFramePillar = styled.div`\r\n display: inline-block;\r\n width: 10px;\r\n`;\r\nexport const FrameInfoBlock = ({\r\n nameKey,\r\n labelBackgroundColor,\r\n labelBackgroundColorList,\r\n className,\r\n}: Omit & { className?: string }) => {\r\n const language = useLanguage();\r\n\r\n return \r\n {labelBackgroundColorList\r\n ? \r\n {labelBackgroundColorList.map(color => )}\r\n \r\n : labelBackgroundColor\r\n ? \r\n : null}\r\n \r\n ;\r\n};\r\n","import { useLanguage, useSetting } from 'src/service';\r\nimport { SettingFilled } from '@ant-design/icons';\r\nimport styled, { css, keyframes } from 'styled-components';\r\nimport { Checkbox, Popover, Tooltip } from 'antd';\r\n\r\nconst rotate = keyframes`\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n`;\r\nconst StyledSettingPanel = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr;\r\n gap: var(--spacing-sm);\r\n background-color: var(--main-level-3);\r\n padding: var(--spacing-sm);\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br-lg);\r\n color: var(--color);\r\n`;\r\nconst StyledSettingButtonContainer = styled.div<{ $softMode?: boolean }>`\r\n cursor: pointer;\r\n .setting-button-label {\r\n display: grid;\r\n label {\r\n cursor: pointer;\r\n line-height: 1;\r\n font-size: var(--fs-xs);\r\n margin-top: var(--spacing-xs);\r\n }\r\n }\r\n .anticon-setting {\r\n font-size: var(--fs-xl);\r\n justify-self: center;\r\n > svg {\r\n ${({ $softMode }) => $softMode ? '' : css`animation: ${rotate} 12s linear infinite;`}\r\n }\r\n }\r\n &:hover {\r\n color: var(--main-active);\r\n .anticon-setting {\r\n color: var(--sub-active);\r\n }\r\n }\r\n`;\r\nexport const SettingButton = () => {\r\n const language = useLanguage();\r\n const {\r\n setting,\r\n updateSetting,\r\n } = useSetting(({ setting, updateSetting }) => ({ setting, updateSetting }));\r\n const {\r\n allowHotkey,\r\n reduceMotionColor,\r\n showCreativeOption,\r\n showExtraDecorativeOption,\r\n } = setting;\r\n\r\n return \r\n \r\n
\r\n updateSetting({ reduceMotionColor: e.target.checked })}\r\n >{language['setting.option.soft-mode.label']}\r\n
\r\n
\r\n updateSetting({ showExtraDecorativeOption: e.target.checked })}\r\n >{language['setting.option.extra-decorative.label']}\r\n
\r\n
\r\n updateSetting({ showCreativeOption: e.target.checked })}\r\n >{language['setting.option.creative.label']}\r\n
\r\n
\r\n \r\n updateSetting({ allowHotkey: e.target.checked })}\r\n >{language['setting.option.hotkey.label']}\r\n \r\n
\r\n
\r\n {language['setting.alert']}\r\n
\r\n }\r\n >\r\n
\r\n \r\n \r\n
\r\n \r\n
;\r\n};","import { GithubFilled } from '@ant-design/icons';\r\nimport styled from 'styled-components';\r\nimport { Explanation } from '../explanation';\r\nimport { SettingButton } from '../setting';\r\nimport { useI18N, useLanguage } from 'src/service';\r\nimport { Radio } from 'antd';\r\nimport './app-header.scss';\r\n\r\nexport const Affiliation = () => {\r\n return
\r\n v{process.env.REACT_APP_VERSION ?? 'unknown'}\r\n
\r\n \r\n \r\n \r\n
\r\n
;\r\n};\r\n\r\nconst StyledAppSettingContainer = styled.div`\r\n align-content: center;\r\n align-self: center;\r\n border-left: var(--bw) dashed #b1b1b1;\r\n padding-left: var(--spacing);\r\n margin-left: var(--spacing);\r\n`;\r\n/** @summary If possible, please don't remove this credit box. Show these artists the appreciation they deserve for their hard works. */\r\nexport const AppHeader = () => {\r\n const {\r\n language,\r\n languageInfo,\r\n languageMetadataMap,\r\n changeLanguage,\r\n } = useI18N(({\r\n languageInfo,\r\n language,\r\n languageMetadataMap,\r\n changeLanguage,\r\n }) => ({\r\n languageInfo,\r\n language,\r\n languageMetadataMap,\r\n changeLanguage,\r\n }));\r\n\r\n return
\r\n \"app-logo\"\r\n
\r\n
\r\n

Yugioh Carder

\r\n {/** Temporary disable until Japanese is translated */}\r\n \r\n {Object.values(languageMetadataMap)\r\n .filter(({ active }) => active)\r\n .map(({ codeName, name }) => {\r\n return changeLanguage(e.target.value)}\r\n >\r\n {name}\r\n ;\r\n })}\r\n \r\n
\r\n
\r\n \r\n {language['contributor.gui.label']}: \r\n Lauqerm\r\n  \r\n

{language['contributor.disclaimer.label']}

\r\n
    \r\n
  • {language['contributor.disclaimer.line-1'](lauqerm.github.io/ygocarder)}
  • \r\n
  • {language['contributor.disclaimer.line-2']}
  • \r\n
  • {language['contributor.disclaimer.line-3']}
  • \r\n
  • {language['contributor.disclaimer.line-4']}
  • \r\n
  • {language['contributor.disclaimer.line-5'](\r\n Grezar,\r\n 9558able\r\n )}
  • \r\n
  • {language['contributor.disclaimer.line-6']}
  • \r\n
\r\n
}\r\n />\r\n \r\n \r\n {language['contributor.template-maker'](\r\n Grezar,\r\n 9558able,\r\n SlackerMagician,\r\n icycatelf,\r\n )}\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n ;\r\n};\r\n\r\nexport const TaintedCanvasWarning = () => {\r\n const language = useLanguage();\r\n\r\n return \r\n

{language['alert.explaination.tainted.first-question']}

\r\n

{language['alert.explaination.tainted.first-answer']}

\r\n

{language['alert.explaination.tainted.second-question']}

\r\n

{language['alert.explaination.tainted.second-answer']}

\r\n

{language['alert.explaination.tainted.third-question']}

\r\n

{language['alert.explaination.tainted.third-answer']}

\r\n }\r\n />;\r\n};","import styled from 'styled-components';\r\n\r\nexport const StandaloneLabel = styled.div`\r\n font-weight: 500;\r\n border-color: transparent;\r\n background-color: transparent;\r\n color: var(--color-vendor);\r\n text-shadow: var(--ts);\r\n user-select: none;\r\n display: inline-block;\r\n height: 32px;\r\n width: var(--width-label);\r\n line-height: 30px;\r\n position: relative;\r\n min-width: var(--width-label);\r\n text-align: right;\r\n padding-right: var(--spacing-antd);\r\n`;\r\n\r\nexport const StyledDropdownOption = styled.div`\r\n display: flex;\r\n align-items: center;\r\n padding: var(--spacing-xs) var(--spacing);\r\n cursor: pointer;\r\n &:hover {\r\n background-color: var(--sub-active);\r\n }\r\n &.menu-active {\r\n background-color: var(--main-active);\r\n &:hover {\r\n background-color: var(--sub-active);\r\n }\r\n }\r\n`;\r\nexport const StyledDropdownContainer = styled.div`\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br-lg);\r\n background-color: var(--main-level-3);\r\n box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); // Mimic antd\r\n padding: var(--spacing-xs) 0;\r\n color: var(--color);\r\n`;\r\nexport const StyledDropdown = {\r\n Container: StyledDropdownContainer,\r\n Option: StyledDropdownOption,\r\n};\r\n\r\nexport { ImageCropper } from './image-cropper';\r\nexport type { ImageCropperRef } from './image-cropper';\r\nexport { LinkMarkChooser } from './link-marker';\r\nexport { Loading } from './loading';\r\nexport * from './explanation';\r\nexport * from './formatting-guide';\r\nexport * from './frame-info-block';\r\nexport * from './icon-button';\r\nexport * from './setting';\r\nexport * from './app-header';","import {\r\n frameList,\r\n IconList,\r\n AttributeList,\r\n StickerList,\r\n getFoilList,\r\n CondenseTolerantLabelMap,\r\n NameFontDataMap,\r\n NO_ATTRIBUTE,\r\n NO_ICON,\r\n ArtFinishMap,\r\n FinishMap,\r\n FoilDictionary,\r\n} from '../../model';\r\nimport { FrameInfoBlock } from 'src/component';\r\nimport { CloseCircleOutlined } from '@ant-design/icons';\r\nimport { Tooltip } from 'antd';\r\n\r\nexport const FormatButtonList = [\r\n {\r\n label: 'OCG',\r\n value: 'ocg',\r\n props: {\r\n className: 'ocg-button',\r\n style: { fontWeight: 'bold' } as React.CSSProperties\r\n },\r\n },\r\n {\r\n label: 'TCG',\r\n value: 'tcg',\r\n props: {\r\n className: 'tcg-button',\r\n style: { fontWeight: 'bold' } as React.CSSProperties\r\n },\r\n },\r\n];\r\n\r\nexport const getFoilButtonList = (dictionary: FoilDictionary) => {\r\n return getFoilList(dictionary).map(({ color, name, label }) => ({\r\n label,\r\n value: name,\r\n props: {\r\n style: {\r\n color,\r\n fontWeight: 'bold',\r\n } as React.CSSProperties,\r\n }\r\n }));\r\n};\r\n\r\nexport const FinishButtonList = Object.values(FinishMap).map(({ value, label }) => ({\r\n label,\r\n value,\r\n}));\r\n\r\nexport const getNameFontOptionList = (dictionary: Record) => Object.values(NameFontDataMap).map(({ value, labelKey }) => ({\r\n label: dictionary[labelKey],\r\n value,\r\n}));\r\n\r\nexport const ArtFinishButtonList = [\r\n { value: 'normal', label: },\r\n ...Object.values(ArtFinishMap).map(({ value, label }) => ({\r\n label,\r\n value,\r\n })),\r\n];\r\n\r\nexport const getFrameButtonList = () => frameList.map(({ name, nameKey, labelBackgroundColor, labelBackgroundColorList, edition }) => ({\r\n label: ,\r\n value: name,\r\n edition,\r\n}));\r\n\r\nexport const getAttributeList = (format: string, dictionary: Record) => AttributeList.map(({ name, nameKey }) => ({\r\n label: name === NO_ATTRIBUTE\r\n ? \r\n : \r\n \r\n ,\r\n value: name,\r\n}));\r\n\r\nexport const getSTIconButtonList = (dictionary: Record) => IconList.map(({ value, nameKey }) => ({\r\n label: value === NO_ICON\r\n ? \r\n : \r\n {dictionary[nameKey]}\r\n ,\r\n value,\r\n}));\r\n\r\nexport const StarButtonList = [...Array(14)].map((_, index) => ({ label: index, value: index }));\r\nexport const IconTypeMap: Record = {\r\n 'auto': {\r\n value: 'auto',\r\n labelKey: 'input.icon-type.auto.label',\r\n fullLabelKey: 'input.icon-type.auto.label',\r\n icon: null,\r\n },\r\n 'st': {\r\n value: 'st',\r\n labelKey: 'input.icon-type.icon.label',\r\n fullLabelKey: 'input.icon-type.icon.label',\r\n icon: \"s/t-icon\",\r\n },\r\n 'level': {\r\n value: 'level',\r\n labelKey: 'input.icon-type.level.label',\r\n fullLabelKey: 'input.icon-type.level.label',\r\n icon: \"s/t-icon\",\r\n },\r\n 'negative-level': {\r\n value: 'negative-level',\r\n labelKey: 'input.icon-type.negative-level.label',\r\n fullLabelKey: 'input.icon-type.negative-level.label',\r\n icon: \"s/t-icon\",\r\n },\r\n 'rank': {\r\n value: 'rank',\r\n labelKey: 'input.icon-type.rank.label',\r\n fullLabelKey: 'input.icon-type.rank.label',\r\n icon: \"s/t-icon\",\r\n },\r\n};\r\nexport const IconTypeList = Object.values(IconTypeMap);\r\n\r\nexport const StickerButtonList = StickerList.map(name => ({\r\n label: name === 'no-sticker'\r\n ? \r\n : {name},\r\n value: name,\r\n}));\r\n\r\nexport const CondenseThresholdButtonList = Object\r\n .entries(CondenseTolerantLabelMap)\r\n .map(([key, { label, order }]) => {\r\n return {\r\n label,\r\n value: key,\r\n order\r\n };\r\n })\r\n .sort((l, r) => l.order - r.order);","// import { useCallback, useEffect, useState } from 'react';\r\n// import Moveable from 'react-moveable';\r\n// import { EllipsisOutlined } from '@ant-design/icons';\r\nimport { Explanation } from 'src/component';\r\nimport { useLanguage } from 'src/service';\r\nimport styled from 'styled-components';\r\n\r\nexport function insertAtCursor(target: HTMLTextAreaElement, myValue: string) {\r\n //IE support\r\n if ((document as any).selection) {\r\n target.focus();\r\n const sel = (document as any).selection.createRange();\r\n sel.text = myValue;\r\n\r\n return {\r\n value: target.value,\r\n position: 0,\r\n };\r\n }\r\n //MOZILLA and others\r\n else if (target.selectionStart || target.selectionStart === 0) {\r\n const startPos = target.selectionStart;\r\n const endPos = target.selectionEnd;\r\n target.value = target.value.substring(0, startPos)\r\n + myValue\r\n + target.value.substring(endPos, target.value.length);\r\n target.selectionStart = startPos + myValue.length;\r\n target.selectionEnd = startPos + myValue.length;\r\n target.focus();\r\n\r\n return {\r\n value: target.value,\r\n position: startPos + myValue.length,\r\n };\r\n } else {\r\n target.value += myValue;\r\n\r\n return {\r\n value: target.value,\r\n position: 0,\r\n };\r\n }\r\n}\r\n\r\nconst StyledCharPickerContainer = styled.div`\r\n z-index: 10;\r\n display: inline-grid;\r\n grid-template-columns: 1fr max-content;\r\n align-items: center;\r\n column-gap: var(--spacing-sm);\r\n .char-picker-guideline {\r\n\r\n }\r\n .char-picker {\r\n z-index: 1;\r\n display: grid;\r\n grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));\r\n .handler,\r\n .ant-btn {\r\n background-color: var(--main-level-1);\r\n color: var(--color-heavy);\r\n text-shadow: var(--ts);\r\n font-family: Segoe UI Symbol, sans-serif;\r\n border: 1px solid var(--sub-level-1);\r\n border-radius: 0;\r\n padding: 0 var(--spacing);\r\n + .ant-btn {\r\n border-left-width: 0;\r\n }\r\n &:hover {\r\n color: var(--main-active);\r\n }\r\n &:first-child {\r\n border-radius: var(--br) 0 0 var(--br);\r\n }\r\n &:last-child {\r\n border-radius: 0 var(--br) var(--br) 0;\r\n }\r\n }\r\n /** Currently char picker no longer movable */\r\n /* .handler {\r\n cursor: grabbing;\r\n background-color: var(--main-level-2);\r\n height: unset;\r\n font-size: var(--fs-xl);\r\n height: var(--fs-xl);\r\n line-height: 1;\r\n padding: 0;\r\n text-align: center;\r\n } */\r\n }\r\n .moveable-control-box {\r\n .moveable-control.moveable-origin,\r\n .moveable-line.moveable-direction {\r\n border-color: transparent;\r\n background: none;\r\n }\r\n }\r\n`;\r\n\r\n/** The dragging experience is not good. Currently turn it off for now and glue it into effect's textarea. */\r\nexport type CharPicker = {\r\n targetId: string,\r\n onPick?: (value: string, letter: string) => void,\r\n}\r\nexport const CharPicker = ({\r\n targetId = '',\r\n onPick = () => {},\r\n}: CharPicker) => {\r\n const language = useLanguage();\r\n // const [target, setTarget] = useState(null);\r\n const internalOnPick = (letter: string) => {\r\n const inputTarget = document.getElementById(targetId) as HTMLTextAreaElement;\r\n if (inputTarget) {\r\n const { value } = insertAtCursor(inputTarget, letter);\r\n\r\n onPick(value, letter);\r\n }\r\n };\r\n\r\n // useEffect(() => {\r\n // setTarget(document.getElementById('char-picker'));\r\n // }, []);\r\n\r\n // const onDrag = useCallback(({\r\n // target,\r\n // left, top,\r\n // transform,\r\n // }) => {\r\n // target!.style.left = `${left}px`;\r\n // target!.style.top = `${top}px`;\r\n // target!.style.transform = transform;\r\n // }, []);\r\n\r\n /** No tabIndex here because this is not an essential input, but rather a QoL component */\r\n return \r\n {
\r\n {/*
\r\n \r\n
*/}\r\n {[\r\n '∞',\r\n '☆',\r\n '●',\r\n '©',\r\n '™',\r\n 'Ɐ',\r\n 'Я',\r\n '※',\r\n ].map(entry => {\r\n return ;\r\n })}\r\n
}\r\n
\r\n \r\n {language['input.char-picker.guide.header']}\r\n
    \r\n
  • {language['input.char-picker.guide.instruction-1']}
  • \r\n
  • {language['input.char-picker.guide.instruction-2']}
  • \r\n
\r\n }\r\n />\r\n
\r\n {/* */}\r\n
;\r\n};","import { Button, InputNumber } from 'antd';\r\nimport { ForwardedRef, forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\r\nimport { ChromePicker } from 'react-color';\r\nimport { AnglePicker, ColorPoint, GradientPicker } from 'react-linear-gradient-picker';\r\nimport { getDefaultGradientPalette, parsePalette, stringifyPalette } from 'src/util';\r\nimport debounce from 'lodash.debounce';\r\nimport 'react-linear-gradient-picker/dist/index.css';\r\nimport './gradient-picker.scss';\r\nimport { useLanguage } from 'src/service';\r\n\r\ntype WrappedColorPicker = {\r\n color?: string,\r\n onSelect?: (color: string, opacity?: number) => void,\r\n onOffsetChange?: (id: number, offset: string) => void,\r\n onRemove?: (id: number) => void,\r\n opacity?: number,\r\n};\r\ntype WrappedColorPickerRef = {\r\n setColor: (stopColor: ColorPoint) => void,\r\n setCurrentOffset: (id: number, offset: string) => void,\r\n}\r\nconst WrappedColorPicker = forwardRef(({\r\n color,\r\n onSelect,\r\n onOffsetChange,\r\n onRemove,\r\n}: WrappedColorPicker, ref: ForwardedRef) => {\r\n const language = useLanguage();\r\n const [internalColor, setInternalColor] = useState(color);\r\n const [internalOffset, setInternalOffset] = useState(0);\r\n const [internalId, setInternalId] = useState(-1);\r\n const debouncedOnChange = useRef(debounce(setInternalOffset, 250)).current;\r\n\r\n useImperativeHandle(ref, () => ({\r\n setColor: ({ color, offset, id }) => {\r\n const { min, max, round } = Math;\r\n\r\n setInternalColor(color);\r\n setInternalOffset(max(0, min(100, round(parseFloat(offset) * 100))));\r\n setInternalId(id);\r\n },\r\n setCurrentOffset: (id, offset) => {\r\n const { min, max, round } = Math;\r\n\r\n if (id === internalId) setInternalOffset(max(0, min(100, round(parseFloat(offset) * 100))));\r\n }\r\n }));\r\n\r\n useEffect(() => {\r\n if (internalId > 0) onOffsetChange?.(internalId, `${internalOffset / 100}`);\r\n }, [internalId, internalOffset, onOffsetChange]);\r\n\r\n return
\r\n
\r\n
\r\n {language['input.name-style.gradient.color-stop.label']}: debouncedOnChange(typeof value === 'string' ? parseInt(value) : value ?? 0)}\r\n />\r\n
\r\n \r\n
\r\n setInternalColor(color.hex)}\r\n onChangeComplete={color => {\r\n setInternalColor(color.hex);\r\n onSelect?.(color.hex);\r\n }}\r\n />\r\n
;\r\n});\r\n\r\nconst MAX_STOP_POINT = 20;\r\nconst getPaletteInfo = (newColorList: ColorPoint[]) => {\r\n return {\r\n colorList: newColorList,\r\n raw: stringifyPalette(newColorList),\r\n };\r\n};\r\nexport type TextGradientPicker = {\r\n palette?: string,\r\n angle?: number,\r\n memoizedOnChange: (palette: ColorPoint[], angle: number) => void,\r\n};\r\nexport const TextGradientPicker = ({\r\n palette: externalPalette = stringifyPalette(getDefaultGradientPalette()),\r\n angle: externalAngle = 180,\r\n memoizedOnChange,\r\n}: TextGradientPicker) => {\r\n const language = useLanguage();\r\n const pickerRef = useRef(null);\r\n const [angle, setAngle] = useState(externalAngle);\r\n const [palette, setPalette] = useState(() => {\r\n const intialPalette = parsePalette(externalPalette);\r\n\r\n return {\r\n raw: externalPalette,\r\n colorList: intialPalette,\r\n currentControlId: intialPalette[0]?.id ?? -1,\r\n };\r\n });\r\n\r\n const changePalette = useCallback((id: number, offset: string) => setPalette(cur => {\r\n const nextColorList = cur.colorList.map(entry => entry.id === id ? { ...entry, offset } : entry);\r\n\r\n return { ...cur, ...getPaletteInfo(nextColorList) };\r\n }), []);\r\n\r\n useEffect(() => {\r\n setAngle(externalAngle);\r\n }, [externalAngle]);\r\n\r\n useEffect(() => {\r\n const newPalette = parsePalette(externalPalette);\r\n\r\n setPalette({\r\n raw: externalPalette,\r\n colorList: newPalette,\r\n currentControlId: newPalette[0]?.id ?? -1,\r\n });\r\n }, [externalPalette]);\r\n\r\n const setPickerOnMount = useRef(false);\r\n useEffect(() => {\r\n if (palette.colorList[0] && setPickerOnMount.current) {\r\n setPickerOnMount.current = true;\r\n pickerRef.current?.setColor(palette.colorList[0]);\r\n }\r\n }, [palette.colorList]);\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n const { colorList, currentControlId } = palette;\r\n if (relevant && currentControlId >= 0) {\r\n const targetColor = colorList.find(entry => entry.id === currentControlId);\r\n\r\n if (targetColor) pickerRef.current?.setCurrentOffset(currentControlId, targetColor.offset);\r\n }\r\n }, 100);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n }, [palette]);\r\n\r\n /** @todo REMEMBER to memorize the callback before passing into this component */\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n if (relevant) {\r\n memoizedOnChange(palette.colorList, angle);\r\n }\r\n }, 200);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n }, [palette, angle, memoizedOnChange]);\r\n\r\n return
\r\n
\r\n

\r\n {language['input.name-style.gradient.color-point.label']}\r\n

\r\n MAX_STOP_POINT}\r\n onClick={() => {\r\n setPalette(cur => {\r\n const nextColorList = [\r\n ...cur.colorList,\r\n { offset: '0.5', color: '#ffffff', id: cur.colorList.length + 1 },\r\n ].sort((l, r) => Number(l.offset) - Number(r.offset));\r\n\r\n return {\r\n ...cur,\r\n ...getPaletteInfo(nextColorList)\r\n };\r\n });\r\n }}\r\n >{language['input.name-style.gradient.add-point.label']} ({palette.colorList.length}/{MAX_STOP_POINT})\r\n
\r\n

{language['input.name-style.gradient.gradient-direction.label']}

\r\n \r\n
\r\n
\r\n
\r\n setPalette(cur => ({ ...cur, ...getPaletteInfo(colorList) })),\r\n onColorStopSelect: stopColor => {\r\n setPalette(cur => ({ ...cur, currentControlId: stopColor.id }));\r\n pickerRef.current?.setColor(stopColor);\r\n },\r\n }}>\r\n {/** Under the hood this children will be cloned with pre-populate props, so it seemingly work even though we do not pass anything here. */}\r\n {\r\n setPalette(cur => {\r\n const nextColorList = cur.colorList.filter(entry => entry.id !== id);\r\n const nextId = nextColorList?.[0].id ?? -1;\r\n if (nextId > 0) pickerRef.current?.setColor(palette.colorList[nextId]);\r\n\r\n return {\r\n ...getPaletteInfo(nextColorList),\r\n currentControlId: nextId,\r\n };\r\n });\r\n }}\r\n />\r\n \r\n
\r\n
;\r\n};","import { StyledDropdown } from 'src/component';\r\nimport styled from 'styled-components';\r\n\r\nexport const StyledPickerButton = styled.div<{ $active?: boolean, $softMode: boolean }>`\r\n background-color: var(--main-level-4);\r\n ${({ $active }) => $active ? 'border: var(--bw) solid var(--main-active);' : 'border: var(--bw) solid var(--sub-level-1);'}\r\n padding: var(--spacing-xxs) var(--spacing-xs);\r\n margin: calc(-1 * var(--spacing-xxs)) 0;\r\n border-radius: var(--br-lg);\r\n box-shadow: var(--bs-button);\r\n color: var(--color-heavy);\r\n cursor: pointer;\r\n ${({ $softMode, $active }) => {\r\n return $softMode\r\n ? `\r\n border: var(--bw) solid var(--main-level-4);\r\n ${$active ? 'outline: var(--bw) solid var(--main-active);' : ''}\r\n `\r\n : '';\r\n }}\r\n &:hover {\r\n background-color: var(--sub-level-4);\r\n }\r\n`;\r\n\r\nexport const StyledPatternContainer = styled(StyledDropdown.Container)`\r\n display: grid;\r\n grid-template-columns: repeat(2, 200px);\r\n gap: var(--spacing-sm);\r\n padding: var(--spacing-xs);\r\n .alert {\r\n grid-column: span 2;\r\n font-size: var(--fs-sm);\r\n text-align: center;\r\n }\r\n`;\r\nexport const StyledPatternOption = styled.div`\r\n line-height: 0;\r\n cursor: pointer;\r\n align-self: center;\r\n text-align: center;\r\n &:not(.menu-off) {\r\n min-height: 23.2px;\r\n &.menu-active {\r\n outline: var(--bw-lg) solid var(--main-active);\r\n &:hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n }\r\n :hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n }\r\n &.menu-off {\r\n &:hover {\r\n color: var(--main-link);\r\n .anticon {\r\n color: var(--main-link);\r\n }\r\n }\r\n }\r\n img {\r\n max-width: 100%;\r\n border: var(--bw) solid var(--sub-level-1);\r\n }\r\n`;\r\n\r\nexport const StyledPredefinedContainer = styled(StyledDropdown.Container)`\r\n display: grid;\r\n grid-template-columns: repeat(4, 120px);\r\n gap: var(--spacing-sm);\r\n padding: var(--spacing-xs);\r\n &:focus-visible {\r\n outline: none;\r\n box-shadow: 0 0 0 2px var(--focus) inset;\r\n }\r\n`;\r\nexport const StyledPredefinedOption = styled.div`\r\n line-height: 0;\r\n cursor: pointer;\r\n min-height: 26.13px;\r\n &.menu-active {\r\n outline: var(--bw-lg) solid var(--main-active);\r\n &:hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n }\r\n &.preset-item-focused {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n :hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n img {\r\n max-width: 100%;\r\n }\r\n`;","import { InputNumber, Slider } from 'antd';\r\nimport { forwardRef, useEffect, useImperativeHandle, useState } from 'react';\r\nimport { CompactPicker } from 'react-color';\r\nimport PowerSlider from 'react-input-slider';\r\nimport { DefaultColorList, NameStyle } from 'src/model';\r\nimport { useLanguage } from 'src/service';\r\n\r\nexport type GridSliderInputRef = {\r\n setValue: (value: Partial<{\r\n x: number;\r\n y: number;\r\n width: number;\r\n color: string;\r\n }>) => void,\r\n};\r\nexport type GridSliderInput = {\r\n className: string,\r\n defaultValue: Partial,\r\n fieldMap: {\r\n x: keyof NameStyle,\r\n y: keyof NameStyle,\r\n width: keyof NameStyle,\r\n color: keyof NameStyle,\r\n },\r\n labelMap: Partial>,\r\n onChange: (value: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n color: string;\r\n }) => void,\r\n}\r\nexport const GridSliderInput = forwardRef(({\r\n className,\r\n defaultValue,\r\n fieldMap,\r\n labelMap,\r\n onChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n x: xField,\r\n y: yField,\r\n color: colorField,\r\n width: widthField,\r\n } = fieldMap;\r\n const [value, setValue] = useState(() => {\r\n const xValue = defaultValue[xField] as number;\r\n const yValue = defaultValue[yField] as number;\r\n const colorValue = defaultValue[colorField] as string;\r\n const widthValue = defaultValue[widthField] as number;\r\n\r\n return {\r\n x: xValue ?? 0,\r\n y: yValue ?? 0,\r\n width: widthValue ?? 0,\r\n color: colorValue,\r\n };\r\n });\r\n const {\r\n x,\r\n y,\r\n color,\r\n width,\r\n } = value;\r\n const widthLabel = labelMap[widthField];\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n if (relevant) {\r\n onChange(value);\r\n }\r\n }, 500);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n /** No need to depend on handler */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: nextValue => {\r\n const keyList = Object.keys(nextValue) as (keyof typeof value)[];\r\n\r\n for (const key in keyList) {\r\n if (nextValue[key as keyof typeof value] !== value[key as keyof typeof value]) {\r\n setValue(cur => ({ ...cur, ...nextValue }));\r\n return;\r\n }\r\n }\r\n },\r\n }));\r\n\r\n return
\r\n

{language['input.name-style.slider.position.label']}

\r\n
\r\n setValue(cur => ({ ...cur, x, y }))} />\r\n
\r\n {language['input.name-style.slider.x-offset.label']}: setValue(cur => ({ ...cur, x: typeof value === 'number' ? value : parseInt(value ?? '0') }))}\r\n />\r\n
\r\n
\r\n {language['input.name-style.slider.y-offset.label']}: setValue(cur => ({ ...cur, y: typeof value === 'number' ? value : parseInt(value ?? '0') }))}\r\n />\r\n
\r\n
\r\n {widthLabel}: {\r\n if (typeof value === 'number') {\r\n setValue(cur => ({ ...cur, width: value }));\r\n }\r\n }}\r\n />\r\n
\r\n
\r\n

{language['input.name-style.slider.color.label']}

\r\n setValue(cur => ({ ...cur, color: color.hex }))}\r\n />\r\n
;\r\n});","import { forwardRef, useImperativeHandle, useRef, useState } from 'react';\r\nimport { StyledPredefinedContainer, StyledPredefinedOption } from './style-picker.styled';\r\nimport { NameStyle, PresetNameStyle, PresetNameStyleList } from 'src/model';\r\nimport { getNavigationProps, mergeClass } from 'src/util';\r\n\r\nexport type PredefinedOptionGridRef = {\r\n focus: () => void,\r\n};\r\nexport type PredefinedOptionGrid = {\r\n active: boolean,\r\n value: Partial,\r\n onClick: (value: {\r\n key: PresetNameStyle,\r\n label: string,\r\n image: string,\r\n value: Partial,\r\n }) => void,\r\n onCancel?: () => void,\r\n};\r\nexport const PredefinedOptionGrid = forwardRef(({\r\n active,\r\n value,\r\n onClick,\r\n onCancel,\r\n}, ref) => {\r\n const containerRef = useRef(null);\r\n const [focus, setFocus] = useState(0);\r\n\r\n useImperativeHandle(ref, () => ({\r\n focus: () => containerRef.current?.focus(),\r\n }));\r\n\r\n return {\r\n if (focus >= 0) onClick(PresetNameStyleList[focus]);\r\n },\r\n onCancel: () => {\r\n onCancel?.();\r\n }\r\n })}\r\n >\r\n {PresetNameStyleList.map((entry, index) => {\r\n const { key, image, label } = entry;\r\n\r\n return {\r\n e.stopPropagation();\r\n onClick(entry);\r\n }}\r\n >\r\n {/** Tooltip currently is not really helpful, and gives poor UX */}\r\n {/* */}\r\n \r\n {/* */}\r\n ;\r\n })}\r\n ;\r\n});","import { Checkbox, Popover } from 'antd';\r\nimport { useCallback, useEffect, useRef, useState, forwardRef, useImperativeHandle, ForwardedRef, useMemo } from 'react';\r\nimport { CompactPicker } from 'react-color';\r\nimport { CaretDownOutlined, CloseCircleOutlined } from '@ant-design/icons';\r\nimport {\r\n PresetNameStyleMap,\r\n NameStyle,\r\n NameStyleType,\r\n PatternList,\r\n FrameInfo,\r\n DefaultColorList,\r\n} from '../../../model';\r\nimport debounce from 'lodash.debounce';\r\nimport { getNavigationProps, mergeClass, stringifyPalette, useRefresh } from 'src/util';\r\nimport { TextGradientPicker } from './gradient-picker';\r\nimport { getNameFontOptionList } from '../const';\r\nimport { StyledDropdown } from 'src/component';\r\nimport {\r\n StyledPatternContainer,\r\n StyledPatternOption,\r\n StyledPickerButton,\r\n} from './style-picker.styled';\r\nimport { useLanguage, useSetting } from 'src/service';\r\nimport { GridSliderInput, GridSliderInputRef } from './grid-slider-input';\r\nimport { PredefinedOptionGrid, PredefinedOptionGridRef } from './predefined-option-grid';\r\nimport './style-picker.scss';\r\n\r\nexport type NameStylePickerRef = {\r\n setValue: (value: Partial) => void,\r\n};\r\nexport type NameStylePicker = {\r\n frameInfo?: FrameInfo,\r\n defaultType: NameStyleType,\r\n defaultValue: Partial,\r\n showExtraDecorativeOption: boolean,\r\n onChange: (type: NameStyleType, style: Partial) => void,\r\n};\r\nexport const NameStylePicker = forwardRef(({\r\n frameInfo,\r\n defaultType,\r\n defaultValue,\r\n showExtraDecorativeOption,\r\n onChange: undebouncedOnChange,\r\n}: NameStylePicker, ref: ForwardedRef) => {\r\n const language = useLanguage();\r\n const optionGridRef = useRef(null);\r\n const [focus, setFocus] = useState(-1);\r\n const [predefinedDropdownVisible, setPredefinedDropdownVisible] = useState(false);\r\n const [type, setType] = useState(defaultType);\r\n const [value, setValue] = useState(defaultValue);\r\n const [customStyleSignal, sendCustomStyleSignal] = useRefresh();\r\n const onChange = useRef(debounce(undebouncedOnChange, 250)).current;\r\n const memoizedOnGradientChange = useCallback((palette, gradientAngle) => {\r\n setValue(cur => ({ ...cur, gradientAngle, gradientColor: stringifyPalette(palette) }));\r\n customStyleSignal();\r\n }, [customStyleSignal]);\r\n const reduceColorMotion = useSetting(state => state.setting.reduceMotionColor);\r\n\r\n const fontList = useMemo(() => getNameFontOptionList(language), [language]);\r\n\r\n useEffect(() => {\r\n if (sendCustomStyleSignal !== 0) {\r\n setType('custom');\r\n onChange('custom', value);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [sendCustomStyleSignal]);\r\n\r\n const shadowPickeRef = useRef(null);\r\n const outlinePickeRef = useRef(null);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: nextValue => {\r\n setValue(currentValue => ({ ...currentValue, ...nextValue }));\r\n\r\n const {\r\n lineColor, lineWidth, lineOffsetX, lineOffsetY,\r\n shadowBlur, shadowColor, shadowOffsetX, shadowOffsetY,\r\n } = nextValue;\r\n shadowPickeRef.current?.setValue({\r\n x: shadowOffsetX, y: shadowOffsetY,\r\n width: shadowBlur, color: shadowColor,\r\n });\r\n outlinePickeRef.current?.setValue({\r\n x: lineOffsetX, y: lineOffsetY,\r\n width: lineWidth, color: lineColor,\r\n });\r\n },\r\n }));\r\n const {\r\n fillStyle,\r\n headTextFillStyle,\r\n hasOutline,\r\n hasShadow,\r\n hasGradient, gradientColor, gradientAngle,\r\n pattern,\r\n font,\r\n } = value;\r\n const { labelBackgroundColor, labelBackgroundImage } = frameInfo ?? {};\r\n const patternStyle = {\r\n background: labelBackgroundColor,\r\n backgroundImage: labelBackgroundImage,\r\n };\r\n const isStyleCustom = type === 'custom';\r\n const isStylePredefined = type === 'predefined';\r\n const optionInputContainerId = 'name-style-option-input-container';\r\n const applyAutoStyle = () => {\r\n setType('auto');\r\n if (type !== 'auto') onChange('auto', value);\r\n };\r\n const applyPredefinedStyle = () => {\r\n const presetValue = value.preset\r\n ? PresetNameStyleMap[value.preset]?.value\r\n : {};\r\n setType('predefined');\r\n setValue(cur => ({ ...cur, ...presetValue }));\r\n onChange('predefined', { ...value, ...presetValue });\r\n };\r\n const applyCustomStyle = () => {\r\n setType('custom');\r\n if (type !== 'custom') onChange('custom', value);\r\n };\r\n return
\r\n \r\n {language['input.name-style.label']}\r\n \r\n {\r\n if (focus === 1 && (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ')) {\r\n e.preventDefault();\r\n setFocus(1);\r\n setPredefinedDropdownVisible(true);\r\n /** Popover takes time to mount / become visible */\r\n setTimeout(() => {\r\n if (focus === 1) optionGridRef.current?.focus();\r\n }, 200);\r\n\r\n return false;\r\n }\r\n },\r\n onTrigger() {\r\n if (focus === 0) applyAutoStyle();\r\n if (focus === 1) applyPredefinedStyle();\r\n if (focus === 2) applyCustomStyle();\r\n },\r\n })}\r\n >\r\n applyAutoStyle()}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n {language['input.name-style.type.auto.label']}\r\n \r\n \r\n \r\n applyPredefinedStyle()}\r\n >\r\n \r\n {\r\n setPredefinedDropdownVisible(false);\r\n document.getElementById(optionInputContainerId)?.focus();\r\n }}\r\n onClick={({ key }) => {\r\n const presetValue = key\r\n ? PresetNameStyleMap[key]?.value\r\n : {};\r\n setType('predefined');\r\n setValue(cur => ({ ...cur, ...presetValue }));\r\n onChange('predefined', { ...value, ...presetValue });\r\n }}\r\n />\r\n
}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n \r\n {language['input.name-style.type.predefined.label']}\r\n \r\n \r\n \r\n \r\n \r\n applyCustomStyle()}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n \r\n {language['input.name-style.type.custom.label']}\r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n

\r\n {language['input.name-style.color.text.label']}\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, fillStyle: color.hex }));\r\n customStyleSignal();\r\n }}\r\n />\r\n
\r\n
\r\n
\r\n

\r\n {language['input.name-style.color.ruby.label']}\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, headTextFillStyle: color.hex }));\r\n customStyleSignal();\r\n }}\r\n />\r\n
\r\n
\r\n
}\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.color.label']} \r\n \r\n \r\n {showExtraDecorativeOption && \r\n
\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, hasShadow: !cur.hasShadow }));\r\n customStyleSignal();\r\n }}>\r\n {language['input.name-style.shadow.toggle.label']}\r\n \r\n

\r\n {hasShadow && {\r\n setValue(cur => ({\r\n ...cur,\r\n shadowBlur: width,\r\n shadowColor: color,\r\n shadowOffsetX: x,\r\n shadowOffsetY: y,\r\n }));\r\n customStyleSignal();\r\n }}\r\n />}\r\n
\r\n }\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.shadow.label']} \r\n \r\n
}\r\n \r\n
\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, hasOutline: !cur.hasOutline }));\r\n customStyleSignal();\r\n }}>\r\n {language['input.name-style.outline.toggle.label']}\r\n \r\n

\r\n {hasOutline && {\r\n setValue(cur => ({\r\n ...cur,\r\n lineWidth: width,\r\n lineColor: color,\r\n lineOffsetX: x,\r\n lineOffsetY: y,\r\n }));\r\n customStyleSignal();\r\n }}\r\n />}\r\n
\r\n }\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.outline.label']} \r\n \r\n
\r\n {showExtraDecorativeOption && \r\n
\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, hasGradient: !cur.hasGradient }));\r\n customStyleSignal();\r\n }}>\r\n {language['input.name-style.gradient.toggle.label']}\r\n \r\n

\r\n {hasGradient &&
\r\n \r\n
}\r\n
\r\n }\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.gradient.label']} \r\n \r\n
}\r\n {showExtraDecorativeOption && \r\n e.stopPropagation()}>\r\n
\r\n {language['input.name-style.pattern.alert']}\r\n
\r\n {PatternList.map(({ key, patternImage }) => {\r\n return {\r\n setValue(cur => ({ ...cur, pattern: key }));\r\n customStyleSignal();\r\n }}\r\n >\r\n {patternImage\r\n ? \r\n : <>\r\n {language['input.name-style.pattern.no-pattern.label']}\r\n }\r\n ;\r\n })}\r\n
\r\n }\r\n placement=\"bottomLeft\"\r\n >\r\n \r\n {language['input.name-style.pattern.label']}\r\n \r\n
}\r\n \r\n \r\n {fontList.map(({ value: fontValue, label }) => {\r\n return {\r\n setValue(cur => ({ ...cur, font: fontValue }));\r\n customStyleSignal();\r\n }}\r\n >\r\n {label}\r\n ;\r\n })}\r\n \r\n }\r\n placement=\"bottomLeft\"\r\n >\r\n \r\n {language['input.name-style.font.label']}\r\n \r\n \r\n \r\n
\r\n
\r\n ;\r\n});\r\n","import { useCallback, useState } from 'react';\r\n\r\nexport const useRefresh = (): [() => void, number] => {\r\n const [cnt, setCnt] = useState(0);\r\n const refresh = useCallback(() => {\r\n setCnt(cur => cur + 1);\r\n }, []);\r\n\r\n return [refresh, cnt];\r\n};","import { css } from 'styled-components';\r\n\r\nexport const InputTrainStyle = css`\r\n display: flex;\r\n .checkbox-train-input-group,\r\n .radio-train-input-group {\r\n display: flex;\r\n flex: 1 1 auto;\r\n\t\t&:focus-visible {\r\n\t\t\t.radio-train-focused,\r\n\t\t\t.checkbox-train-focused {\r\n\t\t\t\tbackground-color: var(--main-level-3);\r\n\t\t\t}\r\n\t\t}\r\n }\r\n .ant-radio-button-wrapper {\r\n user-select: none;\r\n }\r\n .ant-radio-button-wrapper:first-child,\r\n .ant-radio-button-wrapper:last-child {\r\n border-radius: 0;\r\n }\r\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):first-child {\r\n border-left-color: var(--sub-level-1);\r\n }\r\n`;\r\n\r\nexport const TrainGridStyle = css`\r\n .checkbox-train-input-group,\r\n .radio-train-input-group {\r\n\t\tdisplay: flex;\r\n\t\tflex-wrap: wrap;\r\n\t\tcolumn-gap: var(--spacing-xs);\r\n\t\trow-gap: var(--spacing-xs);\r\n\t\tbox-shadow: none;\r\n\t\tborder-radius: 0;\r\n\t\t&:focus-visible {\r\n\t\t\toutline: 3px solid var(--focus); // +1 width size to account for shadow\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper:first-child,\r\n\t\t.ant-radio-button-wrapper:last-child {\r\n\t\t\tborder-radius: 0;\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper {\r\n\t\t\tflex: 1;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\tborder: none;\r\n\t\t\tbox-shadow: var(--bs-1);\r\n\t\t\tpadding: 0;\r\n\t\t\tmin-width: 90px;\r\n\t\t\theight: 28px;\r\n\t\t\tline-height: 28px;\r\n\t\t\ttext-align: center;\r\n\t\t\ttext-shadow: none;\r\n\t\t\tfont-size: var(--fs-sm);\r\n\t\t\t&:hover {\r\n\t\t\t\toutline: var(--bw) solid var(--main-active);\r\n\t\t\t\toutline-offset: var(--bw);\r\n\t\t\t}\r\n\t\t\t&::before {\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper-checked {\r\n\t\t\toutline: var(--bw) solid var(--main-active);\r\n\t\t\toutline-offset: var(--bw);\r\n\t\t}\r\n\t}\r\n`;","import styled from 'styled-components';\r\nimport { InputTrainStyle } from './input-train.styled';\r\nimport React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';\r\nimport { getNavigationProps } from 'src/util';\r\nimport { Tooltip } from 'antd';\r\n\r\nconst StyledRadioTrainContainer = styled.div`\r\n ${InputTrainStyle}\r\n`;\r\nexport type RadioTrainRef = {\r\n focus: () => void,\r\n}\r\nexport type RadioTrain = {\r\n className?: string,\r\n strict?: boolean,\r\n value: string | number,\r\n optionList: { label: React.ReactNode, value: string | number, tooltipProps?: React.ComponentProps, props?: React.LabelHTMLAttributes }[],\r\n onChange: (value: string | number) => void,\r\n children?: React.ReactNode,\r\n suffix?: React.ReactNode,\r\n}\r\nexport const RadioTrain = forwardRef(({\r\n onChange,\r\n value: activeValue,\r\n optionList,\r\n children,\r\n suffix,\r\n className,\r\n strict = false,\r\n}, ref) => {\r\n const [focus, setFocus] = useState(-1);\r\n const internalRef = useRef(null);\r\n const optionLength = optionList.length;\r\n\r\n useImperativeHandle(ref, () => ({\r\n focus: () => internalRef.current?.focus(),\r\n }));\r\n\r\n return \r\n {children && }\r\n
{\r\n const target = optionList[focus];\r\n if (target) {\r\n onChange(target.value);\r\n }\r\n },\r\n })}\r\n >\r\n {optionList.map(({ value, props, label, tooltipProps }, index) => {\r\n const { className } = props ?? {};\r\n const isChecked = strict\r\n ? value === activeValue\r\n : `${value}` === `${activeValue}`;\r\n\r\n return \r\n \r\n ;\r\n })}\r\n
\r\n {suffix}\r\n ;\r\n});","import { useCard, useSetting } from 'src/service';\r\nimport { RadioTrain } from './radio-train';\r\nimport { useCallback, useMemo } from 'react';\r\nimport { getFrameButtonList } from '../const';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { tcgToOCGTermMap } from 'src/model';\r\nimport { TrainGridStyle } from './input-train.styled';\r\n\r\nconst StyledFrameTrain = styled(RadioTrain)`\r\n\t${TrainGridStyle}\r\n`;\r\n\r\nexport type FrameTrain = {\r\n onSTFrameChange: (value: string[]) => void,\r\n};\r\nexport const FrameTrain = ({\r\n onSTFrameChange,\r\n}: FrameTrain) => {\r\n const {\r\n setting,\r\n } = useSetting();\r\n const { showExtraDecorativeOption } = setting;\r\n const frameList = useMemo(() => getFrameButtonList()\r\n .filter(entry => {\r\n return showExtraDecorativeOption || entry.edition === 'normal';\r\n }),\r\n [showExtraDecorativeOption],\r\n );\r\n\r\n const {\r\n frame,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card,\r\n setCard,\r\n }) => ({\r\n frame: card.frame,\r\n setCard,\r\n })));\r\n const changeFrame = useCallback((frameValue: number | string) => {\r\n setCard(currentCard => {\r\n const {\r\n typeAbility,\r\n isPendulum,\r\n attribute,\r\n format,\r\n } = currentCard;\r\n const nextFrame = `${frameValue}`;\r\n const isST = nextFrame === 'spell' || nextFrame === 'trap';\r\n const termMap = format === 'tcg'\r\n ? {\r\n 'Spell Card': 'Spell Card',\r\n 'Trap Card': 'Trap Card',\r\n }\r\n : tcgToOCGTermMap;\r\n const newTypeAbility = nextFrame === 'spell'\r\n ? [termMap['Spell Card']]\r\n : nextFrame === 'trap' ? [termMap['Trap Card']] : typeAbility;\r\n if (isST) onSTFrameChange(newTypeAbility);\r\n\r\n return {\r\n ...currentCard,\r\n frame: nextFrame,\r\n isPendulum: nextFrame === 'link' ? false : isPendulum,\r\n attribute: isST\r\n ? `${nextFrame}`.toUpperCase()\r\n : attribute,\r\n typeAbility: newTypeAbility,\r\n };\r\n });\r\n }, [setCard, onSTFrameChange]);\r\n\r\n return ;\r\n};","import styled from 'styled-components';\r\nimport { InputTrainStyle } from './input-train.styled';\r\nimport { useState } from 'react';\r\nimport { getNavigationProps } from 'src/util';\r\n\r\nconst StyledCheckboxTrainContainer = styled.div`\r\n ${InputTrainStyle}\r\n`;\r\nexport type CheckboxTrain = {\r\n className?: string,\r\n value: string[],\r\n optionList: { label: React.ReactNode, value: string | number, props?: React.LabelHTMLAttributes }[],\r\n onChange: (value: (string | number)[]) => void,\r\n children?: React.ReactNode,\r\n}\r\nexport const CheckboxTrain = ({\r\n onChange,\r\n value: activeValue,\r\n optionList,\r\n children,\r\n className,\r\n}: CheckboxTrain) => {\r\n const [focus, setFocus] = useState(-1);\r\n const optionLength = optionList.length;\r\n\r\n return \r\n {children && }\r\n {\r\n const target = optionList[focus];\r\n if (target) {\r\n const isChecked = Array.isArray(activeValue) ? activeValue.includes(`${target.value}`) : false;\r\n onChange(isChecked\r\n ? activeValue.filter(currentValue => `${target.value}` !== currentValue)\r\n : [...activeValue, `${target.value}`]);\r\n }\r\n },\r\n })}\r\n >\r\n {optionList.map((entry, index) => {\r\n const { label, value, props } = entry;\r\n const isChecked = Array.isArray(activeValue) ? activeValue.includes(`${value}`) : false;\r\n\r\n return ;\r\n })}\r\n \r\n ;\r\n};","import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { ImageCropper, ImageCropperRef } from 'src/component';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { getArtCanvasCoordinate } from 'src/model';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledImageCropper = styled(ImageCropper)`\r\n display: grid;\r\n grid-template-columns: max-content max-content;\r\n align-items: start;\r\n gap: 0;\r\n .card-image-source-input {\r\n display: flex;\r\n flex-direction: column-reverse;\r\n .online-image-tip {\r\n text-align: center;\r\n }\r\n }\r\n .card-cropper {\r\n width: 375px;\r\n text-align: center;\r\n }\r\n`;\r\n\r\nexport type BackgroundInputGroupRef = {\r\n hasImage: () => boolean,\r\n setValue: (value: { background?: string, backgroundCrop?: Partial }) => void,\r\n};\r\nexport type BackgroundInputGroup = {\r\n children?: React.ReactNode,\r\n onCropChange?: (cropInfo: Partial, sourceType: 'internal' | 'external') => void,\r\n} & Pick;\r\nexport const BackgroundInputGroup = forwardRef(({\r\n backgroundColor,\r\n children,\r\n receivingCanvas,\r\n onSourceLoaded,\r\n onTainted,\r\n onCropChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n background, backgroundCrop, backgroundType,\r\n isPendulum,\r\n opacity,\r\n getUpdater,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n background, backgroundCrop, backgroundType,\r\n isPendulum,\r\n opacity,\r\n },\r\n getUpdater,\r\n setCard,\r\n }) => ({\r\n background, backgroundCrop, backgroundType,\r\n isPendulum,\r\n opacity,\r\n getUpdater,\r\n setCard,\r\n })));\r\n const imageCropperRef = useRef(null);\r\n\r\n const changeBackground = useMemo(() => getUpdater('background'), [getUpdater]);\r\n const changeBackgroundCrop = useCallback((cropInfo: Partial, sourceType: 'internal' | 'external') => {\r\n onCropChange?.(cropInfo, sourceType);\r\n if (cropInfo) setCard(curr => ({\r\n ...curr,\r\n backgroundCrop: cropInfo,\r\n }));\r\n }, [onCropChange, setCard]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n hasImage: () => imageCropperRef.current?.hasImage() ?? false,\r\n setValue: ({ background, backgroundCrop }) => {\r\n if (typeof background === 'string' && backgroundCrop) {\r\n imageCropperRef.current?.forceExternalSource(background, backgroundCrop);\r\n }\r\n }\r\n }));\r\n\r\n return \r\n {children}\r\n ;\r\n});","import { Checkbox, InputNumber, Popover, Slider, Tooltip } from 'antd';\r\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\r\nimport { CompactPicker } from 'react-color';\r\nimport { BackgroundType, getBackgroundTypeList, CardOpacity, DEFAULT_BASE_FILL_COLOR, OpacityList, getDefaultCardOpacity, DefaultColorList } from 'src/model';\r\nimport styled from 'styled-components';\r\nimport { BackgroundInputGroup, BackgroundInputGroupRef } from './background-input-group';\r\nimport { ImageCropper } from 'src/component';\r\nimport { RadioTrain } from '../input-train';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { BorderOuterOutlined } from '@ant-design/icons';\r\nimport './layout-picker.scss';\r\n\r\nconst StyledBoundlessOverlay = styled.span`\r\n white-space: pre-line;\r\n`;\r\nconst StyledLayoutPickerContainer = styled.div`\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: wrap;\r\n column-gap: var(--spacing-sm);\r\n row-gap: var(--spacing-sm);\r\n padding: 2px 0;\r\n align-items: center;\r\n .slider-label,\r\n .ant-slider,\r\n .slider-padding {\r\n border: var(--bw) solid var(--sub-level-1);\r\n background-color: var(--main-level-4);\r\n }\r\n .slider-label {\r\n display: inline-flex;\r\n column-gap: var(--spacing-xs);\r\n border-right: none;\r\n padding: var(--spacing-xxs) var(--spacing-xs);\r\n border-radius: var(--br) 0 0 var(--br);\r\n box-shadow: var(--bs-input);\r\n .ant-checkbox-wrapper {\r\n transform: translateY(-1px); // Alignment\r\n }\r\n }\r\n .ant-slider {\r\n margin: 0;\r\n border-left: none;\r\n border-right: none;\r\n height: 28px; // Alignment\r\n padding-top: 11px; // Alignment\r\n }\r\n .slider-padding {\r\n border-left: none;\r\n border-radius: 0 var(--br) var(--br) 0;\r\n }\r\n .ant-slider-rail,\r\n .ant-slider-track {\r\n border-radius: 0 var(--br) var(--br) 0;\r\n }\r\n .card-opacity-slider {\r\n flex: 0 1 auto;\r\n display: grid;\r\n grid-template-columns: max-content 60px 45px 12px;\r\n &.inactive {\r\n .slider-label,\r\n .ant-slider,\r\n .slider-padding {\r\n background-color: var(--main-level-3);\r\n }\r\n }\r\n }\r\n .ant-input-number.ant-input-number-sm {\r\n height: 28px; // Alignment\r\n width: unset;\r\n border-radius: 0;\r\n box-shadow: var(--bs-input);\r\n .ant-input-number-input {\r\n height: 26px; // Alignment\r\n }\r\n }\r\n .background-preview {\r\n display: inline-block;\r\n line-height: 0;\r\n width: 17px;\r\n height: 17px; // Alignment\r\n align-self: center;\r\n border: 1px solid #333333;\r\n cursor: pointer;\r\n text-align: center;\r\n user-select: none;\r\n &:hover {\r\n box-shadow: 0 0 2px 0 #222222;\r\n }\r\n .background-image-preview {\r\n max-width: 15px;\r\n max-height: 15px;\r\n }\r\n .no-background-icon {\r\n font-size: 15px; // Alignment\r\n }\r\n }\r\n`;\r\nconst StyledBaseFillPickerContainer = styled.div`\r\n --input-width: 315px;\r\n &.overlay-no-background-image {\r\n .card-image-cropper {\r\n grid-template-columns: 1fr;\r\n }\r\n .card-cropper {\r\n min-height: 0;\r\n line-height: 0;\r\n width: 0;\r\n visibility: hidden;\r\n position: absolute;\r\n }\r\n .card-image-source-input {\r\n padding-right: 0;\r\n margin-right: 0;\r\n border-right: none;\r\n }\r\n i {\r\n max-width: var(--input-width); // Alignment\r\n }\r\n }\r\n i {\r\n display: inline-block;\r\n font-size: var(--fs-sm);\r\n color: var(--color);\r\n font-weight: normal;\r\n }\r\n .background-picker {\r\n padding: var(--spacing-xs);\r\n /** No display none here, again we want to keep card cropper painted, just not visible */\r\n &.overlay-no-background {\r\n visibility: hidden;\r\n height: 0;\r\n width: 0;\r\n padding: 0;\r\n }\r\n .card-image-input {\r\n text-align: center;\r\n max-width: var(--input-width);\r\n }\r\n }\r\n .card-image-source-input {\r\n height: 100%;\r\n justify-content: start;\r\n padding-right: var(--spacing-xs);\r\n margin-right: var(--spacing-xs);\r\n border-right: var(--bw) solid var(--sub-level-4);\r\n .type-section h2 {\r\n margin-top: var(--spacing-xs);\r\n }\r\n .color-section h2 {\r\n padding-top: 0;\r\n padding-left: 0;\r\n }\r\n }\r\n .color-section {\r\n > h2 + div {\r\n > div:first-child {\r\n box-shadow: none !important; // Override inline style\r\n }\r\n > div:nth-child(2) {\r\n border: var(--bw) solid var(--main-level-1);\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport type LayoutPicker = {\r\n defaultValue: Partial,\r\n onChange: (opacity: CardOpacity) => void,\r\n} & Pick;\r\nexport type OpacityPickerRef = {\r\n setValue: (opacity: Partial & {\r\n background?: string,\r\n backgroundCrop?: Partial,\r\n backgroundType?: BackgroundType,\r\n }) => void,\r\n};\r\nexport const LayoutPicker = forwardRef(({\r\n receivingCanvas,\r\n defaultValue,\r\n onTainted,\r\n onChange,\r\n onSourceLoaded,\r\n onCropChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n hasBackground,\r\n backgroundType,\r\n isPendulum,\r\n background,\r\n setCard,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n isPendulum,\r\n hasBackground,\r\n backgroundType,\r\n background,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n hasBackground,\r\n backgroundType,\r\n isPendulum,\r\n background,\r\n setCard,\r\n getUpdater,\r\n })));\r\n const [backgroundInputVisible, setBackgroundInputVisible] = useState(true);\r\n const [backgroundInputHidden, setBackgroundInputHidden] = useState(true);\r\n const [opacity, setOpacity] = useState({ ...getDefaultCardOpacity(), ...defaultValue });\r\n const backgroundInputRef = useRef(null);\r\n\r\n const changeBackgroundType = useMemo(() => getUpdater('backgroundType'), [getUpdater]);\r\n const changeHasBackground = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return { ...currentCard, hasBackground: nextValue };\r\n }), [setCard]);\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n if (relevant) {\r\n onChange(opacity);\r\n }\r\n }, 500);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [opacity]);\r\n\r\n useEffect(() => {\r\n /** Force render, otherwise we will miss the image */\r\n setBackgroundInputVisible(false);\r\n /** Avoid consecutive render here, so the popover does not \"flashing\" when close */\r\n setTimeout(() => {\r\n setBackgroundInputHidden(false);\r\n }, 250);\r\n }, []);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ background, backgroundCrop, ...newValue }) => {\r\n if (typeof background === 'string' && backgroundCrop) {\r\n backgroundInputRef.current?.setValue({ background, backgroundCrop });\r\n }\r\n for (const key in newValue) {\r\n if (newValue[key as keyof CardOpacity] !== opacity[key as keyof CardOpacity]) {\r\n setOpacity(cur => ({ ...cur, ...newValue }));\r\n }\r\n }\r\n }\r\n }));\r\n\r\n const noBackground = (background ?? '').length === 0\r\n && (backgroundInputRef.current?.hasImage() !== true);\r\n return \r\n \r\n {language['input.opacity.boundless.tooltip']}\r\n }\r\n >\r\n setOpacity(cur => ({ ...cur, boundless: value.target.checked }))}\r\n checked={opacity.boundless}\r\n >\r\n {language['input.opacity.boundless.label']}\r\n \r\n \r\n {OpacityList.map(({ labelKey, type, subType, tooltipKey }) => {\r\n if (type === 'pendulum' && !isPendulum) return null;\r\n const activable = !!subType;\r\n const isActive = subType && opacity[subType];\r\n return
\r\n
\r\n {type === 'body' && \r\n \r\n

\r\n {\r\n changeHasBackground(e);\r\n }}\r\n >{language['input.background.toggle-label']}\r\n
\r\n {language['input.background.description']}\r\n

\r\n
\r\n \r\n
\r\n
\r\n

{language['input.background-color.label']}

\r\n {\r\n setOpacity(cur => ({ ...cur, baseFill: color.hex }));\r\n }}\r\n />\r\n
\r\n {!noBackground &&
\r\n

{language['input.background-type.label']}

\r\n \r\n
}\r\n
\r\n \r\n
\r\n \r\n
}\r\n placement=\"bottom\"\r\n >\r\n \r\n {hasBackground\r\n ? background\r\n ? \"Background\"\r\n : null\r\n : }\r\n
\r\n }\r\n {activable && \r\n subType && setOpacity(cur => ({ ...cur, [subType]: e.target.checked }))}\r\n />\r\n }\r\n {language[labelKey]}\r\n \r\n setOpacity(cur => ({ ...cur, [type]: typeof value === 'number' ? value : 100 }))}\r\n value={opacity[type] ?? 100}\r\n />\r\n setOpacity(cur => ({ ...cur, [type]: value }))}\r\n value={opacity[type] ?? 100}\r\n />\r\n
\r\n
;\r\n })}\r\n
;\r\n});","import { Input, Popover } from 'antd';\r\nimport { RadioTrain } from '../input-train';\r\nimport { StyledDropdown } from 'src/component';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useImperativeHandle, useMemo } from 'react';\r\nimport { CaretDownOutlined, AlignCenterOutlined, AlignLeftOutlined, AlignRightOutlined, CloseCircleOutlined } from '@ant-design/icons';\r\nimport { IconTypeList, IconTypeMap, StarButtonList, getSTIconButtonList } from '../const';\r\nimport { checkDarkSynchro, checkXyz } from 'src/util';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledIconDropdown = styled(StyledDropdown.Container)`\r\n img {\r\n max-height: 1.3em;\r\n }\r\n`;\r\nconst StyledCheckboxStarTrain = styled(RadioTrain)`\r\n .custom-star-input {\r\n margin-left: var(--spacing-sm);\r\n width: 6.5rem;\r\n }\r\n .checkbox-star-suffix {\r\n display: grid;\r\n grid-template-columns: max-content max-content;\r\n column-gap: var(--spacing-sm);\r\n }\r\n`;\r\n\r\nexport type CardIconInputGroupRef = {}\r\nexport type CardIconInputGroup = {\r\n isLink: boolean,\r\n isMonster: boolean,\r\n showCreativeOption: boolean,\r\n};\r\nexport const CardIconInputGroup = forwardRef(({\r\n isLink,\r\n isMonster,\r\n showCreativeOption,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n frame,\r\n subFamily,\r\n cardIcon,\r\n star,\r\n starAlignment,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n frame,\r\n subFamily,\r\n cardIcon,\r\n star,\r\n starAlignment,\r\n },\r\n getUpdater,\r\n }) => ({\r\n frame,\r\n subFamily,\r\n cardIcon,\r\n star,\r\n starAlignment,\r\n getUpdater,\r\n })));\r\n const isDarkSynchro = checkDarkSynchro({ frame });\r\n const isXyz = checkXyz({ frame });\r\n\r\n const changeCardIcon = useMemo(() => getUpdater('cardIcon'), [getUpdater]);\r\n const changeSubFamily = useMemo(() => getUpdater('subFamily'), [getUpdater]);\r\n const changeStar = useMemo(() => getUpdater('star'), [getUpdater]);\r\n const changeStarAlignment = useMemo(() => getUpdater('starAlignment'), [getUpdater]);\r\n\r\n useImperativeHandle(ref, () => ({}));\r\n\r\n const iconTypeData = cardIcon === 'auto'\r\n ? IconTypeMap[isMonster\r\n ? isXyz ? 'rank' : isDarkSynchro ? 'negative-level' : 'level'\r\n : 'st'\r\n ]\r\n : IconTypeMap[cardIcon];\r\n const iconDropdownText = language[iconTypeData.labelKey];\r\n const IconDropdownLabel = showCreativeOption\r\n ? <>{iconDropdownText} \r\n : iconDropdownText;\r\n const IconDropdown = \r\n \r\n {IconTypeList.map(({ fullLabelKey, value, icon }) => {\r\n return changeCardIcon(value)}\r\n >\r\n {icon ? <>{icon}  : null}{language[fullLabelKey]}\r\n ;\r\n })}\r\n \r\n }\r\n placement=\"bottomRight\"\r\n >\r\n \r\n {IconDropdownLabel}\r\n
\r\n ;\r\n const DropdownChildren = showCreativeOption\r\n ? IconDropdown\r\n : IconDropdownLabel;\r\n return !isLink\r\n ? iconTypeData.value === 'st'\r\n ? \r\n {DropdownChildren}\r\n \r\n : \r\n \r\n ,\r\n },\r\n {\r\n value: 'left',\r\n tooltipProps: { overlay: language['input.icon-type.alignment.left'] },\r\n label: ,\r\n },\r\n {\r\n value: 'center',\r\n tooltipProps: { overlay: language['input.icon-type.alignment.center'] },\r\n label: ,\r\n },\r\n {\r\n value: 'right',\r\n tooltipProps: { overlay: language['input.icon-type.alignment.right'] },\r\n label: ,\r\n },\r\n ]}\r\n />\r\n }\r\n >\r\n {DropdownChildren}\r\n \r\n : null;\r\n});","export const availableCommand = new Set(['1', '2', '3', '4', '5']);\r\nexport const resolveHotkey = (\r\n value: string,\r\n key: string,\r\n selectionStart: number,\r\n selectionEnd: number,\r\n allowNewLine: boolean,\r\n onResult: (joinedText: string, newCursorPlacement: number) => void,\r\n) => {\r\n const selectedText = value.substring(selectionStart, selectionEnd);\r\n const nextLetter = value[selectionEnd];\r\n const keepInline = nextLetter === '\\n' || !allowNewLine;\r\n let wrappedText = selectedText;\r\n let cursorOffset = 2;\r\n switch (key) {\r\n case '1': wrappedText = `[${selectedText}]${keepInline ? '' : '\\n'}`;\r\n cursorOffset = keepInline ? 2 : 3;\r\n break;\r\n case '2': wrappedText = `{${selectedText}}`; break;\r\n case '3': wrappedText = `{${selectedText}|}`; break;\r\n case '4': wrappedText = `{${selectedText}||}`; cursorOffset = 3; break;\r\n case '5': wrappedText = `{{${selectedText}}}`; cursorOffset = 4; break;\r\n }\r\n const joinedText = value.substring(0, selectionStart)\r\n + `${wrappedText}`\r\n + value.substring(selectionEnd, value.length);\r\n\r\n onResult(joinedText, selectionEnd + cursorOffset);\r\n};\r\n\r\nexport const placeCursorInInput = ({\r\n id,\r\n placement,\r\n}: {\r\n id: string;\r\n placement: number;\r\n}) => {\r\n if (id && placement >= 0) {\r\n const target = document.querySelector(`#${id}`) as HTMLInputElement | null;\r\n\r\n if (target && (target.selectionEnd ?? -1) >= 0) {\r\n target.selectionEnd = placement;\r\n }\r\n }\r\n};","import { availableCommand, placeCursorInInput, resolveHotkey } from './util';\r\nimport { Input } from 'antd';\r\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\r\nimport { TextAreaProps } from 'antd/lib/input';\r\n\r\nconst { TextArea } = Input;\r\nexport type CardTextAreaRef = {\r\n setValue: (nextValue: string) => void,\r\n getPickerRef: () => null | {\r\n id: string, \r\n setValue: (nextValue: string) => void;\r\n },\r\n};\r\nexport type CardTextArea = {\r\n allowHotkey?: boolean,\r\n defaultValue: string,\r\n onTakePicker?: (ref: {\r\n id: string, \r\n setValue: (nextValue: string) => void;\r\n }) => void,\r\n onChange: (e: { target: { value: string } }) => void,\r\n} & Partial;\r\nexport const CardTextArea = forwardRef(({\r\n id,\r\n allowHotkey,\r\n defaultValue,\r\n onTakePicker,\r\n onChange,\r\n onKeyDown,\r\n className,\r\n ...rest\r\n}, ref) => {\r\n const immediateValue = useRef(defaultValue);\r\n const [value, setValue] = useState(defaultValue);\r\n const [cursorData, setCursorData] = useState({ id: '', placement: -1 });\r\n const internalOnChange = useCallback((eventOrValue: string | { target: { value: string }}) => {\r\n const normalizedValue = typeof eventOrValue === 'string' ? eventOrValue : eventOrValue.target.value;\r\n immediateValue.current = normalizedValue;\r\n setValue(normalizedValue);\r\n }, []);\r\n\r\n useEffect(() => {\r\n placeCursorInInput(cursorData);\r\n }, [cursorData]);\r\n\r\n useEffect(() => {\r\n onChange({ target: { value } });\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value]);\r\n\r\n const externalSetValue = (nextValue: string) => {\r\n if (nextValue !== immediateValue.current) {\r\n internalOnChange(nextValue);\r\n }\r\n };\r\n useImperativeHandle(ref, () => ({\r\n setValue: externalSetValue,\r\n getPickerRef: () => id ? ({ id, setValue: externalSetValue }) : null,\r\n }));\r\n\r\n return id && onTakePicker?.({ id, setValue: externalSetValue })}\r\n allowClear\r\n spellCheck={false}\r\n className={`${id}-input ${className}`}\r\n value={value}\r\n onKeyDown={ev => {\r\n onKeyDown?.(ev);\r\n if (!allowHotkey) return;\r\n const { ctrlKey, key, metaKey } = ev;\r\n const selectionStart = ev.currentTarget.selectionStart ?? -1;\r\n const selectionEnd = ev.currentTarget.selectionEnd ?? -1;\r\n if ((ctrlKey || metaKey) && id && selectionEnd !== selectionStart && availableCommand.has(key)) {\r\n ev.preventDefault();\r\n resolveHotkey(\r\n ev.currentTarget.value, key,\r\n selectionStart, selectionEnd,\r\n true,\r\n (joinedText, placement) => {\r\n internalOnChange(joinedText);\r\n setCursorData({ id, placement });\r\n }\r\n );\r\n }\r\n }}\r\n onChange={internalOnChange}\r\n {...rest}\r\n />;\r\n});","import { availableCommand, placeCursorInInput, resolveHotkey } from './util';\r\nimport { Input } from 'antd';\r\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\r\nimport { InputProps } from 'antd/lib/input';\r\nimport { useSetting } from 'src/service';\r\n\r\nexport type CardTextInputRef = {\r\n setValue: (nextValue: string) => void,\r\n};\r\nexport type CardTextInput = {\r\n defaultValue: string,\r\n onTakePicker?: (ref: {\r\n id: string, \r\n setValue: (nextValue: string) => void;\r\n }) => void,\r\n onChange: (e: {target: { value: string }}) => void,\r\n} & Partial;\r\nexport const CardTextInput = forwardRef(({\r\n id,\r\n defaultValue,\r\n onTakePicker,\r\n onChange,\r\n onKeyDown,\r\n className,\r\n ...rest\r\n}, ref) => {\r\n const { setting } = useSetting();\r\n const { allowHotkey } = setting;\r\n const immediateValue = useRef(defaultValue);\r\n const [value, setValue] = useState(defaultValue);\r\n const [cursorData, setCursorData] = useState({ id: '', placement: -1 });\r\n const internalOnChange = useCallback((eventOrValue: string | { target: { value: string }}) => {\r\n const normalizedValue = typeof eventOrValue === 'string' ? eventOrValue : eventOrValue.target.value;\r\n immediateValue.current = normalizedValue;\r\n setValue(normalizedValue);\r\n }, []);\r\n\r\n useEffect(() => {\r\n placeCursorInInput(cursorData);\r\n }, [cursorData]);\r\n\r\n useEffect(() => {\r\n onChange({ target: { value } });\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value]);\r\n\r\n const externalSetValue = (nextValue: string) => {\r\n if (nextValue !== value) {\r\n internalOnChange(nextValue);\r\n }\r\n };\r\n useImperativeHandle(ref, () => ({\r\n setValue: externalSetValue,\r\n }));\r\n\r\n return id && onTakePicker?.({ id, setValue: externalSetValue })}\r\n allowClear\r\n className={`${id}-input ${className}`}\r\n value={value}\r\n onKeyDown={ev => {\r\n onKeyDown?.(ev);\r\n if (!allowHotkey) return;\r\n const { ctrlKey, key, metaKey } = ev;\r\n const selectionStart = ev.currentTarget.selectionStart ?? -1;\r\n const selectionEnd = ev.currentTarget.selectionEnd ?? -1;\r\n if ((ctrlKey || metaKey) && id && selectionEnd !== selectionStart && availableCommand.has(key)) {\r\n ev.preventDefault();\r\n resolveHotkey(\r\n ev.currentTarget.value, key,\r\n selectionStart, selectionEnd,\r\n false,\r\n (joinedText, placement) => {\r\n internalOnChange(joinedText);\r\n setCursorData({ id, placement });\r\n }\r\n );\r\n }\r\n }}\r\n onChange={ev => internalOnChange(ev.target.value)}\r\n {...rest}\r\n />;\r\n});","import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { CardTextArea, CardTextAreaRef } from '../input-text';\r\nimport { useCard } from 'src/service';\r\n\r\nexport type EffectInputGroupRef = {\r\n setValue: (value: string) => void,\r\n};\r\nexport type EffectInputGroup = {} & Pick;\r\nexport const EffectInputGroup = forwardRef(({\r\n onTakePicker,\r\n}, ref) => {\r\n const getUpdater = useCard(state => state.getUpdater);\r\n const effectInputRef = useRef(null);\r\n\r\n const changeEffect = useMemo(() => getUpdater('effect', undefined, 'debounce'), [getUpdater]);\r\n\r\n useEffect(() => {\r\n const pickerRef = effectInputRef.current?.getPickerRef();\r\n\r\n if (pickerRef) onTakePicker?.(pickerRef);\r\n /** No need to depend on handler */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: (value) => {\r\n effectInputRef.current?.setValue(value);\r\n }\r\n }));\r\n\r\n return ;\r\n});","import { useCallback } from 'react';\r\nimport { Checkbox, Tooltip } from 'antd';\r\nimport { useCard, useLanguage } from '../../service';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\n\r\nconst StyledCheckboxGroup = styled.div`\r\n align-self: center;\r\n text-align: right;\r\n .ant-checkbox + span {\r\n user-select: none;\r\n }\r\n`;\r\n\r\nexport type CardCheckboxGroup = {};\r\nexport const CardCheckboxGroup = (_: CardCheckboxGroup) => {\r\n const language = useLanguage();\r\n const {\r\n isDuelTerminalCard,\r\n isFirstEdition,\r\n isSpeedCard,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card,\r\n setCard,\r\n }) => ({\r\n isSpeedCard: card.isSpeedCard,\r\n isDuelTerminalCard: card.isDuelTerminalCard,\r\n isFirstEdition: card.isFirstEdition,\r\n setCard,\r\n })));\r\n\r\n const onFirstEditionChange = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return { ...currentCard, isFirstEdition: nextValue };\r\n }), [setCard]);\r\n const onDuelTerminalCardChange = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n isDuelTerminalCard: nextValue,\r\n isSpeedCard: nextValue ? false : currentCard.isSpeedCard,\r\n };\r\n }), [setCard]);\r\n const onSpeedCardChange = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n isSpeedCard: e.target.checked,\r\n isDuelTerminalCard: nextValue ? false : currentCard.isDuelTerminalCard,\r\n };\r\n }), [setCard]);\r\n\r\n return \r\n \r\n {language['input.1st-edition.label']}\r\n \r\n \r\n \r\n {language['input.speed-duel.label']}\r\n \r\n \r\n \r\n \r\n {language['input.duel-terminal.label']}\r\n \r\n \r\n ;\r\n};","import { StyledDropdown } from 'src/component';\r\nimport styled from 'styled-components';\r\nimport { RadioTrain, TrainGridStyle } from './input-train';\r\n\r\nexport const StyledPendulumFrameContainer = styled(StyledDropdown.Container)`\r\n padding: var(--spacing-xs);\r\n .radio-train {\r\n display: flex;\r\n flex-wrap: wrap;\r\n max-width: 550px;\r\n .radio-train-input-group {\r\n gap: var(--spacing);\r\n }\r\n }\r\n .ant-checkbox-wrapper {\r\n color: var(--color-heavy);\r\n }\r\n .frame-auto-checkbox {\r\n margin-bottom: var(--spacing-xs);\r\n }\r\n ${TrainGridStyle}\r\n`;\r\n\r\nexport const StyledInputLabelWithButton = styled.div`\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\t.input-label {\r\n\t\tflex: 1;\r\n\t}\r\n`;\r\n\r\nexport const StyledNameSetIdInputContainer = styled.div`\r\n display: flex;\r\n align-items: center;\r\n margin-top: var(--spacing-sm);\r\n flex-wrap: wrap;\r\n row-gap: var(--spacing-sm);\r\n`;\r\n\r\nexport const StyledFormatRadioTrain = styled(RadioTrain)`\r\n &.radio-train {\r\n .ant-radio-button-wrapper-checked {\r\n &.ocg-button {\r\n background-color: var(--main-red-scale);\r\n border-color: var(--sub-red-scale);\r\n &:not([class*=\" ant-radio-button-wrapper-disabled\"]).ant-radio-button-wrapper:first-child {\r\n border-right-color: var(--sub-red-scale);\r\n }\r\n &:not(.ant-radio-button-wrapper-disabled):first-child {\r\n border-color: var(--sub-red-scale);\r\n }\r\n &:hover {\r\n background-color: var(--sub-red-scale);\r\n color: var(--color-heavy);\r\n }\r\n }\r\n &.tcg-button {\r\n background-color: var(--main-blue-scale);\r\n border-color: var(--sub-blue-scale);\r\n &:hover {\r\n background-color: var(--sub-blue-scale);\r\n color: var(--color-heavy);\r\n }\r\n }\r\n }\r\n .ocg-button {\r\n color: var(--color-heavy);\r\n &:hover {\r\n color: var(--sub-red-scale);\r\n }\r\n }\r\n .tcg-button {\r\n color: var(--color-heavy);\r\n &:hover {\r\n color: var(--sub-blue-scale);\r\n }\r\n }\r\n }\r\n`;","import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { CardTextInput, CardTextInputRef } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { IconButton } from 'src/component';\r\nimport { RadioTrain } from '../input-train';\r\nimport { CardCheckboxGroup } from '../input-checkbox-group';\r\nimport { randomPassword } from 'src/util';\r\nimport { SyncOutlined } from '@ant-design/icons';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { StickerButtonList } from '../const';\r\nimport styled from 'styled-components';\r\nimport { StyledInputLabelWithButton } from '../input-panel.styled';\r\n\r\nconst StyledFooterInputContainer = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n gap: var(--spacing-sm);\r\n .checkbox-input {\r\n align-self: center;\r\n .ant-checkbox + span {\r\n user-select: none;\r\n }\r\n }\r\n .sticker-input,\r\n .creator-input {\r\n grid-column: span 2;\r\n }\r\n .sticker-input .ant-radio-button-wrapper {\r\n padding-left: var(--spacing-sm);\r\n padding-right: var(--spacing-sm);\r\n }\r\n`;\r\n\r\nexport type FooterInputGroupRef = {\r\n setValue: (value: { password?: string, creator?: string, atk?: string, def?: string }) => void,\r\n};\r\nexport type FooterInputGroup = {\r\n isMonster: boolean,\r\n showCreativeOption: boolean,\r\n} & Pick;\r\nexport const FooterInputGroup = forwardRef(({\r\n isMonster,\r\n showCreativeOption,\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n sticker,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: { sticker },\r\n getUpdater,\r\n }) => ({\r\n sticker,\r\n getUpdater,\r\n })));\r\n const passwordInputRef = useRef(null);\r\n const creatorInputRef = useRef(null);\r\n const atkInputRef = useRef(null);\r\n const defInputRef = useRef(null);\r\n\r\n const changeATK = useMemo(() => getUpdater('atk', value => typeof value === 'string' ? value.trim() : value), [getUpdater]);\r\n const changeDEF = useMemo(() => getUpdater('def', value => typeof value === 'string' ? value.trim() : value), [getUpdater]);\r\n const changePassword = useMemo(() => getUpdater('password', undefined, 'debounce'), [getUpdater]);\r\n const onStickerChange = useMemo(() => getUpdater('sticker'), [getUpdater]);\r\n const changeCreator = useMemo(() => getUpdater('creator', undefined, 'debounce'), [getUpdater]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ password, creator, atk, def }) => {\r\n if (typeof atk === 'string') atkInputRef.current?.setValue(atk);\r\n if (typeof def === 'string') defInputRef.current?.setValue(def);\r\n if (typeof password === 'string') passwordInputRef.current?.setValue(password);\r\n if (typeof creator === 'string') creatorInputRef.current?.setValue(creator);\r\n }\r\n }));\r\n\r\n return \r\n {(isMonster || showCreativeOption) && <>\r\n \r\n \r\n }\r\n \r\n
{language['input.password.label']}
\r\n passwordInputRef.current?.setValue(randomPassword())}\r\n Icon={SyncOutlined}\r\n tooltipProps={{ overlay: language['button.randomize.label'] }}\r\n />\r\n }\r\n defaultValue={useCard.getState().card.password}\r\n onChange={changePassword}\r\n onTakePicker={onTakePicker}\r\n />\r\n \r\n \r\n \r\n {language['input.sticker.label']}\r\n \r\n
;\r\n});","import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { ImageCropper, ImageCropperRef, LinkMarkChooser } from 'src/component';\r\nimport { RadioTrain } from '../input-train';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { ArtFinishButtonList } from '../const';\r\nimport { getArtCanvasCoordinate } from 'src/model';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledImageRadioTrain = styled(RadioTrain)`\r\n .ant-input-group-addon {\r\n flex: 0;\r\n }\r\n .radio-train-input-group .ant-radio-button-wrapper {\r\n min-width: unset;\r\n }\r\n`;\r\n\r\nexport type ImageInputGroupRef = {\r\n setValue: (value: { art?: string, artCrop?: Partial }) => void,\r\n};\r\nexport type ImageInputGroup = {\r\n isLink: boolean,\r\n showExtraDecorativeOption: boolean,\r\n receivingCanvas: HTMLCanvasElement | null,\r\n onCropChange?: (cropInfo: Partial, sourceType: 'internal' | 'external') => void,\r\n onTainted: ImageCropper['onTainted'],\r\n onSourceLoaded: ImageCropper['onSourceLoaded'],\r\n};\r\nexport const ImageInputGroup = forwardRef(({\r\n isLink,\r\n showExtraDecorativeOption,\r\n receivingCanvas,\r\n onSourceLoaded,\r\n onTainted,\r\n onCropChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n opacity,\r\n artFinish,\r\n linkMap,\r\n isPendulum,\r\n art, artCrop,\r\n getUpdater,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n opacity,\r\n artFinish,\r\n linkMap,\r\n isPendulum,\r\n art, artCrop,\r\n },\r\n getUpdater,\r\n setCard,\r\n }) => ({\r\n opacity,\r\n artFinish,\r\n linkMap,\r\n isPendulum,\r\n art, artCrop,\r\n getUpdater,\r\n setCard,\r\n })));\r\n const imageCropperRef = useRef(null);\r\n\r\n const changeLinkMap = useMemo(() => getUpdater('linkMap'), [getUpdater]);\r\n const changePicture = useMemo(() => getUpdater('art'), [getUpdater]);\r\n const changeArtFinish = useMemo(() => getUpdater('artFinish'), [getUpdater]);\r\n const changeImageCrop = useCallback((cropInfo: Partial, sourceType: 'internal' | 'external') => {\r\n onCropChange?.(cropInfo, sourceType);\r\n if (cropInfo) setCard(curr => ({\r\n ...curr,\r\n artCrop: cropInfo,\r\n }));\r\n }, [onCropChange, setCard]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ art, artCrop }) => {\r\n if (typeof art === 'string' && artCrop) {\r\n imageCropperRef.current?.forceExternalSource(art, artCrop);\r\n }\r\n }\r\n }));\r\n\r\n return \r\n {language['input.art-finish.label']}\r\n \r\n : null\r\n }\r\n >\r\n {isLink\r\n ? \r\n :
}\r\n ;\r\n});","import { Tooltip } from 'antd';\r\nimport { IconButton } from 'src/component';\r\nimport { CardTextInput, CardTextInputRef } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { SyncOutlined } from '@ant-design/icons';\r\nimport { normalizedCardName, randomSetID } from 'src/util';\r\nimport { StyledInputLabelWithButton } from '../input-panel.styled';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledNameInputContainer = styled.div`\r\n display: flex;\r\n flex-wrap: wrap;\r\n gap: var(--spacing-sm);\r\n width: 100%;\r\n .name-input {\r\n flex: 3;\r\n min-width: 400px;\r\n }\r\n .set-id-input {\r\n flex: 1;\r\n min-width: 250px;\r\n }\r\n`;\r\nconst StyledCopyButton = styled.span`\r\n cursor: pointer;\r\n`;\r\n\r\nexport type NameSetInputGroupRef = {\r\n setValue: (value: { name?: string, setId?: string }) => void,\r\n}\r\nexport type NameSetInputGroup = {} & Pick;\r\nexport const NameSetInputGroup = forwardRef(({\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n name,\r\n format,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n name,\r\n format,\r\n },\r\n getUpdater,\r\n }) => ({\r\n name,\r\n format,\r\n getUpdater,\r\n })));\r\n const nameInputRef = useRef(null);\r\n const setIdInputRef = useRef(null);\r\n\r\n const changeSetId = useMemo(() => getUpdater('setId'), [getUpdater]);\r\n const changeName = useMemo(() => getUpdater('name', undefined, 'debounce'), [getUpdater]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ name, setId }) => {\r\n if (typeof name === 'string') nameInputRef.current?.setValue(name);\r\n if (typeof setId === 'string') setIdInputRef.current?.setValue(setId);\r\n }\r\n }));\r\n\r\n return \r\n \r\n {\r\n navigator.clipboard.writeText(normalizedCardName(name));\r\n }}>\r\n {language['input.name.label']}\r\n \r\n }\r\n onChange={changeName}\r\n onTakePicker={onTakePicker}\r\n />\r\n \r\n
\r\n {language['input.set-id.label']}\r\n
\r\n setIdInputRef.current?.setValue(randomSetID(format))}\r\n Icon={SyncOutlined}\r\n tooltipProps={{ overlay: language['button.randomize.label'] }}\r\n />\r\n }\r\n onChange={changeSetId}\r\n onTakePicker={onTakePicker}\r\n />\r\n
;\r\n});","import { Checkbox, Input, Popover } from 'antd';\r\nimport { StyledPendulumFrameContainer } from '../input-panel.styled';\r\nimport { RadioTrain } from '../input-train';\r\nimport { FrameInfoBlock } from 'src/component';\r\nimport { CardTextArea, CardTextAreaRef, CardTextInput } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';\r\nimport { FrameInfoMap } from 'src/model';\r\nimport { CaretDownOutlined } from '@ant-design/icons';\r\nimport { getFrameButtonList } from '../const';\r\nimport styled from 'styled-components';\r\nimport { getNavigationProps } from 'src/util';\r\n\r\ntype BottomFrameOptionGridRef = {\r\n focus: () => void,\r\n};\r\ntype BottomFrameOptionGrid = {\r\n pendulumFrame: string,\r\n frameList: ReturnType,\r\n onChange: (value: string | number) => void,\r\n onCancel: () => void,\r\n};\r\nconst BottomFrameOptionGrid = forwardRef(({\r\n frameList,\r\n pendulumFrame,\r\n onChange,\r\n onCancel,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const recentCustomPendulumFrame = useRef(pendulumFrame === 'auto' ? 'spell' : pendulumFrame);\r\n const inputRef = useRef(null);\r\n const [focus, setFocus] = useState(0);\r\n\r\n useImperativeHandle(ref, () => ({\r\n focus: () => inputRef.current?.focus(),\r\n }));\r\n\r\n return {\r\n if (focus >= 0) onChange(frameList[focus].value);\r\n },\r\n onCancel,\r\n })}\r\n >\r\n {\r\n onChange(e.target.checked ? 'auto' : recentCustomPendulumFrame.current);\r\n }}\r\n >{language['input.frame.auto']}\r\n \r\n ;\r\n});\r\n\r\nconst StyledPendulumFrameInputContainer = styled.div`\r\n display: inline-flex;\r\n cursor: pointer;\r\n box-shadow: var(--bs-input);\r\n vertical-align: bottom;\r\n box-shadow: var(--bs-button);\r\n border-radius: var(--br-lg);\r\n &:focus-visible {\r\n outline: 2px solid var(--focus);\r\n }\r\n .pendulum-frame-info-block {\r\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\r\n line-height: 2; // Alignment\r\n background-color: var(--main-level-4);\r\n min-width: 100px;\r\n overflow: hidden;\r\n border: var(--bw) solid var(--sub-level-1);\r\n .frame-info-block-label {\r\n padding: var(--spacing-px) var(--spacing-xs);\r\n }\r\n }\r\n .pendulum-frame-label {\r\n display: inline-block;\r\n background: var(--main-level-4);\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-right: none;\r\n padding: var(--spacing-px) var(--spacing-xs);\r\n border-radius: var(--br-lg) 0 0 var(--br-lg);\r\n line-height: 2; // Alignment\r\n &:last-child {\r\n border-radius: var(--br-lg);\r\n border-right: var(--bw) solid var(--sub-level-1);\r\n }\r\n }\r\n`;\r\nconst StyledPendulumInputContainer = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n column-gap: var(--spacing-sm);\r\n row-gap: var(--spacing-sm);\r\n .red-scale {\r\n color: var(--sub-red-scale);\r\n }\r\n .blue-scale {\r\n color: var(--sub-blue-scale);\r\n }\r\n .joined-row {\r\n position: 'relative';\r\n grid-column: span 2;\r\n .standalone-label {\r\n min-width: 0;\r\n width: unset;\r\n padding-left: var(--spacing-antd);\r\n }\r\n .pendulum-checkbox {\r\n /** Alignment **/\r\n width: var(--width-label);\r\n line-height: 32px;\r\n text-align: right;\r\n font-weight: 500;\r\n margin-right: 0;\r\n padding-right: var(--spacing);\r\n > span {\r\n padding-right: 0;\r\n }\r\n }\r\n .pendulum-checkbox-placeholder {\r\n display: inline-block;\r\n /** Alignment **/\r\n width: var(--width-label);\r\n }\r\n .pendulum-frame-input {\r\n margin-right: var(--spacing-lg);\r\n }\r\n .ant-checkbox-wrapper + .ant-checkbox-wrapper {\r\n margin-left: 0;\r\n }\r\n }\r\n`;\r\n\r\nexport type PendulumInputGroupRef = {\r\n setValue: (value: { pendulumEffect?: string }) => void,\r\n}\r\nexport type PendulumInputGroup = {\r\n showCreativeOption: boolean,\r\n showExtraDecorativeOption: boolean,\r\n} & Pick;\r\nexport const PendulumInputGroup = forwardRef(({\r\n showCreativeOption,\r\n showExtraDecorativeOption,\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n frame,\r\n isPendulum,\r\n pendulumFrame,\r\n pendulumScaleBlue,\r\n pendulumScaleRed,\r\n setCard,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n frame,\r\n isPendulum,\r\n pendulumFrame,\r\n pendulumScaleBlue,\r\n pendulumScaleRed,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n frame,\r\n isPendulum,\r\n pendulumFrame,\r\n pendulumScaleBlue,\r\n pendulumScaleRed,\r\n setCard,\r\n getUpdater,\r\n })));\r\n const containerRef = useRef(null);\r\n const bottomFrameOptionGridRef = useRef(null);\r\n const pendulumEffectInputRef = useRef(null);\r\n const [isMirrorScale, setMirrorScale] = useState(true);\r\n const [frameDropdownVisible, setFrameDropdownVisibleVisible] = useState(false);\r\n const recentCustomPendulumFrame = useRef(pendulumFrame === 'auto' ? 'spell' : pendulumFrame);\r\n const changeToPendulum = (e: any) => setCard(currentCard => {\r\n const willBecomePendulum = e.target.checked;\r\n /** It is rather not desirable to seemingly reduce opacity of pendulum frame, even though it looks closer to real card */\r\n // const currentOpacity = currentCard.opacity;\r\n // const nextOpacity = willBecomePendulum && (currentOpacity.pendulum ?? 100) !== 85\r\n // ? { ...currentOpacity, pendulum: 85 }\r\n // : currentOpacity;\r\n\r\n return {\r\n ...currentCard,\r\n // opacity: nextOpacity,\r\n isPendulum: willBecomePendulum,\r\n };\r\n });\r\n const changeBottomFrame = (value: string | number) => {\r\n const normalizedValue = `${value}`;\r\n\r\n if (normalizedValue !== 'auto') recentCustomPendulumFrame.current = normalizedValue;\r\n setCard(currentCard => {\r\n return { ...currentCard, pendulumFrame: normalizedValue };\r\n });\r\n };\r\n const onRedScaleChange = useMemo(() => getUpdater('pendulumScaleRed'), [getUpdater]);\r\n const onBlueScaleChange = useMemo(() => getUpdater('pendulumScaleBlue'), [getUpdater]);\r\n const changePendulumEffect = useMemo(() => getUpdater('pendulumEffect', undefined, 'debounce'), [getUpdater]);\r\n\r\n const frameList = useMemo(() => getFrameButtonList()\r\n .filter(entry => {\r\n return showExtraDecorativeOption || entry.edition === 'normal';\r\n }),\r\n [showExtraDecorativeOption],\r\n );\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ pendulumEffect }) => {\r\n if (pendulumEffect) pendulumEffectInputRef.current?.setValue(pendulumEffect);\r\n }\r\n }));\r\n\r\n const currentPendulumFrame = FrameInfoMap[pendulumFrame];\r\n return \r\n
\r\n {frame !== 'link'\r\n ? {language['input.pendulum.label']}\r\n :
}\r\n {showCreativeOption && \r\n {\r\n setFrameDropdownVisibleVisible(false);\r\n containerRef.current?.focus();\r\n }}\r\n onChange={changeBottomFrame}\r\n />\r\n
}\r\n >\r\n {\r\n if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {\r\n setFrameDropdownVisibleVisible(true);\r\n /** Popover takes time to mount / become visible */\r\n setTimeout(() => {\r\n bottomFrameOptionGridRef.current?.focus();\r\n }, 200);\r\n\r\n return false;\r\n }\r\n }}\r\n >\r\n {language['input.bottom-frame.label']} \r\n {currentPendulumFrame\r\n ? \r\n : }\r\n \r\n }\r\n {(isPendulum && showCreativeOption)\r\n && setMirrorScale(e.target.checked)} checked={isMirrorScale}>\r\n {language['input.mirror-scale.label']}\r\n }\r\n
\r\n {isPendulum && <>\r\n
\r\n \r\n {language['input.scale.label'](\r\n \r\n {language['input.scale.blue.label']}\r\n \r\n )}\r\n }\r\n value={pendulumScaleBlue}\r\n onChange={e => {\r\n onBlueScaleChange(e);\r\n if (isMirrorScale) onRedScaleChange(e);\r\n }} />\r\n
\r\n
\r\n \r\n {language['input.scale.label'](\r\n \r\n {language['input.scale.red.label']}\r\n \r\n )}\r\n }\r\n value={pendulumScaleRed}\r\n onChange={e => {\r\n if (isMirrorScale) onBlueScaleChange(e);\r\n onRedScaleChange(e);\r\n }}\r\n />\r\n
\r\n
\r\n {/** Explicit label does not looks too good */}\r\n {/* Pendulum Effect */}\r\n \r\n
\r\n }\r\n ;\r\n});","import { Checkbox, Tooltip } from 'antd';\r\nimport { RadioTrain } from '../input-train';\r\nimport { Explanation, FormattingHelpDrawer } from 'src/component';\r\nimport { CardTextInput, CardTextInputRef } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { CondenseType } from 'src/model';\r\nimport { CondenseThresholdButtonList, IconTypeMap } from '../const';\r\nimport styled from 'styled-components';\r\nimport { checkMonster } from 'src/util';\r\n\r\nconst StyledPostPendulumInputContainer = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr max-content;\r\n grid-template-areas:\r\n \"type-input input-helper\"\r\n \"condense-input help-button\";\r\n gap: var(--spacing-sm);\r\n align-items: center;\r\n .formatting-help-button {\r\n grid-area: help-button;\r\n &:focus {\r\n box-shadow: 0 0 0 2px var(--focus);\r\n }\r\n }\r\n .input-kanji-helper {\r\n grid-area: input-helper;\r\n }\r\n .type-ability-input {\r\n grid-area: type-input;\r\n }\r\n .condense-input {\r\n grid-area: condense-input;\r\n\t\t.standalone-addon.ant-input-group-addon {\r\n\t\t\twidth: unset;\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper {\r\n\t\t\tflex: 1 1 90px;\r\n\t\t}\r\n\t}\r\n &.variant-tcg {\r\n .type-ability-input {\r\n grid-column: span 2;\r\n }\r\n }\r\n`;\r\n\r\nexport type PostPendulumInputGroupRef = {\r\n setValue: (value: { typeAbility?: string[] }) => void,\r\n}\r\nexport type PostPendulumInputGroup = {} & Pick;\r\nexport const PostPendulumInputGroup = forwardRef(({\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n frame,\r\n cardIcon,\r\n format,\r\n furiganaHelper,\r\n condenseTolerant,\r\n setCard,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n frame,\r\n cardIcon,\r\n format,\r\n furiganaHelper,\r\n effectStyle,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n frame,\r\n cardIcon,\r\n format,\r\n furiganaHelper,\r\n condenseTolerant: effectStyle?.condenseTolerant,\r\n setCard,\r\n getUpdater,\r\n })));\r\n const typeAbilitySeparator = format === 'ocg' ? '/' : '/';\r\n const typeAbilityInputRef = useRef(null);\r\n const changeTypeAbility = useMemo(() => {\r\n return getUpdater(\r\n 'typeAbility',\r\n value => {\r\n return typeof value !== 'string' ? [] : value.split(//|\\//)\r\n .map(entry => `${entry}`.trim())\r\n .filter(entry => typeof entry === 'string' && entry.length > 0);\r\n },\r\n 'debounce',\r\n );\r\n }, [getUpdater]);\r\n const toggleFuriganaHelper = useCallback((e: any) => setCard(currentCard => {\r\n return { ...currentCard, furiganaHelper: e.target.checked };\r\n }), [setCard]);\r\n const onCondenseTolerantChange = (value: CondenseType) => {\r\n setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n effectStyle: {\r\n ...currentCard.effectStyle,\r\n condenseTolerant: value,\r\n }\r\n };\r\n });\r\n };\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ typeAbility }) => {\r\n if (typeAbility) typeAbilityInputRef.current?.setValue(typeAbility.join(typeAbilitySeparator));\r\n }\r\n }));\r\n\r\n const typeLabel = cardIcon === 'auto'\r\n ? checkMonster({ frame })\r\n ? 'input.type.monster.label'\r\n : 'input.type.st.label'\r\n : IconTypeMap[cardIcon].value === 'st'\r\n ? 'input.type.st.label'\r\n : 'input.type.monster.label';\r\n const isOCG = format === 'ocg';\r\n return \r\n \r\n {isOCG && \r\n \r\n {language['input.furigana-helper.label']}\r\n \r\n }\r\n onCondenseTolerantChange(value as CondenseType)}\r\n optionList={CondenseThresholdButtonList}\r\n >\r\n \r\n {language['input.condense.label']} \r\n \r\n \r\n \r\n ;\r\n});","import { Checkbox, Input, Popover } from 'antd';\r\nimport { CompactPicker } from 'react-color';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { DefaultColorList } from 'src/model';\r\nimport { useEffect, useState } from 'react';\r\nimport { HexColorRegex, hexToRGBA } from 'src/util';\r\n\r\n/** Spacing in this component mimic react-color's */\r\nconst StyledInlineColorPickerContainer = styled.div`\r\n color: var(--color);\r\n text-shadow: var(--ts);\r\n font-weight: 500;\r\n padding: 5px;\r\n display: grid;\r\n grid-template-columns: max-content 1fr;\r\n gap: 3px;\r\n .color-list {\r\n display: flex;\r\n flex-wrap: nowrap;\r\n gap: 3px;\r\n }\r\n .color-block {\r\n height: 17px;\r\n width: 17px;\r\n cursor: pointer;\r\n position: relative;\r\n outline: none;\r\n border: var(--bw) solid var(--sub-level-4);\r\n &.static-block {\r\n cursor: default;\r\n height: 9px;\r\n width: 9px;\r\n margin: 4px 0;\r\n border: none;\r\n }\r\n }\r\n .active-dot {\r\n position: absolute;\r\n inset: var(--spacing-xs);\r\n background: rgb(0, 0, 0);\r\n border-radius: 50%;\r\n opacity: 1;\r\n }\r\n .color-input {\r\n display: grid;\r\n grid-template-columns: max-content 1fr;\r\n gap: 3px;\r\n border-left: var(--bw-lg) solid var(--sub-level-4);\r\n padding-left: 3px;\r\n input {\r\n width: 58px;\r\n font-size: var(--fs-sm);\r\n line-height: 1;\r\n border: none;\r\n padding: 0 5px;\r\n }\r\n }\r\n`;\r\nconst InlineColorList = [\r\n { hex: '#FFFFFF', rgb: [255, 255, 255] },\r\n { hex: '#000000', rgb: [0, 0, 0] },\r\n { hex: '#FF0000', rgb: [255, 0, 0] },\r\n { hex: '#FFFF00', rgb: [255, 255, 0] },\r\n { hex: '#00FF00', rgb: [0, 255, 0] },\r\n { hex: '#00FFFF', rgb: [0, 255, 255] },\r\n { hex: '#0000FF', rgb: [0, 0, 255] },\r\n { hex: '#FF00FF', rgb: [255, 0, 255] },\r\n];\r\ntype InlineColorPicker = {\r\n value?: string,\r\n onChange?: (hexValue: string) => void,\r\n}\r\nconst InlineColorPicker = ({\r\n value = '',\r\n onChange,\r\n}: InlineColorPicker) => {\r\n const [currentText, setCurrentText] = useState(value);\r\n const [internalValue, setInternalValue] = useState(() => {\r\n return {\r\n hex: HexColorRegex.test(value) ? value : '#000000',\r\n rgb: hexToRGBA(value, false),\r\n };\r\n });\r\n\r\n useEffect(() => {\r\n const normalizedText = currentText.startsWith('#') ? currentText : `#${currentText}`;\r\n\r\n if (HexColorRegex.test(normalizedText)) {\r\n setCurrentText(normalizedText);\r\n setInternalValue({\r\n hex: normalizedText,\r\n rgb: hexToRGBA(normalizedText, false),\r\n });\r\n onChange?.(normalizedText);\r\n }\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [currentText]);\r\n\r\n useEffect(() => {\r\n setCurrentText(value);\r\n setInternalValue({\r\n hex: HexColorRegex.test(value) ? value : '#000000',\r\n rgb: hexToRGBA(value, false),\r\n });\r\n }, [value]);\r\n\r\n return \r\n
\r\n {InlineColorList.map(({ hex, rgb }) => {\r\n /** Contrast formula from google \\ :v / */\r\n const dotColor = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000 >= 128\r\n ? '#000000'\r\n : '#FFFFFF';\r\n\r\n return
onChange?.(hex)}>\r\n {internalValue.hex.toUpperCase() === hex && }\r\n
;\r\n })}\r\n
\r\n
\r\n
\r\n {\r\n setCurrentText(e.target.value);\r\n }}\r\n />\r\n
\r\n ;\r\n};\r\n\r\nconst StyledTextStyleContainer = styled.div`\r\n display: inline-grid;\r\n grid-template-columns: 1fr 1fr 1fr 1fr;\r\n column-gap: var(--spacing-xxs);\r\n padding: var(--spacing-px);\r\n margin-right: var(--spacing-sm);\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br);\r\n background-color: var(--main-level-4);\r\n cursor: pointer;\r\n &:hover {\r\n border-color: var(--main-active);\r\n }\r\n .text-style-preview-section {\r\n width: 8px;\r\n height: 28px; // Alignment\r\n }\r\n`;\r\nconst StyledTextStylePicker = styled.div`\r\n position: relative;\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n gap: var(--spacing-px);\r\n &.custom-style-picker {\r\n background-color: var(--sub-level-4); // Mimic border color\r\n }\r\n .style-section {\r\n z-index: 1;\r\n position: relative;\r\n background-color: var(--main-level-3);\r\n }\r\n .style-picker-section {\r\n overflow: hidden;\r\n .shadow-checkbox .ant-checkbox {\r\n transform: translateY(1px);\r\n }\r\n > .ant-checkbox-wrapper {\r\n padding: var(--spacing-xs);\r\n }\r\n }\r\n .custom-style-expand {\r\n display: grid;\r\n grid-template-columns: 1fr max-content;\r\n column-gap: var(--spacing-xs);\r\n .ant-checkbox-wrapper > span {\r\n padding-right: 0;\r\n }\r\n }\r\n .radio-train {\r\n padding: var(--spacing-xs);\r\n padding-bottom: 0;\r\n .standalone-addon {\r\n flex: 1 1 auto;\r\n text-align: left;\r\n }\r\n .radio-train-input-group {\r\n flex: 0 0 auto;\r\n }\r\n .ant-radio-button-wrapper {\r\n height: 26px;\r\n line-height: 24px;\r\n }\r\n }\r\n`;\r\nconst TextStyleInfoMap = {\r\n effectTextStyle: {\r\n keyName: 'effectTextStyle' as const,\r\n labelKey: 'input.text-style.section.effect.label',\r\n },\r\n pendulumTextStyle: {\r\n keyName: 'pendulumTextStyle' as const,\r\n labelKey: 'input.text-style.section.pendulum.label',\r\n },\r\n statTextStyle: {\r\n keyName: 'statTextStyle' as const,\r\n labelKey: 'input.text-style.section.stat.label',\r\n },\r\n typeTextStyle: {\r\n keyName: 'typeTextStyle' as const,\r\n labelKey: 'input.text-style.section.type.label',\r\n },\r\n};\r\nexport const TextStylePicker = () => {\r\n const language = useLanguage();\r\n const {\r\n statTextStyle,\r\n typeTextStyle,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n statTextStyle,\r\n typeTextStyle,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n statTextStyle,\r\n typeTextStyle,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n setCard,\r\n })));\r\n\r\n const styleList = [\r\n { info: TextStyleInfoMap.effectTextStyle, value: effectTextStyle },\r\n { info: TextStyleInfoMap.pendulumTextStyle, value: pendulumTextStyle },\r\n { info: TextStyleInfoMap.statTextStyle, value: statTextStyle },\r\n { info: TextStyleInfoMap.typeTextStyle, value: typeTextStyle },\r\n ];\r\n return \r\n \r\n {styleList.map(({ info, value }) => {\r\n const { keyName, labelKey } = info;\r\n const [custom, fillStyle, hasShadow, shadow] = value;\r\n\r\n return
\r\n

\r\n \r\n {language[labelKey]}\r\n \r\n {\r\n setCard(currentCard => {\r\n const applyStyle = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n [keyName]: [applyStyle, ...value.slice(1)],\r\n };\r\n });\r\n }}\r\n >{language['input.text-style.custom.label']}\r\n

\r\n {custom &&
\r\n

\r\n {\r\n setCard(currentCard => {\r\n const applyShadow = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n [keyName]: [...value.slice(0, 2), applyShadow, value[3]],\r\n };\r\n });\r\n }}\r\n >\r\n {language['input.text-style.shadow.label']}\r\n \r\n

\r\n {hasShadow && setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n [keyName]: [...value.slice(0, 3), shadowValue],\r\n };\r\n })}\r\n />}\r\n

{language['input.text-style.color.label']}

\r\n {\r\n setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n [keyName]: [value[0], color.hex, ...value.slice(2, 4)],\r\n };\r\n });\r\n }}\r\n />\r\n
}\r\n
;\r\n })}\r\n
\r\n
}\r\n >\r\n \r\n {styleList.map(({ info, value }) => {\r\n const { keyName } = info;\r\n const [custom, fillStyle, hasShadow, shadow] = value;\r\n\r\n return
;\r\n })}\r\n \r\n ;\r\n};","import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\r\nimport {\r\n Card,\r\n CardOpacity,\r\n NameStyle,\r\n NameStyleType,\r\n FrameInfoMap,\r\n} from '../../model';\r\nimport {\r\n Affiliation,\r\n AppHeader,\r\n StandaloneLabel,\r\n} from '../../component';\r\nimport {\r\n checkLink,\r\n checkMonster,\r\n} from '../../util';\r\nimport {\r\n getFoilButtonList,\r\n getAttributeList,\r\n FinishButtonList,\r\n FormatButtonList,\r\n} from './const';\r\nimport { CharPicker } from './char-picker';\r\nimport { NameStylePicker, NameStylePickerRef } from './name-style-picker';\r\nimport { CheckboxTrain, FrameTrain, RadioTrain } from './input-train';\r\nimport { Explanation } from 'src/component/explanation';\r\nimport { changeCardFormat, useCard, useLanguage, useSetting } from '../../service';\r\nimport { LayoutPicker, OpacityPickerRef } from './layout-picker';\r\nimport {\r\n CardIconInputGroup,\r\n EffectInputGroup,\r\n EffectInputGroupRef,\r\n FooterInputGroup,\r\n FooterInputGroupRef,\r\n ImageInputGroup,\r\n ImageInputGroupRef,\r\n NameSetInputGroup,\r\n NameSetInputGroupRef,\r\n PendulumInputGroup,\r\n PendulumInputGroupRef,\r\n PostPendulumInputGroup,\r\n PostPendulumInputGroupRef,\r\n} from './input-group';\r\nimport {\r\n TextStylePicker,\r\n} from './text-style-picker';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport {\r\n StyledFormatRadioTrain,\r\n StyledNameSetIdInputContainer,\r\n} from './input-panel.styled';\r\nimport './input-panel.scss';\r\n\r\nexport type CardInputPanelRef = {\r\n forceCardData: (card: Card) => void,\r\n}\r\nexport type CardInputPanel = {\r\n artworkCanvas: ImageInputGroup['receivingCanvas'],\r\n backgroundCanvas: ImageInputGroup['receivingCanvas'],\r\n} & Pick;\r\nexport const CardInputPanel = React.forwardRef(({\r\n artworkCanvas,\r\n backgroundCanvas,\r\n onCropChange,\r\n onTainted,\r\n onSourceLoaded,\r\n}: CardInputPanel, forwardedRef) => {\r\n const language = useLanguage();\r\n const {\r\n format,\r\n frame, foil, finish, opacity,\r\n nameStyleType, nameStyle,\r\n isPendulum,\r\n attribute,\r\n getUpdater,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n format,\r\n frame, foil, finish, opacity,\r\n nameStyleType, nameStyle,\r\n isPendulum,\r\n attribute,\r\n },\r\n getUpdater,\r\n setCard,\r\n }) => ({\r\n format,\r\n frame, foil, finish, opacity,\r\n nameStyleType, nameStyle,\r\n isPendulum,\r\n attribute,\r\n getUpdater,\r\n setCard,\r\n })));\r\n const { setting } = useSetting();\r\n const { showCreativeOption, showExtraDecorativeOption } = setting;\r\n\r\n const stylePickerRef = useRef(null);\r\n\r\n const isLink = checkLink({ frame });\r\n const isMonster = checkMonster({ frame });\r\n const [stylePickerResetCount, setStylePickerResetCount] = useState(0);\r\n const foilButtonList = useMemo(() => getFoilButtonList({\r\n normal: language['input.foil.normal.label'],\r\n gold: language['input.foil.gold.label'],\r\n platinum: language['input.foil.platinum.label'],\r\n }), [language]);\r\n\r\n const imageInputGroupRef = useRef(null);\r\n const layoutPickerRef = useRef(null);\r\n const nameSetIdInputGroupRef = useRef(null);\r\n const pendulumInputGroupRef = useRef(null);\r\n const effectInputGroupRef = useRef(null);\r\n const postPendulumInputGroupRef = useRef(null);\r\n const footerInputGroupRef = useRef(null);\r\n\r\n const [pickerTarget, setPickerTarget] = useState<{\r\n id: string,\r\n setValue: (nextValue: string) => void,\r\n }>({\r\n id: '',\r\n setValue: () => {},\r\n });\r\n\r\n const changeFormat = (formatValue: string | number) => {\r\n setCard(currentCard => {\r\n const nextFormat = `${formatValue}`;\r\n const formatSwappedCard = changeCardFormat(currentCard, nextFormat);\r\n\r\n const { name, setId, effect, typeAbility, password, creator, pendulumEffect } = formatSwappedCard;\r\n nameSetIdInputGroupRef.current?.setValue({ name, setId });\r\n effectInputGroupRef.current?.setValue(effect);\r\n pendulumInputGroupRef.current?.setValue({ pendulumEffect });\r\n postPendulumInputGroupRef.current?.setValue({ typeAbility });\r\n footerInputGroupRef.current?.setValue({ creator, password });\r\n\r\n return formatSwappedCard;\r\n });\r\n };\r\n const changeFoil = useMemo(() => getUpdater('foil'), [getUpdater]);\r\n const onFinishChange = useMemo(() => getUpdater('finish'), [getUpdater]);\r\n const changeOpacity = useCallback((opacity: CardOpacity) => setCard(curr => ({ ...curr, opacity })), [setCard]);\r\n const changeAttribute = useMemo(() => getUpdater('attribute'), [getUpdater]);\r\n const changeNameStyle = useCallback((type: NameStyleType, value: Partial) => {\r\n setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n nameStyleType: type,\r\n nameStyle: value,\r\n };\r\n });\r\n }, [setCard]);\r\n\r\n const attributeList = useMemo(() => getAttributeList(format, language), [format, language]);\r\n\r\n useEffect(() => {\r\n stylePickerRef.current?.setValue({ font: nameStyle.font });\r\n }, [nameStyle]);\r\n\r\n useEffect(() => {\r\n layoutPickerRef.current?.setValue(opacity);\r\n }, [opacity]);\r\n\r\n useImperativeHandle(forwardedRef, () => ({\r\n forceCardData: card => {\r\n setStylePickerResetCount(cnt => cnt + 1);\r\n const {\r\n name,\r\n art, artCrop,\r\n background, backgroundCrop,\r\n opacity,\r\n setId,\r\n pendulumEffect,\r\n typeAbility,\r\n effect,\r\n atk, def,\r\n creator, password,\r\n } = card;\r\n\r\n imageInputGroupRef.current?.setValue({ art, artCrop });\r\n layoutPickerRef.current?.setValue({ ...opacity, background, backgroundCrop });\r\n nameSetIdInputGroupRef.current?.setValue({ name, setId });\r\n pendulumInputGroupRef.current?.setValue({ pendulumEffect });\r\n effectInputGroupRef.current?.setValue(effect);\r\n postPendulumInputGroupRef.current?.setValue({ typeAbility });\r\n footerInputGroupRef.current?.setValue({ atk, def, creator, password });\r\n }\r\n }));\r\n\r\n return \r\n \r\n
\r\n \r\n\r\n
\r\n \r\n {language['input.format.label']}\r\n \r\n \r\n {language['input.foil.label']}\r\n \r\n {showExtraDecorativeOption && \r\n {language['input.finish.label']}\r\n }\r\n
\r\n\r\n {showCreativeOption &&
\r\n \r\n \r\n
}\r\n\r\n postPendulumInputGroupRef.current?.setValue({ typeAbility })} />\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n {language['input.attribute.label']}\r\n \r\n\r\n {(isPendulum || frame !== 'link' || showCreativeOption)\r\n && }\r\n\r\n \r\n\r\n
\r\n
\r\n \r\n {language['input.effect.label']}\r\n \r\n {showCreativeOption ? :
}\r\n \r\n
\r\n \r\n
\r\n\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
;\r\n});","import { Button, Dropdown, Menu, notification, Tooltip } from 'antd';\r\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\r\nimport { MasterSeriesCanvas } from 'src/model';\r\nimport { useCardExport, useLanguage, useMasterSeriDrawer, useSetting } from 'src/service';\r\nimport { MenuOutlined } from '@ant-design/icons';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forceRefocus } from 'src/util';\r\n\r\nconst StyledDownloadDropdownLabel = styled(Menu.Item)`\r\n color: var(--color);\r\n padding: 1px 12px 5px 12px; // Alignment\r\n font-size: var(--fs-sm);\r\n border-bottom: var(--bw) solid var(--sub-level-4);\r\n cursor: default;\r\n &.ant-dropdown-menu-item.ant-dropdown-menu-item-disabled:hover {\r\n cursor: default;\r\n background: var(--main-level-3);\r\n }\r\n`;\r\nconst StyledDownloadDropdownOption = styled(Menu.Item)`\r\n &.active-resolution {\r\n background-color: var(--sub-active);\r\n }\r\n`;\r\nconst StyledDownloadButton = styled(Button)`\r\n padding: 0;\r\n .button-label {\r\n padding: 4px 15px;\r\n height: 100%; // Alignment\r\n align-content: center;\r\n border-radius: var(--br-lg);\r\n line-height: 1.5;\r\n }\r\n .button-option {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n height: 100%;\r\n display: flex;\r\n align-items: center;\r\n padding: var(--spacing);\r\n border-left: var(--bw) solid var(--sub-secondary);\r\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\r\n .anticon {\r\n font-size: var(--fs-2xl);\r\n margin-left: 0;\r\n }\r\n &:hover {\r\n background: #399af9;\r\n }\r\n }\r\n`;\r\nexport type DownloadButtonRef = {\r\n download: () => void,\r\n}\r\nexport type DownloadButton = {\r\n isTainted: boolean,\r\n isInitializing: boolean,\r\n imageChangeCount: number,\r\n canvasMap: MasterSeriesCanvas,\r\n onDownloadError: () => void,\r\n};\r\nexport const DownloadButton = forwardRef(({\r\n isTainted,\r\n isInitializing,\r\n imageChangeCount,\r\n canvasMap,\r\n onDownloadError,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n allowHotkey,\r\n resolution,\r\n updateSetting,\r\n } = useSetting(useShallow(({\r\n setting: { allowHotkey, resolution },\r\n updateSetting,\r\n }) => ({\r\n allowHotkey,\r\n resolution,\r\n updateSetting,\r\n })));\r\n const { onExport } = useMasterSeriDrawer(\r\n true,\r\n canvasMap,\r\n {\r\n imageChangeCount,\r\n isInitializing,\r\n },\r\n );\r\n const {\r\n drawCanvasRef,\r\n } = canvasMap;\r\n const exportRef = useRef({\r\n currentPipeline: Promise.resolve(),\r\n pipelineRunning: false,\r\n });\r\n const [isDownloading, setDownloading] = useState(false);\r\n const onDownloadComplete = useCallback(() => {\r\n setDownloading(false);\r\n }, []);\r\n const { onSave } = useCardExport({\r\n isTainted,\r\n isInitializing,\r\n drawCanvasRef,\r\n exportRef,\r\n onExport,\r\n onDownloadError,\r\n onDownloadComplete,\r\n });\r\n\r\n const download = (size?: [number, number]) => {\r\n if (isDownloading) return;\r\n if (isTainted) {\r\n notification.error({\r\n message: 'Your card is tainted, you must save manually',\r\n description: 'Right click the card → Choose \"Save image as...\"',\r\n });\r\n return;\r\n }\r\n setDownloading(true);\r\n onSave(size);\r\n return;\r\n };\r\n useImperativeHandle(ref, () => ({\r\n download,\r\n }));\r\n\r\n if (isTainted) return null;\r\n return
\r\n
\r\n download()}>\r\n Ctrl-S / ⌘-S : null}>\r\n
\r\n {isDownloading\r\n ? language['button.download.ongoing.label']\r\n : language['button.download.label']}\r\n
\r\n
\r\n e.domEvent.stopPropagation()}>\r\n {language['button.download.resolution.label']}\r\n {[\r\n { width: 549, height: 800 },\r\n { width: 813, height: 1185 },\r\n ].map(({ width, height }) => {\r\n return {\r\n updateSetting({\r\n resolution: [width, height],\r\n });\r\n forceRefocus();\r\n }}\r\n >\r\n {width} × {height}\r\n ;\r\n })}\r\n }\r\n >\r\n
e.stopPropagation()}>\r\n \r\n
\r\n \r\n
\r\n
;\r\n});","import { useCallback, useEffect, useRef } from 'react';\r\nimport { compressCardData, insertUrlParam, normalizedCardName } from 'src/util';\r\nimport { useCard } from './use-card';\r\nimport { CardOpacity } from 'src/model';\r\nimport { useSetting } from './use-setting';\r\n\r\nexport type UseCardExport = {\r\n isTainted: boolean,\r\n isInitializing: boolean,\r\n drawCanvasRef: React.RefObject,\r\n exportRef: React.MutableRefObject<{\r\n currentPipeline: Promise;\r\n pipelineRunning: boolean;\r\n }>,\r\n onExport: (exportProps: {\r\n isPendulum: boolean,\r\n opacity: Partial,\r\n isRelevant: () => boolean,\r\n }) => Promise,\r\n onDownloadError: () => void,\r\n onDownloadComplete: () => void,\r\n};\r\nexport const useCardExport = ({\r\n isTainted,\r\n isInitializing,\r\n drawCanvasRef,\r\n exportRef,\r\n onExport,\r\n onDownloadError,\r\n onDownloadComplete,\r\n}: UseCardExport) => {\r\n const {\r\n card: currentCard,\r\n } = useCard();\r\n const resolution = useSetting(state => state.setting.resolution);\r\n const {\r\n opacity,\r\n name,\r\n isPendulum,\r\n } = currentCard;\r\n const pendingSave = useRef(false);\r\n\r\n const download = useCallback((size: [number, number] = resolution) => {\r\n const drawCanvas = drawCanvasRef.current;\r\n /** Clone node so we can resize it as will */\r\n const cloneCanvas = drawCanvas?.cloneNode() as HTMLCanvasElement | null;\r\n const drawCanvasContext = drawCanvas?.getContext('2d');\r\n const cloneCanvasContext = cloneCanvas?.getContext('2d');\r\n if (drawCanvas && drawCanvasContext\r\n && cloneCanvas && cloneCanvasContext\r\n && !isTainted\r\n ) {\r\n try {\r\n if (size) {\r\n cloneCanvas.width = size[0];\r\n cloneCanvas.height = size[1];\r\n }\r\n /** Resize here */\r\n cloneCanvasContext.drawImage(\r\n drawCanvas,\r\n 0, 0, drawCanvas.width, drawCanvas.height,\r\n 0, 0, cloneCanvas.width, cloneCanvas.height,\r\n );\r\n\r\n const normalizedName = normalizedCardName(name);\r\n var link = document.createElement('a');\r\n link.download = normalizedName\r\n ? `${normalizedName}.png`\r\n : 'card.png';\r\n link.href = cloneCanvas.toDataURL('image/png');\r\n link.click();\r\n } catch (e) {\r\n onDownloadError();\r\n }\r\n }\r\n document.querySelector('#export-canvas-guard')?.classList.remove('guard-on');\r\n onDownloadComplete();\r\n }, [drawCanvasRef, isTainted, name, resolution, onDownloadComplete, onDownloadError]);\r\n const onSave = (size?: [number, number]) => {\r\n document.querySelector('#export-canvas-guard')?.classList.add('guard-on');\r\n const queuingSize = size ? [...size] as [number, number] : undefined;\r\n /** Prevent split-second download. By using hotkey user is able to perform extremely fast save process before the pipeline start running, thus getting the previous card data instead of the most recent one. */\r\n setTimeout(() => {\r\n if (exportRef.current.pipelineRunning === false) {\r\n download(queuingSize);\r\n } else pendingSave.current = true;\r\n }, 200);\r\n };\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n const normalizedName = normalizedCardName(name);\r\n\r\n if (relevant) {\r\n document.title = normalizedName\r\n ? `${normalizedName} - Yu-Gi-Oh Carder`\r\n : 'Yu-Gi-Oh Carder';\r\n }\r\n }, 500);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n }, [name]);\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n let confirmReload = (ev: Event) => {\r\n ev.preventDefault();\r\n return 'Leave right now may make you lose unsaved progress, proceed?';\r\n };\r\n if (isInitializing === false) {\r\n localStorage.setItem('card-data', JSON.stringify(currentCard));\r\n localStorage.setItem('card-version', process.env.REACT_APP_VERSION ?? 'unknown');\r\n\r\n /**\r\n * Run export pipeline:\r\n * - Immediately mark the pipeline as running, then run wait for the current pipeline (1).\r\n * - If the (1) pipeline is no longer relevant, end effect.\r\n * - Otherwise (the current pipeline is the newest), start export pipeline, this export pipeline is now the current pipeline (2).\r\n * - If the (2) pipeline is no longer relevant, end effect.\r\n * - Otherwise finish the pipeline and write result, also mark the pipeline as no longer running.\r\n */\r\n (async () => {\r\n const canvasRef = drawCanvasRef.current;\r\n if (canvasRef) {\r\n window.addEventListener('beforeunload', confirmReload);\r\n document.getElementById('export-canvas')?.classList.remove('js-export-available');\r\n document.getElementById('export-canvas-guard')?.setAttribute('style', '');\r\n document.getElementById('save-button-waiting')?.setAttribute('style', 'display: block');\r\n\r\n exportRef.current.pipelineRunning = true;\r\n /** Artifical delay, turn on to test export timing */\r\n // await new Promise(resolve => setTimeout(() => resolve(true), 3000));\r\n await exportRef.current.currentPipeline;\r\n\r\n if (relevant) {\r\n exportRef.current.currentPipeline = onExport({ isPendulum, opacity, isRelevant: () => relevant });\r\n\r\n await exportRef.current.currentPipeline;\r\n if (relevant) {\r\n const condensedCard = compressCardData(currentCard);\r\n if (typeof condensedCard === 'string') insertUrlParam('data', condensedCard);\r\n\r\n document.getElementById('export-canvas')?.classList.add('js-export-available');\r\n document.getElementById('export-canvas-guard')?.setAttribute('style', 'display: none');\r\n document.getElementById('save-button-waiting')?.setAttribute('style', 'display: none');\r\n window.removeEventListener('beforeunload', confirmReload);\r\n exportRef.current.pipelineRunning = false;\r\n\r\n if (pendingSave.current) {\r\n pendingSave.current = false;\r\n download();\r\n }\r\n }\r\n }\r\n }\r\n })();\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('beforeunload', confirmReload);\r\n relevant = false;\r\n };\r\n });\r\n\r\n return {\r\n onSave,\r\n };\r\n};","import styled from 'styled-components';\r\n\r\nexport const StyledDataButtonPanelContainer = styled.div`\r\n display: flex;\r\n column-gap: var(--spacing);\r\n border-radius: var(--br-lg);\r\n font-size: var(--fs-4xl);\r\n line-height: 1.5;\r\n margin: auto;\r\n max-width: var(--card-width);\r\n min-height: 59px;\r\n outline: none !important; // Avoid default state styling\r\n padding: var(--spacing);\r\n padding-right: 0;\r\n text-align: center;\r\n text-shadow: 0 1px 2px black;\r\n .anticon {\r\n cursor: pointer;\r\n }\r\n button {\r\n color: white;\r\n border-radius: var(--br-lg);\r\n outline: none !important; // Avoid default state styling\r\n cursor: pointer;\r\n }\r\n .save-button {\r\n flex: 1;\r\n font-size: var(--fs-xl);\r\n border: var(--bw) solid var(--sub-secondary);\r\n font-weight: 500;\r\n box-shadow: var(--bs-button);\r\n height: 39px; // Alignment\r\n line-height: 1;\r\n &:focus, &:active {\r\n color: white;\r\n }\r\n }\r\n #save-button-waiting {\r\n cursor: wait;\r\n position: absolute;\r\n width: 100%;\r\n height: 100%;\r\n top: 0;\r\n left: 0;\r\n z-index: 1;\r\n }\r\n #save-button-ready {\r\n cursor: pointer;\r\n &:hover {\r\n background-color: var(--sub-info);\r\n box-shadow: none;\r\n }\r\n }\r\n .save-button-container {\r\n display: flex;\r\n flex: 1;\r\n font-size: var(--fs);\r\n line-height: 1.35;\r\n position: relative;\r\n }\r\n .imexport {\r\n flex: 0 0 210px;\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n column-gap: var(--spacing);\r\n button {\r\n font-size: var(--fs);\r\n background-color: var(--main-tertiary);\r\n border: var(--bw) solid var(--sub-tertiary);\r\n box-shadow: var(--bs-button);\r\n &:hover {\r\n background-color: var(--sub-tertiary);\r\n box-shadow: none;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport const StyledCardCanvasGroupContainer = styled.div`\r\n width: var(--card-width);\r\n height: var(--card-height);\r\n margin-bottom: var(--spacing);\r\n transform: translateX(var(--translate-ratio)) translateY(var(--translate-ratio)) scale(var(--resize-ratio))\r\n translateZ(0);\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n canvas {\r\n position: absolute;\r\n left: 0;\r\n z-index: 1;\r\n pointer-events: none;\r\n }\r\n &:hover {\r\n .reset-button,\r\n .lightbox-button {\r\n display: block;\r\n }\r\n #export-canvas.js-export-available {\r\n display: inline-block !important; // Override js-controlled inline style\r\n cursor: default;\r\n }\r\n #export-canvas-guard {\r\n display: flex;\r\n cursor: wait;\r\n transition: all 2s;\r\n }\r\n }\r\n #export-canvas {\r\n display: none;\r\n z-index: 100;\r\n pointer-events: all;\r\n }\r\n #export-canvas-guard {\r\n position: absolute;\r\n left: 0;\r\n display: none;\r\n align-items: center;\r\n justify-content: center;\r\n z-index: 101;\r\n // background-color: #ffffff08;\r\n width: var(--card-width);\r\n height: var(--card-height);\r\n .anticon {\r\n font-size: var(--fs-4xl);\r\n }\r\n .canvas-guard-alert {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n color: white;\r\n padding: var(--spacing-xs) var(--spacing);\r\n border-radius: 0 0 0 var(--br-lg);\r\n background-color: var(--main-active);\r\n box-shadow:\r\n 0 3px 6px rgba(0, 0, 0, 0.16),\r\n 0 3px 6px rgba(0, 0, 0, 0.23);\r\n }\r\n &.guard-on {\r\n display: flex !important; // Override js-controlled inline style\r\n }\r\n }\r\n .crop-canvas {\r\n position: relative;\r\n width: 416px;\r\n height: 416px;\r\n z-index: 0;\r\n visibility: hidden;\r\n }\r\n`;\r\n\r\nexport const StyledAppLoading = styled.div`\r\n\tposition: fixed;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-image: linear-gradient(45deg, #333, #333);\r\n\tz-index: 4000;\r\n\tcolor: white;\r\n\ttext-shadow:\r\n\t\t0 1px #333,\r\n\t\t0 2px #111;\r\n\tfont-size: var(--fs-3xl);\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: center;\r\n`;\r\n\r\nexport const StyledByMe = styled.div`\r\n\tposition: fixed;\r\n\tright: var(--spacing);\r\n\tbottom: 0;\r\n\tfont-size: var(--fs-xs);\r\n\topacity: 0.5;\r\n\tpadding: var(--spacing-px) var(--spacing-xs);\r\n\tcolor: var(--color-dim);\r\n img {\r\n height: 10px;\r\n margin-left: 1px;\r\n }\r\n`;\r\n\r\nexport const ErrorAlert = styled.span`\r\n color: var(--main-danger);\r\n`;\r\n\r\nexport const OverlayButton = styled.div`\r\n --overlay-size: 51px;\r\n position: absolute;\r\n z-index: 101;\r\n background: var(--main-primary);\r\n border-color: var(--main-active);\r\n color: var(--color-heavy);\r\n padding: var(--spacing);\r\n line-height: 1;\r\n font-size: var(--fs-3xl);\r\n text-align: center;\r\n width: var(--overlay-size);\r\n height: var(--overlay-size);\r\n border-radius: var(--br-lg);\r\n cursor: pointer;\r\n box-shadow: var(--bs-1);\r\n display: none;\r\n &:hover {\r\n background: var(--sub-primary);\r\n }\r\n`;\r\n\r\nexport const LightboxButton = styled(OverlayButton)`\r\n top: var(--spacing-xs);\r\n right: var(--spacing-xs);\r\n`;\r\n\r\nexport const ResetButton = styled(OverlayButton)`\r\n top: var(--spacing-xs);\r\n right: calc(var(--overlay-size) + 2 * var(--spacing-xs));\r\n`;","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport 'antd/dist/antd.css';\r\nimport './app.scss';\r\nimport './style/index.scss';\r\nimport './responsive.scss';\r\nimport './reduce-color-motion.scss';\r\nimport {\r\n CanvasConst,\r\n getDefaultCard,\r\n} from './model';\r\nimport {\r\n compressCardData,\r\n forceRefocus,\r\n isMobileDevice,\r\n} from './util';\r\nimport { CardInputPanel, CardInputPanelRef, DownloadButton, DownloadButtonRef } from './page';\r\nimport WebFont from 'webfontloader';\r\nimport {\r\n changeCardFormat,\r\n getLanguage,\r\n retrieveSavedCard,\r\n decodeCardWithCompatibility,\r\n useCard,\r\n useI18N,\r\n useOCGFont,\r\n useSetting,\r\n} from './service';\r\nimport { Modal, notification, Tooltip } from 'antd';\r\nimport { TaintedCanvasWarning } from './component';\r\nimport { clearCanvas } from './draw';\r\nimport { ZoomInOutlined, ClearOutlined } from '@ant-design/icons';\r\nimport {\r\n ErrorAlert,\r\n LightboxButton,\r\n ResetButton,\r\n StyledAppLoading,\r\n StyledByMe,\r\n StyledCardCanvasGroupContainer,\r\n StyledDataButtonPanelContainer,\r\n} from './app.styled';\r\nimport { configure, HotKeys } from 'react-hotkeys';\r\nimport { useShallow } from 'zustand/react/shallow';\r\n\r\n/** React hotkey setup */\r\nconfigure({\r\n ignoreTags: [],\r\n});\r\nconst AppGlobalHotkeyMap = {\r\n EXPORT: ['ctrl+d', 'command+d'],\r\n IMPORT: ['ctrl+e', 'command+e'],\r\n MERGE: ['ctrl+g', 'command+g'],\r\n VIEW: ['ctrl+b', 'command+b'],\r\n DOWNLOAD: ['ctrl+s', 'command+s'],\r\n};\r\n\r\nconst { height: CanvasHeight, width: CanvasWidth } = CanvasConst;\r\nfunction App() {\r\n const {\r\n allowHotkey,\r\n softMode,\r\n } = useSetting(useShallow(({ setting: { allowHotkey, reduceMotionColor } }) => ({\r\n softMode: reduceMotionColor,\r\n allowHotkey,\r\n })));\r\n const {\r\n isInitiating: isLanguageInitiating,\r\n isLoading: isLanguageLoading,\r\n language,\r\n isMetadataReady,\r\n languageInfo,\r\n initiate: initiateI18N,\r\n loadDefaultLanguage,\r\n } = useI18N(useShallow(({\r\n isInitiating,\r\n isLoading,\r\n language,\r\n isMetadataReady,\r\n languageInfo,\r\n initiate,\r\n loadDefaultLanguage,\r\n }) => ({\r\n isInitiating,\r\n isLoading,\r\n language,\r\n isMetadataReady,\r\n languageInfo,\r\n initiate,\r\n loadDefaultLanguage,\r\n })));\r\n const [isInitializing, setInitializing] = useState(true);\r\n const [error, setError] = useState('');\r\n const [sourceType, setSourceType] = useState<'internal' | 'external'>('external');\r\n const [canvasKey, setCanvasKey] = useState(0);\r\n const [lightboxVisible, setLightboxVisible] = useState(false);\r\n\r\n const cardInputRef = useRef(null);\r\n const artworkCanvasRef = useRef(null);\r\n const backgroundCanvasRef = useRef(null);\r\n const drawCanvasRef = useRef(null);\r\n const frameCanvasRef = useRef(null);\r\n const cardIconCanvasRef = useRef(null);\r\n const pendulumScaleCanvasRef = useRef(null);\r\n const pendulumEffectCanvasRef = useRef(null);\r\n const typeCanvasRef = useRef(null);\r\n const effectCanvasRef = useRef(null);\r\n const nameCanvasRef = useRef(null);\r\n const statCanvasRef = useRef(null);\r\n const setIdCanvasRef = useRef(null);\r\n const passwordCanvasRef = useRef(null);\r\n const creatorCanvasRef = useRef(null);\r\n const stickerCanvasRef = useRef(null);\r\n const finishCanvasRef = useRef(null);\r\n const lightboxCanvasRef = useRef(null);\r\n const [canvasMap] = useState({\r\n artworkCanvasRef,\r\n backgroundCanvasRef,\r\n drawCanvasRef,\r\n frameCanvasRef,\r\n cardIconCanvasRef,\r\n pendulumScaleCanvasRef,\r\n pendulumEffectCanvasRef,\r\n typeCanvasRef,\r\n effectCanvasRef,\r\n nameCanvasRef,\r\n statCanvasRef,\r\n setIdCanvasRef,\r\n passwordCanvasRef,\r\n creatorCanvasRef,\r\n stickerCanvasRef,\r\n finishCanvasRef,\r\n lightboxCanvasRef,\r\n });\r\n\r\n const downloadButtonRef = useRef(null);\r\n\r\n const [imageChangeCount, setImageChangeCount] = useState(0);\r\n\r\n useEffect(() => {\r\n initiateI18N();\r\n }, [initiateI18N]);\r\n useEffect(() => {\r\n if (isMetadataReady) loadDefaultLanguage();\r\n }, [isMetadataReady, loadDefaultLanguage]);\r\n /** Dynamic style, we force inline style into body because app component's style cannot affect overlay component. */\r\n useEffect(() => {\r\n const applyList = [\r\n 'font-family',\r\n 'letter-spacing',\r\n '--width-label',\r\n ];\r\n\r\n applyList.forEach(styleName => {\r\n document.body.style.setProperty(styleName, languageInfo.style?.[styleName] ?? '' as any);\r\n });\r\n }, [languageInfo]);\r\n\r\n useEffect(() => {\r\n const ctx = drawCanvasRef.current?.getContext('2d');\r\n const setCard = useCard.getState().setCard;\r\n if (ctx) {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.imageSmoothingQuality = 'high';\r\n clearCanvas(ctx);\r\n }\r\n\r\n if (isLanguageInitiating === false) WebFont.load({\r\n custom: {\r\n families: [\r\n 'Matrix-Bold',\r\n 'MatrixBoldSmallCaps',\r\n 'MatrixBook',\r\n 'MatrixRegularSmallCaps',\r\n 'RoGSanSrfStd-Bd',\r\n 'YuGiOhITCStoneSerifBSc',\r\n 'matrix',\r\n 'palatino-linotype-bold',\r\n 'stone-serif-bold',\r\n 'stone-serif-regular',\r\n ],\r\n urls: ['asset/font.css'],\r\n },\r\n active: () => {\r\n const retrievedCard = retrieveSavedCard();\r\n\r\n setCard(retrievedCard);\r\n setInitializing(false);\r\n },\r\n fontinactive(familyName, fvd) {\r\n console.error('TCG fontinactive', familyName, fvd);\r\n notification.error({\r\n message: getLanguage()['error.load.font.tcg'](familyName),\r\n });\r\n },\r\n inactive: () => {\r\n setError(getLanguage()['error.load.font.all-tcg']);\r\n setInitializing(false);\r\n },\r\n });\r\n }, [isLanguageInitiating]);\r\n\r\n const {\r\n styleContent: ocgStyleFile,\r\n } = useOCGFont({\r\n isLanguageInitiating,\r\n onBeforeLoad: () => {\r\n setInitializing(true);\r\n const ctx = drawCanvasRef.current?.getContext('2d');\r\n if (ctx) {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.imageSmoothingQuality = 'high';\r\n clearCanvas(ctx);\r\n }\r\n },\r\n onActive: () => {\r\n setInitializing(false);\r\n },\r\n onInactive: () => {\r\n setError(getLanguage()['error.load.font.all-ocg']);\r\n setInitializing(false);\r\n },\r\n onFontInactive: (familyName, fvd) => {\r\n console.error('OCG fontinactive', familyName, fvd);\r\n notification.error({\r\n message: getLanguage()['error.load.font.ocg'](familyName),\r\n });\r\n }\r\n });\r\n\r\n const [isTainted, setTainted] = useState(false);\r\n\r\n useEffect(() => {\r\n const documentClassList = document.body.classList;\r\n\r\n if (softMode) documentClassList.add('reduced-color-motion');\r\n else documentClassList.remove('reduced-color-motion');\r\n }, [softMode]);\r\n\r\n const displayLightbox = useCallback((status?: boolean, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n setLightboxVisible(cur => typeof status === 'boolean' ? status : !cur);\r\n }, [allowHotkey]);\r\n\r\n const importData = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n const cardData = window.prompt(language['prompt.import.message']);\r\n const setCard = useCard.getState().setCard;\r\n\r\n if (cardData) {\r\n const decodedCard = decodeCardWithCompatibility(cardData);\r\n\r\n setCard(decodedCard);\r\n setImageChangeCount(cnt => cnt + 1);\r\n cardInputRef.current?.forceCardData(decodedCard);\r\n /** Allow navigate input panel right away */\r\n forceRefocus();\r\n }\r\n }, [allowHotkey, language]);\r\n\r\n const mergeData = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n const cardData = window.prompt(language['prompt.import.message']);\r\n const setCard = useCard.getState().setCard;\r\n\r\n if (cardData) {\r\n const decodedCard = decodeCardWithCompatibility(cardData, useCard.getState().card);\r\n\r\n setCard(decodedCard);\r\n setImageChangeCount(cnt => cnt + 1);\r\n cardInputRef.current?.forceCardData(decodedCard);\r\n /** Allow navigate input panel right away */\r\n forceRefocus();\r\n }\r\n }, [allowHotkey, language]);\r\n\r\n const exportData = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n if (sourceType === 'internal') window.alert(language['prompt.export.offline-warning.message']);\r\n const exportableCard = useCard.getState().card;\r\n\r\n window.prompt(\r\n language['prompt.export.message'],\r\n `${compressCardData(exportableCard)}`,\r\n );\r\n }, [allowHotkey, language, sourceType]);\r\n\r\n const downloadFromHotkey = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n downloadButtonRef.current?.download();\r\n }, [allowHotkey]);\r\n\r\n const hotkeyHandlerMap = useMemo(() => {\r\n return {\r\n IMPORT: (event?: { preventDefault: () => void }) => importData(event, true),\r\n MERGE: (event?: { preventDefault: () => void }) => mergeData(event, true),\r\n EXPORT: (event?: { preventDefault: () => void }) => exportData(event, true),\r\n VIEW: () => displayLightbox(true, true),\r\n DOWNLOAD: (event?: { preventDefault: () => void }) => downloadFromHotkey(event, true),\r\n };\r\n }, [downloadFromHotkey, exportData, importData, mergeData, displayLightbox]);\r\n\r\n const alertDownloadError = useCallback(() => {\r\n setTainted(true);\r\n alert(language['prompt.download.tainted.message']);\r\n }, [language]);\r\n\r\n const rerenderAllImage = useCallback(() => {\r\n setCanvasKey(cnt => cnt + 1);\r\n setImageChangeCount(cnt => cnt + 1);\r\n setTainted(false);\r\n }, []);\r\n\r\n const rerenderCardImage: NonNullable = useCallback((_, sourceType) => {\r\n setImageChangeCount(cnt => cnt + 1);\r\n setSourceType(sourceType);\r\n }, []);\r\n\r\n const markTaintedImage = useCallback(() => {\r\n setImageChangeCount(cnt => cnt + 1);\r\n setTainted(true);\r\n }, []);\r\n\r\n const isLoading = isLanguageLoading || isInitializing;\r\n return (\r\n \r\n
{ }}\r\n className={`language-${languageInfo.codeName}`}\r\n style={{\r\n backgroundImage: `url(\"${process.env.PUBLIC_URL}/asset/image/texture/debut-dark.png\"), linear-gradient(180deg, #00000022, #00000044)`,\r\n height: isMobileDevice() ? '-webkit-fill-available' : '100vh',\r\n ...({\r\n '--card-height': `${CanvasConst.height}px`,\r\n '--card-width': `${CanvasConst.width}px`,\r\n }),\r\n }}\r\n >\r\n {ocgStyleFile && }\r\n \r\n {isLoading && \r\n {error.length > 0\r\n ? \r\n {error}\r\n \r\n : languageInfo.initialMessage ?? ''}\r\n }\r\n {/*
*/}\r\n
\r\n \r\n
\r\n Ctrl-D / ⌘-D : null}>\r\n \r\n \r\n \r\n
Ctrl-E / ⌘-E
\r\n
Ctrl-G / ⌘-G{language['prompt.import.merge.tooltip']}
\r\n
: null}>\r\n \r\n \r\n
\r\n \r\n {isTainted &&
\r\n \r\n {language['alert.download.tainted-first-line']}
\r\n {language['alert.download.tainted-second-line']}
\r\n
}\r\n \r\n
\r\n \r\n \r\n {\r\n const consent = window.confirm(language['prompt.reset.message']);\r\n\r\n if (consent) {\r\n const { setCard, card } = useCard.getState();\r\n const defaultCard = getDefaultCard();\r\n const contextualDefaultCardData = card.format === 'tcg'\r\n ? defaultCard\r\n : changeCardFormat(defaultCard, 'ocg');\r\n\r\n setCard(contextualDefaultCardData);\r\n setImageChangeCount(cnt => cnt + 1);\r\n cardInputRef.current?.forceCardData(contextualDefaultCardData);\r\n }\r\n }}>\r\n \r\n \r\n \r\n \r\n {language['button.full-size.label']}\r\n {allowHotkey ? <>
Ctrl-B / ⌘-B : null}\r\n
}>\r\n displayLightbox()}>\r\n \r\n \r\n \r\n \r\n {/** Overlay guarding seems very janky, cursor should suffix for now */}\r\n
e.preventDefault()}>\r\n {/*
Generating...
*/}\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n {isLoading === false && }\r\n
\r\n {/** Pixel perfect for card image */}\r\n setLightboxVisible(false)}\r\n footer={null}\r\n >\r\n \r\n \r\n \r\n Made by Lauqerm \"avatar\"\r\n \r\n
\r\n \r\n );\r\n}\r\n\r\nexport default App;\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport WebFont from 'webfontloader';\r\nimport { useCard } from './use-card';\r\nimport { useShallow } from 'zustand/react/shallow';\r\n\r\nexport type UseOCGFont = {\r\n isLanguageInitiating: boolean,\r\n onBeforeLoad: () => void,\r\n onActive: () => void,\r\n onInactive: () => void,\r\n onFontInactive: (familyName: string, fvd: string) => void,\r\n}\r\nexport const useOCGFont = ({\r\n isLanguageInitiating,\r\n onActive,\r\n onBeforeLoad,\r\n onFontInactive,\r\n onInactive,\r\n}: UseOCGFont) => {\r\n const {\r\n font,\r\n format,\r\n } = useCard(useShallow(state => ({\r\n format: state.card.format,\r\n font: state.card.nameStyle.font,\r\n })));\r\n const [styleContent, setStyleContent] = useState('');\r\n\r\n const ocgReady = useRef(false);\r\n const loadAttempt = useRef(0);\r\n useEffect(() => {\r\n if (\r\n (format === 'ocg' || font === 'OCG')\r\n && ocgReady.current === false\r\n && loadAttempt.current <= 3\r\n && isLanguageInitiating === false\r\n ) {\r\n loadAttempt.current += 1;\r\n setStyleContent(`${process.env.PUBLIC_URL}/asset/ocg-font.css`);\r\n onBeforeLoad();\r\n\r\n WebFont.load({\r\n custom: {\r\n families: [\r\n 'DFHSGothic-W3-WIN-RKSJ-H',\r\n 'DFKakuTaiHiStd-W4',\r\n 'FOT-Rodin Pro M',\r\n 'Yu-Gi-Oh! DF Leisho 3',\r\n ],\r\n urls: ['asset/ocg-font.css'],\r\n },\r\n active: () => {\r\n ocgReady.current = true;\r\n onActive();\r\n },\r\n inactive: () => {\r\n ocgReady.current = true;\r\n onInactive();\r\n },\r\n fontinactive: onFontInactive,\r\n });\r\n }\r\n }, [format, font, isLanguageInitiating, onActive, onBeforeLoad, onFontInactive, onInactive]);\r\n\r\n return {\r\n styleContent,\r\n };\r\n};","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport './index.css';\r\nimport App from './app';\r\nimport reportWebVitals from './reportWebVitals';\r\n\r\nReactDOM.render(\r\n \r\n \r\n ,\r\n document.getElementById('root'),\r\n);\r\n\r\n// If you want to start measuring performance in your app, pass a function\r\n// to log results (for example: reportWebVitals(console.log))\r\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\r\nreportWebVitals();\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.7ea04692.chunk.js b/static/js/main.7ea04692.chunk.js deleted file mode 100644 index 460d97e..0000000 --- a/static/js/main.7ea04692.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -(this.webpackJsonpygocarder=this.webpackJsonpygocarder||[]).push([[0],{222:function(e,t,n){},224:function(e,t,n){},225:function(e,t,n){},226:function(e,t,n){},227:function(e,t,n){},241:function(e,t,n){},272:function(e,t,n){},273:function(e,t,n){},274:function(e,t,n){},275:function(e,t,n){},383:function(e,t,n){},389:function(e,t,n){},390:function(e,t,n){},391:function(e,t,n){},407:function(e,t,n){"use strict";n.r(t);var r,a=n(1),o=n(0),i=n.n(o),c=n(30),l=n.n(c),s=(n(222),n(2)),u=n(11),d=(n(223),n(224),n(225),n(226),n(227),813),f=1185,b=210,p=912,m=52,h="#404040",g=function(){return{body:100,pendulum:100,text:100,name:100,baseFill:h,artBorder:!0,nameBorder:!0,boundless:!1}},v={normal:{artFinishX:100,artFinishY:219,artWidth:614,artX:100,artY:219,ratio:1,type:"normal"},pendulum:{artFinishX:56,artFinishY:213,artWidth:702,artX:56,artY:213,ratio:1.325,type:"pendulum"},extendedCard:{artFinishX:100,artFinishY:219,artWidth:702,artX:56,artY:213,ratio:.775,type:"extendedCard"},extendedPendulum:{artFinishX:56,artFinishY:213,artWidth:702,artX:56,artY:213,ratio:.775,type:"extendedPendulum"},truePendulum:{artFinishX:56,artFinishY:213,artWidth:702,artX:56,artY:213,ratio:1.057,type:"truePendulum"},fullCard:{artFinishX:100,artFinishY:219,artWidth:758,artX:28,artY:28,ratio:.67,type:"fullCard"},fullPendulum:{artFinishX:56,artFinishY:213,artWidth:758,artX:28,artY:28,ratio:.67,type:"fullPendulum"}},x=function(e,t,n){var r=Object(s.a)(Object(s.a)({},g()),t),a=r.boundless,o=r.body,i=r.pendulum,c=r.text;return"full"===n?v.fullCard:v["fit"!==n&&a||o<100?e?"fullPendulum":"fullCard":e?c<100?"extendedPendulum":i<100?"truePendulum":"pendulum":c<100?"extendedCard":"normal"]},j=n(423),y="NONE",O=[{name:y,nameKey:"input.attribute.none",color:"#000000"},{name:"DARK",nameKey:"input.attribute.dark",label:"Dark",color:"#b41dda"},{name:"EARTH",nameKey:"input.attribute.earth",label:"Earth",color:"#8d8e8e"},{name:"FIRE",nameKey:"input.attribute.fire",label:"Fire",color:"#e51b23"},{name:"LIGHT",nameKey:"input.attribute.light",label:"Light",color:"#bfae32"},{name:"WATER",nameKey:"input.attribute.water",label:"Water",color:"#008ecd"},{name:"WIND",nameKey:"input.attribute.wind",label:"Wind",color:"#28ab35"},{name:"DIVINE",nameKey:"input.attribute.divine",label:"Divine",color:"#ef6300"},{name:"SPELL",nameKey:"input.attribute.spell",label:"Spell",color:"#1b8f83"},{name:"TRAP",nameKey:"input.attribute.trap",label:"TRAP",color:"#c32a8c"}],w="NO ICON",k=[{label:Object(a.jsx)(j.a,{}),value:w,nameKey:"input.icon.none"},{label:"Field",value:"FIELD",nameKey:"input.icon.field"},{label:"Continuous",value:"CONTINUOUS",nameKey:"input.icon.continuous"},{label:"Quick-Play",value:"QUICK-PLAY",nameKey:"input.icon.quick-play"},{label:"Ritual",value:"RITUAL",nameKey:"input.icon.ritual"},{label:"Equip",value:"EQUIP",nameKey:"input.icon.equip"},{label:"Counter",value:"COUNTER",nameKey:"input.icon.counter"}],F=function(e){return Object(s.a)({hasGradient:!1,hasOutline:!1,hasShadow:!1,pattern:"none"},e)},C={commonB:{key:"commonB",label:"Common (Black)",image:"asset/image/other/name-common-b.png",value:F({preset:"commonB",fillStyle:"#000000"})},commonW:{key:"commonW",label:"Common (White)",image:"asset/image/other/name-common-w.png",value:F({preset:"commonW",fillStyle:"#ffffff"})},skillDefault:{key:"skillDefault",label:"Skill (Default)",image:"asset/image/other/name-skill-default.png",value:F({preset:"skillDefault",fillStyle:"#ffffff",lineWidth:6,lineColor:"#000",hasOutline:!0})},skillArial:{key:"skillArial",label:"Skill (Arial)",image:"asset/image/other/name-skill-arial.png",value:F({preset:"skillArial",font:"Arial",fillStyle:"#ffffff",lineWidth:6,lineColor:"#000",lineOffsetX:1,hasOutline:!0})},rare:{key:"rare",label:"Rare",image:"asset/image/other/name-rare.png",value:F({preset:"rare",fillStyle:"#cfc6de"})},secretGradient:{key:"secretGradient",label:"Secret (Gradient)",image:"asset/image/other/name-secret-gradient.png",value:F({preset:"secretGradient",gradientAngle:180,gradientColor:"0.000|#7a71a6,1.000|#a8c1e5",hasGradient:!0})},secret:{key:"secret",label:"Secret",image:"asset/image/other/name-secret.png",value:F({preset:"secret",fillStyle:"#8a8381"})},platinum2:{key:"platinum2",label:"Platinum",image:"asset/image/other/name-platinum.png",value:F({preset:"platinum2",fillStyle:"#a49f9e"})},ultra:{key:"ultra",label:"Ultra",image:"asset/image/other/name-ultra.png",value:F({preset:"ultra",fillStyle:"#dbb473"})},ultra2:{key:"ultra2",label:"Ultra (Type 2)",image:"asset/image/other/name-ultra-2.png",value:F({preset:"ultra2",fillStyle:"#fee002"})},platinum:{key:"platinum",label:"Foil Platinum",image:"asset/image/other/name-foil-platinum.png",value:F({preset:"platinum",fillStyle:"#CCCCCC",shadowColor:"#FFFFFF",shadowOffsetY:1,shadowOffsetX:0,shadowBlur:1,hasShadow:!0})},gold:{key:"gold",label:"Foil Gold",image:"asset/image/other/name-foil-gold.png",value:F({preset:"gold",fillStyle:"#b88c43",shadowColor:"#FCC400",shadowOffsetY:1,shadowOffsetX:0,shadowBlur:1,hasShadow:!0})},animeRed:{key:"animeRed",label:"Anime (Type Red)",image:"asset/image/other/name-anime-red.png",value:F({preset:"animeRed",gradientAngle:180,gradientColor:"0.000|#d81961,0.220|#b81654,0.270|#9e1348,0.330|#95093e,0.380|#95093e,0.450|#ba3264,0.530|#ff5e99,0.620|#ffa0c3,0.690|#ffffff,0.770|#ff5e99,0.870|#d81961,1.000|#b81654",hasGradient:!0,hasOutline:!0,hasShadow:!0,lineColor:"#333333",lineOffsetX:1,lineOffsetY:0,lineWidth:3,shadowBlur:2,shadowColor:"#383838",shadowOffsetX:2,shadowOffsetY:3})},animeSilver:{key:"animeSilver",label:"Anime (Type Silver)",image:"asset/image/other/name-anime-silver.png",value:F({preset:"animeSilver",shadowColor:"#383838",shadowOffsetY:3,shadowOffsetX:2,shadowBlur:2,hasShadow:!0,lineColor:"#333333",lineWidth:3,lineOffsetX:1,lineOffsetY:0,hasOutline:!0,gradientAngle:180,gradientColor:"0.000|#cecbb8,0.220|#b0ad9b,0.270|#94917e,0.330|#797768,0.380|#797768,0.450|#d9d9d9,0.610|#ffffff,0.700|#ffffff,0.870|#d6d7c7,1.000|#c9cbb6",hasGradient:!0})},animeGold:{key:"animeGold",label:"Anime (Type Gold)",image:"asset/image/other/name-anime-gold.png",value:F({preset:"animeGold",shadowColor:"#383838",shadowOffsetY:3,shadowOffsetX:2,shadowBlur:2,hasShadow:!0,lineColor:"#333333",lineWidth:3,lineOffsetX:1,lineOffsetY:0,hasOutline:!0,gradientAngle:180,gradientColor:"0.000|#eee317,0.220|#dbbe15,0.270|#d0920c,0.330|#b57f0b,0.380|#d0920c,0.450|#ffff6b,0.610|#ffffff,0.700|#ffffff,0.870|#e5dd2d,1.000|#e3da23",hasGradient:!0})},promo:{key:"promo",label:"Promo",image:"asset/image/other/name-promo.png",value:F({preset:"promo",fillStyle:"#c7080b",shadowColor:"#333333",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:1,hasShadow:!0,lineColor:"#8a1801",lineWidth:3,lineOffsetX:0,hasOutline:!0,lineOffsetY:0})}},S=Object.values(C),T={none:{key:"none",patternImage:"",blendMode:"source-atop"},type1:{key:"type1",patternImage:"finish-name-type1",blendMode:"source-atop"},type2:{key:"type2",patternImage:"finish-name-type2",blendMode:"source-atop"},type3:{key:"type3",patternImage:"finish-name-type3",blendMode:"source-atop"},type4:{key:"type4",patternImage:"finish-name-type4",blendMode:"source-atop"},type5:{key:"type5",patternImage:"finish-name-type5",blendMode:"multiply",overrideFill:!0},type6:{key:"type6",patternImage:"finish-name-type6",blendMode:"source-atop"},type7:{key:"type7",patternImage:"finish-name-type7",blendMode:"lighter",overrideFill:!0},type8:{key:"type8",patternImage:"finish-name-type8",blendMode:"source-atop"},type9:{key:"type9",patternImage:"finish-name-type9",blendMode:"source-atop"}},R=Object.values(T),N={tcg:[{trueWidth:684,trueBaseline:890.23,trueEdge:64.8}],"tcg-stat":[{trueWidth:684,trueBaseline:890.23,trueEdge:64.8}],"tcg-type-stat":[{trueWidth:684,trueBaseline:919.8,trueEdge:64.5}],"tcg-type":[{trueWidth:684,trueBaseline:921.8,trueEdge:64.5}],ocg:[{trueWidth:684,trueBaseline:895.23,trueEdge:64.8}],"ocg-stat":[{trueWidth:684,trueBaseline:891.23,trueEdge:64.8}],"ocg-type-stat":[{trueWidth:684,trueBaseline:918.5,trueEdge:64.5}],"ocg-type":[{trueWidth:684,trueBaseline:918.5,trueEdge:64.5}]},L=[{trueWidth:555.47,trueBaseline:746.29,trueEdge:128.94},{trueWidth:555.47,trueBaseline:746.29,trueEdge:128.94}],M={tcg:{small:{trueBaseline:919,trueEdge:62.5,trueWidth:684.5},medium:{trueBaseline:920,trueEdge:62.5,trueWidth:684.5},large:{trueBaseline:187.5,trueEdge:732,edgeAlignment:"right",trueWidth:648.5}},ocg:{small:{trueBaseline:917,trueEdge:63.7,trueWidth:684.5},medium:{trueBaseline:917,trueEdge:63.7,trueWidth:684.5},large:{trueBaseline:190.5,trueEdge:728,edgeAlignment:"right",trueWidth:642.5}}},E={ocg:{trueBaseline:1146.5,trueEdge:736,trueWidth:435},tcg:{trueBaseline:1149.5,trueEdge:733,trueWidth:380}},I={ocg:{trueBaseline:1148.931,trueEdge:37.031,trueWidth:255},tcg:{trueBaseline:1149.431,trueEdge:37.031,trueWidth:311}},A=[{shortForm:"\u7279\u6b8a\u53ec\u559a",rubyForm:"{\u7279|\u3068\u304f}{\u6b8a|\u3057\u3085}{\u53ec|\u3057\u3087\u3046}{\u559a|\u304b\u3093}"},{shortForm:"\u30ab\u30fc\u30c9",rubyForm:"{\u30ab\u30fc\u30c9}"},{shortForm:"\u30c7\u30e5\u30a8\u30eb",rubyForm:"{\u30c7\u30e5\u30a8\u30eb}"},{shortForm:"\u30de\u30c3\u30c1",rubyForm:"{\u30de\u30c3\u30c1}"},{shortForm:"\u30bf\u30fc\u30f3",rubyForm:"{\u30bf\u30fc\u30f3}"},{shortForm:"\u30d7\u30ec\u30a4\u30e4\u30fc",rubyForm:"{\u30d7\u30ec\u30a4\u30e4\u30fc}"},{shortForm:"\u81ea\u5206",rubyForm:"{\u81ea|\u3058}{\u5206|\u3076\u3093}"},{shortForm:"\u76f8\u624b",rubyForm:"{\u76f8|\u3042\u3044}{\u624b|\u3066}"},{shortForm:"LP",regexForm:"(?","\uff01":"!","\uff08":"(","\uff09":")","\uff06":"&","\uff07":"'","\uff20":"@"},se={"\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\uff41":"a","\uff42":"b","\uff43":"c","\uff44":"d","\uff45":"e","\uff46":"f","\uff47":"g","\uff48":"h","\uff49":"i","\uff4a":"j","\uff4b":"k","\uff4c":"l","\uff4d":"m","\uff4e":"n","\uff4f":"o","\uff50":"p","\uff51":"q","\uff52":"r","\uff53":"s","\uff54":"t","\uff55":"u","\uff56":"v","\uff57":"w","\uff58":"x","\uff59":"y","\uff5a":"z","\uff21":"A","\uff22":"B","\uff23":"C","\uff24":"D","\uff25":"E","\uff26":"F","\uff27":"G","\uff28":"H","\uff29":"I","\uff2a":"J","\uff2b":"K","\uff2c":"L","\uff2d":"M","\uff2e":"N","\uff2f":"O","\uff30":"P","\uff31":"Q","\uff32":"R","\uff33":"S","\uff34":"T","\uff35":"U","\uff36":"V","\uff37":"W","\uff38":"X","\uff39":"Y","\uff3a":"Z","\uff62":"\u300c","\uff63":"\u300d","\uff64":"\u3001","\uff1a":":","\u2200":"\u2c6f","\ua4ef":"\u2c6f","\ua4db":"\u0186","\ua4f1":"\u018e","\ua4de":"\u2132","\ua4e8":"\u2141","\ua4d8":"\ua7b0","\ua4f6":"\ua780","\u2142":"\ua780","\ua4d2":"\u0500","\ua4d5":"\ua7b1","\u0548":"\ua4f5","\ua4e5":"\u0245","\uff1c":"<","\uff1e":">","\uff01":"!","\uff08":"(","\uff09":")","\uff06":"&","\uff07":"'","\uff20":"@"},ue={"(\uff11)":"\u2460","(\uff12)":"\u2461","(\uff13)":"\u2462","(\uff14)":"\u2463","(\uff15)":"\u2464","(\uff16)":"\u2465","(\uff17)":"\u2466","(\uff18)":"\u2467","(\uff19)":"\u2468","(\uff11\uff10)":"\u2469","(\uff11\uff11)":"\u246a","(\uff11\uff12)":"\u246b","(\uff11\uff13)":"\u246c","(\uff11\uff14)":"\u246d","(\uff11\uff15)":"\u246e","(\uff11\uff16)":"\u246f","(\uff11\uff17)":"\u2470","(\uff11\uff18)":"\u2471","(\uff11\uff19)":"\u2472","(\uff12\uff10)":"\u2473","(1)":"\u2460","(2)":"\u2461","(3)":"\u2462","(4)":"\u2463","(5)":"\u2464","(6)":"\u2465","(7)":"\u2466","(8)":"\u2467","(9)":"\u2468","(10)":"\u2469","(11)":"\u246a","(12)":"\u246b","(13)":"\u246c","(14)":"\u246d","(15)":"\u246e","(16)":"\u246f","(17)":"\u2470","(18)":"\u2471","(19)":"\u2472","(20)":"\u2473"},de=(r={"\u6c34\u65cf":"Aqua","\u7363\u65cf":"Beast","\u7363\u6226\u58eb\u65cf":"Beast-Warrior","\u5275\u9020\u795e\u65cf":"Creator God","\u30b5\u30a4\u30d0\u30fc\u30b9\u65cf":"Cyberse","\u6050\u7adc\u65cf":"Dinosaur","\u5e7b\u795e\u7363\u65cf":"Divine-Beast","\u30c9\u30e9\u30b4\u30f3\u65cf":"Dragon","\u5929\u4f7f\u65cf":"Fairy","\u60aa\u9b54\u65cf":"Fiend","\u9b5a\u65cf":"Fish","\u30ae\u30e3\u30e9\u30af\u30b7\u30fc\u65cf":"Galaxy","\u5e7b\u60f3\u9b54\u65cf":"Illusion","\u6606\u866b\u65cf":"Insect","\u6a5f\u68b0\u65cf":"Machine","\u690d\u7269\u65cf":"Plant","\u30b5\u30a4\u30ad\u30c3\u30af\u65cf":"Psychic","\u708e\u65cf":"Pyro","\u722c\u866b\u985e\u65cf":"Reptile","\u5ca9\u77f3\u65cf":"Rock","\u6d77\u7adc\u65cf":"Sea Serpent","\u9b54\u6cd5\u4f7f\u3044\u65cf":"Spellcaster","\u96f7\u65cf":"Thunder","\u6226\u58eb\u65cf":"Warrior","\u9ce5\u7363\u65cf":"Winged Beast","\u5e7b\u7adc\u65cf":"Wyrm","\u30a2\u30f3\u30c7\u30c3\u30c8\u65cf":"Zombie","\u30b5\u30a4\u30dc\u30fc\u30b0\u65cf":"Cyborg","\u5929\u754c\u6226\u58eb\u65cf":"Celestial Warrior","\u30cf\u30a4\u30c9\u30e9\u30b4\u30f3\u65cf":"High Dragon","\u9b54\u5c0e\u9a0e\u58eb\u65cf":"Magical Knight","\u30aa\u30e1\u30ac\u30b5\u30a4\u30ad\u30c3\u30af\u65cf":"Omega Psychic","\u30e2\u30f3\u30b9\u30bf\u30fc":"Monster","\u9b54\u6cd5\u30ab\u30fc\u30c9":"Spell Card","\u7f60\u30ab\u30fc\u30c9":"Trap Card","\u30a2\u30af\u30b7\u30e7\u30f3":"Action","\u901a\u5e38":"Normal","\u52b9\u679c":"Effect","\u5100\u5f0f":"Ritual","\u30d5\u30e5\u30fc\u30b8\u30e7\u30f3":"Fusion","\u878d\u5408":"Fusion","\u30b7\u30f3\u30af\u30ed":"Synchro","\u30a8\u30af\u30b7\u30fc\u30ba":"Xyz","\u30da\u30f3\u30c7\u30e5\u30e9\u30e0":"Pendulum","\u30ea\u30f3\u30af":"Link","\u30de\u30ad\u30b7\u30de\u30e0":"Maximum","\u30c8\u30fc\u30af\u30f3":"Token","\u7279\u6b8a\u53ec\u559a":"Special Summon","\u30c0\u30fc\u30af\u30b7\u30f3\u30af\u30ed\u30e2\u30f3\u30b9\u30bf\u30fc":"Dark Synchro","\u30c1\u30e5\u30fc\u30ca\u30fc":"Tuner","\u30c7\u30e5\u30a2\u30eb":"Gemini","\u30ea\u30d0\u30fc\u30b9":"Flip","\u30c8\u30a5\u30fc\u30f3":"Toon","\u30b9\u30d4\u30ea\u30c3\u30c8":"Spirit","\u30e6\u30cb\u30aa\u30f3":"Union","\xa9\u9ad8\u6a4b\u548c\u5e0c \u30b9\u30bf\u30b8\u30aa\u30fb\u30c0\u30a4\u30b9\uff0f\u96c6\u82f1\u793e":"\xa91996 KAZUKI TAKAHASHI","\xa9\u30b9\u30bf\u30b8\u30aa\u30fb\u30c0\u30a4\u30b9\uff0f\u96c6\u82f1\u793e\u30fb\u30c6\u30ec\u30d3\u6771\u4eac\u30fbKONAMI":"\xa92020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI","{\u7d14|\u30b8\u30e5\u30f3}{\u72d0|\u3053}":"Junko"},Object(ce.a)(r,"\u81ea\u5206\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u52b9\u679c\u30e2\u30f3\u30b9\u30bf\u30fc\xd7\uff12\u4f53\u4ee5\u4e0a\n\u2460\uff1a\u3053\u306e\u30ab\u30fc\u30c9\u304c\u30e2\u30f3\u30b9\u30bf\u30fc\u30be\u30fc\u30f3\u306b\u5b58\u5728\u3059\u308b\u9650\u308a\u3001\u76f8\u624b\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u30e2\u30f3\u30b9\u30bf\u30fc\u304c\u52b9\u679c\u3092\u767a\u52d5\u3059\u308b\u5ea6\u306b\u3001\u305d\u306e\u76f8\u624b\u306e\u8868\u5074\u8868\u793a\u30e2\u30f3\u30b9\u30bf\u30fc\u306b\u30d4\u30e5\u30a2\u30ab\u30a6\u30f3\u30bf\u30fc\u3092\uff11\u3064\u7f6e\u304f(\u6700\u5927\uff11\u3064\u307e\u3067\uff09\u3002\u2461\uff1a\u3053\u306e\u30ab\u30fc\u30c9\u306f\u30d4\u30e5\u30a2\u30ab\u30a6\u30f3\u30bf\u30fc\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30e2\u30f3\u30b9\u30bf\u30fc\u304c\u767a\u52d5\u3057\u305f\u52b9\u679c\u3092\u53d7\u3051\u306a\u3044\u3002\u2462\uff1a\u3053\u306e\u30ab\u30fc\u30c9\u306f\u30d4\u30e5\u30a2\u30ab\u30a6\u30f3\u30bf\u30fc\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u30e2\u30f3\u30b9\u30bf\u30fc\u3068\u306e\u6226\u95d8\u3067\u306f\u7834\u58ca\u3055\u308c\u306a\u3044\u3002","[2+ Effect Monsters on your field]\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter."),Object(ce.a)(r,"\u203b\u516c\u5f0f\u306e\u30c7\u30e5\u30a8\u30eb\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002","This card cannot be used in a Duel."),Object(ce.a)(r,"\u2460\uff1a\uff11\u30bf\u30fc\u30f3\u306b\uff11\u5ea6\u3001\uff18\uff10\uff10\uff2c\uff30\u3092\u6255\u3063\u3066\u767a\u52d5\u3067\u304d\u308b\u3002\u3053\u306e\u30ab\u30fc\u30c9\u306e\uff30\u30b9\u30b1\u30fc\u30eb\u30921\u3064\u4e0a\u3052\u308b\u3002","Once per turn: You can pay 800 LP, increase this card's Pendulum Scale by 1."),r),fe=Object.entries(de).reduce((function(e,t){var n=Object(u.a)(t,2),r=n[0];return e[n[1]]=r,e}),{"Once per turn: You can pay 800 LP, increase this card\u2019s Pendulum Scale by 1.":"\u2460\uff1a\uff11\u30bf\u30fc\u30f3\u306b\uff11\u5ea6\u3001\uff18\uff10\uff10\uff2c\uff30\u3092\u6255\u3063\u3066\u767a\u52d5\u3067\u304d\u308b\u3002\u3053\u306e\u30ab\u30fc\u30c9\u306e\uff30\u30b9\u30b1\u30fc\u30eb\u30921\u3064\u4e0a\u3052\u308b\u3002"}),be={normal:{name:"normal",nameKey:"input.frame.normal",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#c49c5e"},effect:{name:"effect",nameKey:"input.frame.effect",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#b96c49"},fusion:{name:"fusion",nameKey:"input.frame.fusion",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#8948a4"},synchro:{name:"synchro",nameKey:"input.frame.synchro",labelColor:"#000",edition:"normal",labelBackgroundColor:"#efefef"},xyz:{name:"xyz",nameKey:"input.frame.xyz",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#000000"},link:{name:"link",nameKey:"input.frame.link",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#0c8ac6"},ritual:{name:"ritual",nameKey:"input.frame.ritual",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#5e85c9"},spell:{name:"spell",nameKey:"input.frame.spell",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#1b8f83"},trap:{name:"trap",nameKey:"input.frame.trap",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#c32a8c"},token:{name:"token",nameKey:"input.frame.token",labelColor:"#ffffff",edition:"normal",labelBackgroundColor:"#6f6c6b"},"dark-synchro":{name:"dark-synchro",nameKey:"input.frame.dark-synchro",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#4d4543"},obelisk:{name:"obelisk",nameKey:"input.frame.obelisk",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#515eb0"},osiris:{name:"osiris",nameKey:"input.frame.osiris",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#bd5044"},ra:{name:"ra",nameKey:"input.frame.ra",labelColor:"#000",edition:"extendend",labelBackgroundColor:"#b9ad34"},raviel:{name:"raviel",nameKey:"input.frame.raviel",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#313c5f"},uria:{name:"uria",nameKey:"input.frame.uria",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#623320"},hamon:{name:"hamon",nameKey:"input.frame.hamon",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#534a19"},"lg-dragon":{name:"lg-dragon",nameKey:"input.frame.lg-dragon",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#4e84a4"},"speed-skill":{name:"speed-skill",nameKey:"input.frame.speed-skill",labelColor:"#ffffff",edition:"extendend",labelBackgroundColor:"#199cd5"},zarc:{name:"zarc",nameKey:"input.frame.zarc",labelColor:"#000",edition:"extendend",labelBackgroundColorList:["rgba(185,108,73,1)","rgba(137,72,164,1)","rgba(239,239,239,1)","rgba(0,0,0,1)"],labelBackgroundImage:"linear-gradient(90deg, ".concat(["rgba(185,108,73,1) 23%","rgba(137,72,164,1) 27%","rgba(137,72,164,1) 48%","rgba(239,239,239,1) 52%","rgba(239,239,239,1) 73%","rgba(0,0,0,1) 77%"].join(", "),")")}},pe=Object.values(be),me=[{top:175,left:55,width:100,height:100},{top:165,left:323,width:170,height:80},{top:175,left:655,width:100,height:100},{top:442,left:45,width:70,height:170},{top:0,left:0,width:0,height:0},{top:442,left:700,width:70,height:170},{top:775,left:55,width:100,height:100},{top:810,left:323,width:170,height:80},{top:775,left:655,width:100,height:100}],he=new RegExp("[A-Z\uff21-\uff3a]"),ge=new RegExp("[\\[\\]\u3010\u3011]"),ve="[#@\u221ea-z\uff41-\uff5aA-Z\uff21-\uff3a0-9\uff10-\uff19!\uff01+\xd7\uff03#@\u221e\u2018\u201c\u2019\u201d:;\\[\\]\\(\\)\u3010\u3011\\.,]+",xe=new RegExp(ve),je=new RegExp("({[^{}]+?}|".concat(ve,"|.)")),ye="\u2989",Oe="\u298a",we="\u27c5",ke="\u27c6",Fe="\u27ec",Ce="\u27ed",Se=new RegExp("[".concat([ye,Oe,we,ke,Fe,Ce].join(""),"]|(\\|[^}]+})"),"g"),Te="".concat(ye,"|").concat(Oe),Re=new RegExp(Te),Ne="(\\n^[\\r\\t\\f\\v \\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*\\n".concat(ye,"?\\([\\w\\W]+\\)").concat(Oe,"?)\\s*$"),Le=new RegExp("[".concat("#\u2605@\u221e","]")),Me=A.map((function(e){var t;return null!==(t=e.regexForm)&&void 0!==t?t:e.shortForm})).join("|"),Ee="(".concat(Me,")(?![^{]*})"),Ie="\u30fd\u30fe\u30fc\u30a1\u30a3\u30a5\u30a7\u30a9\u30c3\u30e3\u30e5\u30e7\u30ee\u30f5\u30f6\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308e\u3095\u3096\u31f0\u31f1\u31f2\u31f3\u31f4\u31f5\u31f6\u31f7\u31f8\u31f9\u31fa\u31fb\u31fc\u31fd\u31fe\u31ff\u3005\u303b",Ae=new RegExp("[".concat(Ie,"]")),Be=".[".concat(Ie,")\\]\uff5d\u3015\u3009\u300b\u300d\uff63\u300f\u3011\u3019\u3017\u301f'\"\u2019\u201d\uff60\xbb\u2010\u30a0\u2013\u301c\uff1f!\u203c\u2047\u2048\u2049\u30fb\u3001:;,\u3002.\uff61\uff64]+"),We=new RegExp("[\u2460-\u2473\u203b]"),Pe=new RegExp("[\uff21-\uff3a\uff41-\uff5a]"),De=new RegExp("[\uff10-\uff19]"),ze=new RegExp("[0-9]"),He=/[\u3042\u3044\u3046\u3048\u304a\u304b\u304c\u304d\u304e\u304f\u3050\u3051\u3052\u3053\u3054\u3055\u3056\u3057\u3058\u3059\u305a\u305b\u305c\u305d\u305e\u305f\u3060\u3061\u3062\u3064\u3065\u3066\u3067\u3068\u3069\u306a\u306b\u306c\u306d\u306e\u306f\u3070\u3071\u3072\u3073\u3074\u3075\u3076\u3077\u3078\u3079\u307a\u307b\u307c\u307d\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a\u308b\u308c\u308d\u308f\u3090\u3091\u3092\u3093\u3094]/,Ke=/[\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ac\u30ad\u30ae\u30af\u30b0\u30b1\u30b2\u30b3\u30b4\u30b5\u30b6\u30b7\u30b8\u30b9\u30ba\u30bb\u30bc\u30bd\u30be\u30bf\u30c0\u30c1\u30c2\u30c4\u30c5\u30c6\u30c7\u30c8\u30c9\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d0\u30d1\u30d2\u30d3\u30d4\u30d5\u30d6\u30d7\u30d8\u30d9\u30da\u30db\u30dc\u30dd\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea\u30eb\u30ec\u30ed\u30ef\u30f0\u30f1\u30f2\u30f3\u30f4\u30f7\u30f8\u30f9\u30fa]/,Ge=new RegExp("[\u30fb]"),Ye=new RegExp("[\u30fc]"),Xe=new RegExp("[\u2015]"),Ve=new RegExp("[".concat("\uff1a","]")),Ue=new RegExp("[".concat("\u3002\uff64","]")),qe=new RegExp("[".concat("\uff1a","]")),Je={"\u3002":-.2,"\uff64":-.2,"\uff62":0,"\uff63":0,"\uff1a":0,">":.25,"<":-.25},$e={"\u3002":-.5,"\uff1a":-.25},_e={">":.125,"<":.125},Ze={"\\":-.025},Qe={},et={"\\":.3},tt=function(e){return"tcg"===e?7:1},nt=/{[^{}]+?}/,rt="\\s\\-/",at=-2.25,ot=function(){return{version:0,format:"tcg",frame:"fusion",foil:"normal",opacity:g(),finish:[],artFinish:"normal",name:"Junko",nameStyleType:"auto",nameStyle:{font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"},attribute:"LIGHT",subFamily:w,cardIcon:"auto",star:6,starAlignment:"auto",art:"https://i.imgur.com/h5kXZeC.png",artCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},hasBackground:!1,background:"",backgroundType:"fit",backgroundCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},linkMap:["1","3","7","9"],isPendulum:!1,pendulumFrame:"auto",pendulumEffect:"Once per turn: You can pay 800 LP, increase this card's Pendulum Scale by 1.",pendulumScaleRed:"4",pendulumScaleBlue:"4",typeAbility:["Fairy","Fusion","Effect"],effectStyle:{condenseTolerant:"strict"},effect:"[2+ Effect Monsters on your field]\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter.",setId:"YGOC-EN001",atk:"2000",def:"2000",password:"18111996",sticker:"holo5",isFirstEdition:!0,isSpeedCard:!1,isDuelTerminalCard:!1,creator:"\xa92020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI",furiganaHelper:!0,statTextStyle:[!1,"#000000",!1,"#000000"],typeTextStyle:[!1,"#000000",!1,"#000000"],effectTextStyle:[!1,"#000000",!1,"#000000"],pendulumTextStyle:[!1,"#000000",!1,"#000000"]}},it=function(){return{version:0,format:"tcg",frame:"effect",foil:"normal",opacity:g(),finish:[],artFinish:"normal",name:"",nameStyleType:"auto",nameStyle:{font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"},attribute:"LIGHT",subFamily:w,cardIcon:"auto",star:6,starAlignment:"auto",art:"https://i.imgur.com/jjtCuG5.png",artCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},hasBackground:!1,background:"",backgroundType:"fit",backgroundCrop:{x:0,y:4,width:100,height:89.5,unit:"%",aspect:1},linkMap:[],isPendulum:!1,pendulumFrame:"auto",pendulumEffect:"",pendulumScaleRed:"4",pendulumScaleBlue:"4",typeAbility:[],effectStyle:{condenseTolerant:"strict"},effect:"",setId:"",atk:"0",def:"0",password:"",sticker:"no-sticker",isFirstEdition:!1,isSpeedCard:!1,isDuelTerminalCard:!1,creator:"",furiganaHelper:!0,statTextStyle:[!1,"#000000",!1,"#000000"],typeTextStyle:[!1,"#000000",!1,"#000000"],effectTextStyle:[!1,"#000000",!1,"#000000"],pendulumTextStyle:[!1,"#000000",!1,"#000000"]}},ct=[{type:"body",subType:"artBorder",label:"Card",labelKey:"input.opacity.body.label",tooltipKey:"input.opacity.art-border.tooltip"},{type:"name",subType:"nameBorder",label:"Name",labelKey:"input.opacity.name.label",tooltipKey:"input.opacity.name-border.tooltip"},{type:"pendulum",label:"Pendulum",labelKey:"input.opacity.pendulum.label",tooltipKey:null},{type:"text",label:"Effect",labelKey:"input.opacity.effect.label",tooltipKey:null}],lt=["#4D4D4D","#999999","#FFFFFF","#FF7F7F","#FFD27F","#FFFF7F","#7FFF7F","#7FBF7F","#7FFFFF","#7F7FFF","#BF7FBF","#FF7FFF","#333333","#808080","#cccccc","#7F0000","#7F5200","#7F7F00","#007F00","#004000","#007F7F","#00007F","#400040","#7F007F","#000000","#666666","#B3B3B3","#FF0000","#FFA500","#FFFF00","#00FF00","#008000","#00FFFF","#0000FF","#800080","#FF00FF"],st=function(e){return"xyz"===e.frame},ut=function(e){return"link"===e.frame&&ft(e)},dt=function(e){return"speed-skill"===e.frame&&!ft(e)},ft=function(e){return"spell"!==e.frame&&"trap"!==e.frame&&"speed-skill"!==e.frame},bt=function(e){return"spell"===e||"trap"===e?"st":"xyz"===e?"rank":"dark-synchro"===e?"negative-level":"speed-skill"===e?"none":"level"},pt=function(e){return!ft({frame:e})||mt(e)},mt=function(e){return["link","xyz","dark-synchro","speed-skill","hamon","uria","raviel"].includes(e)},ht=function(e){var t,n=e.format,r=e.frame,a=e.nameStyle,o=e.nameStyleType,i=e.foil;if("custom"===o)return a;var c=dt({frame:r}),l=pt(r),u="Default";"ocg"===n&&(u="OCG"),c&&"tcg"===n&&(u="Arial");var d={fillStyle:l?"#ffffff":"#000000",headTextFillStyle:l?"#ffffff":"#000000"};if("predefined"===o){var f,b,p=Object(s.a)({},C[null!==(f=a.preset)&&void 0!==f?f:"commonB"].value);return C[null!==(b=p.preset)&&void 0!==b?b:"commonB"].value.font||(p.font=u),Object(s.a)(Object(s.a)({},d),p)}var m=c?{hasOutline:!0,lineWidth:6,strokeStyle:"#000"}:{},h="normal"!==i&&null!==(t=C[i].value)&&void 0!==t?t:{},g="zarc"===r?C.animeGold.value:{};return Object(s.a)(Object(s.a)(Object(s.a)(Object(s.a)({font:u},d),m),h),g)},gt=1e3,vt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt,n=e,r=t,a=r,o=a,i=30,c=100,l=10,s=function(){return 1===c?v():(a+=c,a-=c/=l),Math.min(a,r)},u=function(){return i-=1,a-=c},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r;n=e,r=t,a=t,i=30,c=100,o=t},f=function(){return a},b=function(e){return a=e},p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a;return o=e},m=function(){return o},h=function(){return i=-1,a=o},g=function(){return i},v=function(){return i=-1};return{reset:d,searchDown:u,reverseSearch:s,finish:v,getMedian:f,setMedian:b,setLastEffective:p,getLastEffective:m,applyLastEffective:h,getIterateCount:g}},xt=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,n=gt,r=vt();r.getIterateCount()>=0;){if(r.getIterateCount()<=0){var a=r.getMedian();n=a;break}var o=e(r.getMedian());if(!o&&r.getMedian()>0)r.searchDown();else{if(r.getMedian()===gt)break;n=r.reverseSearch()}}var i=Math.max(t,Math.min(n,gt));return i!==n&&e(i),i},jt=function(e){var t=null!==e&&void 0!==e?e:{},n=t.defaultWeight,r=void 0===n?"":n,a=t.defaultStyle,o=void 0===a?"":a,i=t.defaultSize,c=void 0===i?"10px":i,l=t.defaultFamily,s=void 0===l?"Arial":l,u=r,d=o,f="number"===typeof c?"".concat(c,"px"):c,b="number"===typeof c?c:parseFloat(c.replaceAll("px","")),p=s;return{getFont:function(){return"".concat([d,u,f,p].filter((function(e){return""!==e})).join(" "),", Arial")},getFontInfo:function(){return{style:d,size:f,family:p,sizeAsNumber:b,weight:u}},setWeight:function(e){return u=e,this},setStyle:function(e){return d=e,this},setSize:function(e){var t="function"===typeof e?e(b):e;return f="number"===typeof t?"".concat(t,"px"):t,b="number"===typeof t?t:parseFloat(t.replaceAll("px","")),this},setFamily:function(e){return p=e,this}}},yt=function(e){return(null!==e&&void 0!==e?e:[]).map((function(e){var t=e.color,n=e.offset;return"".concat(n,"|").concat(t)})).join(",")},Ot=function e(t){return t?t.split(",").map((function(e,t){var n=e.split("|"),r=Object(u.a)(n,2),a=r[0];return{color:r[1],offset:a,id:t+1}})):e("0.000|#eef10b,0.5|#d78025,1.000|#7e20cf")},wt=function(e){var t=e.debug,n=e.optionLength,r=e.stopPropagation,a=void 0!==r&&r,o=e.setFocus,i=e.onTrigger,c=e.onCancel,l=e.onKeyPress;return{tabIndex:0,onFocus:function(){t&&console.info("Navigation Focus",t),o(0)},onBlur:function(){t&&console.info("Navigation Blur",t),o(-1)},onKeyDown:function(e){a&&e.stopPropagation(),t&&console.info("Navigation Keydown",t,e.key),!1!==(null===l||void 0===l?void 0:l(e))&&("ArrowRight"===e.key||"ArrowDown"===e.key?(e.preventDefault(),o((function(e){return Math.max(0,n+e+1)%n}))):"ArrowLeft"===e.key||"ArrowUp"===e.key?(e.preventDefault(),o((function(e){return Math.max(0,n+e-1)%n}))):"Enter"===e.key||" "===e.key?i():"Escape"===e.key&&(null===c||void 0===c||c()))}}},kt=n(416),Ft=n(61),Ct=function(e){var t=(e=e.substring(0,e.length-1)).split("\x01");if(e=t[0],11&&void 0!==arguments[1]?arguments[1]:1,n=[['"',"'"],["':","!"],[",'","~"],["}",")","\\","\\"],["{","(","\\","\\"]],r=function(e,t){return e.replace(new RegExp("".concat((t[2]?t[2]:"")+t[0],"|").concat((t[3]?t[3]:"")+t[1]),"g"),(function(e){return e===t[0]?t[1]:t[0]}))};if(t)for(t=0;t1&&void 0!==arguments[1]?arguments[1]:Tt,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a={},o=Object(s.a)({},t);return Object.keys(o).forEach((function(t){var r=o[t];if("object"!==typeof r||null===r||Array.isArray(r)){var i=n[t];"string"===typeof i&&(a[i]=r)}else{var c,l=null===(c=n[t])||void 0===c?void 0:c._newKey;l&&(a[l]=e(r,n[t],!1))}})),r?JSON.stringify(a):a},Nt=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tt,r={};return Object.keys(n).forEach((function(a){var o=n[a];if("object"!==typeof o||null===o||Array.isArray(o))null!=t[o]&&(r[a]=t[o]);else{var i=null===o||void 0===o?void 0:o._newKey;i&&t[i]&&(r[a]=e(t[i],n[a]))}})),r},Lt=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tt,r="string"===typeof t?JSON.parse(Ct(decodeURIComponent(t))):t,a={};return Object.keys(n).forEach((function(t){var o=n[t];if("object"!==typeof o||null===o||Array.isArray(o))null!=r[o]&&(a[t]=r[o]);else{var i=null===o||void 0===o?void 0:o._newKey;i&&r[i]&&(a[t]=e(r[i],n[t]))}})),a},Mt=function(e,t){var n="string"===typeof e?JSON.parse(e):e,r=Nt(n);return Et(r,t)},Et=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:it(),a=Object(s.a)(Object(s.a)({},r),Object(kt.a)(e));return null==a.effectStyle&&(a.effectStyle=Object(s.a)({},it().effectStyle)),null==a.version&&(a.version=1),null==a.format&&(a.format="tcg"),null==a.pendulumFrame&&(a.pendulumFrame="auto"),null==a.finish&&(a.finish=[]),null==a.artFinish&&(a.artFinish="normal"),a.picture&&!e.art&&(a.art=a.picture),delete a.picture,a.pictureCrop&&!e.artCrop&&(a.artCrop=a.pictureCrop),delete a.pictureCrop,""===(null!==(t=a.art)&&void 0!==t?t:"")&&(a.art=""),"boolean"===typeof a.opacity.artFrame&&null==a.opacity.boundless&&(a.opacity.boundless=!a.opacity.artFrame,delete a.opacity.artFrame),a.opacity=Object(s.a)(Object(s.a)({},g()),a.opacity),""===(null!==(n=a.background)&&void 0!==n?n:"")&&(a.background=""),null==a.hasBackground&&(a.background||a.opacity.baseFill)&&(a.hasBackground=!0),a.kanjiHelper&&!e.furiganaHelper&&(a.furiganaHelper=a.kanjiHelper),delete a.kanjiHelper,void 0===a.furiganaHelper&&(a.furiganaHelper=!0),a.passcode&&!e.password&&(a.password=a.passcode),delete a.passcode,a.effectTextStyle||(a.effectTextStyle=[!1,"#000000",!1,"#000000"]),a.pendulumTextStyle||(a.pendulumTextStyle=[!1,"#000000",!1,"#000000"]),a.typeTextStyle||(a.typeTextStyle=[!1,"#000000",!1,"#000000"]),a.statTextStyle||(a.statTextStyle=[!1,"#000000",!1,"#000000"]),a.starAlignment||(a.starAlignment="auto"),a},It=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ABCDEFGHIJKLMNOPQRSTUVWXYZ",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n="",r=e.length,a=0;a0&&void 0!==arguments[0]?arguments[0]:".radio-train-input-group";null===(e=document.querySelector(t))||void 0===e||e.focus()},Pt=/^#[a-fA-F0-9]{3}([a-fA-F0-9]{3})?$/,Dt=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];try{var n,r,a,o=e.replace("#",""),i=[0,0,0,1];if(3===o.length||4===o.length)i=[parseInt("".concat(o[0]).concat(o[0]),16),parseInt("".concat(o[1]).concat(o[1]),16),parseInt("".concat(o[2]).concat(o[2]),16),parseInt("".concat(null!==(n=o[3])&&void 0!==n?n:"f").concat(null!==(r=o[3])&&void 0!==r?r:"f"),16)];if(6===o.length||8===o.length)i=[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(null!==(a=o.slice(6,8))&&void 0!==a?a:"ff",16)];return i.map((function(e){return isNaN(e)?255:e})).slice(0,t?4:3)}catch(c){return[0,0,0,1].slice(0,t?4:3)}},zt=function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(e.substr(0,4)))&&(t=!0),t};function Ht(){for(var e=arguments.length,t=new Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=Object(s.a)(Object(s.a)({},t),e.rawDictionary),r=function(e){var t;return null!==(t=n[e])&&void 0!==t?t:""},o=function(e,t){var n=new RegExp("\\{(".concat(Object.keys(t).join("|"),")\\}")),r=e.split(n);return Object(a.jsx)(a.Fragment,{children:r.map((function(e,n){return n%2===0?Object(a.jsx)(i.a.Fragment,{children:e},"".concat(e,"-").concat(n)):t[e]}))})},c={"error.load.font.tcg":function(e){return r("error.load.font.tcg").replaceAll("{familyName}",e)},"error.load.font.ocg":function(e){return r("error.load.font.ocg").replaceAll("{familyName}",e)},"contributor.disclaimer.line-1":function(e){return o(r("contributor.disclaimer.line-1"),{siteLink:e})},"contributor.disclaimer.line-5":function(e,t){return o(r("contributor.disclaimer.line-5"),{author1:e,author2:t})},"contributor.template-maker":function(e,t,n,a){return o(r("contributor.template-maker"),{artist1:e,artist2:t,artist3:n,artist4:a})},"guide.format.introduction":function(e){return o(r("guide.format.introduction"),{settingIcon:e})},"guide.format.section-1.content":function(e,t,n,a){return o(r("guide.format.section-1.content"),{openTag:e,closeTag:t,hotkey:n,hotkeyAlternative:a})},"guide.format.section-2.content":function(e,t,n,a){return o(r("guide.format.section-2.content"),{openTag:e,closeTag:t,hotkey:n,hotkeyAlternative:a})},"guide.format.section-3.content":function(e,t,n){return o(r("guide.format.section-3.content"),{separator:e,hotkey:t,hotkeyAlternative:n})},"guide.format.section-4.content":function(e,t,n){return o(r("guide.format.section-4.content"),{separator:e,hotkey:t,hotkeyAlternative:n})},"guide.format.section-5.content":function(e,t,n,a){return o(r("guide.format.section-5.content"),{openTag:e,closeTag:t,hotkey:n,hotkeyAlternative:a})},"input.scale.label":function(e){return o(r("input.scale.label"),{scaleType:e})}};return Object(s.a)(Object(s.a)({},e),{},{rawDictionary:n,dictionary:Object(s.a)(Object(s.a)({},n),c)})},gn=Object(cn.create)((function(e,t){var n=function(){var e=new URL(window.location.href),t=e.searchParams,n=t.get("language");if(t.delete("language"),window.history.replaceState(window.history.state,"",e.href),n)return n;try{var r=window.localStorage.getItem("language");return r||"eng"}catch(a){return console.error("useSetting: Error when getting cached language",a),"eng"}}(),r={},a=hn(Object(s.a)(Object(s.a)({},{name:"Default",formalName:"Default",codeName:"def",initialMessage:"",order:1e3,active:!1}),{},{rawDictionary:{}})),o=function(){var t=Object(mn.a)(pn.a.mark((function t(){var n,r;return pn.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("".concat("/ygocarder","/asset/i18n/metadata.json"),{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 3:return n=t.sent,t.next=6,n.json();case 6:if(r=t.sent){t.next=9;break}throw new Error("No metadata found");case 9:e({languageMetadataMap:r,isMetadataReady:!0}),t.next=16;break;case 12:t.prev=12,t.t0=t.catch(0),console.error("loadLanguageMetadata: Could not load language metadata, try to use English",t.t0),e({languageMetadataMap:{eng:{name:"English",formalName:"English",codeName:"eng",initialMessage:"Loading fonts and scripts\u2026",order:1,active:!0}},isMetadataReady:!0});case 16:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(){return t.apply(this,arguments)}}(),i=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,a,o,i;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r[t]){e.next=2;break}return e.abrupt("return",null);case 2:return e.prev=2,e.next=5,fetch("".concat("/ygocarder","/asset/i18n/").concat(t,".json"),{headers:{"Content-Type":"application/json",Accept:"application/json"}});case 5:return a=e.sent,e.next=8,a.json();case 8:if((o=e.sent).rawDictionary){e.next=11;break}throw new Error("No dictionary found");case 11:return i=hn(o,null===(n=r.eng)||void 0===n?void 0:n.rawDictionary),r[t]=i,e.abrupt("return",i);case 16:return e.prev=16,e.t0=e.catch(2),console.error("loadLanguage: Could not load language, revert back to default",e.t0),e.abrupt("return",null);case 20:case"end":return e.stop()}}),e,null,[[2,16]])})));return function(t){return e.apply(this,arguments)}}(),c=function(){var n=Object(mn.a)(pn.a.mark((function n(o){var c,l;return pn.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(c=t().languageMetadataMap[o]){n.next=3;break}return n.abrupt("return");case 3:if(r[o]){n.next=9;break}return n.next=6,i(o);case 6:n.t0=n.sent,n.next=10;break;case 9:n.t0=r[o];case 10:(l=n.t0)?(e({languageInfo:t().languageMetadataMap[o],language:l.dictionary}),window.localStorage.setItem("language",o),e({isLoading:!1,languageInfo:c})):e({isLoading:!1,languageInfo:t().languageMetadataMap.eng,language:a.dictionary});case 12:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}();return{languageMetadataMap:{},languageInfo:{name:"Default",formalName:"Default",codeName:"def",initialMessage:"",order:1e3,active:!1},language:a.dictionary,error:null,isInitiating:!0,isLoading:!0,isMetadataReady:!1,initiate:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o();case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),loadDefaultLanguage:function(){var t=Object(mn.a)(pn.a.mark((function t(){return pn.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i("eng");case 2:return t.next=4,c(n);case 4:e({isInitiating:!1});case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),loadLanguage:i,changeLanguage:c}})),vn=function(){return gn((function(e){return e.language}))},xn=function(){return gn.getState().language},jn=function(e,t){var n=it();if(!e)return n;try{n=Mt(e,t)}catch(r){console.error("decodedCard",e,r);try{n=function(e){var t;return t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?Lt(e):"string"===typeof e?JSON.parse(e):e,Et(t)}(e,!0),fn.a.info({message:xn()["service.decode.outdated.message"],description:xn()["service.decode.outdated.description"]})}catch(r){console.error("cardData",e,r),fn.a.error({message:xn()["service.decode.error.message"],description:xn()["service.decode.error.description"]})}}return n},yn={debounce:{type:"debounce",wait:400},throttle:{type:"throttle",wait:1e3}},On=Object(cn.create)((function(e,t){return{card:ot(),setCard:function(t){e("function"===typeof t?function(e){return{card:t(e.card)}}:{card:t})},getUpdater:function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e},a=arguments.length>2?arguments[2]:void 0,o=t(),i=o.setCard,c=function(t){i((function(n){var a;return Object(s.a)(Object(s.a)({},n),{},Object(ce.a)({},e,r("string"===typeof t||"number"===typeof t||Array.isArray(t)?t:null===t||void 0===t||null===(a=t.target)||void 0===a?void 0:a.value)))}))};if(!a)return c;var l="string"===typeof a?null!==(n=yn[a])&&void 0!==n?n:void 0:a;if(!l)return c;var u=l.wait,d=l.type;return"debounce"===d?sn()(c,u):"throttle"===d?dn()(c,u):c}}})),wn=n(33),kn=Object(cn.create)((function(e){var t=function(){try{var e,t=JSON.parse(null!==(e=window.localStorage.getItem("setting"))&&void 0!==e?e:"{}");return t&&"object"===typeof t&&!Array.isArray(t)?t:{}}catch(n){return console.error("useSetting: Error when getting cached setting",n),{}}}(),n=t.resolution,r=t.allowHotkey,a=t.reduceMotionColor,o=t.showCreativeOption,i=t.showExtraDecorativeOption;return{setting:{resolution:Array.isArray(n)&&"number"===typeof n[0]&&"number"===typeof n[1]?n:[d,f],allowHotkey:"boolean"!==typeof r||r,reduceMotionColor:"boolean"===typeof a&&a,showCreativeOption:"boolean"!==typeof o||o,showExtraDecorativeOption:"boolean"!==typeof i||i},updateSetting:function(t){e((function(e){var n="function"===typeof t?t(e.setting):Object(s.a)(Object(s.a)({},e.setting),t);return window.localStorage.setItem("setting",JSON.stringify(n)),{setting:n}}))}}})),Fn=f,Cn=d,Sn=function(e){var t=e.ctx,n=e.color,r=void 0===n?"#000000".replace(/0/g,(function(){return(~~(12*Math.random()+2)).toString(16)})):n,a=e.width,o=e.offset,i=void 0===o?4:o,c=e.edge,l=e.baseline,s=e.xRatio,u=t.fillStyle;t.fillStyle=r,t.beginPath(),t.rect(c/s,l+1+Math.random()*i,a/s,2),t.fillStyle=u},Tn=function(e,t,n,r,a,o){if(!e||!t)return r;var i=(null!==o&&void 0!==o?o:{}).stroke,c=void 0!==i&&i;e.textAlign="left";var l=t.split(""),s=r;return l.forEach((function(t){e.fillText(t,s,a),c&&e.strokeText(t,s,a),s+=e.measureText(t).width*(2+n)/2})),s},Rn=function(e,t,n,r,a,o){if(!e||!t)return r;var i=(null!==o&&void 0!==o?o:{}).stroke,c=void 0!==i&&i;e.textAlign="right";var l=t.split(""),s=r;return l.forEach((function(t,r){var o=l[l.length-r-1];e.fillText(o,s,a),c&&e.strokeText(o,s,a),s-=e.measureText(o).width*(2+n)/2})),s},Nn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Cn,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fn;return!!e&&(e.clearRect(0,0,t,n),!0)},Ln=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:D;return function(){var n=Object(mn.a)(pn.a.mark((function n(r,a,o){var i,c,l,s,u,d,f,b,p,m,h,g,v,x;return pn.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r&&Array.isArray(e)&&!(e.length<=0)){n.next=2;break}return n.abrupt("return",Promise.resolve());case 2:i=Object(Ft.a)(e),n.prev=3,i.s();case 5:if((c=i.n()).done){n.next=39;break}if(l=c.value,s=t[l],!o||!t[l]){n.next=37;break}if(d=s.partInstructionMap,!(f=a&&null!==(u=d[a])&&void 0!==u?u:[]).length){n.next=33;break}b=Object(Ft.a)(f),n.prev=13,b.s();case 15:if((p=b.n()).done){n.next=23;break}return m=p.value,h=m.blendMode,g=void 0===h?"source-over":h,v=m.opacity,x=void 0===v?1:v,r.globalCompositeOperation=g,r.globalAlpha=x,n.next=21,o(l);case 21:n.next=15;break;case 23:n.next=28;break;case 25:n.prev=25,n.t0=n.catch(13),b.e(n.t0);case 28:return n.prev=28,b.f(),n.finish(28);case 31:n.next=35;break;case 33:return n.next=35,o(l);case 35:r.globalAlpha=1,r.globalCompositeOperation="source-over";case 37:n.next=5;break;case 39:n.next=44;break;case 41:n.prev=41,n.t1=n.catch(3),i.e(n.t1);case 44:return n.prev=44,i.f(),n.finish(44);case 47:r.globalAlpha=1,r.globalCompositeOperation="source-over";case 49:case"end":return n.stop()}}),n,null,[[3,41,44,47],[13,25,28,31]])})));return function(e,t,r){return n.apply(this,arguments)}}()},Mn="#000000",En="#000000",In=function(e){var t=e.ctx,n=e.x,r=void 0===n?0:n,a=e.y,o=void 0===a?0:a,i=e.blur,c=void 0===i?0:i,l=e.color,s=void 0===l?En:l,u=e.shadowColor,d=void 0===u?Mn:u;return t.shadowOffsetX=r,t.shadowOffsetY=o,t.shadowBlur=c,t.shadowColor=d,t.fillStyle=s,function(){t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,t.shadowColor=Mn,t.fillStyle=En}},An={},Bn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n){var r,a,o=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=o.length>2&&void 0!==o[2]?o[2]:0,a=o.length>3&&void 0!==o[3]?o[3]:0,t&&""!==n){e.next=4;break}return e.abrupt("return",new Promise((function(e){return e(!1)})));case 4:return e.abrupt("return",new Promise((function(e){var o;if(!0===(null===(o=An[n])||void 0===o?void 0:o.ready)){var i=An[n].image,c="number"===typeof r?r:r(i),l="number"===typeof a?a:a(i);t.drawImage(i,c,l),e(!0)}else{var s;if(null===(s=An[n])||void 0===s?void 0:s.error)return void e(!0);var u=An[n]&&(An[n].cache||An[n].ready),d=u?An[n].image:new Image;u||(d.src="/ygocarder"+n),d.addEventListener("load",(function(){var o="number"===typeof r?r:r(d),i="number"===typeof a?a:a(d);t.drawImage(d,o,i),An[n].ready=!0,An[n].error=!1,e(!0)}),{once:!0}),d.addEventListener("error",(function(){An[n].error=!0,e(!1)}),{once:!0}),u||(An[n]={image:d,ready:!1,error:!1,cache:!0})}})));case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Wn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n){var r,a,o=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>2&&void 0!==o[2]?o[2]:0,a=o.length>3&&void 0!==o[3]?o[3]:0,e.next=4,Bn(t,"/asset/image/"+n,r,a);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),Pn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&""!==n){e.next=2;break}return e.abrupt("return",new Promise((function(e){return e(!1)})));case 2:return e.abrupt("return",new Promise((function(e){var c;if(!0===(null===(c=An[n])||void 0===c?void 0:c.ready)){var l=An[n].image,s="number"===typeof r?r:r(l),u="number"===typeof a?a:a(l),d="number"===typeof o?o:o(l),f="number"===typeof i?i:i(l);t.drawImage(l,s,u,d,f),e(!0)}else{var b;if(null===(b=An[n])||void 0===b?void 0:b.error)return void e(!0);var p=An[n]&&(An[n].cache||An[n].ready),m=p?An[n].image:new Image;p||(m.src="/ygocarder"+n),m.addEventListener("load",(function(){var c="number"===typeof r?r:r(m),l="number"===typeof a?a:a(m),s="number"===typeof o?o:o(m),u="number"===typeof i?i:i(m);t.drawImage(m,c,l,s,u),An[n].ready=!0,An[n].error=!1,e(!0)}),{once:!0}),m.addEventListener("error",(function(){An[n].error=!0,e(!1)}),{once:!0}),p||(An[n]={image:m,ready:!1,error:!1,cache:!0})}})));case 3:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i){return e.apply(this,arguments)}}(),Dn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pn(t,"/asset/image/"+n,r,a,o,i);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i){return e.apply(this,arguments)}}(),zn=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i,c,l){var u,d,f,b,p,m,h,g,v,x,j,y;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=t.getContext("2d"),(d=document.createElement("canvas")).width=a,d.height=o,(f=d.getContext("2d",{willReadFrequently:!0}))&&u){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,Wn(f,n,0,0);case 9:return b=Dt(r),p=f.getImageData(0,0,a,o).data,m=In(Object(s.a)({ctx:f},l)),e.next=14,Wn(f,n,0,0);case 14:for(h=f.getImageData(0,0,a,o),g=h.data,m(),f.clearRect(0,0,a,o),f.drawImage(t,i,c,a,o,0,0,a,o),v=f.getImageData(0,0,a,o),x=v.data,j=0;j0?(x[j+0]=b[0]*(1-p[j+0]/255),x[j+1]=b[1]*(1-p[j+1]/255),x[j+2]=b[2]*(1-p[j+2]/255),x[j+3]=255):g[j+3]>0&&(y=g[j+3]/255,x[j+0]=(1-y)*x[j+0]+y*g[j+0],x[j+1]=(1-y)*x[j+1]+y*g[j+1],x[j+2]=(1-y)*x[j+2]+y*g[j+2],x[j+3]=255);u.putImageData(v,i,c);case 23:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i,c,l){return e.apply(this,arguments)}}(),Hn=function(e){var t,n,r=e.ctx,a=e.letter,o=e.isLastOfLine,i=void 0!==o&&o,c=e.debug,l=e.fontStyle,s=e.xRatio,u=e.metricMethod,d=void 0===u?"standard":u;if(Re.test(a))return{width:0,boundWidth:0};var f="tcg"===l?et:_e,b="tcg"===l?Ze:Je,p="tcg"===l?Qe:$e,m=r.measureText(a),h=m.width,g=m.actualBoundingBoxLeft+m.actualBoundingBoxRight,v=1;"name"===d&&(v=1+8*(1-s));var x,j="name"===d||"compact"===d||"furigana"===d?.046875:0,y=g,O=null!==(t=i?p[a]:b[a])&&void 0!==t?t:0;if("tcg"===l)return{width:h,actualBoundWidth:g,boundWidth:h+2*((null!==(x=f[a])&&void 0!==x?x:0)*h),metric:m,offsetRatio:O};var w=(null!==(n=f[a])&&void 0!==n?n:0)*h+("furigana"===d?0:Math.min(.075*h,Math.max(.45,h*j)*v)),k=1;Ge.test(a)?(y="furigana"===d?g:g*("creator"===d?1.75:2.5),k=.6):Ye.test(a)?(y="furigana"===d?g:Math.max(g,.75*h),w=2):Ae.test(a)?y="furigana"===d?g:Math.max(g,.7*h):De.test(a)?y=h:Ve.test(a)?y=2*g:Ue.test(a)?y=1.25*g*(i?.5:1):He.test(a)?y="furigana"===d?g:Math.max(g,.75*h):Ke.test(a)?y=Math.max(g,.69*h)*("creator"===d?.975:1):Xe.test(a)?(y=h,w=0):y="furigana"===d?g:Math.max(g,.75*h),w="furigana"===d?0:w;var F=1*h*1;return c&&console.info("getLetterWidth ".concat(c),a,m,1,1,"|",F),{width:h,actualBoundWidth:g,boundWidth:"standard"===d?h*k:y+2*w,metric:m,offsetRatio:O}},Kn=function(e){var t=e.ctx,n=e.baseline,r=e.edge,a=e.letter,o=e.xRatio,i=e.deviation,c=void 0===i?{}:i,l=e.letterMetric,s=e.textDrawer,u=null!==l&&void 0!==l?l:{},d=u.boundWidth,f=u.metric,b=void 0===f?t.measureText(a):f,p=u.offsetRatio,m=void 0===p?0:p,h=o<1?{}:c,g=h.yOffset,v=void 0===g?K:g,x=h.yRatio,j=void 0===x?G:x,y=b.width*o,O=d?d*o:y,w=null!==s&&void 0!==s?s:function(e){var t=e.ctx,n=e.letter,r=e.scaledBaseline,a=e.scaledEdge;t.fillText(n,a,r)},k=(y-O)/2,F=O*m;t.scale(1,j),w({ctx:t,letter:a,scaledEdge:r/o-k-F,scaledBaseline:(n+v)/j}),t.scale(1,1/j)},Gn=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t?new RegExp("([".concat(rt,"])|(").concat(ye,"[\\w\\W]+?").concat(Oe,")|(.+?)")):new RegExp("([".concat(rt,"])|").concat(ye,"([\\w\\W]+?)").concat(Oe,"|(.+?)"));return e.split(n).filter((function(e){return null!=e&&""!==e}))},Yn=function(e,t,n,r){var a=n.fontSize,o=n.ordinalFontRatio,i=void 0===o?H.ordinalFontRatio:o,c=n.headTextFontRatio,l=void 0===c?H.headTextFontRatio:c,s=t.font,u=t.ordinalFont,d=t.symbolFont,f=t.symbolFontRatio,b=t.numberFont,p=void 0===b?s:b,m=t.numberFontRatio,h=void 0===m?1:m,g=t.furiganaFont,v=r.getFontInfo(),x=r.getFontInfo(),j=r.getFontInfo(),y=r.getFontInfo(),O=r.getFontInfo();return{applyNumberFont:function(){v=r.getFontInfo(),e.font=r.setFamily(p).setSize(a*h).getFont()},stopApplyNumberFont:function(){e.font=r.setFamily(v.family).setSize(v.size).getFont()},applyLargerText:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;O=r.getFontInfo(),e.font=r.setSize(a*t).getFont()},stopApplyLargerText:function(){e.font=r.setSize(O.size).getFont()},applySymbolFont:function(){x=r.getFontInfo(),e.font=r.setFamily(d).setSize(a*f).getFont()},stopApplySymbolFont:function(){e.font=r.setFamily(x.family).setSize(x.size).getFont()},applyOrdinalFont:function(){j=r.getFontInfo(),e.font=r.setFamily(u).setSize(a*i).getFont()},stopApplyOrdinalFont:function(){e.font=r.setFamily(j.family).setSize(j.size).getFont()},applyFuriganaFont:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];y=r.getFontInfo(),e.font=r.setFamily(g).setWeight(t?"bold":"").setSize(a*l).getFont()},stopApplyFuriganaFont:function(){e.font=r.setFamily(y.family).setWeight(y.weight).setSize(y.size).getFont()},applyAsymmetricScale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;e.scale(t,n)},applyScale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;e.scale(t,n)},resetScale:function(){e.setTransform(1,0,0,1,0,0)},reverseScale:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;e.scale(1/t,1/t)}}},Xn=function(e,t,n,r,a){var o=(r-a)/2;e.beginPath(),e.arc(t+o,n-o-1,o,0,2*Math.PI,!1),e.fill(),e.lineWidth=1,e.strokeStyle="#003300",e.stroke()},Vn=function(e){var t=e.footText,n=e.footTextWidth,r=e.headText,a=e.headTextLetterWidth,o=e.headTextGap,i=e.headTextSpacing,c=e.gapPadding,l=e.debug,s=e.fitFootText,u=e.sentenceXRatio,d=e.xRatio,f=0===r.length,b=a/n*u,p=i,m=0;b<=.95?p=i:b<=1.175?p=i>=0?0:3*i:b<=1.56?p=i>=0?-1*i/4:3*i:(m=.66,p=i>=0?-1*i/4:2*i),(s||d>0&&d<1)&&(p=i);var h=a*(d&&!s?d:!m||s?1:m)+p*(r.length-1),g=f?0:(n-a)/r.length,v=n,x=1===t.length||2*c+h>n?"center":"space-around",j="center"===x?p:g,y="center"===x?2*c+h:v,O=s?Math.min(y,n):y,w="center"===x?(h-n)/2:0,k=Math.max(o,s?Math.min(w,0):w);return l&&console.info("analyzeHeadText ".concat(l),x,j,"|",r,O,y,t,n,k),{gapPadding:c,letterSpacing:j,trueHeadTextWidth:y,headTextWidth:O,alignment:x,halfGap:k,headTextXRatio:"center"===x?m:0}},Un=function(e,t){return e>=0?t>=0?0:-1*Math.max(-1*e,t):t>=0?-1*Math.max(e,-1*t):0},qn=function e(t){var n=t.ctx,r=t.token,a=t.nextToken,o=t.xRatio,i=t.previousTokenGap,c=void 0===i?0:i,l=t.letterSpacing,s=void 0===l?H.letterSpacing:l,d=t.format,f=t.textData;if(!n||!r)return{totalWidth:0,leftMostLetter:"",spaceCount:0,spaceAtEnd:!1,rightGap:0,leftGap:0};for(var b=f.currentFont,p=f.fontData,m=f.fontLevel,h=p.metricMethod,g=p.headTextGapRatio,v=void 0===g?U:g,x=p.headTextOverflow,j=void 0===x?X:x,y=p.fontStyle,O=p.fontList[m],w=O.bulletSymbolWidth,k=O.capitalLetterRatio,F=O.fontSize,C=O.iconSymbolWidth,S=void 0===C?w:C,T=O.largeSymbolRatio,R=void 0===T?H.largeSymbolRatio:T,N=O.headTextSpacing,L=void 0===N?H.headTextSpacing:N,M=O.squareBracketRatio,E=O.wordLetterSpacing,I=-.5*F,A=Yn(n,p,O,b),B=A.applyScale,W=A.reverseScale,P=A.applyLargerText,D=A.stopApplyLargerText,z=A.applyFuriganaFont,K=A.stopApplyFuriganaFont,G=A.applyOrdinalFont,Y=A.stopApplyOrdinalFont,V=A.applySymbolFont,q=A.stopApplySymbolFont,J=A.applyNumberFont,$=A.stopApplyNumberFont,_=1+s/2,Z="",Q=0,ee=0,te=!1,ne=void 0===a,re=null!==c&&void 0!==c?c:0,ae=!1,oe=0,ie=r.replaceAll(new RegExp(Te,"g"),"").split(je).filter((function(e){return null!=e&&""!==e})),ce=0;ce1?Math.min(1,o+.1):0}),Ce=Fe.halfGap,Se=Fe.headTextWidth,Re=0===ye.length?Math.max(I,we/at):Ce,Ne=Re,Me=Re,Ee=Math.max(Se,we),Ie=Un(re,Ne);re=Me,Q+=Ee-Ie,ee+=1,le&&(ae=!0,oe=Ne,Z=pe[0])}else if(xe.test(se)){var Ae=E?1+E/2:_;n.letterSpacing="".concat((Ae-1)*b.getFontInfo().sizeAsNumber,"px");for(var Be=se,Pe=0;""!==Be;){var De=Be[0],He=Be.slice(1),Ke=n.measureText(Be).width-n.measureText(He).width;ge.test(De)?(B(M),Ke=n.measureText(Be).width-n.measureText(He).width,W(M)):he.test(De)?(B(k),Ke=n.measureText(Be).width-n.measureText(He).width,W(k)):ze.test(De)?(J(),Ke=n.measureText(Be).width-n.measureText(He).width,$()):Le.test(De)&&"tcg"===y?(V(),Ke=n.measureText(Be).width-n.measureText(He).width,q()):Ke=n.measureText(Be).width-n.measureText(He).width,Pe+=Ke,Be=He}var Ge=Math.max(I,Pe/at),Ye=Ge;Q+=Pe-Un(re,Ge),re=Ye,le&&(oe=Ge,Z=se[0]),n.letterSpacing="0px"}else if(Le.test(se)&&"tcg"===y){V();var Ve=n.measureText(se).width*_;q();var Ue=Math.max(I,Ve/at),Je=Ue;Q+=Ve-Un(re,Ue),re=Je,le&&(oe=Ue,Z=se[0])}else{var $e=Hn({ctx:n,letter:se,isLastOfLine:ne,fontStyle:y,metricMethod:h,xRatio:o}).boundWidth*_,_e=Math.max(I,$e/at),Ze=_e;Q+=$e-Un(re,_e),re=Ze,("ocg"===d||"tcg"===d&&/\s+/.test(se))&&!1===Xe.test(se)&&(ee+=1,ce===ie.length-1&&(te=!0)),le&&(oe=_e,Z=se[0]),qe.test(se)&&(oe=0,re=0)}}return{totalWidth:Q,spaceCount:ee,spaceAtEnd:te,leftMostLetter:Z,rightGap:re,leftGap:oe,offsetable:ae}},Jn=function(e){var t=e.ctx,n=e.median,r=e.paragraphList,a=e.additionalLineCount,o=void 0===a?0:a,i=e.width,c=e.format,l=e.textData,s=l.fontData,u=l.fontLevel,d=s.fontList[u].letterSpacing,f=[],b=r.reduce((function(e,r){for(var a=(n<=100?100:n)/1e3,o=i/a,s=Gn(r,!0),u=1,b=[],p=0,m=0,h=0,g=0,v=a;g0?a:1)+(0===g?(F>0?-1*Math.min(20/v,F):0)+(Pe.test(O)?4:0):0);if(p+C>o){var S=b.join("").trim();h>0&&(S+=Ce),h<0&&(S=Fe+S),h=0,f.push({line:S,effectiveMedian:n,isLast:!1,actualLineWidth:p});var T=qn({ctx:t,token:x,nextToken:j,xRatio:v,previousTokenGap:0,format:c,textData:l}),R=T.totalWidth,N=T.rightGap,L=T.leftGap;p=R+((L>0?-1*Math.min(20/v,L):0)+(Pe.test(O)?4:0)),m=N,b=[x],u+=1}else p+=C,m=k,b.push(x)}var M=b.join("").trim();return h>0&&(M+=Ce),h<0&&(M=Fe+M),h=0,f.push({line:M,effectiveMedian:n,isLast:!0,actualLineWidth:p}),e+u}),0)+(null!==o&&void 0!==o?o:0);return{currentLineList:f,currentLineCount:b}},$n=function(e){var t=e.ctx,n=e.fontSize,r=e.edge,a=e.baseline,o=e.headText,i=e.headTextLetterWidth,c=e.footText,l=e.footTextWidth,s=e.headTextGap,u=e.headTextSpacing,d=e.headTextHeightRatio,f=e.headTextBold,b=e.headTextGapRatio,p=e.xRatio,m=e.fontStyle,h=e.textWorker,g=e.fitFootText,v=e.headTextOverflow,x=h.applyFuriganaFont,j=h.stopApplyFuriganaFont,y=h.resetScale,O=h.applyScale,w="condense"===v&&c.length>1?Math.min(1,p+.1):0,k=Vn({headText:o,headTextLetterWidth:i,footText:c,footTextWidth:l*p,headTextGap:s,headTextSpacing:u*p,gapPadding:n*b,fitFootText:g,sentenceXRatio:p,xRatio:w}),F=k.gapPadding,C=k.letterSpacing,S=k.trueHeadTextWidth,T=k.halfGap,R=k.alignment,N=k.headTextXRatio,L=S>l*p;if(0===o.length)return{trueHeadTextWidth:S,halfGap:T};var M=g?Math.min(1,l*p/S):1,E=g?M:w&&"center"===R?w:N,I=r;y(),(g||E)&&(O(E,1),I=r/E),"center"===R?(I+=F,L?E>M&&(I+=(l*p/E-S)/2/E):I+=(l*p-S)/2):I+=C/2;var A,B=Object(Ft.a)(o);try{for(B.s();!(A=B.n()).done;){var W=A.value;x();var P=Hn({ctx:t,letter:W,fontStyle:m,metricMethod:"furigana",xRatio:1}),D=P.width,z=P.boundWidth,H=(D-z)/2;j(),x(f),t.fillText(W,I-H,a-n*d),j(),I+=z+C}}catch(K){B.e(K)}finally{B.f()}return(g||E)&&y(),O(p,1),{trueHeadTextWidth:S,halfGap:T}},_n=function e(t){for(var n=t.ctx,r=t.tokenList,a=t.trueEdge,o=t.trueBaseline,i=t.spaceWidth,c=void 0===i?0:i,l=t.xRatio,d=t.yRatio,f=void 0===d?1:d,b=t.textData,p=t.format,m=t.textDrawer,h=t.debug,g=void 0!==h&&h,v=b.currentFont,x=b.fontData,j=b.fontLevel,y=x.fontList[j],O=x.headTextFillStyle,w=x.headTextBold,k=void 0===w?V:w,F=x.headTextHeightRatio,C=void 0===F?Y:F,S=x.headTextOverflow,T=void 0===S?X:S,R=x.headTextGapRatio,N=void 0===R?U:R,L=x.metricMethod,M=x.fontStyle,E=x.letterDeviationMap,I=void 0===E?{}:E,A=y.bulletSymbolWidth,B=y.capitalLetterRatio,W=void 0===B?H.capitalLetterRatio:B,P=y.fontSize,D=y.headTextSpacing,z=void 0===D?H.headTextSpacing:D,K=y.iconSymbolWidth,G=void 0===K?A:K,q=y.largeSymbolRatio,J=void 0===q?H.largeSymbolRatio:q,$=y.letterSpacing,_=void 0===$?H.letterSpacing:$,Z=y.ordinalFontOffsetY,Q=void 0===Z?H.ordinalFontOffsetY:Z,ee=y.squareBracketRatio,te=void 0===ee?H.squareBracketRatio:ee,ne=y.wordLetterSpacing,re=Yn(n,x,y,v),ae=re.stopApplyFuriganaFont,oe=re.applyFuriganaFont,ie=re.stopApplyLargerText,ce=re.applyLargerText,le=re.stopApplyNumberFont,se=re.applyNumberFont,ue=re.stopApplyOrdinalFont,de=re.applyOrdinalFont,fe=re.applyScale,be=re.reverseScale,pe=re.applySymbolFont,me=re.stopApplySymbolFont,ve=re.applyAsymmetricScale,ye=re.resetScale,Oe=1+_/2,we=o/f,ke=0,Se=[],Te=0,Re=a,Ne=0,Me=l;Ne0?-1*Math.min(20,Ue*Me):0)+(Pe.test(Ve)?4:0):0,Qe=Re+Ze,et=ke,rt=0;rt1?Math.min(1,Me+.1):0}),xt=vt.headTextWidth,jt=vt.halfGap,yt=0===pt.length?Math.max(Ae,ht*Ie):jt,Ot=yt,wt=yt,kt=Un(et,wt),Ft=wt>0?wt-kt:0,Ct=qn(Object(s.a)({token:ct,nextToken:lt,previousTokenGap:Ot/Me},He)),St=Ct.offsetable,Tt=Ct.leftGap*Me,Rt=Un(Ot,Tt),Nt=Ft+(Ot>0?Ot-Rt:0),Lt=0,Mt=0;Nt>0&&Tt>=-2&&St?(Lt=(Nt+2*Math.max(Tt,0))/3,Mt=Math.max(Tt,0)-Lt):Lt=Ft;var Et=Qe+(yt<0?-kt:Ze?-Ze:Lt)+Te;Te=Mt,e({ctx:n,format:p,textData:b,tokenList:Gn(dt),trueBaseline:we,trueEdge:Et,xRatio:Me,yRatio:f,spaceWidth:0,textDrawer:m,debug:!1});var It=n.fillStyle,At=n.strokeStyle,Bt=n.shadowColor,Wt=n.shadowOffsetX,Pt=n.shadowOffsetY,Dt=n.shadowBlur;O&&(n.fillStyle=O,n.strokeStyle="",n.shadowColor="",n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=0),$n({ctx:n,fontSize:P,edge:Qe-kt,baseline:we,headText:pt,headTextLetterWidth:gt,footText:dt,footTextWidth:ht,headTextGap:Ae,headTextSpacing:z,headTextHeightRatio:C,headTextBold:k,headTextGapRatio:N,xRatio:Me,fontStyle:M,textWorker:re,fitFootText:mt,headTextOverflow:T}),n.fillStyle=It,n.strokeStyle=At,n.shadowColor=Bt,n.shadowOffsetX=Wt,n.shadowOffsetY=Pt,n.shadowBlur=Dt,Qe+=Math.max(ht*Me,xt)-kt+c,et=Ot}else if(xe.test(it)){var zt=ne?1+ne/2:Oe;n.letterSpacing="".concat((zt-1)*v.getFontInfo().sizeAsNumber,"px");for(var Ht=n.measureText(it).width*Me,Kt=Math.max(Ae,Ht*Ie),Gt=Kt,Yt=it,Xt=Qe-=Un(et,Kt);""!==Yt;){var Vt=Yt[0],Ut=Yt.slice(1),qt=0,Jt=Object(s.a)(Object(s.a)({},Ke),{},{deviation:I[Vt],letter:Vt,edge:Xt});if(ge.test(Vt))fe(te),qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Object(s.a)(Object(s.a)({},Jt),{},{edge:Xt/te,baseline:we/te})),be(te);else if(he.test(Vt)){fe(W);var $t=(qt=n.measureText(Yt).width-n.measureText(Ut).width)>n.measureText(Vt).width*W?Math.round(qt*(1-W))/2:0;Kn(Object(s.a)(Object(s.a)({},Jt),{},{edge:Xt/W+$t,baseline:we/W})),be(W)}else ze.test(Vt)?(se(),qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Jt),le()):Le.test(Vt)&&"tcg"===M?(pe(),qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Jt),me()):(qt=n.measureText(Yt).width-n.measureText(Ut).width,Kn(Jt));Xt+=qt*Me,Yt=Ut}Qe=Xt,et=Gt,Te=0,n.letterSpacing="0px"}else if(Le.test(it)&&"tcg"===M){var _t=it;pe();var Zt=n.measureText(_t).width*Oe*Me,Qt=Math.max(Ae,Zt*Ie),en=Qt;Qe-=Un(et,Qt),Kn(Object(s.a)(Object(s.a)({},Ke),{},{letter:_t,edge:Qe})),Qe+=Zt,me(),et=en,Te=0}else{var tn=it,nn=Hn({ctx:n,letter:tn,fontStyle:M,metricMethod:L,isLastOfLine:void 0===ct,xRatio:Me}),rn=nn.boundWidth*Oe*Me,an=Math.max(Ae,rn*Ie),on=an;Qe-=Un(et,an),Kn(Object(s.a)(Object(s.a)({},Ke),{},{letter:tn,edge:Qe,deviation:I[tn],letterMetric:nn})),Qe+=rn,("ocg"===p||"tcg"===p&&/\s+/.test(tn))&&!0!==Xe.test(tn)&&(Qe+=c),qe.test(tn)||(et=on),Te=0}}ke=Je*Me,g&&Sn({ctx:n,baseline:we,edge:Re,width:$e*Me,xRatio:Me}),Re+=$e*Me+_e*c+Ze}else Me=l,n.scale(Me,1);else Me=1,n.setTransform(1,0,0,1,0,0)}return{tokenEdge:Re,iconPositionList:Se}},Zn=function(e,t,n){var r,a=null!==n&&void 0!==n?n:{},o=a.multiline,i=void 0===o||o,c=a.furiganaHelper,l=void 0===c||c,s=a.dictionaryType,u=void 0===s?"rubyForm":s,d=null!==e&&void 0!==e?e:"",f="",b="ocg"===t?le:se,p=Object(Ft.a)(d);try{for(p.s();!(r=p.n()).done;){var m,h=r.value;f+=null!==(m=b[h])&&void 0!==m?m:h}}catch(F){p.e(F)}finally{p.f()}var g,v=f,x=(i?v.replace(/^\[([\w\W]*?)\](?=(\n|$))/gm,"".concat(we,"$1").concat(ke)):v).replace(/(^|[-\u2014\s(["])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/[(\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/--/g,"\u2014").replace(/\u25cf /g,"\u25cf").replace(/(\([\uff10-\uff190-9]{1,2}\))/g,(function(e){var t=ue[e];return null!==t&&void 0!==t?t:e})).replaceAll(new RegExp("{{([^{}]+?)}}","g"),(function(e){return e.replaceAll("{{",Fe).replaceAll("}}",Ce)})).replaceAll(new RegExp("{[^{}]+?}","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})),j=("tcg"===t||!1===l?x:x.replaceAll(new RegExp(Ee,"g"),(function(e){var t,n=null!==(t=B[e][u])&&void 0!==t?t:B[e].rubyForm;return"".concat(ye).concat(n).concat(Oe)}))).replaceAll(new RegExp(ve,"g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp("[(\\[\uff5b\u3014\u3008\u300a\u300c\uff62\u300e\u3010\u3018\u3016\u301d'\"\u2018\u201c\uff5f\xab\u25cf]+.","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp(Be,"g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp(".[\u2014...\u2025\u3033\u3034\u3035)]+[^\\s]","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})).replaceAll(new RegExp("[\u2460-\u2473]\uff1a.","g"),(function(e){return"".concat(ye).concat(e).concat(Oe)})),y=[],O=0,w=Object(Ft.a)(j);try{for(w.s();!(g=w.n()).done;){var k=g.value;k===ye?(0===O&&y.push(k),O+=1):k===Oe?0===(O-=1)&&y.push(k):y.push(k)}}catch(F){w.e(F)}finally{w.f()}return y.join("").replaceAll("".concat(ke).concat(Oe),"".concat(Oe).concat(ke)).replaceAll("".concat(ye).concat(we),"".concat(we).concat(ye)).replaceAll("".concat(Fe).concat(Oe),"".concat(Oe).concat(Fe)).replaceAll("".concat(ye).concat(Ce),"".concat(Ce).concat(ye)).replaceAll("".concat(we).concat(ke),"").replaceAll("".concat(ye).concat(Oe),"")},Qn=function(e){var t=e.format,n=e.isNormal,r=e.statInEffect,a=e.typeInEffect,o=[t,a?"type":"",r?"stat":""].filter((function(e){return""!==e})).join("-"),i=[t,a?"type":"",r?"stat":""].filter((function(e){return""!==e})).join("-"),c=Z[i];return r&&a&&n&&"tcg"===t&&((c=$).fontList=Q),{fontData:c,sizeList:N[o]}},er=d,tr=function(e){var t,n,r=e.ctx,a=e.content,o=e.isNormal,i=void 0!==o&&o,c=e.fontData,l=void 0===c?Z.tcg:c,u=e.textStyle,d=e.sizeList,f=void 0===d?N["tcg-type"]:d,b=e.condenseTolerant,p=void 0===b?"strict":b,m=e.format,h=e.furiganaHelper,g=0;if(!r||!a)return g;for(var v=Zn(a.trim(),m,{furiganaHelper:h}),x="tcg"===m?null!==(t=te[p])&&void 0!==t?t:te.strict:{1:800,2:800,3:800},j=function(e){var t,n,r,a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=e,i=[],c=new RegExp("^(".concat(we,"([^").concat(ke,"]*)").concat(ke,"\\s*)"));do{var l,s;n=null===(l=c.exec(o))||void 0===l?void 0:l[1],(r=null===(s=c.exec(o))||void 0===s?void 0:s[2])&&n&&(i.push(r),o=o.replace(n,""))}while(n&&r);var u="",d=new RegExp(Ne,"m"),f=null===(t=d.exec(e))||void 0===t?void 0:t[1];return f&&a?(u=f,o=o.replace(f,"")):u="",{fullLineList:i,effectText:o,effectFlavorCondition:u}}(v,i),y=j.effectText,O=j.effectFlavorCondition,w=j.fullLineList,k=(null!==(n=w.length)&&void 0!==n?n:0)+(O.length>0?1:0),F=y?y.split("\n"):[],C=l.font,S=l.fontList,T=function(){var e,t,n=S[g],a=n.fontSize,o=n.lineHeight,c=n.lineCount,d=null!==(e=f[g])&&void 0!==e?e:f[f.length-1],b=d.trueEdge,p=d.trueWidth,h=d.trueBaseline,v=i&&"tcg"===m?p-2:p,j=jt();r.font=j.setStyle(i&&"tcg"===m?"italic":"").setWeight("").setSize(a).setFamily(C).getFont(),r.textAlign="left";var y={fontData:l,fontLevel:g,currentFont:j},T=[],R=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:F,additionalLineCount:k,format:m,textData:y,width:v}),n=t.currentLineList,a=t.currentLineCount;return T=n,!(a>c)}),200),N=In(Object(s.a)({ctx:r},u));if(!(R<(null!==(t=x["".concat(F.length)])&&void 0!==t?t:x[3])&&g1)}))}}));if([].concat(Object(wn.a)(M),Object(wn.a)(T)).forEach((function(e){var t=e.line,n=e.isLast,a=e.effectiveMedian/1e3,i=function(e){for(var t=e.ctx,n=e.line,r=e.width,a=e.xRatio,o=e.format,i=e.isLast,c=e.textData,l=Gn(n),s=0,u=0,d=0,f=0,b=a;f0?-1*Math.min(20,j*b):0)+(0===f&&Pe.test(O)?4*b:0)),u+=g-(x&&void 0===m?1:0)}else b=a;else b=1}var w=u>0?(r-s)/u:0;return{tokenList:l,spaceWidth:i?"tcg"===o?w>1.5?0:w:w>3.65?0:w:w}}({ctx:r,line:t,xRatio:a,format:m,isLast:n,textData:y,width:v}),c=i.tokenList,l=i.spaceWidth;r.scale(a,1),_n({ctx:r,tokenList:c,xRatio:a,yRatio:1,trueEdge:b,trueBaseline:L,spaceWidth:l,textData:y,format:m}),L+=o,r.setTransform(1,0,0,1,0,0)})),O.length>0){var E=xt((function(e){return!(Jn({ctx:r,median:e,paragraphList:[O],format:m,textData:y,width:v}).currentLineCount>1)}))/1e3;r.scale(E,1),r.font=j.setStyle("").getFont();var I=Gn(O);I="\n"===I[0]?I.slice(1):I,_n({ctx:r,tokenList:I,xRatio:E,yRatio:1,trueEdge:b,trueBaseline:L,textData:y,format:m}),L+=o,r.setTransform(1,0,0,1,0,0)}return"break"}g+=1,N()};g12&&(b="center"),a&&"center"===b&&(d=0,f=0),p="center"===b?(nr+f)/2:"left"===b?85.9125+f:728.775,m=-54,n&&a&&"st"!==r&&(50,h=In(Object(s.a)({ctx:n},l)),n.textAlign="left"===b||"right"===b?b:"left",n.font="bold ".concat(50,"px RoGSanSrfStd-Bd"),g="center"===b?n.measureText(a).width/-2:"left"===b?4:-58,n.fillText(a,p+g,190),n.textAlign="left",h()),e.next=16,Promise.all(Object(wn.a)(Array(d)).map(Object(mn.a)(pn.a.mark((function e(){var t;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[p-(50+(m+=54)),145],e.next=4,Wn.apply(void 0,[n,"subfamily/subfamily-".concat(r,".png")].concat(t));case 4:return e.next=6,u(t);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})))));case 16:return e.abrupt("return",e.sent);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ar=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ctx,r=t.sticker,Nn(n)){e.next=3;break}return e.abrupt("return");case 3:if("no-sticker"!==r){e.next=5;break}return e.abrupt("return",Promise.resolve());case 5:return e.abrupt("return",Wn(n,"sticker/sticker-".concat(r.toLowerCase(),".png"),739.1438,1110.938));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),or=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r,a,o,i,c,l,s,u;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ctx,r=t.type,a=t.isPendulum,o=t.isLink,i=t.isDuelTerminalCard,c=t.isSpeedCard,l=t.bordered,n){e.next=3;break}return e.abrupt("return");case 3:if(!i){e.next=7;break}return s=a?[250,1087,180,20]:o?[151,848,216,24]:[80,843,270,30],e.next=7,Dn.apply(void 0,[n,"text/text-duel-terminal-".concat(r).concat(l?"-bordered":"",".png")].concat(s));case 7:if(!c){e.next=11;break}return u=a?[250,1090,176.4,18]:o?[151,855,215.6,22]:[80,850,245,25],e.next=11,Dn.apply(void 0,[n,"text/text-speed-duel-".concat(r).concat(l?"-bordered":"",".png")].concat(u));case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ir=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r){var a,o,i;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=t.getContext("2d"))&&Array.isArray(n)){e.next=3;break}return e.abrupt("return");case 3:return i=null!==(a=r.color)&&void 0!==a?a:"#000000",e.next=6,zn(t,"link/link-text.png",i,120,30,600,1080,r);case 6:o.textAlign="right",o.scale(1.2,1),o.font="bold 26.55px RoGSanSrfStd-Bd",o.fillText("".concat(n.length),622.75,1105),o.setTransform(1,0,0,1,0,0),o.textAlign="left";case 12:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),cr=b,lr=p,sr=m,ur=function(e){var t=e.canvas,n=e.artworkCanvas,r=e.backgroundCanvas,a=e.format,o=e.hasBackground,i=e.frame,c=e.bottomFrame,l=e.backgroundType,u=e.cardIcon,d=e.attribute,f=e.star,b=e.foil,p=e.pendulumSize,m=e.opacity,h=e.isLink,g=e.isSpeedSkill,v=e.isXyz,j=e.isPendulum,O=e.loopFinish,w=e.loopArtFinish,k=t.getContext("2d"),F=m.artBorder,C=m.nameBorder,S=m.body,T=m.name,R=m.pendulum,N=m.text,L=m.boundless,M=x(j,m),E=M.artX,I=M.artY,A=M.artFinishX,B=M.artFinishY,W=M.artWidth,P=S>0||F,D=860,z="normal"!==b,H=v||g?i:"normal",K=H,G=!L&&P,Y={calculateCardArtRedrawCoordination:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,a=null!==t&&void 0!==t?t:m,o=a.body,i=x(j,a,r),c=i.artX,l=i.artY,s=i.artWidth,u=e.width,d=e.height,f=s/u,b=o<100?(sr-c)/f:0,p=b*f,h=o<100?(cr-l)/f:0,g=h*f,v=o<100?d-lr/f:0,y=c+p,O=l+g,w=s-2*p,k=s/(u/d)*n-v*f;return{imageScaledRatio:f,sourceOffsetX:b,sourceOffsetY:h,destinationOffsetX:p,destinationOffsetY:g,offsetHeight:v,destinationX:y,destinationY:O,destinationWidth:w,destinationHeight:k}},drawFrame:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k){e.next=2;break}return e.abrupt("return");case 2:return k.globalAlpha=S/100,e.next=5,Wn(k,"frame/frame-".concat(i,".png"),0,0);case 5:return e.next=7,Wn(k,"frame-pendulum/frame-pendulum-".concat(c,".png"),0,0);case 7:k.globalAlpha=1;case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawCardArt:function(){if(n&&k){var e=n.width,t=n.height;t<=0||k.drawImage(n,0,0,e,t,E,I,W,W/(e/t))}},drawBackground:function(e){if(r&&k&&o){var t=r.width,n=r.height;if(!(n<=0))if("pendulum"!==e){var a=x(j,Object(s.a)(Object(s.a)({},m),{},{boundless:!0}),l),i=a.artX,c=a.artY,u=a.artWidth;k.drawImage(r,0,0,t,n,i,c,u,u/(t/n))}else{var d=Y.calculateCardArtRedrawCoordination(r);"full"===l?d=Y.calculateCardArtRedrawCoordination(r,Object(s.a)(Object(s.a)({},m),{},{body:0}),void 0,"full"):"fit"===l&&(d=Y.calculateCardArtRedrawCoordination(r,m,void 0,"fit"));var f=d,b=f.sourceOffsetX,p=f.sourceOffsetY,h=f.offsetHeight,g=f.destinationX,v=f.destinationY,y=f.destinationWidth,O=f.destinationHeight;k.drawImage(r,b,p,t-2*b,n-h,g,v,y,O)}}},drawAttribute:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"attribute/attr-".concat(a,"-").concat(d.toLowerCase(),".png"),678,55);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawStar:function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r,a;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.style,r=t.starAlignment,a="auto"===u?bt(i):u,e.next=4,rr({ctx:k,cardIcon:a,text:"string"===typeof f?f:null,star:f,starAlignment:r,style:n,onStarDraw:function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("st"!==a){e.next=4;break}e.t0=Promise.resolve(),e.next=7;break;case 4:return e.next=6,O(k,"star",function(){var e=Object(mn.a)(pn.a.mark((function e(n){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn.apply(void 0,[k,"finish/finish-".concat(n,"-star.png")].concat(Object(wn.a)(t))));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 6:e.t0=e.sent;case 7:return e.abrupt("return",e.t0);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),drawPendulumScaleIcon:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame-pendulum/pendulum-scale-".concat(p,".png"),0,750);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawLinkArrowMap:function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([1,2,3,4,6,7,8,9].map(function(){var e=Object(mn.a)(pn.a.mark((function e(n){var r,a,o,i,c,l,s,u,d;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(r=me[n-1]).left,o=r.top,i=r.height,c=r.width,l=t.includes("".concat(n)),s="link/link-inactive-".concat(n),u="link/link-active-".concat(n),d=[a,o,c,i],e.next=7,Dn.apply(void 0,[k,"".concat(s,"-base").concat(L?"-full":"",".png")].concat(d));case 7:return e.next=9,Dn.apply(void 0,[k,"".concat(s,"-core.png")].concat(d));case 9:if(!l){e.next=15;break}return e.next=12,Dn.apply(void 0,[k,"".concat(u,"-base.png")].concat(d));case 12:return e.abrupt("return",Dn.apply(void 0,[k,"".concat(u,"-core.png")].concat(d)));case 15:return e.abrupt("return");case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),drawStatBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(n){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,zn(t,"frame/frame-stat-border.png",n,813,20,0,1070);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),drawNameBackground:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(k){e.next=2;break}return e.abrupt("return");case 2:return k.globalAlpha=T/100,e.next=5,Wn(k,"background/background-name-".concat(i,".png"),0,0);case 5:k.globalAlpha=1;case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawEffectBackground:function(){var e=Object(mn.a)(pn.a.mark((function e(){var t,n=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],k){e.next=3;break}return e.abrupt("return");case 3:return k.globalAlpha=N/100,e.next=6,Wn(k,"background/background-text-".concat(c,".png"),54,884);case 6:if(!t){e.next=10;break}return k.globalAlpha=R/100,e.next=10,Wn(k,"background/background-pendulum-".concat(c,".png"),55,738);case 10:k.globalAlpha=1;case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawFrameBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"frame/frame-border-".concat(H,".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawNameBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",C?Wn(k,"frame/name-border-".concat(K,".png"),0,0):Promise.resolve());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){var t;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=5;break}return t="",t=v||g?"frame/art-border-".concat(i,".png"):h||["zarc","hamon","uria","raviel"].includes(i)?"frame/art-border-special.png":"frame/art-border.png",e.next=5,Wn(k,t,60,170);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawPendulumBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(t,n){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame-pendulum/border-pendulum-".concat(p)+"-".concat(n)+(t?"":"-artless")+".png",30,185);case 2:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),drawEffectBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(z||"speed-skill"!==c){e.next=5;break}return e.next=3,Wn(k,"frame/effect-border-speed-skill.png",35,D);case 3:e.next=7;break;case 5:return e.next=7,Wn(k,"frame/effect-border.png",35,D);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawCardBorder:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame/card-border".concat(z?"-".concat(b):"",".png"),0,0);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtBorderFoil:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=3;break}return e.next=3,Wn(k,"frame/art-border-".concat(b,".png"),60,170);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawEffectBorderFoil:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"frame/effect-border-".concat(b,".png"),35,D);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawLinkMapFoil:function(){var e=Object(mn.a)(pn.a.mark((function e(){var t,n=arguments;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:P,e.next=3,Wn(k,"link/link-overlay-arrow-".concat(b).concat(t?"":"-artless",".png"),0,175);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawNameFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P&&!C){e.next=3;break}return e.next=3,O(k,"name",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-name.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawAttributeFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d===y){e.next=3;break}return e.next=3,O(k,"attribute",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-attribute.png"),678,55));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!G){e.next=3;break}return e.next=3,w(k,"art",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wn(k,"finish/art-finish-".concat(t).concat(j?"-pendulum-".concat(p):"",".png"),A,B);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtOverlayFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"art-overlay",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish"+"-".concat(t)+"-".concat(G?"art":"unart")+"-overlay"+(j?"-pendulum-".concat(p):"")+".png",A,B));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawArtBorderFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=3;break}return e.next=3,O(k,"art-border",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-art-border.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawPendulumArtBorderFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=3;break}return e.next=3,O(k,"art-border-pendulum",(function(e){return Wn(k,"finish/finish-".concat(e,"-art-border-pendulum-").concat(p,".png"),0,0)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawBorderPendulumFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"border-pendulum",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-border-pendulum-").concat(p,".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawFrameFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"frame",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-frame").concat(j?"-pendulum-".concat(p):"",".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawFrameBackgroundFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"frame-background",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-frame-background").concat(j?"-pendulum-".concat(p):"",".png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawOverlayFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"overlay",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-overlay.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),drawCardBorderFinish:function(){var e=Object(mn.a)(pn.a.mark((function e(){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,O(k,"card-border",function(){var e=Object(mn.a)(pn.a.mark((function e(t){return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Wn(k,"finish/finish-".concat(t,"-card-border.png"),0,0));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()};return Y},dr=function(e,t,n,r,a,o,i,c){var l=t%360,s="".concat(Math.floor(l/90)),u=l%90,d=i+c,f=r+a/2,b=o+(c-i)/2,p=a,m=d;"1"!==s&&"3"!==s||(p=d,m=a);var h=Math.sqrt(Math.pow(p,2)/4+Math.pow(m,2)/4);if(h>0){var g=90-(180*Math.asin(p/2/h)/Math.PI-u),v=Math.sin(g/180*Math.PI)*h,x=Math.sin(u/180*Math.PI)*v,j=Math.cos(u/180*Math.PI)*v,y=x,O=j;"1"===s&&(y=j,O=-x),"2"===s&&(y=-x,O=-j),"3"===s&&(y=-j,O=x);var w=f+y,k=b-O,F=f-y,C=b+O,S=e.createLinearGradient(w,k,F,C);return n.forEach((function(e){var t=e.color,n=e.offset;return S.addColorStop(parseFloat(n),t)})),S}},fr=function(){var e=Object(mn.a)(pn.a.mark((function e(t,n,r,a,o,i,c){var l,u,d,f,b,p,m,h,g,v,x,j,y,O,w,k,F,C,S,R,N,L,M,E,I,A,B,W,P,D,z,K,G,Y,X,V,U,q,J,$,_,Z,Q,ee,te,re,ae,oe,ie;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=c.isSpeedSkill,u=c.format,d=c.cloneNode,f=c.frame,b=c.furiganaHelper,p=null===d||void 0===d?void 0:d.getContext("2d"),!(t&&p&&n)){e.next=58;break}if(v=Object(s.a)(Object(s.a)({},{font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"}),i),x=v.font,j=v.fillStyle,y=v.headTextFillStyle,O=v.shadowBlur,w=v.hasShadow,k=v.shadowColor,F=v.shadowOffsetX,C=v.shadowOffsetY,S=v.hasOutline,R=v.lineColor,N=v.lineWidth,L=v.lineOffsetX,M=v.lineOffsetY,E=v.hasGradient,I=v.gradientAngle,A=v.gradientColor,B=v.pattern,W=null!==(m=T[null!==B&&void 0!==B?B:""])&&void 0!==m?m:{},P=W.patternImage,D=W.blendMode,z=S,t.textAlign="left",w&&(t.shadowColor=k,t.shadowOffsetY=C,t.shadowOffsetX=F,t.shadowBlur=O),S&&(t.lineWidth=N,t.strokeStyle=R),K=Object(s.a)(Object(s.a)({},(null!==(h=ne[x])&&void 0!==h?h:ne.Default).fontData),{},{headTextFillStyle:y}),G=jt({defaultFamily:K.font,defaultSize:K.fontList[0].fontSize,defaultWeight:K.weight}),Y={fontLevel:0,fontData:K,currentFont:G},X=Zn(n,u,{multiline:!1,furiganaHelper:b,dictionaryType:"rubyFormName"}),V="ocg"===u?[X]:X.split(new RegExp("([^".concat("&A-Za-z0-9\\-/\\s\\(\\)!,.\u2018\u201c\u2019\u201d:;<>\\[\\]\\\\","])"),"g")),U=jt({defaultFamily:K.font,defaultSize:K.fontList[0].fontSize,defaultWeight:K.weight}),q=U.getFont(),J=U.setSize((function(e){return e*K.symbolFontRatio})).setStyle("small-caps").setFamily(K.symbolFont).getFont(),$=0,_=0,V.forEach((function(e,n){t.font=n%2===0?q:J;var r=t.measureText(e.replaceAll(Se,""));$=Math.max($,r.actualBoundingBoxAscent),_=Math.max(_,r.actualBoundingBoxDescent)}),0),t.font=q,Z=0,Q=xt((function(e){var n=Jn({ctx:t,median:e,paragraphList:[X],format:u,textData:Y,width:o}),r=n.currentLineCount,a=n.currentLineList;return!(r>1)&&(Z=a[0].actualLineWidth,!0)})),ee=Q/1e3,te=1,t.scale(ee,te),re=null!==(g=K.fontList[0].offsetY)&&void 0!==g?g:H.offsetY,ae=Gn(X),oe=Z>0&&E?dr(t,I,Ot(A),r,Z,a,$,_):void 0,t.fillStyle=null!==oe&&void 0!==oe?oe:j,_n({ctx:t,tokenList:ae,xRatio:ee,yRatio:te,trueEdge:r,trueBaseline:a,textData:Y,format:u,textDrawer:function(e){var t=e.ctx,n=e.letter,r=e.scaledEdge,a=e.scaledBaseline;t.fillText(n,r,a-(l?re:0))}}),!P||!d){e.next=45;break}return t.setTransform(1,0,0,1,0,0),e.next=35,Wn(p,"frame/frame-".concat(f,".png"),0,0);case 35:return e.next=37,Wn(p,"background/background-name-".concat(f,".png"),0,0);case 37:return p.globalCompositeOperation=D,e.next=40,Dn(p,"finish-name/".concat(P,".png"),r,a-$,o,$+_);case 40:t.globalCompositeOperation="source-in",t.drawImage(d,0,0),t.scale(ee,te),t.globalCompositeOperation="source-over",_n({ctx:t,tokenList:ae,xRatio:ee,yRatio:te,trueEdge:r,trueBaseline:a,textData:Y,format:u,textDrawer:function(){}});case 45:z&&(t.globalCompositeOperation="destination-over",_n({ctx:t,tokenList:ae,xRatio:ee,yRatio:te,trueEdge:r,trueBaseline:a,textData:Y,format:u,textDrawer:function(e){var t=e.ctx,n=e.letter,r=e.scaledEdge,a=e.scaledBaseline;t.lineJoin="round",t.strokeText(n,r+L,a+M-(l?re:0))}})),t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),ie={font:"Default",fillStyle:"#000000",headTextFillStyle:"#000000",shadowColor:"#000000",shadowOffsetY:0,shadowOffsetX:0,shadowBlur:0,hasShadow:!1,lineColor:"#000000",lineWidth:0,lineOffsetY:0,lineOffsetX:0,hasOutline:!1,gradientAngle:0,gradientColor:"0.000|#eef10b,0.5|#d78025,1.000|#7e20cf",hasGradient:!1,preset:"commonB",pattern:"none"},t.fillStyle=ie.fillStyle,t.shadowColor=ie.shadowColor,t.shadowOffsetY=ie.shadowOffsetY,t.shadowOffsetX=ie.shadowOffsetX,t.shadowBlur=ie.shadowBlur,t.lineWidth=ie.lineWidth,t.strokeStyle=ie.lineColor,t.lineJoin="miter",t.globalCompositeOperation="source-over";case 58:case"end":return e.stop()}}),e)})));return function(t,n,r,a,o,i,c){return e.apply(this,arguments)}}(),br={small:0,medium:1,large:2},pr=function(e){var t,n,r=e.ctx,a=e.value,o=e.format,i=e.metricMethod,c=e.size,l=e.furiganaHelper,u=null!==(t=null===(n=M[o])||void 0===n?void 0:n[c])&&void 0!==t?t:M.tcg.medium,d=u.edgeAlignment,f=void 0===d?"left":d,b=u.trueEdge,p=u.trueBaseline,m=u.trueWidth,h={tcg:oe,ocg:ie}[o];i&&(h.metricMethod=i);var g=h.font,v=br[c],x=h.fontList[v],j=jt({defaultFamily:g,defaultSize:"".concat(x.fontSize,"px")}),y={fontLevel:v,fontData:h,currentFont:j},O=0;r.font=j.getFont(),r.textAlign="left";var w=Zn(a,o,{multiline:!1,furiganaHelper:l}),k=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:[w],format:o,textData:y,width:m}),n=t.currentLineCount,a=t.currentLineList;return!(n>1)&&(O=a[0].actualLineWidth,!0)}))/1e3;r.scale(k,1);var F=_n({ctx:r,tokenList:Gn(w),xRatio:k,yRatio:1,trueEdge:"left"===f?b:b-O*k,trueBaseline:p,textData:y,format:o,textDrawer:function(e){var t=e.ctx,n=e.letter,r=e.scaledEdge,a=e.scaledBaseline;t.fillText(n,r,a)}});return r.setTransform(1,0,0,1,0,0),Object(s.a)(Object(s.a)({},F),{},{xRatio:k})},mr=function(){var e=Object(mn.a)(pn.a.mark((function e(t){var n,r,a,o,i,c,l,u,d,f,b,p,m,h,g,v,x,j,y,O,k,F,C,S;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.ctx,r=t.typeAbility,a=t.subFamily,o=t.format,i=t.frame,c=t.size,l=t.isMonster,u=t.textStyle,d=t.furiganaHelper,Nn(n)){e.next=3;break}return e.abrupt("return");case 3:if(f=r.length>0,p=r+((b=a!==w&&"large"===c)?"\u29be":""),m=f?"tcg"===o?"large"===c?"[\u200a\u200a".concat(p,"\u200a\u200a]"):"[".concat(p,"]"):"\u3010".concat(p,"\u3011"):"",f){e.next=9;break}return e.abrupt("return");case 9:if(h=mt(i)&&!dt({frame:i})&&"large"===c?"#ffffff":"#000000",g=Object(s.a)({color:h},u),v=In(Object(s.a)({ctx:n},g)),x=pr({ctx:n,format:o,size:c,value:m,metricMethod:l?void 0:"compact",furiganaHelper:d}),j=x.iconPositionList,y=x.xRatio,v(),O="ocg"===o?-4:0,k="ocg"===o?-3:0,!b){e.next=22;break}return F=j[0],C=F.edge,S=F.baseline,e.next=20,Dn(n,"subfamily/subfamily-".concat(a.toLowerCase(),".png"),(function(e){return C+.175*e.naturalWidth*y+k}),(function(e){return S-.8*e.naturalWidth+O}),(function(e){return e.naturalWidth}),(function(e){return e.naturalWidth}));case 20:e.next=22;break;case 22:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),hr=function(e,t,n,r){if(e&&t){e.font="".concat(60.5,"px MatrixBoldSmallCaps"),e.textAlign="left";var a="".concat(t).split(""),o=0;a.forEach((function(t){o+=e.measureText(t).width*("1"===t?.65:1)}));var i=n-o/2;a.forEach((function(t){e.fillText(t,"1"===t?i-3:i,r+60.5),i+=e.measureText(t).width*("1"===t?.65:1)}))}},gr=function(e,t,n,r){if(e){e.scale(1,.98),e.font="bold 35.73px Matrix-Bold";var a=Tn(e,t,.075,n,r/.98);e.setTransform(1,0,0,1,0,0),e.scale(1,1.01),e.font="bold 34.74px Matrix-Bold",Tn(e,"/",.15,a+5,r/1.01),e.setTransform(1,0,0,1,0,0)}},vr=function(e,t,n,r){if(e&&null!=t){var a=73.97;if("\u221e"===t)e.textAlign="right",e.font="bold 37px matrix",e.fillText(t,n+a,r);else if("?"===t)e.textAlign="right",e.font="bold 34px matrix",e.fillText(t,n+a,r);else{e.textAlign="left";var o="".concat(t).split("?"),i=o.reduce((function(t,n,r){e.font="37px MatrixBoldSmallCaps";var a=t+e.measureText(n).width;return r0){var c=Math.min(a/i,1);e.scale(c,1),o.reduce((function(t,n,a,i){var l=i[i.length-1-a],s=t;return e.font="37px MatrixBoldSmallCaps",s-=e.measureText(l).width*c,e.fillText(l,s/c,r),a0||i,(f=function(e,n,r,a){t.fillStyle=A?d:h,t.fillRect(e,n,r,a)})(0,0,jr,xr),p=ur({canvas:l.current,artworkCanvas:n,backgroundCanvas:r,format:M,frame:W,bottomFrame:Fe,hasBackground:A,backgroundType:B,attribute:fe,cardIcon:be,star:me,foil:P,pendulumSize:_e,opacity:o,isLink:Re,isSpeedSkill:Le,isXyz:Te,isPendulum:ne,loopFinish:Qe,loopArtFinish:et}),m=p.drawFrame,x=p.drawCardArt,j=p.drawBackground,y=p.drawPendulumScaleIcon,O=p.drawLinkArrowMap,w=p.drawStar,k=p.drawAttribute,F=p.drawNameBackground,C=p.drawEffectBackground,S=p.drawFrameBorder,T=p.drawNameBorder,R=p.drawArtBorder,N=p.drawPendulumBorder,L=p.drawBorderPendulumFinish,E=p.drawEffectBorder,I=p.drawCardBorder,D=p.drawStatBorder,z=p.drawAttributeFinish,H=p.drawArtBorderFoil,K=p.drawEffectBorderFoil,G=p.drawLinkMapFoil,X=p.drawNameFinish,V=p.drawArtFinish,U=p.drawArtOverlayFinish,q=p.drawArtBorderFinish,J=p.drawPendulumArtBorderFinish,$=p.drawFrameFinish,_=p.drawFrameBackgroundFinish,Z=p.drawOverlayFinish,Q=p.drawCardBorderFinish,ee=p.calculateCardArtRedrawCoordination,r&&t&&j(),n&&t&&!u&&x(),e.next=12,m();case 12:return e.next=14,I();case 14:return e.next=16,Q();case 16:if(ne){e.next=32;break}if(u){e.next=26;break}return e.next=20,F();case 20:return e.next=22,C();case 22:return e.next=24,E();case 24:return e.next=26,K();case 26:return e.next=28,R();case 28:return e.next=30,H();case 30:return e.next=32,q();case 32:if(!ne||Re||u){e.next=38;break}return n&&t&&n.height>0&&(te=n.width,re=n.height,ae=ee(n),oe=ae.sourceOffsetX,ie=ae.sourceOffsetY,ce=ae.offsetHeight,le=ae.destinationX,se=ae.destinationY,ue=ae.destinationWidth,pe=ae.destinationHeight,f(le,se,ue,pe),j("pendulum"),t.drawImage(n,oe,ie,te-2*oe,re-ce,le,se,ue,pe)),e.next=36,F();case 36:return e.next=38,C(!0);case 38:return e.next=40,V();case 40:return e.next=42,U();case 42:if(!ne||Re||u){e.next=54;break}return e.next=45,y();case 45:return e.next=47,N(b,"normal");case 47:return e.next=49,N(b,P);case 49:return e.next=51,J();case 51:if(!b){e.next=54;break}return e.next=54,L();case 54:if(u){e.next=59;break}return e.next=57,$();case 57:return e.next=59,X();case 59:if(!b){e.next=62;break}return e.next=62,_();case 62:if(!u){e.next=108;break}if(!Re){e.next=68;break}return e.next=66,q();case 66:e.next=78;break;case 68:if(!ne){e.next=78;break}if(ge=v.fullCard.ratio/v.extendedPendulum.ratio,n&&t&&n.height>0&&(ve=ee(n,Object(s.a)(Object(s.a)(Object(s.a)({},g()),Y),{},{body:100,boundless:!1}),ge),xe=ve.destinationX,je=ve.destinationY,ye=ve.destinationWidth,ke=ve.destinationHeight,f(xe,je,ye,ke),j("pendulum")),!b){e.next=76;break}return e.next=74,N(b,"normal");case 74:return e.next=76,N(b,P);case 76:return e.next=78,J();case 78:return e.next=80,F();case 80:return e.next=82,X();case 82:return e.next=84,T();case 84:return n&&t&&x(),e.next=87,U();case 87:if(!ne||Re){e.next=100;break}return e.next=90,C(!0);case 90:return e.next=92,y();case 92:return e.next=94,N(!1,"normal");case 94:return e.next=96,N(!1,P);case 96:return e.next=98,L();case 98:e.next=106;break;case 100:return e.next=102,C();case 102:return e.next=104,E();case 104:return e.next=106,K();case 106:return e.next=108,$();case 108:if(!Ve){e.next=111;break}return e.next=111,D(null!==(a=Ke.color)&&void 0!==a?a:"#000000");case 111:if(ne||!Re){e.next=120;break}return e.next=114,O(de);case 114:return e.next=116,G(!1);case 116:return Ce=In(Object(s.a)({ctx:t},Ke)),e.next=119,ir(l.current,null!==de&&void 0!==de?de:[],Ke);case 119:Ce();case 120:return e.next=122,k();case 122:return e.next=124,z();case 124:if(Re){e.next=127;break}return e.next=127,w({style:De,starAlignment:he});case 127:if(u){e.next=130;break}return e.next=130,T();case 130:return e.next=132,S();case 132:return e.next=134,or({ctx:t,type:Be&&!ne?"white":"black",bordered:(c<50||u)&&!ne,isDuelTerminalCard:Oe,isSpeedCard:we,isLink:Re,isPendulum:ne});case 134:return e.next=136,Z();case 136:case"end":return e.stop()}}),e)})))}}),[Ze,i,c,l,W,M,A,B,fe,Fe,P,me,he,be,Oe,Re,ne,we,Le,Te,Be,de,Ke,et,Qe,Y,_e,Ve,De,Je]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=w.current)||void 0===e?void 0:e.getContext("2d");Nn(t)&&ne&&(hr(t,null!==ce&&void 0!==ce?ce:0,84.4,790),hr(t,null!==le&&void 0!==le?le:0,728,790))}}),[Ze,ne,ce,le,w]),Object(o.useEffect)((function(){Ze&&(tt.current.name.rerun+=1,tt.current.name.instructor=Object(mn.a)(pn.a.mark((function e(){var t,n,r,a;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null===(t=m.current)||void 0===t?void 0:t.getContext("2d"),a=null===(n=m.current)||void 0===n?void 0:n.cloneNode(),Nn(r)&&a){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,fr(r,X,"tcg"===M?60:68,116,fe===y?"tcg"===M?688:674:"tcg"===M?608:598,ht({format:M,frame:W,nameStyle:V,nameStyleType:U,foil:P}),{isSpeedSkill:Le,format:M,cloneNode:a,frame:W,furiganaHelper:ke});case 6:case"end":return e.stop()}}),e)}))))}),[Ze,fe,P,M,W,ke,Le,X,m,V,U]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=F.current)||void 0===e?void 0:e.getContext("2d");if(Nn(t)&&Ve){var n=In(Object(s.a)({ctx:t},Ke));gr(t,"ATK",432.1,1106.494),vr(t,se,508.824,1106.494),Re||(gr(t,"DEF",600.85,1106.494),vr(t,ue,673.865,1106.494)),n()}}}),[Ze,se,ue,Re,Ne,Ke,F,Ve]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=k.current)||void 0===e?void 0:e.getContext("2d");Nn(t)&&function(e,t,n){if(e){var r=n.isPendulum,a=n.isLink,o=n.withShadow,i=n.format,c=n.lightFooter,l=.175,s=0,u=0;e.fillStyle=c&&!r?"#ffffff":"#000000",e.shadowColor=o?c?"#000000":"#ffffff":"#000000",e.shadowOffsetY=0,e.shadowOffsetX=0,e.shadowBlur=o&&!r?3:0,e.font="".concat(o?"bold":""," 22px stone-serif-regular"),"ocg"===i&&(l=.145,s=-1,u=-3),r?Tn(e,t,l,66.65+u,1105.01+s):a?Rn(e,t,l,666.56+u,872.94+s):Rn(e,t,l,728.78+u,871.5+s)}}(t,ge,{isLink:Re,isPendulum:ne,withShadow:Ae&&!ne,format:M,lightFooter:Be})}}),[Ze,M,Re,ne,Be,k,ge,Le,Fe,Ae]),Object(o.useEffect)((function(){var e;if(Ze){var t=null===(e=j.current)||void 0===e?void 0:e.getContext("2d");if(Nn(t)){var n=function(e){var t,n,r=e.ctx,a=e.value,o=e.format,i=e.alignment,c=e.baselineOffset,l=void 0===c?0:c,s=e.lightFooter,u=e.hasShadow;if(!Nn(r))return 0;r.fillStyle=s?"#ffffff":"#000000",r.shadowColor=u?s?"#000000":"#ffffff":"#000000",r.shadowOffsetY=0,r.shadowOffsetX=0,r.shadowBlur=u?3:0;for(var d=null!==(t=I[o])&&void 0!==t?t:I.tcg,f=d.trueEdge,b=d.trueBaseline,p=d.trueWidth,m=/^[0-9]*$/.test(a),h=ae[o],g=h.font,v=Zn(a,o,{multiline:!1,furiganaHelper:!1}),x={fontLevel:m?0:1,fontData:h,currentFont:jt()},j=0,y=1e3,O=h.fontList[0],w=function(e){O=h.fontList[e];var t=jt({defaultFamily:g,defaultSize:"".concat(O.fontSize,"px"),defaultWeight:u?"bold":""}),n={fontLevel:e,fontData:h,currentFont:t},a=0;if(r.font=t.getFont(),r.textAlign="left",y=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:[v],format:o,textData:n,width:p}),i=t.currentLineCount,c=t.currentLineList;return!(i>1)&&(a=c[0].actualLineWidth,!0)})),j=a,x=n,y>=1e3)return"break"},k=0;k1&&void 0!==arguments[1]?arguments[1]:99,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{stroke:!1};if(e){var a=(null!==r&&void 0!==r?r:{}).stroke,o=void 0!==a&&a;e.font="bold 23.7px palatino-linotype-bold";var i=t;e.fillText("1",i,1150.93+n),o&&e.strokeText("1",i,1150.93),i+=e.measureText("1").width-2,e.font="bold 17.78px palatino-linotype-bold",e.fillText("st",i,1143.53+n),o&&e.strokeText("st",i,1143.53),i+=e.measureText("st").width,e.font="bold 22.22px palatino-linotype-bold",e.fillText(" Edition",i,1150.93+n),o&&e.strokeText(" Edition",i,1150.93)}}(t,Math.max(n+14.813,142.2)-("ocg"===M?10:0),Le?-2:-1))}}}),[Ze,Oe,ye,ve,j,Be,M,Ae,Le,Fe]),Object(o.useEffect)((function(){var e;Ze&&function(e){var t,n,r=e.ctx,a=e.value,o=e.format,i=e.alignment,c=e.baselineOffset,l=void 0===c?0:c,s=e.lightFooter,u=e.hasShadow;if(Nn(r)){r.fillStyle=s?"#ffffff":"#000000",r.shadowColor=u?s?"#000000":"#ffffff":"#000000",r.shadowOffsetY=0,r.shadowOffsetX=0,r.shadowBlur=u?3:0;for(var d=null!==(t=E[o])&&void 0!==t?t:E.tcg,f=d.trueEdge,b=d.trueBaseline,p=d.trueWidth,m=re[o],h=m.font,g=Zn(a,o,{multiline:!1,furiganaHelper:!1}),v={fontLevel:0,fontData:m,currentFont:jt()},x=0,j=1e3,y=m.fontList[0],O=function(e){y=m.fontList[e];var t=jt({defaultFamily:h,defaultSize:"".concat(y.fontSize,"px"),defaultWeight:u?"bold":""}),n={fontLevel:e,fontData:m,currentFont:t},a=0;if(r.font=t.getFont(),r.textAlign="left",j=xt((function(e){var t=Jn({ctx:r,median:e,paragraphList:[g],format:o,textData:n,width:p}),i=t.currentLineCount,c=t.currentLineList;return!(i>1)&&(a=c[0].actualLineWidth,!0)})),x=a,v=n,j>=1e3)return"break"},w=0;w2&&void 0!==arguments[2]?arguments[2]:0;return new Promise((function(r){setTimeout((function(){if(e.current&&t)try{e.current.toBlob((function(e){if(e){var n=URL.createObjectURL(e);if(n){var a=new Image;a.src=n,a.onload=function(){t.drawImage(a,0,0),URL.revokeObjectURL(n),r(!0)},a.onerror=function(){URL.revokeObjectURL(n),r(!1)}}else r(!1)}else r(!1)}))}catch(n){console.error(n),r(!1)}else r(!1)}),25*n)}))},!c||!s){e.next=37;break}return s.clearRect(0,0,d,f),e.next=8,Promise.all(Object.values(tt.current).sort((function(e,t){return e.order-t.order})).map((function(e){var t=e.instructor,n=e.rerun,r=e.name;return 0!==n&&nt.current[r]!==n||!nt.current[r]?(nt.current[r]=n,t()):Promise.resolve()})));case 8:return(v=i.current)&&s&&(y=x(r,o),L=y.artX,M=y.artY,E=y.artWidth,I=v.width,(A=v.height)>0&&s.drawImage(v,0,0,I,A,L,M,E,E/(I/A))),e.next=12,u(l,s,0);case 12:return e.next=14,u(m,s,0);case 14:return e.next=16,u(S,s,0);case 16:return e.next=18,u(w,s,0);case 18:return e.next=20,u(O,s,0);case 20:return e.next=22,u(T,s,0);case 22:return e.next=24,u(p,s,0);case 24:return e.next=26,u(F,s,0);case 26:return e.next=28,u(k,s,0);case 28:return e.next=30,u(j,s,0);case 30:return e.next=32,u(b,s,0);case 32:return e.next=34,u(C,s,0);case 34:return e.next=36,u(R,s,0);case 36:null===(h=N.current)||void 0===h||null===(g=h.getContext("2d"))||void 0===g||g.drawImage(c,0,0);case 37:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[i,S,b,a,p,R,N,m,j,O,w,k,l,F,C,T]);return{drawingPipeline:tt,onExport:rt}},Or=n(120),wr=n.n(Or),kr=n(26);var Fr=function(e,t,n){if(!t)return e;var r=e.width,a=e.height,o=e.x,i=void 0===o?0:o,c=e.y,l=void 0===c?0:c;if("px"===e.unit){var u=t.width,d=t.height,f=d/u>=.8?400/300:1,b=Math.min((null!==i&&void 0!==i?i:0)*f,u),p=Math.min((null!==l&&void 0!==l?l:0)*f,d),m=Math.min((null!==r&&void 0!==r?r:0)*f,u);return{unit:"%",x:b/u*100,y:p/d*100,width:m/u*100,height:m/(null!==n&&void 0!==n?n:1)/d*100,aspect:n}}if(i<0)return Object(s.a)(Object(s.a)({},e),{},{x:0});if(l<0)return Object(s.a)(Object(s.a)({},e),{},{y:0});var h=t.naturalHeight,g=t.naturalWidth,v=null!==r&&void 0!==r?r:0,x=null!==a&&void 0!==a?a:0,j=.05*(h>g?h:g),y=Math.abs(x*h*n-v*g)<=j;return Object(s.a)(Object(s.a)({},e),{},{x:i<0?0:i,y:l<0?0:l,height:y?x:v*t.naturalWidth/n/t.naturalHeight,aspect:n})},Cr=i.a.forwardRef((function(e,t){var n=e.title,r=e.backgroundColor,i=e.className,c=e.defaultExternalSource,l=void 0===c?"":c,d=e.receivingCanvas,f=e.children,b=e.beforeCropper,p=e.defaultCropInfo,m=e.ratio,h=e.onSourceLoaded,g=void 0===h?function(){}:h,v=e.onSourceChange,x=void 0===v?function(){}:v,j=e.onCropChange,y=void 0===j?function(){}:j,O=e.onTainted,w=void 0===O?function(){}:O,k=vn(),F=Object(o.useRef)(null),C=Object(o.useState)("anonymous"),S=Object(u.a)(C,1)[0],T=Object(o.useState)(0),R=Object(u.a)(T,2),N=R[0],L=R[1],M=Object(o.useState)("external"),E=Object(u.a)(M,2),I=E[0],A=E[1],B=Object(o.useState)("external"),W=Object(u.a)(B,2),P=W[0],D=W[1],z=Object(o.useState)(""),H=Object(u.a)(z,2),K=H[0],G=H[1],Y=Object(o.useState)(!1),X=Object(u.a)(Y,2),V=X[0],U=X[1],q=Object(o.useState)(null),J=Object(u.a)(q,2),$=J[0],_=J[1],Z=Object(o.useState)(l),Q=Object(u.a)(Z,2),ee=Q[0],te=Q[1],ne=Object(o.useRef)(null),re=Object(o.useState)({current:p,completed:null}),ae=Object(u.a)(re,2),oe=ae[0],ie=ae[1],ce=Object(o.useState)("%"===p.unit),le=Object(u.a)(ce,2),se=le[0],ue=le[1],de=oe.current,fe=oe.completed,be=Object(o.useRef)({source:"",crop:null}),pe=Object(o.useCallback)((function(e){if(U(!1),_(null),g(),ne.current=e,e.src===be.current.source&&be.current.crop){var t=me.current;setTimeout((function(){if(t===me.current&&be.current.crop){var n=Fr(be.current.crop,e,m);ie({completed:n,current:n}),ue(!0),be.current={source:"",crop:null}}}),250)}else setTimeout((function(){ie((function(t){var n=Fr(t.current,e,m);return{completed:n,current:n}})),ue(!0)}),250)}),[g,m]);Object(o.useEffect)((function(){var e,t,n,r,a,o,i=ne.current;if(fe&&d&&i){var c=fe.aspect;d.style.transform="scale(2)";var l=d.getContext("2d");if(l&&"number"===typeof c&&!(c<=0)){var u=i.naturalHeight,f=i.naturalWidth,b=f/i.width,p=u/i.height,m=null!==(e=fe.unit)&&void 0!==e?e:"px",h=window.devicePixelRatio;l.setTransform(h,0,0,h,0,0);var g=Math.floor((null!==(t=fe.width)&&void 0!==t?t:0)*("px"===m?b:f/100)),v=Math.min(f,g),x=Math.floor(g/c),j=Math.min(u,x),O=Math.min(f,Math.floor((null!==(n=fe.x)&&void 0!==n?n:0)*("px"===m?b:f/100))),w=Math.min(u,Math.floor((null!==(r=fe.y)&&void 0!==r?r:0)*("px"===m?p:u/100)));if(l.imageSmoothingQuality="high",!(v<=0||j<=0)){var k=void 0;if(O+v>f||w+j>u||O<0||w<0||Math.abs((g-v)/v)>.01||Math.abs((x-j)/j)>.01)"width"===(c*u>f?"width":"height")?(O=0,k={unit:"%",aspect:c,height:(j=(v=f)/c)/u*100,width:v/f*100,x:0,y:(w=(u-j)/2)/u*100}):(w=0,k={unit:"%",aspect:c,height:(j=u)/u*100,width:(v=u*c)/f*100,x:(O=(f-v)/2)/f*100,y:0});d.width=null!==(a=v)&&void 0!==a?a:0,d.height=null!==(o=j)&&void 0!==o?o:0,l.drawImage(i,O,w,v,j,0,0,v,j),"internal"===I&&(null!==K&&void 0!==K?K:"").length<=0||c===fe.aspect&&y(fe,I),k&&ie((function(e){return Object(s.a)(Object(s.a)({},e),{},{current:k})}))}}}}),[fe,d,N]),Object(o.useEffect)((function(){ie((function(e){if(null!=ne.current&&e.current){var t=Fr(e.current,ne.current,m);return{current:t,completed:t}}return e}))}),[m]);var me=Object(o.useRef)(0);Object(o.useImperativeHandle)(t,(function(){return{hasImage:function(){return"string"===typeof K&&K.length>0&&"internal"===I||"string"===typeof ee&&ee.length>0&&"external"===I},forceExternalSource:function(e,t){("internal"===I?K:ee)!==e&&(U(!0),A("external"),D("external"),x(e),te(e)),ue("%"===t.unit),me.current+=1,be.current={source:e,crop:t},L((function(e){return e+1}))}}}));var he=d&&!V&&(null===fe||void 0===fe?void 0:fe.width)&&(null===fe||void 0===fe?void 0:fe.height);return Object(a.jsxs)("div",{className:"card-image-cropper ".concat(i),children:[Object(a.jsxs)("div",{className:"card-image-source-input",children:[f,Object(a.jsxs)("div",{className:"card-image-source-input-container",children:[Object(a.jsxs)("div",{className:"card-image-source-input-title",children:[Object(a.jsxs)("span",{className:"field-title",children:[n," ",Object(a.jsx)(an,{Icon:Jt.a,containerProps:{className:he?"":"disabled"},tooltipProps:{overlay:he?k["image-cropper.download"]:k["image-cropper.no-download"]},onClick:function(){return he&&d&&function(e,t){t&&e&&e.toBlob((function(e){if(null!==e){var t=window.URL.createObjectURL(e),n=document.createElement("a");n.download="crop-preview.png",n.href=URL.createObjectURL(e),n.click(),window.URL.revokeObjectURL(t)}}),"image/png",1)}(d,fe)}})]}),Object(a.jsxs)(Yt.a.Group,{className:"card-image-source-type-input",onChange:function(e){var t=e.target.value;D(t),((null!==K&&void 0!==K?K:"").length>0&&"internal"===t||(null!==ee&&void 0!==ee?ee:"").length>0&&"external"===t)&&A(t)},value:P,children:[Object(a.jsx)(Yt.a.Button,{value:"external",checked:"external"===P,children:k["image-cropper.source.online.tooltip"]}),Object(a.jsx)(Xt.a,{title:Object(a.jsx)("div",{className:"image-warning",children:k["image-cropper.offline-warning"]}),children:Object(a.jsxs)(Yt.a.Button,{value:"internal",checked:"internal"===P,children:[k["image-cropper.source.offline.tooltip"]," ",Object(a.jsx)($t.a,{})]})})]})]}),Object(a.jsxs)("div",{className:["card-image-input","external"===P?"":"input-inactive"].join(" "),children:[Object(a.jsx)(Vt.a,{placeholder:k["image-cropper.placeholder"],value:ee,onChange:function(e){var t=e.target.value;U(!0),A("external"),D("external"),x(t),te(t)},maxLength:512,allowClear:!0},"key"),$?Object(a.jsx)("div",{className:"online-image-tip image-warning",children:k["image-cropper.not-found-warning"]}):Object(a.jsx)("div",{className:"online-image-tip",children:k["image-cropper.online-tip"]})]}),Object(a.jsxs)("div",{className:["card-image-input","internal"===P?"":"input-inactive"].join(" "),children:[Object(a.jsx)(Vt.a,{ref:F,type:"file",accept:"image/*",onChange:function(e){if(e.target.files&&e.target.files.length>0){U(!0);var t=new FileReader;t.addEventListener("load",(function(){"string"===typeof t.result&&(G(t.result),A("internal"),D("internal"),U(!1))})),t.readAsDataURL(e.target.files[0])}else alert(k["image-cropper.not-found-warning"])},onClick:function(){var e;return null===(e=F.current)||void 0===e?void 0:e.setValue("")}}),Object(a.jsx)("hr",{}),k["image-cropper.offline-warning"]]})]})]}),b,Object(a.jsxs)("div",{className:"card-cropper",children:[V&&Object(a.jsx)(en.FullView,{}),Object(a.jsx)(qt.a,{src:"internal"===I?K:ee,imageStyle:r?{backgroundColor:r}:{backgroundImage:'url("'.concat("/ygocarder",'/asset/image/texture/transparent-tile.png")')},onImageLoaded:pe,onImageError:function(){if(be.current={source:"",crop:null},_("Image error"),U(!1),"external"===I&&""===(null!==ee&&void 0!==ee?ee:"")&&d){var e=d.width,t=d.height,n=d.getContext("2d");null===n||void 0===n||n.clearRect(0,0,e,t),fe&&y(fe,I),g()}else w()},crop:de,onChange:function(e,t){var n=ne.current;be.current.crop||(se?ie((function(e){return Object(s.a)(Object(s.a)({},e),{},{current:Fr(t,n,m)})})):(ue(!0),ie((function(t){return Object(s.a)(Object(s.a)({},t),{},{current:Fr(e,n,m)})}))))},onComplete:function(e,t){be.current.crop||ie((function(e){return Object(s.a)(Object(s.a)({},e),{},{completed:t})}))},ruleOfThirds:!0,crossorigin:S},"".concat(I,"-").concat(se,"-").concat(N))]})]})})),Sr=(n(272),function(e){var t=e.defaultValue,n=void 0===t?[]:t,r=e.onChange,i=void 0===r?function(){}:r,c=Object(o.useState)(n),l=Object(u.a)(c,2),s=l[0],d=l[1],f=[-45,0,45,-90,0,90,-135,180,135],b=vn(),p=JSON.stringify(s);return Object(o.useEffect)((function(){i(s)}),[p]),Object(a.jsxs)("div",{className:"link-marker-chooser",children:[Object(a.jsx)("div",{className:"title",children:b["link-picker.label"]}),Object(a.jsx)("div",{className:"container",children:Object(wn.a)(Array(9)).map((function(e,t){var n="".concat(t+1);return"5"===n?Object(a.jsx)(Xt.a,{overlay:b["link-picker.reset.tooltip"],children:Object(a.jsx)("div",{className:"link-marker-reset",onClick:function(){d([])},children:Object(a.jsx)(j.a,{})})},"5"):Object(a.jsx)("div",{className:"link-marker-button marker-".concat(t+1," ").concat(s.includes(n)?"marker-checked":""),onClick:function(){d((function(e){var t=Object(wn.a)(e);return t.includes(n)?t=t.filter((function(e){return e!==n})):t.push(n),t}))},children:Object(a.jsx)("div",{className:"link-marker-icon link-marker-icon-".concat(t+1),style:{transform:"rotate(".concat(f[t],"deg)")}})},n)}))})]})}),Tr=n(422),Rr=(n(273),function(e){var t=e.overlayClassName,n=e.iconProps,r=Object(tn.a)(e,["overlayClassName","iconProps"]),o=null!==n&&void 0!==n?n:{},i=o.className,c=Object(tn.a)(o,["className"]);return Object(a.jsx)(Tr.a,Object(s.a)(Object(s.a)({overlayClassName:["explanation-overlay",null!==t&&void 0!==t?t:""].join(" ")},r),{},{children:Object(a.jsx)($t.a,Object(s.a)({className:["explanation-icon",null!==i&&void 0!==i?i:""].join(" ")},c))}))}),Nr=n(418),Lr=n(60),Mr=n(426),Er=n(427);n(274);function Ir(){var e=Object(Kt.a)(["\n min-width: 0;\n position: relative;\n overflow: hidden;\n .caption {\n position: absolute;\n right: 0;\n bottom: 0;\n padding: var(--spacing-px) var(--spacing-sm);\n background: var(--main-level-5);\n border-radius: var(--br-lg) 0 0 0;\n box-shadow: var(--bs-block);\n }\n > img {\n max-width: 100%;\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br-lg);\n }\n"]);return Ir=function(){return e},e}function Ar(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 615fr 703fr;\n gap: var(--spacing-sm);\n padding: var(--spacing-sm) 0;\n overflow: hidden;\n .panel-box {\n min-width: 0;\n position: relative;\n overflow: hidden;\n }\n"]);return Ar=function(){return e},e}function Br(){var e=Object(Kt.a)(["\n white-space: pre-line;\n"]);return Br=function(){return e},e}function Wr(){var e=Object(Kt.a)(["\n background: var(--main-level-1);\n padding: var(--spacing-px) var(--spacing-xxs);\n border: var(--bw) solid #4e84a4;\n border-radius: var(--br);\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\n"]);return Wr=function(){return e},e}var Pr=Gt.b.span(Wr()),Dr=Gt.b.div(Br()),zr=Gt.b.div(Ar()),Hr=Gt.b.div(Ir()),Kr=function(e){var t=e.caption,n=e.containerProps,r=e.alt,o=Object(tn.a)(e,["caption","containerProps","alt"]),i=(null!==n&&void 0!==n?n:{}).className;return Object(a.jsxs)(Hr,{className:"image-with-caption ".concat(i),children:[Object(a.jsx)("img",Object(s.a)({alt:r},o)),Object(a.jsx)("div",{className:"caption",children:t})]})},Gr=function(){var e=Object(o.useState)(!1),t=Object(u.a)(e,2),n=t[0],r=t[1],i=vn();return Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Nr.a,{footer:null,visible:n,width:"60%",title:Object(a.jsxs)("div",{className:"overlay-title",children:[i["guide.format.label"]," ",Object(a.jsx)(Lr.a,{size:"small",type:"primary",onClick:function(){r(!1)},children:i["guide.format.close"]})]}),className:"formattting-guide-overlay",onClose:function(){r(!1)},children:Object(a.jsxs)(Dr,{children:[Object(a.jsxs)("p",{children:[i["guide.format.introduction"](Object(a.jsx)(Mr.a,{},"icon")),"."]}),Object(a.jsx)("h2",{children:i["guide.format.section-1.label"]}),i["guide.format.section-1.content"](Object(a.jsx)(Pr,{children:"["},"open-tag"),Object(a.jsx)(Pr,{children:"]"},"close-tag"),Object(a.jsx)(Pr,{children:"Ctrl-1"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-1"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-1-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-1-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-2.label"]}),i["guide.format.section-2.content"](Object(a.jsx)(Pr,{children:"{"},"open-tag"),Object(a.jsx)(Pr,{children:"}"},"close-tag"),Object(a.jsx)(Pr,{children:"Ctrl-2"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-2"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-2-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-2-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-3.label"]}),i["guide.format.section-3.content"](Object(a.jsx)(Pr,{children:"|"},"separator"),Object(a.jsx)(Pr,{children:"Ctrl-3"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-3"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-3-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-3-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-4.label"]}),i["guide.format.section-4.content"](Object(a.jsx)(Pr,{children:"||"},"separator"),Object(a.jsx)(Pr,{children:"Ctrl-4"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-4"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-4-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-4-preview.jpg"),caption:i["guide.format.caption.output"]})]}),Object(a.jsx)("h2",{children:i["guide.format.section-5.label"]}),i["guide.format.section-5.content"](Object(a.jsx)(Pr,{children:"{{"},"open-tag"),Object(a.jsx)(Pr,{children:"}}"},"close-tag"),Object(a.jsx)(Pr,{children:"Ctrl-5"},"hotkey"),Object(a.jsx)(Pr,{children:"\u2318-5"},"hokey-alternative")),Object(a.jsxs)(zr,{className:"panel-figure",children:[Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-raw"},alt:"non-breakable line raw",src:"".concat("/ygocarder","/asset/image/syntax/syntax-5-raw.jpg"),caption:i["guide.format.caption.input"]}),Object(a.jsx)(Kr,{containerProps:{className:"panel-box box-preview"},alt:"non-breakable line preview",src:"".concat("/ygocarder","/asset/image/syntax/syntax-5-preview.jpg"),caption:i["guide.format.caption.output"]})]})]})}),Object(a.jsxs)(Lr.a,{className:"formatting-help-button",type:"primary",onClick:function(){r(!0)},children:[i["guide.format.label"]," ",Object(a.jsx)(Er.a,{})]})]})};function Yr(){var e=Object(Kt.a)(["\n display: inline-block;\n width: 10px;\n"]);return Yr=function(){return e},e}function Xr(){var e=Object(Kt.a)(["\n display: grid;\n ","\n > label {\n cursor: pointer;\n padding: 0 var(--spacing-xxs);\n text-align: center;\n }\n"]);return Xr=function(){return e},e}var Vr=Gt.b.div(Xr(),(function(e){return e.$withPillar?"grid-template-columns: max-content 1fr;":"grid-template-columns: 1fr;"})),Ur=Gt.b.div(Yr()),qr=function(e){var t=e.nameKey,n=e.labelBackgroundColor,r=e.labelBackgroundColorList,o=e.className,i=vn();return Object(a.jsxs)(Vr,{className:"frame-info-block ".concat(null!==o&&void 0!==o?o:""),$withPillar:!(!n&&!r),children:[r?Object(a.jsx)(Ur,{children:r.map((function(e){return Object(a.jsx)("div",{style:{backgroundColor:e,height:"".concat(100/r.length,"%")}},e)}))}):n?Object(a.jsx)(Ur,{style:{backgroundColor:n}}):null,Object(a.jsx)("label",{className:"frame-info-block-label",children:i[t]})]})},Jr=n(419);function $r(){var e=Object(Kt.a)(["animation: "," 12s linear infinite;"]);return $r=function(){return e},e}function _r(){var e=Object(Kt.a)(["\n cursor: pointer;\n .setting-button-label {\n display: grid;\n label {\n cursor: pointer;\n line-height: 1;\n font-size: var(--fs-xs);\n margin-top: var(--spacing-xs);\n }\n }\n .anticon-setting {\n font-size: var(--fs-xl);\n justify-self: center;\n > svg {\n ","\n }\n }\n &:hover {\n color: var(--main-active);\n .anticon-setting {\n color: var(--sub-active);\n }\n }\n"]);return _r=function(){return e},e}function Zr(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 1fr;\n gap: var(--spacing-sm);\n background-color: var(--main-level-3);\n padding: var(--spacing-sm);\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br-lg);\n color: var(--color);\n"]);return Zr=function(){return e},e}function Qr(){var e=Object(Kt.a)(["\n to {\n transform: rotate(360deg);\n }\n"]);return Qr=function(){return e},e}var ea=Object(Gt.c)(Qr()),ta=Gt.b.div(Zr()),na=Gt.b.div(_r(),(function(e){return e.$softMode?"":Object(Gt.a)($r(),ea)})),ra=function(){var e=vn(),t=kn((function(e){return{setting:e.setting,updateSetting:e.updateSetting}})),n=t.setting,r=t.updateSetting,o=n.allowHotkey,i=n.reduceMotionColor,c=n.showCreativeOption,l=n.showExtraDecorativeOption;return Object(a.jsx)(na,{className:"setting-button",$softMode:i,children:Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"setting-button-overlay",content:Object(a.jsxs)(ta,{children:[Object(a.jsx)("div",{children:Object(a.jsx)(Jr.a,{checked:i,onChange:function(e){return r({reduceMotionColor:e.target.checked})},children:e["setting.option.soft-mode.label"]})}),Object(a.jsx)("div",{children:Object(a.jsx)(Jr.a,{checked:l,onChange:function(e){return r({showExtraDecorativeOption:e.target.checked})},children:e["setting.option.extra-decorative.label"]})}),Object(a.jsx)("div",{children:Object(a.jsx)(Jr.a,{checked:c,onChange:function(e){return r({showCreativeOption:e.target.checked})},children:e["setting.option.creative.label"]})}),Object(a.jsx)("div",{children:Object(a.jsx)(Xt.a,{title:e["setting.option.hotkey.tooltip"],placement:"left",children:Object(a.jsx)(Jr.a,{checked:o,onChange:function(e){return r({allowHotkey:e.target.checked})},children:e["setting.option.hotkey.label"]})})}),Object(a.jsx)("div",{children:Object(a.jsx)("small",{children:e["setting.alert"]})})]}),children:Object(a.jsxs)("div",{className:"setting-button-label",children:[Object(a.jsx)(Mr.a,{}),Object(a.jsx)("label",{children:e["setting.button.label"]})]})})})},aa=n(428);n(275);function oa(){var e=Object(Kt.a)(["\n align-content: center;\n align-self: center;\n border-left: var(--bw) dashed #b1b1b1;\n padding-left: var(--spacing);\n margin-left: var(--spacing);\n"]);return oa=function(){return e},e}var ia=function(){var e;return Object(a.jsxs)("div",{className:"affiliation",children:[Object(a.jsxs)("span",{className:"version",children:["v",null!==(e="2.0.15")?e:"unknown"]}),Object(a.jsx)("div",{className:"affiliation-link",children:Object(a.jsx)("a",{href:"https://github.com/lauqerm/ygocarder",target:"_blank",rel:"noreferrer",children:Object(a.jsx)(aa.a,{})})})]})},ca=Gt.b.div(oa()),la=function(){var e=gn((function(e){return{languageInfo:e.languageInfo,language:e.language,languageMetadataMap:e.languageMetadataMap,changeLanguage:e.changeLanguage}})),t=e.language,n=e.languageInfo,r=e.languageMetadataMap,o=e.changeLanguage;return Object(a.jsxs)("div",{className:"app-header",children:[Object(a.jsx)("img",{alt:"app-logo",src:"".concat("/ygocarder","/logo192.png"),width:35}),Object(a.jsxs)("div",{className:"app-description",children:[Object(a.jsxs)("div",{className:"header-language",children:[Object(a.jsx)("h1",{children:"Yugioh Carder"}),Object(a.jsx)(Yt.a.Group,{value:n.codeName,size:"small",children:Object.values(r).filter((function(e){return e.active})).map((function(e){var t=e.codeName,n=e.name;return Object(a.jsx)(Yt.a.Button,{value:t,onChange:function(e){return o(e.target.value)},children:n},t)}))})]}),Object(a.jsxs)("div",{className:"app-contribution",children:[Object(a.jsxs)("span",{className:"app-creator",children:[t["contributor.gui.label"],": ",Object(a.jsx)("a",{href:"https://github.com/lauqerm/ygocarder",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"Lauqerm"})}),"\xa0",Object(a.jsx)(Rr,{content:Object(a.jsxs)("div",{className:"disclaimer",children:[Object(a.jsx)("h2",{children:t["contributor.disclaimer.label"]}),Object(a.jsxs)("ul",{children:[Object(a.jsx)("li",{children:t["contributor.disclaimer.line-1"](Object(a.jsx)("a",{href:"https://lauqerm.github.io/ygocarder",children:"lauqerm.github.io/ygocarder"},"app-author"))}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-2"]}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-3"]}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-4"]}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-5"](Object(a.jsx)("a",{href:"https://www.deviantart.com/grezar",target:"_blank",rel:"noreferrer",children:"Grezar"},"template-maker-1"),Object(a.jsx)("a",{href:"https://www.deviantart.com/9558able",target:"_blank",rel:"noreferrer",children:"9558able"},"template-maker-2"))}),Object(a.jsx)("li",{children:t["contributor.disclaimer.line-6"]})]})]})})]}),Object(a.jsx)("span",{className:"template-creator",children:t["contributor.template-maker"](Object(a.jsx)("a",{href:"https://www.deviantart.com/grezar/art/SKILL-UPDATE-Series-10-Card-Proxy-Template-686736691",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"Grezar"})},"artist-1"),Object(a.jsx)("a",{href:"https://www.deviantart.com/9558able/art/Yugioh-Series-10-Proxy-Template-DELUXE-EDITION-843282421",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"9558able"})},"artist-2"),Object(a.jsx)("a",{href:"https://www.deviantart.com/slackermagician",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"SlackerMagician"})},"artist-3"),Object(a.jsx)("a",{href:"https://www.deviantart.com/icycatelf",target:"_blank",rel:"noreferrer",children:Object(a.jsx)("b",{children:"icycatelf"})},"artist-4"))})]})]}),Object(a.jsx)(ca,{className:"app-setting",children:Object(a.jsx)(ra,{})})]})},sa=function(){var e=vn();return Object(a.jsx)(Rr,{overlayClassName:"disclaimer-overlay",content:Object(a.jsxs)("div",{className:"disclaimer",children:[Object(a.jsx)("h2",{children:e["alert.explaination.tainted.first-question"]}),Object(a.jsx)("p",{children:e["alert.explaination.tainted.first-answer"]}),Object(a.jsx)("h2",{children:e["alert.explaination.tainted.second-question"]}),Object(a.jsx)("p",{children:e["alert.explaination.tainted.second-answer"]}),Object(a.jsx)("h2",{children:e["alert.explaination.tainted.third-question"]}),Object(a.jsx)("p",{children:e["alert.explaination.tainted.third-answer"]})]})})};function ua(){var e=Object(Kt.a)(["\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br-lg);\n background-color: var(--main-level-3);\n box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); // Mimic antd\n padding: var(--spacing-xs) 0;\n color: var(--color);\n"]);return ua=function(){return e},e}function da(){var e=Object(Kt.a)(["\n display: flex;\n align-items: center;\n padding: var(--spacing-xs) var(--spacing);\n cursor: pointer;\n &:hover {\n background-color: var(--sub-active);\n }\n &.menu-active {\n background-color: var(--main-active);\n &:hover {\n background-color: var(--sub-active);\n }\n }\n"]);return da=function(){return e},e}function fa(){var e=Object(Kt.a)(["\n font-weight: 500;\n border-color: transparent;\n background-color: transparent;\n color: var(--color-vendor);\n text-shadow: var(--ts);\n user-select: none;\n display: inline-block;\n height: 32px;\n width: var(--width-label);\n line-height: 30px;\n position: relative;\n min-width: var(--width-label);\n text-align: right;\n padding-right: var(--spacing-antd);\n"]);return fa=function(){return e},e}var ba=Gt.b.div(fa()),pa=Gt.b.div(da()),ma={Container:Gt.b.div(ua()),Option:pa},ha=[{label:"OCG",value:"ocg",props:{className:"ocg-button",style:{fontWeight:"bold"}}},{label:"TCG",value:"tcg",props:{className:"tcg-button",style:{fontWeight:"bold"}}}],ga=Object.values(D).map((function(e){var t=e.value;return{label:e.label,value:t}})),va=[{value:"normal",label:Object(a.jsx)(j.a,{})}].concat(Object(wn.a)(Object.values(z).map((function(e){var t=e.value;return{label:e.label,value:t}})))),xa=function(){return pe.map((function(e){var t=e.name,n=e.nameKey,r=e.labelBackgroundColor,o=e.labelBackgroundColorList,i=e.edition;return{label:Object(a.jsx)(qr,{labelBackgroundColor:r,labelBackgroundColorList:o,nameKey:n}),value:t,edition:i}}))},ja=Object(wn.a)(Array(14)).map((function(e,t){return{label:t,value:t}})),ya={auto:{value:"auto",labelKey:"input.icon-type.auto.label",fullLabelKey:"input.icon-type.auto.label",icon:null},st:{value:"st",labelKey:"input.icon-type.icon.label",fullLabelKey:"input.icon-type.icon.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-continuous.png")})},level:{value:"level",labelKey:"input.icon-type.level.label",fullLabelKey:"input.icon-type.level.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-level.png")})},"negative-level":{value:"negative-level",labelKey:"input.icon-type.negative-level.label",fullLabelKey:"input.icon-type.negative-level.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-negative-level.png")})},rank:{value:"rank",labelKey:"input.icon-type.rank.label",fullLabelKey:"input.icon-type.rank.label",icon:Object(a.jsx)("img",{alt:"s/t-icon",src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-rank.png")})}},Oa=Object.values(ya),wa=["no-sticker","gold","silver","beta","holo5","holo4","holo3","holo2","holo1","limited","unlimited"].map((function(e){return{label:"no-sticker"===e?Object(a.jsx)(j.a,{}):Object(a.jsx)("img",{alt:e,src:"".concat("/ygocarder","/asset/image/sticker/sticker-").concat(e.toLowerCase(),".png")}),value:e}})),ka=Object.entries({veryStrict:{label:"5",order:1},strict:{label:"4",order:2},loose:{label:"3",order:3},veryLoose:{label:"2",order:4},relaxed:{label:"1",order:5}}).map((function(e){var t=Object(u.a)(e,2),n=t[0],r=t[1];return{label:r.label,value:n,order:r.order}})).sort((function(e,t){return e.order-t.order}));function Fa(){var e=Object(Kt.a)(["\n z-index: 10;\n display: inline-grid;\n grid-template-columns: 1fr max-content;\n align-items: center;\n column-gap: var(--spacing-sm);\n .char-picker-guideline {\n\n }\n .char-picker {\n z-index: 1;\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));\n .handler,\n .ant-btn {\n background-color: var(--main-level-1);\n color: var(--color-heavy);\n text-shadow: var(--ts);\n font-family: Segoe UI Symbol, sans-serif;\n border: 1px solid var(--sub-level-1);\n border-radius: 0;\n padding: 0 var(--spacing);\n + .ant-btn {\n border-left-width: 0;\n }\n &:hover {\n color: var(--main-active);\n }\n &:first-child {\n border-radius: var(--br) 0 0 var(--br);\n }\n &:last-child {\n border-radius: 0 var(--br) var(--br) 0;\n }\n }\n /** Currently char picker no longer movable */\n /* .handler {\n cursor: grabbing;\n background-color: var(--main-level-2);\n height: unset;\n font-size: var(--fs-xl);\n height: var(--fs-xl);\n line-height: 1;\n padding: 0;\n text-align: center;\n } */\n }\n .moveable-control-box {\n .moveable-control.moveable-origin,\n .moveable-line.moveable-direction {\n border-color: transparent;\n background: none;\n }\n }\n"]);return Fa=function(){return e},e}var Ca=Gt.b.div(Fa()),Sa=function(e){var t=e.targetId,n=void 0===t?"":t,r=e.onPick,o=void 0===r?function(){}:r,i=vn(),c=function(e){var t=document.getElementById(n);if(t){var r=function(e,t){if(document.selection)return e.focus(),document.selection.createRange().text=t,{value:e.value,position:0};if(e.selectionStart||0===e.selectionStart){var n=e.selectionStart,r=e.selectionEnd;return e.value=e.value.substring(0,n)+t+e.value.substring(r,e.value.length),e.selectionStart=n+t.length,e.selectionEnd=n+t.length,e.focus(),{value:e.value,position:n+t.length}}return e.value+=t,{value:e.value,position:0}}(t,e).value;o(r,e)}};return Object(a.jsxs)(Ca,{tabIndex:-1,className:"char-picker-container",children:[Object(a.jsx)("div",{id:"char-picker",className:"char-picker",children:["\u221e","\u2606","\u25cf","\xa9","\u2122","\u2c6f","\u042f","\u203b"].map((function(e){return Object(a.jsx)("button",{tabIndex:-1,className:"ant-btn",onClick:function(){return c(e)},children:e},e)}))}),Object(a.jsx)("div",{className:"char-picker-guideline",children:Object(a.jsx)(Rr,{content:Object(a.jsxs)(a.Fragment,{children:[i["input.char-picker.guide.header"],Object(a.jsxs)("ul",{children:[Object(a.jsx)("li",{children:i["input.char-picker.guide.instruction-1"]}),Object(a.jsx)("li",{children:i["input.char-picker.guide.instruction-2"]})]})]})})})]})},Ta=n(59),Ra=n(429),Na=n(420),La=n(151),Ma=(n(382),n(383),Object(o.forwardRef)((function(e,t){var n=e.color,r=e.onSelect,i=e.onOffsetChange,c=e.onRemove,l=vn(),s=Object(o.useState)(n),d=Object(u.a)(s,2),f=d[0],b=d[1],p=Object(o.useState)(0),m=Object(u.a)(p,2),h=m[0],g=m[1],v=Object(o.useState)(-1),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useRef)(sn()(g,250)).current;return Object(o.useImperativeHandle)(t,(function(){return{setColor:function(e){var t=e.color,n=e.offset,r=e.id,a=Math.min,o=Math.max,i=Math.round;b(t),g(o(0,a(100,i(100*parseFloat(n))))),y(r)},setCurrentOffset:function(e,t){var n=Math.min,r=Math.max,a=Math.round;e===j&&g(r(0,n(100,a(100*parseFloat(t)))))}}})),Object(o.useEffect)((function(){j>0&&(null===i||void 0===i||i(j,"".concat(h/100)))}),[j,h,i]),Object(a.jsxs)("div",{className:"stop-point-control-panel",children:[Object(a.jsxs)("div",{className:"stop-point-offset-input",children:[Object(a.jsxs)("div",{children:[l["input.name-style.gradient.color-stop.label"],": ",Object(a.jsx)(Na.a,{value:h,size:"small",max:100,min:0,onChange:function(e){return O("string"===typeof e?parseInt(e):null!==e&&void 0!==e?e:0)}})]}),Object(a.jsx)(Lr.a,{className:"remove-stop-color",size:"small",onClick:function(){return null===c||void 0===c?void 0:c(j)},children:l["input.name-style.gradient.color-remove.label"]})]}),Object(a.jsx)(Ta.a,{styles:{default:{picker:{color:"#000000",background:"var(--main-level-3)",boxShadow:"none"},body:{padding:"var(--spacing) var(--spacing)"}}},disableAlpha:!0,color:f,onChange:function(e){return b(e.hex)},onChangeComplete:function(e){b(e.hex),null===r||void 0===r||r(e.hex)}})]})}))),Ea=function(e){return{colorList:e,raw:yt(e)}},Ia=function(e){var t,n,r=e.palette,i=void 0===r?yt(Ot("0.000|#eef10b,0.5|#d78025,1.000|#7e20cf")):r,c=e.angle,l=void 0===c?180:c,d=e.memoizedOnChange,f=vn(),b=Object(o.useRef)(null),p=Object(o.useState)(l),m=Object(u.a)(p,2),h=m[0],g=m[1],v=Object(o.useState)((function(){var e,t,n=Ot(i);return{raw:i,colorList:n,currentControlId:null!==(e=null===(t=n[0])||void 0===t?void 0:t.id)&&void 0!==e?e:-1}})),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useCallback)((function(e,t){return y((function(n){var r=n.colorList.map((function(n){return n.id===e?Object(s.a)(Object(s.a)({},n),{},{offset:t}):n}));return Object(s.a)(Object(s.a)({},n),Ea(r))}))}),[]);Object(o.useEffect)((function(){g(l)}),[l]),Object(o.useEffect)((function(){var e,t,n=Ot(i);y({raw:i,colorList:n,currentControlId:null!==(e=null===(t=n[0])||void 0===t?void 0:t.id)&&void 0!==e?e:-1})}),[i]);var w=Object(o.useRef)(!1);return Object(o.useEffect)((function(){var e;j.colorList[0]&&w.current&&(w.current=!0,null===(e=b.current)||void 0===e||e.setColor(j.colorList[0]))}),[j.colorList]),Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){var t=j.colorList,n=j.currentControlId;if(e&&n>=0){var r,a=t.find((function(e){return e.id===n}));a&&(null===(r=b.current)||void 0===r||r.setCurrentOffset(n,a.offset))}}),100),function(){e=!1}}),[j]),Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){e&&d(j.colorList,h)}),200),function(){e=!1}}),[j,h,d]),Object(a.jsxs)("div",{className:"controls-wrapper gradient-picker-container",children:[Object(a.jsxs)("div",{className:"gradient-angle-control",children:[Object(a.jsx)("h2",{children:f["input.name-style.gradient.color-point.label"]}),Object(a.jsxs)(Lr.a,{size:"small",className:"add-stop-color",disabled:(null!==(t=null===(n=j.colorList)||void 0===n?void 0:n.length)&&void 0!==t?t:1e4)>20,onClick:function(){y((function(e){var t=[].concat(Object(wn.a)(e.colorList),[{offset:"0.5",color:"#ffffff",id:e.colorList.length+1}]).sort((function(e,t){return Number(e.offset)-Number(t.offset)}));return Object(s.a)(Object(s.a)({},e),Ea(t))}))},children:[f["input.name-style.gradient.add-point.label"]," (",j.colorList.length,"/",20,")"]}),Object(a.jsxs)("div",{className:"angle-picker-container",children:[Object(a.jsx)("h2",{children:f["input.name-style.gradient.gradient-direction.label"]}),Object(a.jsx)(La.AnglePicker,{angle:h,size:120,setAngle:g})]})]}),Object(a.jsx)("div",{className:"stop-color-picker-container",children:Object(a.jsx)(La.GradientPicker,Object(s.a)(Object(s.a)({},{width:370,paletteHeight:32,maxStops:20,minStops:2,stopRemovalDrop:99999,palette:j.colorList,onPaletteChange:function(e){return y((function(t){return Object(s.a)(Object(s.a)({},t),Ea(e))}))},onColorStopSelect:function(e){var t;y((function(t){return Object(s.a)(Object(s.a)({},t),{},{currentControlId:e.id})})),null===(t=b.current)||void 0===t||t.setColor(e)}}),{},{children:Object(a.jsx)(Ma,{ref:b,onOffsetChange:O,onRemove:function(e){y((function(t){var n,r,a=t.colorList.filter((function(t){return t.id!==e})),o=null!==(n=null===a||void 0===a?void 0:a[0].id)&&void 0!==n?n:-1;return o>0&&(null===(r=b.current)||void 0===r||r.setColor(j.colorList[o])),Object(s.a)(Object(s.a)({},Ea(a)),{},{currentControlId:o})}))}})}))})]})};function Aa(){var e=Object(Kt.a)(["\n line-height: 0;\n cursor: pointer;\n min-height: 26.13px;\n &.menu-active {\n outline: var(--bw-lg) solid var(--main-active);\n &:hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n }\n &.preset-item-focused {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n :hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n img {\n max-width: 100%;\n }\n"]);return Aa=function(){return e},e}function Ba(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: repeat(4, 120px);\n gap: var(--spacing-sm);\n padding: var(--spacing-xs);\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px var(--focus) inset;\n }\n"]);return Ba=function(){return e},e}function Wa(){var e=Object(Kt.a)(["\n line-height: 0;\n cursor: pointer;\n align-self: center;\n text-align: center;\n &:not(.menu-off) {\n min-height: 23.2px;\n &.menu-active {\n outline: var(--bw-lg) solid var(--main-active);\n &:hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n }\n :hover {\n outline: var(--bw-lg) solid var(--sub-active);\n }\n }\n &.menu-off {\n &:hover {\n color: var(--main-link);\n .anticon {\n color: var(--main-link);\n }\n }\n }\n img {\n max-width: 100%;\n border: var(--bw) solid var(--sub-level-1);\n }\n"]);return Wa=function(){return e},e}function Pa(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: repeat(2, 200px);\n gap: var(--spacing-sm);\n padding: var(--spacing-xs);\n .alert {\n grid-column: span 2;\n font-size: var(--fs-sm);\n text-align: center;\n }\n"]);return Pa=function(){return e},e}function Da(){var e=Object(Kt.a)(["\n background-color: var(--main-level-4);\n ","\n padding: var(--spacing-xxs) var(--spacing-xs);\n margin: calc(-1 * var(--spacing-xxs)) 0;\n border-radius: var(--br-lg);\n box-shadow: var(--bs-button);\n color: var(--color-heavy);\n cursor: pointer;\n ","\n &:hover {\n background-color: var(--sub-level-4);\n }\n"]);return Da=function(){return e},e}var za=Gt.b.div(Da(),(function(e){return e.$active?"border: var(--bw) solid var(--main-active);":"border: var(--bw) solid var(--sub-level-1);"}),(function(e){var t=e.$softMode,n=e.$active;return t?"\n border: var(--bw) solid var(--main-level-4);\n ".concat(n?"outline: var(--bw) solid var(--main-active);":"","\n "):""})),Ha=Object(Gt.b)(ma.Container)(Pa()),Ka=Gt.b.div(Wa()),Ga=Object(Gt.b)(ma.Container)(Ba()),Ya=Gt.b.div(Aa()),Xa=n(412),Va=n(211),Ua=Object(o.forwardRef)((function(e,t){var n=e.className,r=e.defaultValue,i=e.fieldMap,c=e.labelMap,l=e.onChange,d=vn(),f=i.x,b=i.y,p=i.color,m=i.width,h=Object(o.useState)((function(){var e=r[f],t=r[b],n=r[p],a=r[m];return{x:null!==e&&void 0!==e?e:0,y:null!==t&&void 0!==t?t:0,width:null!==a&&void 0!==a?a:0,color:n}})),g=Object(u.a)(h,2),v=g[0],x=g[1],j=v.x,y=v.y,O=v.color,w=v.width,k=c[m];return Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){e&&l(v)}),500),function(){e=!1}}),[v]),Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t=Object.keys(e);for(var n in t)if(e[n]!==v[n])return void x((function(t){return Object(s.a)(Object(s.a)({},t),e)}))}}})),Object(a.jsxs)("div",{className:n,children:[Object(a.jsx)("h2",{children:d["input.name-style.slider.position.label"]}),Object(a.jsxs)("div",{className:"line-position",children:[Object(a.jsx)(Va.a,{axis:"xy",styles:{track:{backgroundColor:"var(--main-slider)",width:100,height:100,gridRow:"span 3",position:"relative"},thumb:{backgroundColor:"var(--sub-slider)",zIndex:10}},xmax:5,xmin:-5,ymax:5,ymin:-5,x:null!==j&&void 0!==j?j:0,y:null!==y&&void 0!==y?y:0,onChange:function(e){var t=e.x,n=e.y;return x((function(e){return Object(s.a)(Object(s.a)({},e),{},{x:t,y:n})}))}}),Object(a.jsxs)("div",{className:"single-slider",children:[d["input.name-style.slider.x-offset.label"],": ",Object(a.jsx)(Na.a,{size:"small",value:j,onChange:function(e){return x((function(t){return Object(s.a)(Object(s.a)({},t),{},{x:"number"===typeof e?e:parseInt(null!==e&&void 0!==e?e:"0")})}))}})]}),Object(a.jsxs)("div",{className:"single-slider",children:[d["input.name-style.slider.y-offset.label"],": ",Object(a.jsx)(Na.a,{size:"small",value:y,onChange:function(e){return x((function(t){return Object(s.a)(Object(s.a)({},t),{},{y:"number"===typeof e?e:parseInt(null!==e&&void 0!==e?e:"0")})}))}})]}),Object(a.jsxs)("div",{className:"single-slider",children:[k,": ",Object(a.jsx)(Xa.a,{value:w,min:1,max:10,onChange:function(e){"number"===typeof e&&x((function(t){return Object(s.a)(Object(s.a)({},t),{},{width:e})}))}})]})]}),Object(a.jsx)("h2",{children:d["input.name-style.slider.color.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:O,onChangeComplete:function(e){return x((function(t){return Object(s.a)(Object(s.a)({},t),{},{color:e.hex})}))}})]})})),qa=Object(o.forwardRef)((function(e,t){var n=e.active,r=e.value,i=e.onClick,c=e.onCancel,l=Object(o.useRef)(null),d=Object(o.useState)(0),f=Object(u.a)(d,2),b=f[0],p=f[1];return Object(o.useImperativeHandle)(t,(function(){return{focus:function(){var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}}})),Object(a.jsx)(Ga,Object(s.a)(Object(s.a)({ref:l},wt({stopPropagation:!0,optionLength:S.length,setFocus:p,onTrigger:function(){b>=0&&i(S[b])},onCancel:function(){null===c||void 0===c||c()}})),{},{children:S.map((function(e,t){var o=e.key,c=e.image,l=e.label;return Object(a.jsx)(Ya,{className:Ht("preset-item",r.preset===o&&n?"menu-active":"",b===t?"preset-item-focused":""),onClick:function(t){t.stopPropagation(),i(e)},children:Object(a.jsx)("img",{className:"preset-preview",src:"".concat("/ygocarder","/").concat(c),alt:l})},o)}))}))})),Ja=(n(389),Object(o.forwardRef)((function(e,t){var n=e.frameInfo,r=e.defaultType,i=e.defaultValue,c=e.showExtraDecorativeOption,l=e.onChange,d=vn(),f=Object(o.useRef)(null),b=Object(o.useState)(-1),p=Object(u.a)(b,2),m=p[0],h=p[1],g=Object(o.useState)(!1),v=Object(u.a)(g,2),x=v[0],y=v[1],O=Object(o.useState)(r),w=Object(u.a)(O,2),k=w[0],F=w[1],S=Object(o.useState)(i),T=Object(u.a)(S,2),N=T[0],L=T[1],M=function(){var e=Object(o.useState)(0),t=Object(u.a)(e,2),n=t[0],r=t[1];return[Object(o.useCallback)((function(){r((function(e){return e+1}))}),[]),n]}(),E=Object(u.a)(M,2),I=E[0],A=E[1],B=Object(o.useRef)(sn()(l,250)).current,W=Object(o.useCallback)((function(e,t){L((function(n){return Object(s.a)(Object(s.a)({},n),{},{gradientAngle:t,gradientColor:yt(e)})})),I()}),[I]),P=kn((function(e){return e.setting.reduceMotionColor})),D=Object(o.useMemo)((function(){return e=d,Object.values(ne).map((function(t){var n=t.value,r=t.labelKey;return{label:e[r],value:n}}));var e}),[d]);Object(o.useEffect)((function(){0!==A&&(F("custom"),B("custom",N))}),[A]);var z=Object(o.useRef)(null),H=Object(o.useRef)(null);Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n;L((function(t){return Object(s.a)(Object(s.a)({},t),e)}));var r=e.lineColor,a=e.lineWidth,o=e.lineOffsetX,i=e.lineOffsetY,c=e.shadowBlur,l=e.shadowColor,u=e.shadowOffsetX,d=e.shadowOffsetY;null===(t=z.current)||void 0===t||t.setValue({x:u,y:d,width:c,color:l}),null===(n=H.current)||void 0===n||n.setValue({x:o,y:i,width:a,color:r})}}}));var K=N.fillStyle,G=N.headTextFillStyle,Y=N.hasOutline,X=N.hasShadow,V=N.hasGradient,U=N.gradientColor,q=N.gradientAngle,J=N.pattern,$=N.font,_=null!==n&&void 0!==n?n:{},Z={background:_.labelBackgroundColor,backgroundImage:_.labelBackgroundImage},Q="custom"===k,ee="predefined"===k,te="name-style-option-input-container",re=function(){F("auto"),"auto"!==k&&B("auto",N)},ae=function(){var e,t=N.preset?null===(e=C[N.preset])||void 0===e?void 0:e.value:{};F("predefined"),L((function(e){return Object(s.a)(Object(s.a)({},e),t)})),B("predefined",Object(s.a)(Object(s.a)({},N),t))},oe=function(){F("custom"),"custom"!==k&&B("custom",N)};return Object(a.jsx)("div",{className:"ant-input-group-wrapper text-style-input",children:Object(a.jsxs)("span",{className:"ant-input-wrapper ant-input-group",children:[Object(a.jsx)("span",{className:"ant-input-group-addon",children:d["input.name-style.label"]}),Object(a.jsxs)("span",{className:"name-style-input-container",children:[Object(a.jsxs)("div",Object(s.a)(Object(s.a)({id:te,className:"ant-radio-group ant-radio-group-outline name-style-option-input-container"},wt({setFocus:h,optionLength:3,onKeyPress:function(e){if(1===m&&("ArrowDown"===e.key||"Enter"===e.key||" "===e.key))return e.preventDefault(),h(1),y(!0),setTimeout((function(){var e;1===m&&(null===(e=f.current)||void 0===e||e.focus())}),200),!1},onTrigger:function(){0===m&&re(),1===m&&ae(),2===m&&oe()}})),{},{children:[Object(a.jsxs)("label",{className:Ht("ant-radio-wrapper","auto"===k&&"ant-radio-wrapper-checked",0===m&&"ant-radio-focused"),onClick:function(){return re()},children:[Object(a.jsxs)("span",{className:"ant-radio ".concat("auto"===k?"ant-radio-checked":""),children:[Object(a.jsx)("input",{tabIndex:-1,type:"radio",className:"ant-radio-input",value:"auto"}),Object(a.jsx)("span",{className:"ant-radio-inner"})]}),Object(a.jsx)("span",{className:"ant-radio-label",children:d["input.name-style.type.auto.label"]})]}),Object(a.jsx)("span",{className:"name-style-option-break"}),Object(a.jsx)("label",{className:Ht("ant-radio-wrapper",ee&&"ant-radio-wrapper-checked",1===m&&"ant-radio-focused"),onClick:function(){return ae()},children:Object(a.jsx)(Tr.a,{visible:x,onVisibleChange:y,trigger:["hover","click"],placement:"bottomLeft",overlayClassName:"predefined-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(qa,{ref:f,active:ee,value:N,onCancel:function(){var e;y(!1),null===(e=document.getElementById(te))||void 0===e||e.focus()},onClick:function(e){var t,n=e.key,r=n?null===(t=C[n])||void 0===t?void 0:t.value:{};F("predefined"),L((function(e){return Object(s.a)(Object(s.a)({},e),r)})),B("predefined",Object(s.a)(Object(s.a)({},N),r))}})}),children:Object(a.jsxs)("span",{className:"name-style-option-label",children:[Object(a.jsxs)("span",{className:"ant-radio ".concat(ee?"ant-radio-checked":""),children:[Object(a.jsx)("input",{tabIndex:-1,type:"radio",className:"ant-radio-input",value:"predefined"}),Object(a.jsx)("span",{className:"ant-radio-inner"})]}),Object(a.jsx)("span",{className:"ant-radio-label",children:d["input.name-style.type.predefined.label"]})]})})}),Object(a.jsx)("span",{className:"name-style-option-break"}),Object(a.jsx)("label",{className:Ht("ant-radio-wrapper",Q&&"ant-radio-wrapper-checked",2===m&&"ant-radio-focused"),onClick:function(){return oe()},children:Object(a.jsxs)("span",{children:[Object(a.jsxs)("span",{className:"ant-radio ".concat(Q?"ant-radio-checked":""),children:[Object(a.jsx)("input",{tabIndex:-1,type:"radio",className:"ant-radio-input",value:"custom"}),Object(a.jsx)("span",{className:"ant-radio-inner"})]}),Object(a.jsx)("span",{className:"ant-radio-label ant-radio-label-custom",children:d["input.name-style.type.custom.label"]})]})})]})),Object(a.jsxs)("div",{className:"style-picker",children:[Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsxs)("div",{className:"custom-style-text",children:[Object(a.jsx)("h3",{children:d["input.name-style.color.text.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:K,onChangeComplete:function(e){F("custom"),L((function(t){return Object(s.a)(Object(s.a)({},t),{},{fillStyle:e.hex})})),I()}})]}),Object(a.jsx)("hr",{}),Object(a.jsxs)("div",{className:"custom-style-text",children:[Object(a.jsx)("h3",{children:d["input.name-style.color.ruby.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:G,onChangeComplete:function(e){F("custom"),L((function(t){return Object(s.a)(Object(s.a)({},t),{},{headTextFillStyle:e.hex})})),I()}})]})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,className:"picker-dropdown color-picker-dropdown",children:[d["input.name-style.color.label"]," ",Object(a.jsx)(Ra.a,{})]})},"color-picker"),c&&Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsx)("h3",{className:"custom-style-expand",children:Object(a.jsx)(Jr.a,{value:"has-shadow",checked:X,onChange:function(){F("custom"),L((function(e){return Object(s.a)(Object(s.a)({},e),{},{hasShadow:!e.hasShadow})})),I()},children:d["input.name-style.shadow.toggle.label"]})}),X&&Object(a.jsx)(Ua,{ref:z,className:"custom-style-shadow",fieldMap:{color:"shadowColor",width:"shadowBlur",x:"shadowOffsetX",y:"shadowOffsetY"},labelMap:{shadowBlur:d["input.name-style.slider.blur.label"]},defaultValue:N,onChange:function(e){var t=e.color,n=e.width,r=e.x,a=e.y;L((function(e){return Object(s.a)(Object(s.a)({},e),{},{shadowBlur:n,shadowColor:t,shadowOffsetX:r,shadowOffsetY:a})})),I()}})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,$active:Q&&X,className:"picker-dropdown shadow-picker-dropdown",children:[d["input.name-style.shadow.label"]," ",Object(a.jsx)(Ra.a,{})]})},"shadow-picker"),Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsx)("h3",{className:"custom-style-expand",children:Object(a.jsx)(Jr.a,{value:"has-line",checked:Y,onChange:function(){F("custom"),L((function(e){return Object(s.a)(Object(s.a)({},e),{},{hasOutline:!e.hasOutline})})),I()},children:d["input.name-style.outline.toggle.label"]})}),Y&&Object(a.jsx)(Ua,{ref:H,className:"custom-style-line",fieldMap:{color:"lineColor",width:"lineWidth",x:"lineOffsetX",y:"lineOffsetY"},labelMap:{lineWidth:d["input.name-style.slider.thickness.label"]},defaultValue:N,onChange:function(e){var t=e.color,n=e.width,r=e.x,a=e.y;L((function(e){return Object(s.a)(Object(s.a)({},e),{},{lineWidth:n,lineColor:t,lineOffsetX:r,lineOffsetY:a})})),I()}})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,$active:Q&&Y,className:"picker-dropdown outline-picker-dropdown",children:[d["input.name-style.outline.label"]," ",Object(a.jsx)(Ra.a,{})]})},"outline-picker"),c&&Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)("div",{className:"custom-style-picker",children:[Object(a.jsx)("h3",{className:"custom-style-expand",children:Object(a.jsx)(Jr.a,{value:"has-gradient",checked:V,onChange:function(){F("custom"),L((function(e){return Object(s.a)(Object(s.a)({},e),{},{hasGradient:!e.hasGradient})})),I()},children:d["input.name-style.gradient.toggle.label"]})}),V&&Object(a.jsx)("div",{className:"custom-style-gradient",children:Object(a.jsx)(Ia,{angle:q,palette:U,memoizedOnChange:W})})]})}),placement:"bottom",children:Object(a.jsxs)(za,{$softMode:P,$active:Q&&V,className:"picker-dropdown gradient-picker-dropdown",children:[d["input.name-style.gradient.label"]," ",Object(a.jsx)(Ra.a,{})]})},"gradient-picker"),c&&Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay pattern-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)(Ha,{onClick:function(e){return e.stopPropagation()},children:[Object(a.jsx)("div",{className:"alert",children:d["input.name-style.pattern.alert"]}),R.map((function(e){var t=e.key,n=e.patternImage;return Object(a.jsx)(Ka,{className:["pattern-option",N.pattern===t?"menu-active":"",n?"":"menu-off"].join(" "),onClick:function(){L((function(e){return Object(s.a)(Object(s.a)({},e),{},{pattern:t})})),I()},children:n?Object(a.jsx)("img",{style:n?Z:{},className:"pattern-image",src:"".concat("/ygocarder","/asset/image/finish-name/").concat(n,".png"),alt:t}):Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(j.a,{})," ",d["input.name-style.pattern.no-pattern.label"]]})},t)}))]})}),placement:"bottomLeft",children:Object(a.jsx)(za,{$softMode:P,$active:Q&&"string"===typeof J&&"none"!==J,className:"picker-dropdown pattern-picker-dropdown",children:d["input.name-style.pattern.label"]})},"pattern-picker"),Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay font-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(ma.Container,{children:D.map((function(e){var t=e.value,n=e.label;return Object(a.jsx)(ma.Option,{className:$===t?"menu-active":"",onClick:function(){L((function(e){return Object(s.a)(Object(s.a)({},e),{},{font:t})})),I()},children:n},t)}))})}),placement:"bottomLeft",children:Object(a.jsx)(za,{$softMode:P,className:"picker-dropdown font-picker-dropdown",children:d["input.name-style.font.label"]})},"font-picker")]})]})]})})})));function $a(){var e=Object(Kt.a)(["\n .checkbox-train-input-group,\n .radio-train-input-group {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tcolumn-gap: var(--spacing-xs);\n\t\trow-gap: var(--spacing-xs);\n\t\tbox-shadow: none;\n\t\tborder-radius: 0;\n\t\t&:focus-visible {\n\t\t\toutline: 3px solid var(--focus); // +1 width size to account for shadow\n\t\t}\n\t\t.ant-radio-button-wrapper:first-child,\n\t\t.ant-radio-button-wrapper:last-child {\n\t\t\tborder-radius: 0;\n\t\t}\n\t\t.ant-radio-button-wrapper {\n\t\t\tflex: 1;\n\t\t\twhite-space: nowrap;\n\t\t\tborder: none;\n\t\t\tbox-shadow: var(--bs-1);\n\t\t\tpadding: 0;\n\t\t\tmin-width: 90px;\n\t\t\theight: 28px;\n\t\t\tline-height: 28px;\n\t\t\ttext-align: center;\n\t\t\ttext-shadow: none;\n\t\t\tfont-size: var(--fs-sm);\n\t\t\t&:hover {\n\t\t\t\toutline: var(--bw) solid var(--main-active);\n\t\t\t\toutline-offset: var(--bw);\n\t\t\t}\n\t\t\t&::before {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t\t.ant-radio-button-wrapper-checked {\n\t\t\toutline: var(--bw) solid var(--main-active);\n\t\t\toutline-offset: var(--bw);\n\t\t}\n\t}\n"]);return $a=function(){return e},e}function _a(){var e=Object(Kt.a)(["\n display: flex;\n .checkbox-train-input-group,\n .radio-train-input-group {\n display: flex;\n flex: 1 1 auto;\n\t\t&:focus-visible {\n\t\t\t.radio-train-focused,\n\t\t\t.checkbox-train-focused {\n\t\t\t\tbackground-color: var(--main-level-3);\n\t\t\t}\n\t\t}\n }\n .ant-radio-button-wrapper {\n user-select: none;\n }\n .ant-radio-button-wrapper:first-child,\n .ant-radio-button-wrapper:last-child {\n border-radius: 0;\n }\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):first-child {\n border-left-color: var(--sub-level-1);\n }\n"]);return _a=function(){return e},e}var Za=Object(Gt.a)(_a()),Qa=Object(Gt.a)($a());function eo(){var e=Object(Kt.a)(["\n ","\n"]);return eo=function(){return e},e}var to=Gt.b.div(eo(),Za),no=Object(o.forwardRef)((function(e,t){var n=e.onChange,r=e.value,i=e.optionList,c=e.children,l=e.suffix,d=e.className,f=e.strict,b=void 0!==f&&f,p=Object(o.useState)(-1),m=Object(u.a)(p,2),h=m[0],g=m[1],v=Object(o.useRef)(null),x=i.length;return Object(o.useImperativeHandle)(t,(function(){return{focus:function(){var e;return null===(e=v.current)||void 0===e?void 0:e.focus()}}})),Object(a.jsxs)(to,{className:["ant-radio-group ant-radio-group-outline radio-train",d].join(" "),children:[c&&Object(a.jsx)("label",{className:"standalone-addon ant-input-group-addon",children:c}),Object(a.jsx)("div",Object(s.a)(Object(s.a)({ref:v,className:"radio-train-input-group"},wt({setFocus:g,optionLength:x,onTrigger:function(){var e=i[h];e&&n(e.value)}})),{},{children:i.map((function(e,t){var o=e.value,i=e.props,c=e.label,l=e.tooltipProps,u=(null!==i&&void 0!==i?i:{}).className,d=b?o===r:"".concat(o)==="".concat(r);return Object(a.jsx)(Xt.a,Object(s.a)(Object(s.a)({overlay:null},l),{},{children:Object(a.jsxs)("label",Object(s.a)(Object(s.a)({},i),{},{className:["ant-radio-button-wrapper",d?"ant-radio-button-wrapper-checked":"",null!==u&&void 0!==u?u:"",h===t?"radio-train-focused":""].join(" "),onClick:function(){return n(o)},children:[Object(a.jsx)("span",{className:"ant-radio-button ".concat(d?"ant-radio-button-checked":""),children:Object(a.jsx)("span",{className:"ant-radio-button-inner"})}),Object(a.jsx)("span",{className:"label",children:c})]}),o)}))}))})),l]})}));function ro(){var e=Object(Kt.a)(["\n\t","\n"]);return ro=function(){return e},e}var ao=Object(Gt.b)(no)(ro(),Qa),oo=function(e){var t=e.onSTFrameChange,n=kn().setting.showExtraDecorativeOption,r=Object(o.useMemo)((function(){return xa().filter((function(e){return n||"normal"===e.edition}))}),[n]),i=On(Object(kr.useShallow)((function(e){var t=e.card,n=e.setCard;return{frame:t.frame,setCard:n}}))),c=i.frame,l=i.setCard,u=Object(o.useCallback)((function(e){l((function(n){var r=n.typeAbility,a=n.isPendulum,o=n.attribute,i=n.format,c="".concat(e),l="spell"===c||"trap"===c,u="tcg"===i?{"Spell Card":"Spell Card","Trap Card":"Trap Card"}:fe,d="spell"===c?[u["Spell Card"]]:"trap"===c?[u["Trap Card"]]:r;return l&&t(d),Object(s.a)(Object(s.a)({},n),{},{frame:c,isPendulum:"link"!==c&&a,attribute:l?"".concat(c).toUpperCase():o,typeAbility:d})}))}),[l,t]);return Object(a.jsx)(ao,{className:"frame-radio",value:c,onChange:u,optionList:r})};function io(){var e=Object(Kt.a)(["\n ","\n"]);return io=function(){return e},e}var co=Gt.b.div(io(),Za),lo=function(e){var t=e.onChange,n=e.value,r=e.optionList,i=e.children,c=e.className,l=Object(o.useState)(-1),d=Object(u.a)(l,2),f=d[0],b=d[1],p=r.length;return Object(a.jsxs)(co,{className:["ant-radio-group ant-radio-group-outline checkbox-train",c].join(" "),children:[i&&Object(a.jsx)("label",{className:"standalone-addon ant-input-group-addon",children:i}),Object(a.jsx)("div",Object(s.a)(Object(s.a)({className:"checkbox-train-input-group"},wt({setFocus:b,optionLength:p,onTrigger:function(){var e=r[f];if(e){var a=!!Array.isArray(n)&&n.includes("".concat(e.value));t(a?n.filter((function(t){return"".concat(e.value)!==t})):[].concat(Object(wn.a)(n),["".concat(e.value)]))}}})),{},{children:r.map((function(e,r){var o=e.label,i=e.value,c=e.props,l=!!Array.isArray(n)&&n.includes("".concat(i));return Object(a.jsxs)("label",Object(s.a)(Object(s.a)({},c),{},{className:["ant-radio-button-wrapper",l?"ant-radio-button-wrapper-checked":"",f===r?"checkbox-train-focused":""].join(" "),onClick:function(){t(l?n.filter((function(e){return"".concat(i)!==e})):[].concat(Object(wn.a)(n),["".concat(i)]))},children:[Object(a.jsx)("span",{className:"ant-radio-button ".concat(l?"ant-radio-button-checked":""),children:Object(a.jsx)("span",{className:"ant-radio-button-inner"})}),Object(a.jsx)("span",{className:"label",children:o})]}),i)}))}))]})};function so(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: max-content max-content;\n align-items: start;\n gap: 0;\n .card-image-source-input {\n display: flex;\n flex-direction: column-reverse;\n .online-image-tip {\n text-align: center;\n }\n }\n .card-cropper {\n width: 375px;\n text-align: center;\n }\n"]);return so=function(){return e},e}var uo=Object(Gt.b)(Cr)(so()),fo=Object(o.forwardRef)((function(e,t){var n=e.backgroundColor,r=e.children,i=e.receivingCanvas,c=e.onSourceLoaded,l=e.onTainted,u=e.onCropChange,d=vn(),f=On(Object(kr.useShallow)((function(e){var t=e.card;return{background:t.background,backgroundCrop:t.backgroundCrop,backgroundType:t.backgroundType,isPendulum:t.isPendulum,opacity:t.opacity,getUpdater:e.getUpdater,setCard:e.setCard}}))),b=f.background,p=f.backgroundCrop,m=f.backgroundType,h=f.isPendulum,g=f.opacity,v=f.getUpdater,j=f.setCard,y=Object(o.useRef)(null),O=Object(o.useMemo)((function(){return v("background")}),[v]),w=Object(o.useCallback)((function(e,t){null===u||void 0===u||u(e,t),e&&j((function(t){return Object(s.a)(Object(s.a)({},t),{},{backgroundCrop:e})}))}),[u,j]);return Object(o.useImperativeHandle)(t,(function(){return{hasImage:function(){var e,t;return null!==(e=null===(t=y.current)||void 0===t?void 0:t.hasImage())&&void 0!==e&&e},setValue:function(e){var t,n=e.background,r=e.backgroundCrop;"string"===typeof n&&r&&(null===(t=y.current)||void 0===t||t.forceExternalSource(n,r))}}})),Object(a.jsx)(uo,{ref:y,title:d["input.background-image.label"],backgroundColor:n,defaultExternalSource:b,defaultCropInfo:p,receivingCanvas:i,onSourceChange:O,onCropChange:w,onTainted:l,onSourceLoaded:c,ratio:x(h,g,m).ratio,beforeCropper:null,children:r})})),bo=n(430);n(390);function po(){var e=Object(Kt.a)(["\n --input-width: 315px;\n &.overlay-no-background-image {\n .card-image-cropper {\n grid-template-columns: 1fr;\n }\n .card-cropper {\n min-height: 0;\n line-height: 0;\n width: 0;\n visibility: hidden;\n position: absolute;\n }\n .card-image-source-input {\n padding-right: 0;\n margin-right: 0;\n border-right: none;\n }\n i {\n max-width: var(--input-width); // Alignment\n }\n }\n i {\n display: inline-block;\n font-size: var(--fs-sm);\n color: var(--color);\n font-weight: normal;\n }\n .background-picker {\n padding: var(--spacing-xs);\n /** No display none here, again we want to keep card cropper painted, just not visible */\n &.overlay-no-background {\n visibility: hidden;\n height: 0;\n width: 0;\n padding: 0;\n }\n .card-image-input {\n text-align: center;\n max-width: var(--input-width);\n }\n }\n .card-image-source-input {\n height: 100%;\n justify-content: start;\n padding-right: var(--spacing-xs);\n margin-right: var(--spacing-xs);\n border-right: var(--bw) solid var(--sub-level-4);\n .type-section h2 {\n margin-top: var(--spacing-xs);\n }\n .color-section h2 {\n padding-top: 0;\n padding-left: 0;\n }\n }\n .color-section {\n > h2 + div {\n > div:first-child {\n box-shadow: none !important; // Override inline style\n }\n > div:nth-child(2) {\n border: var(--bw) solid var(--main-level-1);\n }\n }\n }\n"]);return po=function(){return e},e}function mo(){var e=Object(Kt.a)(["\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n column-gap: var(--spacing-sm);\n row-gap: var(--spacing-sm);\n padding: 2px 0;\n align-items: center;\n .slider-label,\n .ant-slider,\n .slider-padding {\n border: var(--bw) solid var(--sub-level-1);\n background-color: var(--main-level-4);\n }\n .slider-label {\n display: inline-flex;\n column-gap: var(--spacing-xs);\n border-right: none;\n padding: var(--spacing-xxs) var(--spacing-xs);\n border-radius: var(--br) 0 0 var(--br);\n box-shadow: var(--bs-input);\n .ant-checkbox-wrapper {\n transform: translateY(-1px); // Alignment\n }\n }\n .ant-slider {\n margin: 0;\n border-left: none;\n border-right: none;\n height: 28px; // Alignment\n padding-top: 11px; // Alignment\n }\n .slider-padding {\n border-left: none;\n border-radius: 0 var(--br) var(--br) 0;\n }\n .ant-slider-rail,\n .ant-slider-track {\n border-radius: 0 var(--br) var(--br) 0;\n }\n .card-opacity-slider {\n flex: 0 1 auto;\n display: grid;\n grid-template-columns: max-content 60px 45px 12px;\n &.inactive {\n .slider-label,\n .ant-slider,\n .slider-padding {\n background-color: var(--main-level-3);\n }\n }\n }\n .ant-input-number.ant-input-number-sm {\n height: 28px; // Alignment\n width: unset;\n border-radius: 0;\n box-shadow: var(--bs-input);\n .ant-input-number-input {\n height: 26px; // Alignment\n }\n }\n .background-preview {\n display: inline-block;\n line-height: 0;\n width: 17px;\n height: 17px; // Alignment\n align-self: center;\n border: 1px solid #333333;\n cursor: pointer;\n text-align: center;\n user-select: none;\n &:hover {\n box-shadow: 0 0 2px 0 #222222;\n }\n .background-image-preview {\n max-width: 15px;\n max-height: 15px;\n }\n .no-background-icon {\n font-size: 15px; // Alignment\n }\n }\n"]);return mo=function(){return e},e}function ho(){var e=Object(Kt.a)(["\n white-space: pre-line;\n"]);return ho=function(){return e},e}var go=Gt.b.span(ho()),vo=Gt.b.div(mo()),xo=Gt.b.div(po()),jo=Object(o.forwardRef)((function(e,t){var n,r=e.receivingCanvas,i=e.defaultValue,c=e.onTainted,l=e.onChange,d=e.onSourceLoaded,f=e.onCropChange,b=vn(),p=On(Object(kr.useShallow)((function(e){var t=e.card,n=t.isPendulum;return{hasBackground:t.hasBackground,backgroundType:t.backgroundType,isPendulum:n,background:t.background,setCard:e.setCard,getUpdater:e.getUpdater}}))),m=p.hasBackground,v=p.backgroundType,x=p.isPendulum,j=p.background,y=p.setCard,O=p.getUpdater,w=Object(o.useState)(!0),k=Object(u.a)(w,2),F=k[0],C=k[1],S=Object(o.useState)(!0),T=Object(u.a)(S,2),R=T[0],N=T[1],L=Object(o.useState)(Object(s.a)(Object(s.a)({},g()),i)),M=Object(u.a)(L,2),E=M[0],I=M[1],A=Object(o.useRef)(null),B=Object(o.useMemo)((function(){return O("backgroundType")}),[O]),W=Object(o.useCallback)((function(e){return y((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{hasBackground:n})}))}),[y]);Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){e&&l(E)}),500),function(){e=!1}}),[E]),Object(o.useEffect)((function(){C(!1),setTimeout((function(){N(!1)}),250)}),[]),Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.background,r=e.backgroundCrop,a=Object(tn.a)(e,["background","backgroundCrop"]);"string"===typeof n&&r&&(null===(t=A.current)||void 0===t||t.setValue({background:n,backgroundCrop:r}));for(var o in a)a[o]!==E[o]&&I((function(e){return Object(s.a)(Object(s.a)({},e),a)}))}}}));var P=0===(null!==j&&void 0!==j?j:"").length&&!0!==(null===(n=A.current)||void 0===n?void 0:n.hasImage());return Object(a.jsxs)(vo,{className:"card-opacity-slider-container",children:[Object(a.jsx)(Xt.a,{overlayClassName:"long-tooltip-overlay",title:Object(a.jsx)(go,{children:b["input.opacity.boundless.tooltip"]}),children:Object(a.jsx)(Jr.a,{className:"art-frame",onChange:function(e){return I((function(t){return Object(s.a)(Object(s.a)({},t),{},{boundless:e.target.checked})}))},checked:E.boundless,children:b["input.opacity.boundless.label"]})}),ct.map((function(e){var t,n,o,i=e.labelKey,l=e.type,u=e.subType,p=e.tooltipKey;if("pendulum"===l&&!x)return null;var g,y=!!u,O=u&&E[u];return Object(a.jsxs)("div",{className:["card-opacity-slider",O?"":"inactive"].join(" "),children:[Object(a.jsxs)("div",{className:"slider-label",children:["body"===l&&Object(a.jsx)(Tr.a,{visible:F,destroyTooltipOnHide:!1,trigger:["click"],onVisibleChange:C,overlayClassName:["global-input-overlay global-style-picker-overlay layout-picker-overlay",F?"picker-visible":"",R?"picker-hidden":""].join(" "),content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsxs)(xo,{className:["custom-style-picker",P?"overlay-no-background-image":""].join(" "),children:[Object(a.jsxs)("h3",{className:"custom-style-expand ".concat(m?"":"inactive"),children:[Object(a.jsx)(Jr.a,{checked:m,onChange:function(e){W(e)},children:b["input.background.toggle-label"]}),Object(a.jsx)("br",{}),Object(a.jsx)("i",{children:b["input.background.description"]})]}),Object(a.jsx)("div",{className:"background-picker ".concat(m?"":"overlay-no-background"),children:Object(a.jsx)(fo,{ref:A,receivingCanvas:r,onSourceLoaded:d,onTainted:c,onCropChange:f,backgroundColor:E.baseFill,children:Object(a.jsxs)("div",{className:"layout-picker-panel",children:[Object(a.jsxs)("div",{className:"layout-picker-subpanel color-section",children:[Object(a.jsx)("h2",{children:b["input.background-color.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:E.baseFill,onChangeComplete:function(e){I((function(t){return Object(s.a)(Object(s.a)({},t),{},{baseFill:e.hex})}))}})]}),!P&&Object(a.jsxs)("div",{className:"layout-picker-subpanel type-section",children:[Object(a.jsx)("h2",{children:b["input.background-type.label"]}),Object(a.jsx)(no,{onChange:B,optionList:(g={fit:b["input.background-type.fit.label"],full:b["input.background-type.full.label"]},[{value:"fit",label:g.fit},{value:"full",label:g.full}]),value:v})]})]})})})]})}),placement:"bottom",children:Object(a.jsx)("div",{className:"background-preview",style:{backgroundColor:m?E.baseFill:h},children:m?j?Object(a.jsx)("img",{className:"background-image-preview",src:j,alt:"Background"}):null:Object(a.jsx)(bo.a,{className:"no-background-icon"})})}),y&&Object(a.jsx)(Xt.a,{title:p&&null!==(t=b[p])&&void 0!==t?t:null,overlayClassName:"long-tooltip-overlay",children:Object(a.jsx)(Jr.a,{checked:O,onChange:function(e){return u&&I((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},u,e.target.checked))}))}})}),b[i]]}),Object(a.jsx)(Na.a,{size:"small",min:0,max:100,onChange:function(e){return I((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},l,"number"===typeof e?e:100))}))},value:null!==(n=E[l])&&void 0!==n?n:100}),Object(a.jsx)(Xa.a,{min:0,max:100,step:5,onChange:function(e){return I((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},l,e))}))},value:null!==(o=E[l])&&void 0!==o?o:100}),Object(a.jsx)("div",{className:"slider-padding"})]},l)}))]})})),yo=n(431),Oo=n(432),wo=n(433);function ko(){var e=Object(Kt.a)(["\n .custom-star-input {\n margin-left: var(--spacing-sm);\n width: 6.5rem;\n }\n .checkbox-star-suffix {\n display: grid;\n grid-template-columns: max-content max-content;\n column-gap: var(--spacing-sm);\n }\n"]);return ko=function(){return e},e}function Fo(){var e=Object(Kt.a)(["\n img {\n max-height: 1.3em;\n }\n"]);return Fo=function(){return e},e}var Co=Object(Gt.b)(ma.Container)(Fo()),So=Object(Gt.b)(no)(ko()),To=Object(o.forwardRef)((function(e,t){var n=e.isLink,r=e.isMonster,i=e.showCreativeOption,c=vn(),l=On(Object(kr.useShallow)((function(e){var t=e.card;return{frame:t.frame,subFamily:t.subFamily,cardIcon:t.cardIcon,star:t.star,starAlignment:t.starAlignment,getUpdater:e.getUpdater}}))),s=l.frame,u=l.subFamily,d=l.cardIcon,f=l.star,b=l.starAlignment,p=l.getUpdater,m="dark-synchro"==={frame:s}.frame,h=st({frame:s}),g=Object(o.useMemo)((function(){return p("cardIcon")}),[p]),v=Object(o.useMemo)((function(){return p("subFamily")}),[p]),x=Object(o.useMemo)((function(){return p("star")}),[p]),y=Object(o.useMemo)((function(){return p("starAlignment")}),[p]);Object(o.useImperativeHandle)(t,(function(){return{}}));var O,F="auto"===d?ya[r?h?"rank":m?"negative-level":"level":"st"]:ya[d],C=c[F.labelKey],S=i?Object(a.jsxs)(a.Fragment,{children:[C," ",Object(a.jsx)(Ra.a,{})]}):C,T=Object(a.jsx)(Tr.a,{trigger:["click"],overlayClassName:"global-input-overlay pattern-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(Co,{children:Oa.map((function(e){var t=e.fullLabelKey,n=e.value,r=e.icon;return Object(a.jsxs)(ma.Option,{className:n===d?"menu-active":"",onClick:function(){return g(n)},children:[r?Object(a.jsxs)(a.Fragment,{children:[r,"\xa0"]}):null,c[t]]},n)}))})}),placement:"bottomRight",children:Object(a.jsx)("span",{className:"card-icon-dropdown ".concat("auto"===d?"":"active"," ").concat(i?"":"disabled"),children:S})},"icon-type-picker"),R=i?T:S;return n?null:"st"===F.value?Object(a.jsx)(no,{className:"fill-input-train",value:u,onChange:v,optionList:(O=c,k.map((function(e){var t=e.value,n=e.nameKey;return{label:t===w?Object(a.jsx)(j.a,{}):Object(a.jsx)(Xt.a,{overlay:O[n],children:Object(a.jsx)("img",{alt:O[n],src:"".concat("/ygocarder","/asset/image/subfamily/subfamily-").concat(t.toLowerCase(),".png")})}),value:t}}))),children:R}):Object(a.jsx)(So,{className:"checkbox-star-train",value:f,onChange:x,optionList:ja,strict:!0,suffix:i&&Object(a.jsxs)("div",{className:"checkbox-star-suffix",children:[Object(a.jsx)(Vt.a,{className:"custom-star-input",value:"number"===typeof f?"":f,allowClear:!0,onChange:x,placeholder:c["input.icon-type.custom.placeholder"]}),Object(a.jsx)(no,{value:b,onChange:y,optionList:[{value:"auto",tooltipProps:{overlay:c["input.icon-type.alignment.auto"]},label:Object(a.jsx)(j.a,{})},{value:"left",tooltipProps:{overlay:c["input.icon-type.alignment.left"]},label:Object(a.jsx)(yo.a,{})},{value:"center",tooltipProps:{overlay:c["input.icon-type.alignment.center"]},label:Object(a.jsx)(Oo.a,{})},{value:"right",tooltipProps:{overlay:c["input.icon-type.alignment.right"]},label:Object(a.jsx)(wo.a,{})}]})]}),children:R})})),Ro=new Set(["1","2","3","4","5"]),No=function(e,t,n,r,a,o){var i=e.substring(n,r),c="\n"===e[r]||!a,l=i,s=2;switch(t){case"1":l="[".concat(i,"]").concat(c?"":"\n"),s=c?2:3;break;case"2":l="{".concat(i,"}");break;case"3":l="{".concat(i,"|}");break;case"4":l="{".concat(i,"||}"),s=3;break;case"5":l="{{".concat(i,"}}"),s=4}o(e.substring(0,n)+"".concat(l)+e.substring(r,e.length),r+s)},Lo=function(e){var t=e.id,n=e.placement;if(t&&n>=0){var r,a=document.querySelector("#".concat(t));a&&(null!==(r=a.selectionEnd)&&void 0!==r?r:-1)>=0&&(a.selectionEnd=n)}},Mo=Vt.a.TextArea,Eo=Object(o.forwardRef)((function(e,t){var n=e.id,r=e.allowHotkey,i=e.defaultValue,c=e.onTakePicker,l=e.onChange,d=e.onKeyDown,f=e.className,b=Object(tn.a)(e,["id","allowHotkey","defaultValue","onTakePicker","onChange","onKeyDown","className"]),p=Object(o.useRef)(i),m=Object(o.useState)(i),h=Object(u.a)(m,2),g=h[0],v=h[1],x=Object(o.useState)({id:"",placement:-1}),j=Object(u.a)(x,2),y=j[0],O=j[1],w=Object(o.useCallback)((function(e){var t="string"===typeof e?e:e.target.value;p.current=t,v(t)}),[]);Object(o.useEffect)((function(){Lo(y)}),[y]),Object(o.useEffect)((function(){l({target:{value:g}})}),[g]);var k=function(e){e!==p.current&&w(e)};return Object(o.useImperativeHandle)(t,(function(){return{setValue:k,getPickerRef:function(){return n?{id:n,setValue:k}:null}}})),Object(a.jsx)(Mo,Object(s.a)({id:n,autoComplete:"off",onFocus:function(){return n&&(null===c||void 0===c?void 0:c({id:n,setValue:k}))},allowClear:!0,spellCheck:!1,className:"".concat(n,"-input ").concat(f),value:g,onKeyDown:function(e){var t,a;if(null===d||void 0===d||d(e),r){var o=e.ctrlKey,i=e.key,c=e.metaKey,l=null!==(t=e.currentTarget.selectionStart)&&void 0!==t?t:-1,s=null!==(a=e.currentTarget.selectionEnd)&&void 0!==a?a:-1;(o||c)&&n&&s!==l&&Ro.has(i)&&(e.preventDefault(),No(e.currentTarget.value,i,l,s,!0,(function(e,t){w(e),O({id:n,placement:t})})))}},onChange:w},b))})),Io=Object(o.forwardRef)((function(e,t){var n=e.id,r=e.defaultValue,i=e.onTakePicker,c=e.onChange,l=e.onKeyDown,d=e.className,f=Object(tn.a)(e,["id","defaultValue","onTakePicker","onChange","onKeyDown","className"]),b=kn().setting.allowHotkey,p=Object(o.useRef)(r),m=Object(o.useState)(r),h=Object(u.a)(m,2),g=h[0],v=h[1],x=Object(o.useState)({id:"",placement:-1}),j=Object(u.a)(x,2),y=j[0],O=j[1],w=Object(o.useCallback)((function(e){var t="string"===typeof e?e:e.target.value;p.current=t,v(t)}),[]);Object(o.useEffect)((function(){Lo(y)}),[y]),Object(o.useEffect)((function(){c({target:{value:g}})}),[g]);var k=function(e){e!==g&&w(e)};return Object(o.useImperativeHandle)(t,(function(){return{setValue:k}})),Object(a.jsx)(Vt.a,Object(s.a)({id:n,autoComplete:"off",onFocus:function(){return n&&(null===i||void 0===i?void 0:i({id:n,setValue:k}))},allowClear:!0,className:"".concat(n,"-input ").concat(d),value:g,onKeyDown:function(e){var t,r;if(null===l||void 0===l||l(e),b){var a=e.ctrlKey,o=e.key,i=e.metaKey,c=null!==(t=e.currentTarget.selectionStart)&&void 0!==t?t:-1,s=null!==(r=e.currentTarget.selectionEnd)&&void 0!==r?r:-1;(a||i)&&n&&s!==c&&Ro.has(o)&&(e.preventDefault(),No(e.currentTarget.value,o,c,s,!1,(function(e,t){w(e),O({id:n,placement:t})})))}},onChange:function(e){return w(e.target.value)}},f))})),Ao=Object(o.forwardRef)((function(e,t){var n=e.onTakePicker,r=On((function(e){return e.getUpdater})),i=Object(o.useRef)(null),c=Object(o.useMemo)((function(){return r("effect",void 0,"debounce")}),[r]);return Object(o.useEffect)((function(){var e,t=null===(e=i.current)||void 0===e?void 0:e.getPickerRef();t&&(null===n||void 0===n||n(t))}),[]),Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t;null===(t=i.current)||void 0===t||t.setValue(e)}}})),Object(a.jsx)(Eo,{ref:i,id:"effect",allowHotkey:!0,defaultValue:On.getState().card.effect,onChange:c,onTakePicker:n,rows:9})}));function Bo(){var e=Object(Kt.a)(["\n align-self: center;\n text-align: right;\n .ant-checkbox + span {\n user-select: none;\n }\n"]);return Bo=function(){return e},e}var Wo=Gt.b.div(Bo()),Po=function(e){var t=vn(),n=On(Object(kr.useShallow)((function(e){var t=e.card,n=e.setCard;return{isSpeedCard:t.isSpeedCard,isDuelTerminalCard:t.isDuelTerminalCard,isFirstEdition:t.isFirstEdition,setCard:n}}))),r=n.isDuelTerminalCard,i=n.isFirstEdition,c=n.isSpeedCard,l=n.setCard,u=Object(o.useCallback)((function(e){return l((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isFirstEdition:n})}))}),[l]),d=Object(o.useCallback)((function(e){return l((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isDuelTerminalCard:n,isSpeedCard:!n&&t.isSpeedCard})}))}),[l]),f=Object(o.useCallback)((function(e){return l((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isSpeedCard:e.target.checked,isDuelTerminalCard:!n&&t.isDuelTerminalCard})}))}),[l]);return Object(a.jsxs)(Wo,{className:"checkbox-input",children:[Object(a.jsx)(Jr.a,{className:"input-1st",onChange:u,checked:i,tabIndex:0,children:t["input.1st-edition.label"]}),Object(a.jsx)(Xt.a,{overlayClassName:"long-tooltip-overlay",overlay:"Will turn off Duel Terminal mark.",children:Object(a.jsx)(Jr.a,{className:"input-speed",onChange:f,checked:c,tabIndex:0,children:t["input.speed-duel.label"]})}),Object(a.jsx)(Xt.a,{overlayClassName:"long-tooltip-overlay",overlay:"Will turn off Speed Duel mark.",children:Object(a.jsx)(Jr.a,{className:"input-terminal",onChange:d,checked:r,tabIndex:0,children:t["input.duel-terminal.label"]})})]})},Do=n(434);function zo(){var e=Object(Kt.a)(['\n &.radio-train {\n .ant-radio-button-wrapper-checked {\n &.ocg-button {\n background-color: var(--main-red-scale);\n border-color: var(--sub-red-scale);\n &:not([class*=" ant-radio-button-wrapper-disabled"]).ant-radio-button-wrapper:first-child {\n border-right-color: var(--sub-red-scale);\n }\n &:not(.ant-radio-button-wrapper-disabled):first-child {\n border-color: var(--sub-red-scale);\n }\n &:hover {\n background-color: var(--sub-red-scale);\n color: var(--color-heavy);\n }\n }\n &.tcg-button {\n background-color: var(--main-blue-scale);\n border-color: var(--sub-blue-scale);\n &:hover {\n background-color: var(--sub-blue-scale);\n color: var(--color-heavy);\n }\n }\n }\n .ocg-button {\n color: var(--color-heavy);\n &:hover {\n color: var(--sub-red-scale);\n }\n }\n .tcg-button {\n color: var(--color-heavy);\n &:hover {\n color: var(--sub-blue-scale);\n }\n }\n }\n']);return zo=function(){return e},e}function Ho(){var e=Object(Kt.a)(["\n display: flex;\n align-items: center;\n margin-top: var(--spacing-sm);\n flex-wrap: wrap;\n row-gap: var(--spacing-sm);\n"]);return Ho=function(){return e},e}function Ko(){var e=Object(Kt.a)(["\n\tdisplay: flex;\n\talign-items: center;\n\t.input-label {\n\t\tflex: 1;\n\t}\n"]);return Ko=function(){return e},e}function Go(){var e=Object(Kt.a)(["\n padding: var(--spacing-xs);\n .radio-train {\n display: flex;\n flex-wrap: wrap;\n max-width: 550px;\n .radio-train-input-group {\n gap: var(--spacing);\n }\n }\n .ant-checkbox-wrapper {\n color: var(--color-heavy);\n }\n .frame-auto-checkbox {\n margin-bottom: var(--spacing-xs);\n }\n ","\n"]);return Go=function(){return e},e}var Yo=Object(Gt.b)(ma.Container)(Go(),Qa),Xo=Gt.b.div(Ko()),Vo=Gt.b.div(Ho()),Uo=Object(Gt.b)(no)(zo());function qo(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--spacing-sm);\n .checkbox-input {\n align-self: center;\n .ant-checkbox + span {\n user-select: none;\n }\n }\n .sticker-input,\n .creator-input {\n grid-column: span 2;\n }\n .sticker-input .ant-radio-button-wrapper {\n padding-left: var(--spacing-sm);\n padding-right: var(--spacing-sm);\n }\n"]);return qo=function(){return e},e}var Jo=Gt.b.div(qo()),$o=Object(o.forwardRef)((function(e,t){var n=e.isMonster,r=e.showCreativeOption,i=e.onTakePicker,c=vn(),l=On(Object(kr.useShallow)((function(e){return{sticker:e.card.sticker,getUpdater:e.getUpdater}}))),s=l.sticker,u=l.getUpdater,d=Object(o.useRef)(null),f=Object(o.useRef)(null),b=Object(o.useRef)(null),p=Object(o.useRef)(null),m=Object(o.useMemo)((function(){return u("atk",(function(e){return"string"===typeof e?e.trim():e}))}),[u]),h=Object(o.useMemo)((function(){return u("def",(function(e){return"string"===typeof e?e.trim():e}))}),[u]),g=Object(o.useMemo)((function(){return u("password",void 0,"debounce")}),[u]),v=Object(o.useMemo)((function(){return u("sticker")}),[u]),x=Object(o.useMemo)((function(){return u("creator",void 0,"debounce")}),[u]);return Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n,r,a,o=e.password,i=e.creator,c=e.atk,l=e.def;"string"===typeof c&&(null===(t=b.current)||void 0===t||t.setValue(c)),"string"===typeof l&&(null===(n=p.current)||void 0===n||n.setValue(l)),"string"===typeof o&&(null===(r=d.current)||void 0===r||r.setValue(o)),"string"===typeof i&&(null===(a=f.current)||void 0===a||a.setValue(i))}}})),Object(a.jsxs)(Jo,{className:"card-footer-input",children:[(n||r)&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)(Io,{ref:b,id:"atk",addonBefore:c["input.atk.label"],defaultValue:On.getState().card.atk,onChange:m,onTakePicker:i}),Object(a.jsx)(Io,{ref:p,id:"def",addonBefore:c["input.def.label"],defaultValue:On.getState().card.def,onChange:h,onTakePicker:i})]}),Object(a.jsx)(Io,{ref:d,id:"password",addonBefore:Object(a.jsxs)(Xo,{className:"input-label-with-button",children:[Object(a.jsx)("div",{className:"input-label",children:c["input.password.label"]}),Object(a.jsx)(an,{onClick:function(){var e;return null===(e=d.current)||void 0===e?void 0:e.setValue("".concat(It("0123456789",8)))},Icon:Do.a,tooltipProps:{overlay:c["button.randomize.label"]}})]}),defaultValue:On.getState().card.password,onChange:g,onTakePicker:i}),Object(a.jsx)(Po,{}),Object(a.jsx)(Io,{ref:f,id:"creator",addonBefore:c["input.creator-text.label"],defaultValue:On.getState().card.creator,onChange:x,onTakePicker:i}),Object(a.jsx)(no,{className:"sticker-input fill-input-train",value:s,onChange:v,optionList:wa,children:Object(a.jsx)("span",{children:c["input.sticker.label"]})})]})}));function _o(){var e=Object(Kt.a)(["\n .ant-input-group-addon {\n flex: 0;\n }\n .radio-train-input-group .ant-radio-button-wrapper {\n min-width: unset;\n }\n"]);return _o=function(){return e},e}var Zo=Object(Gt.b)(no)(_o()),Qo=Object(o.forwardRef)((function(e,t){var n=e.isLink,r=e.showExtraDecorativeOption,i=e.receivingCanvas,c=e.onSourceLoaded,l=e.onTainted,u=e.onCropChange,d=vn(),f=On(Object(kr.useShallow)((function(e){var t=e.card;return{opacity:t.opacity,artFinish:t.artFinish,linkMap:t.linkMap,isPendulum:t.isPendulum,art:t.art,artCrop:t.artCrop,getUpdater:e.getUpdater,setCard:e.setCard}}))),b=f.opacity,p=f.artFinish,m=f.linkMap,h=f.isPendulum,g=f.art,v=f.artCrop,j=f.getUpdater,y=f.setCard,O=Object(o.useRef)(null),w=Object(o.useMemo)((function(){return j("linkMap")}),[j]),k=Object(o.useMemo)((function(){return j("art")}),[j]),F=Object(o.useMemo)((function(){return j("artFinish")}),[j]),C=Object(o.useCallback)((function(e,t){null===u||void 0===u||u(e,t),e&&y((function(t){return Object(s.a)(Object(s.a)({},t),{},{artCrop:e})}))}),[u,y]);return Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.art,r=e.artCrop;"string"===typeof n&&r&&(null===(t=O.current)||void 0===t||t.forceExternalSource(n,r))}}})),Object(a.jsx)(Cr,{ref:O,title:d["input.card-art.label"],defaultExternalSource:g,defaultCropInfo:v,receivingCanvas:i,onSourceChange:k,onCropChange:C,onTainted:l,onSourceLoaded:c,ratio:x(h,b).ratio,beforeCropper:r?Object(a.jsx)(Zo,{className:"art-finish-checkbox fill-input-train",value:p,onChange:F,optionList:va,children:Object(a.jsx)("span",{className:"field-title",children:d["input.art-finish.label"]})}):null,children:n?Object(a.jsx)(Sr,{defaultValue:m,onChange:w}):Object(a.jsx)("div",{})})}));function ei(){var e=Object(Kt.a)(["\n cursor: pointer;\n"]);return ei=function(){return e},e}function ti(){var e=Object(Kt.a)(["\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-sm);\n width: 100%;\n .name-input {\n flex: 3;\n min-width: 400px;\n }\n .set-id-input {\n flex: 1;\n min-width: 250px;\n }\n"]);return ti=function(){return e},e}var ni=Gt.b.div(ti()),ri=Gt.b.span(ei()),ai=Object(o.forwardRef)((function(e,t){var n=e.onTakePicker,r=vn(),i=On(Object(kr.useShallow)((function(e){var t=e.card;return{name:t.name,format:t.format,getUpdater:e.getUpdater}}))),c=i.name,l=i.format,s=i.getUpdater,u=Object(o.useRef)(null),d=Object(o.useRef)(null),f=Object(o.useMemo)((function(){return s("setId")}),[s]),b=Object(o.useMemo)((function(){return s("name",void 0,"debounce")}),[s]);return Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n,r=e.name,a=e.setId;"string"===typeof r&&(null===(t=u.current)||void 0===t||t.setValue(r)),"string"===typeof a&&(null===(n=d.current)||void 0===n||n.setValue(a))}}})),Object(a.jsxs)(ni,{className:"name-id-input",children:[Object(a.jsx)(Io,{ref:u,id:"name",defaultValue:c,addonBefore:Object(a.jsx)(Xt.a,{title:"Copy",children:Object(a.jsx)(ri,{onClick:function(){navigator.clipboard.writeText(Bt(c))},children:r["input.name.label"]})}),onChange:b,onTakePicker:n}),Object(a.jsx)(Io,{ref:d,id:"set-id",defaultValue:On.getState().card.setId,addonBefore:Object(a.jsxs)(Xo,{className:"input-label-with-button",children:[Object(a.jsx)("div",{className:"input-label",children:r["input.set-id.label"]}),Object(a.jsx)(an,{onClick:function(){var e;return null===(e=d.current)||void 0===e?void 0:e.setValue(function(e){return It("ABCDEFGHIJKLMNOPQRSTUVWXYZ",4)+"-"+("OCG"===e?"JP":"EN")+It("0000000000111111111122222222223456789",1)+It("0123456789",2)}(l))},Icon:Do.a,tooltipProps:{overlay:r["button.randomize.label"]}})]}),onChange:f,onTakePicker:n})]})}));function oi(){var e=Object(Kt.a)(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n column-gap: var(--spacing-sm);\n row-gap: var(--spacing-sm);\n .red-scale {\n color: var(--sub-red-scale);\n }\n .blue-scale {\n color: var(--sub-blue-scale);\n }\n .joined-row {\n position: 'relative';\n grid-column: span 2;\n .standalone-label {\n min-width: 0;\n width: unset;\n padding-left: var(--spacing-antd);\n }\n .pendulum-checkbox {\n /** Alignment **/\n width: var(--width-label);\n line-height: 32px;\n text-align: right;\n font-weight: 500;\n margin-right: 0;\n padding-right: var(--spacing);\n > span {\n padding-right: 0;\n }\n }\n .pendulum-checkbox-placeholder {\n display: inline-block;\n /** Alignment **/\n width: var(--width-label);\n }\n .pendulum-frame-input {\n margin-right: var(--spacing-lg);\n }\n .ant-checkbox-wrapper + .ant-checkbox-wrapper {\n margin-left: 0;\n }\n }\n"]);return oi=function(){return e},e}function ii(){var e=Object(Kt.a)(["\n display: inline-flex;\n cursor: pointer;\n box-shadow: var(--bs-input);\n vertical-align: bottom;\n box-shadow: var(--bs-button);\n border-radius: var(--br-lg);\n &:focus-visible {\n outline: 2px solid var(--focus);\n }\n .pendulum-frame-info-block {\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\n line-height: 2; // Alignment\n background-color: var(--main-level-4);\n min-width: 100px;\n overflow: hidden;\n border: var(--bw) solid var(--sub-level-1);\n .frame-info-block-label {\n padding: var(--spacing-px) var(--spacing-xs);\n }\n }\n .pendulum-frame-label {\n display: inline-block;\n background: var(--main-level-4);\n border: var(--bw) solid var(--sub-level-1);\n border-right: none;\n padding: var(--spacing-px) var(--spacing-xs);\n border-radius: var(--br-lg) 0 0 var(--br-lg);\n line-height: 2; // Alignment\n &:last-child {\n border-radius: var(--br-lg);\n border-right: var(--bw) solid var(--sub-level-1);\n }\n }\n"]);return ii=function(){return e},e}var ci=Object(o.forwardRef)((function(e,t){var n=e.frameList,r=e.pendulumFrame,i=e.onChange,c=e.onCancel,l=vn(),d=Object(o.useRef)("auto"===r?"spell":r),f=Object(o.useRef)(null),b=Object(o.useState)(0),p=Object(u.a)(b,2),m=p[0],h=p[1];return Object(o.useImperativeHandle)(t,(function(){return{focus:function(){var e;return null===(e=f.current)||void 0===e?void 0:e.focus()}}})),Object(a.jsxs)(Yo,Object(s.a)(Object(s.a)({className:"pendulum-frame-picker"},wt({stopPropagation:!0,optionLength:n.length,setFocus:h,onTrigger:function(){m>=0&&i(n[m].value)},onCancel:c})),{},{children:[Object(a.jsx)(Jr.a,{ref:f,className:"frame-auto-checkbox",checked:"auto"===r,onChange:function(e){i(e.target.checked?"auto":d.current)},children:l["input.frame.auto"]}),Object(a.jsx)(no,{className:"frame-radio",value:r,onChange:i,optionList:n})]}))})),li=Gt.b.div(ii()),si=Gt.b.div(oi()),ui=Object(o.forwardRef)((function(e,t){var n=e.showCreativeOption,r=e.showExtraDecorativeOption,i=e.onTakePicker,c=vn(),l=On(Object(kr.useShallow)((function(e){var t=e.card;return{frame:t.frame,isPendulum:t.isPendulum,pendulumFrame:t.pendulumFrame,pendulumScaleBlue:t.pendulumScaleBlue,pendulumScaleRed:t.pendulumScaleRed,setCard:e.setCard,getUpdater:e.getUpdater}}))),d=l.frame,f=l.isPendulum,b=l.pendulumFrame,p=l.pendulumScaleBlue,m=l.pendulumScaleRed,h=l.setCard,g=l.getUpdater,v=Object(o.useRef)(null),x=Object(o.useRef)(null),j=Object(o.useRef)(null),y=Object(o.useState)(!0),O=Object(u.a)(y,2),w=O[0],k=O[1],F=Object(o.useState)(!1),C=Object(u.a)(F,2),S=C[0],T=C[1],R=Object(o.useRef)("auto"===b?"spell":b),N=Object(o.useMemo)((function(){return g("pendulumScaleRed")}),[g]),L=Object(o.useMemo)((function(){return g("pendulumScaleBlue")}),[g]),M=Object(o.useMemo)((function(){return g("pendulumEffect",void 0,"debounce")}),[g]),E=Object(o.useMemo)((function(){return xa().filter((function(e){return r||"normal"===e.edition}))}),[r]);Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.pendulumEffect;n&&(null===(t=j.current)||void 0===t||t.setValue(n))}}}));var I=be[b];return Object(a.jsxs)(si,{className:"pendulum-input",children:[Object(a.jsxs)("div",{className:"joined-row pendulum-option",children:["link"!==d?Object(a.jsx)(Jr.a,{className:"pendulum-checkbox",onChange:function(e){return h((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},{isPendulum:n})}))},checked:f,children:c["input.pendulum.label"]}):Object(a.jsx)("div",{className:"pendulum-checkbox-placeholder"}),n&&Object(a.jsx)(Tr.a,{visible:S,onVisibleChange:T,trigger:["hover","click"],placement:"bottom",overlayClassName:"pendulum-frame-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(ci,{ref:x,frameList:E,pendulumFrame:b,onCancel:function(){var e;T(!1),null===(e=v.current)||void 0===e||e.focus()},onChange:function(e){var t="".concat(e);"auto"!==t&&(R.current=t),h((function(e){return Object(s.a)(Object(s.a)({},e),{},{pendulumFrame:t})}))}})}),children:Object(a.jsxs)(li,{ref:v,className:"pendulum-frame-input",tabIndex:0,onKeyDown:function(e){if("ArrowDown"===e.key||"Enter"===e.key||" "===e.key)return T(!0),setTimeout((function(){var e;null===(e=x.current)||void 0===e||e.focus()}),200),!1},children:[Object(a.jsxs)("span",{className:"pendulum-frame-label",children:[c["input.bottom-frame.label"]," ",Object(a.jsx)(Ra.a,{})]}),I?Object(a.jsx)(qr,Object(s.a)({className:"pendulum-frame-info-block"},I)):Object(a.jsx)(qr,{className:"pendulum-frame-info-block",nameKey:"input.frame.auto"})]})}),f&&n&&Object(a.jsx)(Jr.a,{onChange:function(e){return k(e.target.checked)},checked:w,children:c["input.mirror-scale.label"]})]}),f&&Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("div",{children:Object(a.jsx)(Vt.a,{addonBefore:Object(a.jsx)("span",{children:c["input.scale.label"](Object(a.jsx)("span",{className:"blue-scale",children:c["input.scale.blue.label"]}))}),value:p,onChange:function(e){L(e),w&&N(e)}})}),Object(a.jsx)("div",{children:Object(a.jsx)(Vt.a,{addonBefore:Object(a.jsx)("span",{children:c["input.scale.label"](Object(a.jsx)("span",{className:"red-scale",children:c["input.scale.red.label"]}))}),value:m,onChange:function(e){w&&L(e),N(e)}})}),Object(a.jsx)("div",{className:"joined-row",children:Object(a.jsx)(Eo,{ref:j,id:"pendulum-effect",allowHotkey:!0,defaultValue:On.getState().card.pendulumEffect,onChange:M,onTakePicker:i,rows:5})})]})]})}));function di(){var e=Object(Kt.a)(['\n display: grid;\n grid-template-columns: 1fr max-content;\n grid-template-areas:\n "type-input input-helper"\n "condense-input help-button";\n gap: var(--spacing-sm);\n align-items: center;\n .formatting-help-button {\n grid-area: help-button;\n &:focus {\n box-shadow: 0 0 0 2px var(--focus);\n }\n }\n .input-kanji-helper {\n grid-area: input-helper;\n }\n .type-ability-input {\n grid-area: type-input;\n }\n .condense-input {\n grid-area: condense-input;\n\t\t.standalone-addon.ant-input-group-addon {\n\t\t\twidth: unset;\n\t\t}\n\t\t.ant-radio-button-wrapper {\n\t\t\tflex: 1 1 90px;\n\t\t}\n\t}\n &.variant-tcg {\n .type-ability-input {\n grid-column: span 2;\n }\n }\n']);return di=function(){return e},e}var fi=Gt.b.div(di()),bi=Object(o.forwardRef)((function(e,t){var n=e.onTakePicker,r=vn(),i=On(Object(kr.useShallow)((function(e){var t=e.card,n=t.frame,r=t.cardIcon,a=t.format,o=t.furiganaHelper,i=t.effectStyle,c=e.setCard,l=e.getUpdater;return{frame:n,cardIcon:r,format:a,furiganaHelper:o,condenseTolerant:null===i||void 0===i?void 0:i.condenseTolerant,setCard:c,getUpdater:l}}))),c=i.frame,l=i.cardIcon,u=i.format,d=i.furiganaHelper,f=i.condenseTolerant,b=i.setCard,p=i.getUpdater,m="ocg"===u?"\uff0f":"/",h=Object(o.useRef)(null),g=Object(o.useMemo)((function(){return p("typeAbility",(function(e){return"string"!==typeof e?[]:e.split(/\uff0f|\//).map((function(e){return"".concat(e).trim()})).filter((function(e){return"string"===typeof e&&e.length>0}))}),"debounce")}),[p]),v=Object(o.useCallback)((function(e){return b((function(t){return Object(s.a)(Object(s.a)({},t),{},{furiganaHelper:e.target.checked})}))}),[b]);Object(o.useImperativeHandle)(t,(function(){return{setValue:function(e){var t,n=e.typeAbility;n&&(null===(t=h.current)||void 0===t||t.setValue(n.join(m)))}}}));var x="auto"===l?ft({frame:c})?"input.type.monster.label":"input.type.st.label":"st"===ya[l].value?"input.type.st.label":"input.type.monster.label",j="ocg"===u;return Object(a.jsxs)(fi,{className:"post-pendulum-input variant-".concat(u),children:[Object(a.jsx)(Io,{ref:h,addonBefore:r[x],id:"type-ability",defaultValue:On.getState().card.typeAbility.join(m),onChange:g,onTakePicker:n}),j&&Object(a.jsx)(Xt.a,{overlay:r["input.furigana-helper.tooltip"],overlayClassName:"long-tooltip-overlay",children:Object(a.jsx)(Jr.a,{className:"input-kanji-helper",onChange:v,checked:d,children:r["input.furigana-helper.label"]})}),Object(a.jsx)(no,{className:"condense-input",value:"".concat(f),onChange:function(e){return function(e){b((function(t){return Object(s.a)(Object(s.a)({},t),{},{effectStyle:Object(s.a)(Object(s.a)({},t.effectStyle),{},{condenseTolerant:e})})}))}(e)},optionList:ka,children:Object(a.jsxs)("span",{children:[r["input.condense.label"]," ",Object(a.jsx)(Rr,{content:r["input.condense.tooltip"]})]})}),Object(a.jsx)(Gr,{})]})}));function pi(){var e=Object(Kt.a)(["\n position: relative;\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: var(--spacing-px);\n &.custom-style-picker {\n background-color: var(--sub-level-4); // Mimic border color\n }\n .style-section {\n z-index: 1;\n position: relative;\n background-color: var(--main-level-3);\n }\n .style-picker-section {\n overflow: hidden;\n .shadow-checkbox .ant-checkbox {\n transform: translateY(1px);\n }\n > .ant-checkbox-wrapper {\n padding: var(--spacing-xs);\n }\n }\n .custom-style-expand {\n display: grid;\n grid-template-columns: 1fr max-content;\n column-gap: var(--spacing-xs);\n .ant-checkbox-wrapper > span {\n padding-right: 0;\n }\n }\n .radio-train {\n padding: var(--spacing-xs);\n padding-bottom: 0;\n .standalone-addon {\n flex: 1 1 auto;\n text-align: left;\n }\n .radio-train-input-group {\n flex: 0 0 auto;\n }\n .ant-radio-button-wrapper {\n height: 26px;\n line-height: 24px;\n }\n }\n"]);return pi=function(){return e},e}function mi(){var e=Object(Kt.a)(["\n display: inline-grid;\n grid-template-columns: 1fr 1fr 1fr 1fr;\n column-gap: var(--spacing-xxs);\n padding: var(--spacing-px);\n margin-right: var(--spacing-sm);\n border: var(--bw) solid var(--sub-level-1);\n border-radius: var(--br);\n background-color: var(--main-level-4);\n cursor: pointer;\n &:hover {\n border-color: var(--main-active);\n }\n .text-style-preview-section {\n width: 8px;\n height: 28px; // Alignment\n }\n"]);return mi=function(){return e},e}function hi(){var e=Object(Kt.a)(["\n color: var(--color);\n text-shadow: var(--ts);\n font-weight: 500;\n padding: 5px;\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 3px;\n .color-list {\n display: flex;\n flex-wrap: nowrap;\n gap: 3px;\n }\n .color-block {\n height: 17px;\n width: 17px;\n cursor: pointer;\n position: relative;\n outline: none;\n border: var(--bw) solid var(--sub-level-4);\n &.static-block {\n cursor: default;\n height: 9px;\n width: 9px;\n margin: 4px 0;\n border: none;\n }\n }\n .active-dot {\n position: absolute;\n inset: var(--spacing-xs);\n background: rgb(0, 0, 0);\n border-radius: 50%;\n opacity: 1;\n }\n .color-input {\n display: grid;\n grid-template-columns: max-content 1fr;\n gap: 3px;\n border-left: var(--bw-lg) solid var(--sub-level-4);\n padding-left: 3px;\n input {\n width: 58px;\n font-size: var(--fs-sm);\n line-height: 1;\n border: none;\n padding: 0 5px;\n }\n }\n"]);return hi=function(){return e},e}var gi=Gt.b.div(hi()),vi=[{hex:"#FFFFFF",rgb:[255,255,255]},{hex:"#000000",rgb:[0,0,0]},{hex:"#FF0000",rgb:[255,0,0]},{hex:"#FFFF00",rgb:[255,255,0]},{hex:"#00FF00",rgb:[0,255,0]},{hex:"#00FFFF",rgb:[0,255,255]},{hex:"#0000FF",rgb:[0,0,255]},{hex:"#FF00FF",rgb:[255,0,255]}],xi=function(e){var t=e.value,n=void 0===t?"":t,r=e.onChange,i=Object(o.useState)(n),c=Object(u.a)(i,2),l=c[0],s=c[1],d=Object(o.useState)((function(){return{hex:Pt.test(n)?n:"#000000",rgb:Dt(n,!1)}})),f=Object(u.a)(d,2),b=f[0],p=f[1];return Object(o.useEffect)((function(){var e=l.startsWith("#")?l:"#".concat(l);Pt.test(e)&&(s(e),p({hex:e,rgb:Dt(e,!1)}),null===r||void 0===r||r(e))}),[l]),Object(o.useEffect)((function(){s(n),p({hex:Pt.test(n)?n:"#000000",rgb:Dt(n,!1)})}),[n]),Object(a.jsxs)(gi,{children:[Object(a.jsx)("div",{className:"color-list",children:vi.map((function(e){var t=e.hex,n=e.rgb,o=(299*n[0]+587*n[1]+114*n[2])/1e3>=128?"#000000":"#FFFFFF";return Object(a.jsx)("div",{className:"color-block",title:t,style:{backgroundColor:t},onClick:function(){return null===r||void 0===r?void 0:r(t)},children:b.hex.toUpperCase()===t&&Object(a.jsx)("div",{className:"active-dot",style:{backgroundColor:o}})})}))}),Object(a.jsxs)("div",{className:"color-input",children:[Object(a.jsx)("div",{className:"color-block static-block",style:{backgroundColor:b.hex}}),Object(a.jsx)(Vt.a,{size:"small",value:l,onChange:function(e){s(e.target.value)}})]})]})},ji=Gt.b.div(mi()),yi=Gt.b.div(pi()),Oi={effectTextStyle:{keyName:"effectTextStyle",labelKey:"input.text-style.section.effect.label"},pendulumTextStyle:{keyName:"pendulumTextStyle",labelKey:"input.text-style.section.pendulum.label"},statTextStyle:{keyName:"statTextStyle",labelKey:"input.text-style.section.stat.label"},typeTextStyle:{keyName:"typeTextStyle",labelKey:"input.text-style.section.type.label"}},wi=function(){var e=vn(),t=On(Object(kr.useShallow)((function(e){var t=e.card,n=t.statTextStyle,r=t.typeTextStyle,a=t.effectTextStyle,o=t.pendulumTextStyle,i=e.setCard;e.getUpdater;return{statTextStyle:n,typeTextStyle:r,effectTextStyle:a,pendulumTextStyle:o,setCard:i}}))),n=t.statTextStyle,r=t.typeTextStyle,o=t.effectTextStyle,i=t.pendulumTextStyle,c=t.setCard,l=[{info:Oi.effectTextStyle,value:o},{info:Oi.pendulumTextStyle,value:i},{info:Oi.statTextStyle,value:n},{info:Oi.typeTextStyle,value:r}];return Object(a.jsx)(Tr.a,{trigger:["click"],placement:"bottomLeft",overlayClassName:"global-input-overlay global-style-picker-overlay",content:Object(a.jsx)("div",{className:"overlay-event-absorber",children:Object(a.jsx)(yi,{className:"custom-style-picker",children:l.map((function(t){var n=t.info,r=t.value,o=n.keyName,i=n.labelKey,l=Object(u.a)(r,4),d=l[0],f=l[1],b=l[2],p=l[3];return Object(a.jsxs)("div",{className:"style-section",children:[Object(a.jsxs)("h3",{className:"custom-style-expand ".concat(d?"":"inactive"),children:[Object(a.jsx)("span",{children:e[i]}),Object(a.jsx)(Jr.a,{checked:d,onChange:function(e){c((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[n].concat(Object(wn.a)(r.slice(1)))))}))},children:e["input.text-style.custom.label"]})]}),d&&Object(a.jsxs)("div",{className:"style-picker-section",children:[Object(a.jsx)("h2",{children:Object(a.jsx)(Jr.a,{className:"shadow-checkbox",checked:b,onChange:function(e){c((function(t){var n=e.target.checked;return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[].concat(Object(wn.a)(r.slice(0,2)),[n,r[3]])))}))},children:e["input.text-style.shadow.label"]})}),b&&Object(a.jsx)(xi,{value:p,onChange:function(e){return c((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[].concat(Object(wn.a)(r.slice(0,3)),[e])))}))}}),Object(a.jsx)("h2",{children:e["input.text-style.color.label"]}),Object(a.jsx)(Ta.b,{colors:lt,color:null!==f&&void 0!==f?f:"",onChangeComplete:function(e){c((function(t){return Object(s.a)(Object(s.a)({},t),{},Object(ce.a)({},o,[r[0],e.hex].concat(Object(wn.a)(r.slice(2,4)))))}))}})]})]},o)}))})}),children:Object(a.jsx)(ji,{className:"text-style-preview",children:l.map((function(e){var t=e.info,n=e.value,r=t.keyName,o=Object(u.a)(n,4),i=o[0],c=o[1],l=o[2],s=o[3];return Object(a.jsx)("div",{className:"text-style-preview-section",style:{backgroundColor:0!==(null!==c&&void 0!==c?c:"").length&&i?c:"#000000",boxShadow:i&&l?"0 0 0 2px ".concat(s," inset"):""}},r)}))})})},ki=(n(391),i.a.forwardRef((function(e,t){var n=e.artworkCanvas,r=e.backgroundCanvas,i=e.onCropChange,c=e.onTainted,l=e.onSourceLoaded,d=vn(),f=On(Object(kr.useShallow)((function(e){var t=e.card;return{format:t.format,frame:t.frame,foil:t.foil,finish:t.finish,opacity:t.opacity,nameStyleType:t.nameStyleType,nameStyle:t.nameStyle,isPendulum:t.isPendulum,attribute:t.attribute,getUpdater:e.getUpdater,setCard:e.setCard}}))),b=f.format,p=f.frame,m=f.foil,h=f.finish,g=f.opacity,v=f.nameStyleType,x=f.nameStyle,w=f.isPendulum,k=f.attribute,F=f.getUpdater,C=f.setCard,S=kn().setting,T=S.showCreativeOption,R=S.showExtraDecorativeOption,N=Object(o.useRef)(null),L=ut({frame:p}),M=ft({frame:p}),E=Object(o.useState)(0),I=Object(u.a)(E,2),A=I[0],B=I[1],W=Object(o.useMemo)((function(){return function(e){return[{name:"normal",label:e.normal,color:"#747b95"},{name:"gold",label:e.gold,color:"#cfa65f"},{name:"platinum",label:e.platinum,color:"#b1b1b1"}]}({normal:d["input.foil.normal.label"],gold:d["input.foil.gold.label"],platinum:d["input.foil.platinum.label"]}).map((function(e){var t=e.color,n=e.name;return{label:e.label,value:n,props:{style:{color:t,fontWeight:"bold"}}}}))}),[d]),P=Object(o.useRef)(null),D=Object(o.useRef)(null),z=Object(o.useRef)(null),H=Object(o.useRef)(null),K=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(null),X=Object(o.useState)({id:"",setValue:function(){}}),V=Object(u.a)(X,2),U=V[0],q=V[1],J=Object(o.useMemo)((function(){return F("foil")}),[F]),$=Object(o.useMemo)((function(){return F("finish")}),[F]),_=Object(o.useCallback)((function(e){return C((function(t){return Object(s.a)(Object(s.a)({},t),{},{opacity:e})}))}),[C]),Z=Object(o.useMemo)((function(){return F("attribute")}),[F]),Q=Object(o.useCallback)((function(e,t){C((function(n){return Object(s.a)(Object(s.a)({},n),{},{nameStyleType:e,nameStyle:t})}))}),[C]),ee=Object(o.useMemo)((function(){return function(e,t){return O.map((function(n){var r=n.name,o=n.nameKey;return{label:r===y?Object(a.jsx)(j.a,{}):Object(a.jsx)(Xt.a,{overlay:t[o],children:Object(a.jsx)("img",{alt:t[o],src:"".concat("/ygocarder","/asset/image/attribute/attr-").concat(e,"-").concat(r.toLowerCase(),".png")})}),value:r}}))}(b,d)}),[b,d]);return Object(o.useEffect)((function(){var e;null===(e=N.current)||void 0===e||e.setValue({font:x.font})}),[x]),Object(o.useEffect)((function(){var e;null===(e=D.current)||void 0===e||e.setValue(g)}),[g]),Object(o.useImperativeHandle)(t,(function(){return{forceCardData:function(e){var t,n,r,a,o,i,c;B((function(e){return e+1}));var l=e.name,u=e.art,d=e.artCrop,f=e.background,b=e.backgroundCrop,p=e.opacity,m=e.setId,h=e.pendulumEffect,g=e.typeAbility,v=e.effect,x=e.atk,j=e.def,y=e.creator,O=e.password;null===(t=P.current)||void 0===t||t.setValue({art:u,artCrop:d}),null===(n=D.current)||void 0===n||n.setValue(Object(s.a)(Object(s.a)({},p),{},{background:f,backgroundCrop:b})),null===(r=z.current)||void 0===r||r.setValue({name:l,setId:m}),null===(a=H.current)||void 0===a||a.setValue({pendulumEffect:h}),null===(o=K.current)||void 0===o||o.setValue(v),null===(i=G.current)||void 0===i||i.setValue({typeAbility:g}),null===(c=Y.current)||void 0===c||c.setValue({atk:x,def:j,creator:y,password:O})}}})),Object(a.jsxs)("div",{className:["card-info-panel","ocg"===b?"input-ocg":"input-tcg"].join(" "),children:[Object(a.jsx)(la,{}),Object(a.jsx)("br",{}),Object(a.jsx)(ia,{}),Object(a.jsxs)("div",{className:"card-overlay-input",children:[Object(a.jsx)(Uo,{className:"format-radio",value:b,onChange:function(e){C((function(t){var n,r,a,o,i,c="".concat(e),l=on(t,c),s=l.name,u=l.setId,d=l.effect,f=l.typeAbility,b=l.password,p=l.creator,m=l.pendulumEffect;return null===(n=z.current)||void 0===n||n.setValue({name:s,setId:u}),null===(r=K.current)||void 0===r||r.setValue(d),null===(a=H.current)||void 0===a||a.setValue({pendulumEffect:m}),null===(o=G.current)||void 0===o||o.setValue({typeAbility:f}),null===(i=Y.current)||void 0===i||i.setValue({creator:p,password:b}),l}))},optionList:ha,children:Object(a.jsx)("span",{children:d["input.format.label"]})}),Object(a.jsx)(no,{className:"foil-radio",value:m,onChange:J,optionList:W,children:Object(a.jsx)("span",{children:d["input.foil.label"]})}),R&&Object(a.jsx)(lo,{className:"finish-checkbox",value:h,onChange:$,optionList:ga,children:Object(a.jsx)("span",{children:d["input.finish.label"]})})]}),T&&Object(a.jsxs)("div",{className:"card-layout-input",children:[Object(a.jsxs)("label",{className:"standalone-addon ant-input-group-addon",children:[d["input.layout.label"]," ",Object(a.jsx)(Rr,{content:d["input.layout.tooltip"]})]}),Object(a.jsx)(jo,{ref:D,defaultValue:g,receivingCanvas:r,onChange:_,onTainted:c,onCropChange:i,onSourceLoaded:l})]}),Object(a.jsx)(oo,{onSTFrameChange:function(e){var t;return null===(t=G.current)||void 0===t?void 0:t.setValue({typeAbility:e})}}),Object(a.jsxs)(Vo,{className:"name-style-id-input",children:[Object(a.jsx)(ai,{ref:z,onTakePicker:q}),Object(a.jsx)(Ja,{ref:N,frameInfo:be[p],defaultType:v,defaultValue:x,showExtraDecorativeOption:R,onChange:Q},A),Object(a.jsx)(To,{isLink:L,isMonster:M,showCreativeOption:T})]}),Object(a.jsxs)("div",{className:"main-info",children:[Object(a.jsxs)("div",{className:"main-info-first",children:[Object(a.jsx)(no,{className:"fill-input-train attribute-input",value:k,onChange:Z,optionList:ee,children:Object(a.jsx)("span",{children:d["input.attribute.label"]})}),(w||"link"!==p||T)&&Object(a.jsx)(ui,{ref:H,showCreativeOption:T,showExtraDecorativeOption:R,onTakePicker:q}),Object(a.jsx)(bi,{ref:G,onTakePicker:q}),Object(a.jsxs)("div",{children:[Object(a.jsxs)("div",{className:"card-effect-letter-helper",children:[Object(a.jsx)(ba,{className:"standalone-label",children:d["input.effect.label"]}),T?Object(a.jsx)(wi,{}):Object(a.jsx)("div",{}),Object(a.jsx)(Sa,{targetId:U.id,onPick:U.setValue})]}),Object(a.jsx)(Ao,{ref:K,onTakePicker:q})]}),Object(a.jsx)($o,{ref:Y,isMonster:M,showCreativeOption:T,onTakePicker:q})]}),Object(a.jsx)("div",{className:"main-info-second",children:Object(a.jsx)(Qo,{ref:P,receivingCanvas:n,isLink:L,showExtraDecorativeOption:R,onSourceLoaded:l,onTainted:c,onCropChange:i})})]})]})}))),Fi=n(413),Ci=n(421),Si=n(435);function Ti(){var e=Object(Kt.a)(["\n padding: 0;\n .button-label {\n padding: 4px 15px;\n height: 100%; // Alignment\n align-content: center;\n border-radius: var(--br-lg);\n line-height: 1.5;\n }\n .button-option {\n position: absolute;\n right: 0;\n top: 0;\n height: 100%;\n display: flex;\n align-items: center;\n padding: var(--spacing);\n border-left: var(--bw) solid var(--sub-secondary);\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\n .anticon {\n font-size: var(--fs-2xl);\n margin-left: 0;\n }\n &:hover {\n background: #399af9;\n }\n }\n"]);return Ti=function(){return e},e}function Ri(){var e=Object(Kt.a)(["\n &.active-resolution {\n background-color: var(--sub-active);\n }\n"]);return Ri=function(){return e},e}function Ni(){var e=Object(Kt.a)(["\n color: var(--color);\n padding: 1px 12px 5px 12px; // Alignment\n font-size: var(--fs-sm);\n border-bottom: var(--bw) solid var(--sub-level-4);\n cursor: default;\n &.ant-dropdown-menu-item.ant-dropdown-menu-item-disabled:hover {\n cursor: default;\n background: var(--main-level-3);\n }\n"]);return Ni=function(){return e},e}var Li=Object(Gt.b)(Fi.a.Item)(Ni()),Mi=Object(Gt.b)(Fi.a.Item)(Ri()),Ei=Object(Gt.b)(Lr.a)(Ti()),Ii=Object(o.forwardRef)((function(e,t){var n=e.isTainted,r=e.isInitializing,i=e.imageChangeCount,c=e.canvasMap,l=e.onDownloadError,s=vn(),d=kn(Object(kr.useShallow)((function(e){var t=e.setting;return{allowHotkey:t.allowHotkey,resolution:t.resolution,updateSetting:e.updateSetting}}))),f=d.allowHotkey,b=d.resolution,p=d.updateSetting,m=yr(!0,c,{imageChangeCount:i,isInitializing:r}).onExport,h=c.drawCanvasRef,g=Object(o.useRef)({currentPipeline:Promise.resolve(),pipelineRunning:!1}),v=Object(o.useState)(!1),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useCallback)((function(){y(!1)}),[]),w=function(e){var t=e.isTainted,n=e.isInitializing,r=e.drawCanvasRef,a=e.exportRef,i=e.onExport,c=e.onDownloadError,l=e.onDownloadComplete,s=On().card,u=kn((function(e){return e.setting.resolution})),d=s.opacity,f=s.name,b=s.isPendulum,p=Object(o.useRef)(!1),m=Object(o.useCallback)((function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,a=r.current,o=null===a||void 0===a?void 0:a.cloneNode(),i=null===a||void 0===a?void 0:a.getContext("2d"),s=null===o||void 0===o?void 0:o.getContext("2d");if(a&&i&&o&&s&&!t)try{n&&(o.width=n[0],o.height=n[1]),s.drawImage(a,0,0,a.width,a.height,0,0,o.width,o.height);var d=Bt(f),b=document.createElement("a");b.download=d?"".concat(d,".png"):"card.png",b.href=o.toDataURL("image/png"),b.click()}catch(p){c()}null===(e=document.querySelector("#export-canvas-guard"))||void 0===e||e.classList.remove("guard-on"),l()}),[r,t,f,u,l,c]);return Object(o.useEffect)((function(){var e=!0;return setTimeout((function(){var t=Bt(f);e&&(document.title=t?"".concat(t," - Yu-Gi-Oh Carder"):"Yu-Gi-Oh Carder")}),500),function(){e=!1}}),[f]),Object(o.useEffect)((function(){var e,t=!0,o=function(e){return e.preventDefault(),"Leave right now may make you lose unsaved progress, proceed?"};return!1===n&&(localStorage.setItem("card-data",JSON.stringify(s)),localStorage.setItem("card-version",null!==(e="2.0.15")?e:"unknown"),Object(mn.a)(pn.a.mark((function e(){var n,c,l,u,f,h,g;return pn.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.current){e.next=14;break}return window.addEventListener("beforeunload",o),null===(n=document.getElementById("export-canvas"))||void 0===n||n.classList.remove("js-export-available"),null===(c=document.getElementById("export-canvas-guard"))||void 0===c||c.setAttribute("style",""),null===(l=document.getElementById("save-button-waiting"))||void 0===l||l.setAttribute("style","display: block"),a.current.pipelineRunning=!0,e.next=9,a.current.currentPipeline;case 9:if(!t){e.next=14;break}return a.current.currentPipeline=i({isPendulum:b,opacity:d,isRelevant:function(){return t}}),e.next=13,a.current.currentPipeline;case 13:t&&("string"===typeof(g=Rt(s))&&At("data",g),null===(u=document.getElementById("export-canvas"))||void 0===u||u.classList.add("js-export-available"),null===(f=document.getElementById("export-canvas-guard"))||void 0===f||f.setAttribute("style","display: none"),null===(h=document.getElementById("save-button-waiting"))||void 0===h||h.setAttribute("style","display: none"),window.removeEventListener("beforeunload",o),a.current.pipelineRunning=!1,p.current&&(p.current=!1,m()));case 14:case"end":return e.stop()}}),e)})))()),function(){window.removeEventListener("beforeunload",o),t=!1}})),{onSave:function(e){var t;null===(t=document.querySelector("#export-canvas-guard"))||void 0===t||t.classList.add("guard-on");var n=e?Object(wn.a)(e):void 0;setTimeout((function(){!1===a.current.pipelineRunning?m(n):p.current=!0}),200)}}}({isTainted:n,isInitializing:r,drawCanvasRef:h,exportRef:g,onExport:m,onDownloadError:l,onDownloadComplete:O}).onSave,k=function(e){j||(n?fn.a.error({message:"Your card is tainted, you must save manually",description:'Right click the card \u2192 Choose "Save image as..."'}):(y(!0),w(e)))};return Object(o.useImperativeHandle)(t,(function(){return{download:k}})),n?null:Object(a.jsxs)("div",{className:"save-button-container",children:[Object(a.jsx)("div",{id:"save-button-waiting"}),Object(a.jsxs)(Ei,{className:"save-button",id:"save-button-ready",onClick:function(){return k()},children:[Object(a.jsx)(Xt.a,{overlay:f?Object(a.jsx)(a.Fragment,{children:"Ctrl-S / \u2318-S"}):null,children:Object(a.jsx)("div",{className:"button-label",children:j?s["button.download.ongoing.label"]:s["button.download.label"]})}),Object(a.jsx)(Ci.a,{disabled:j,className:"save-button-dropdown",placement:"bottomRight",overlay:Object(a.jsxs)(Fi.a,{onClick:function(e){return e.domEvent.stopPropagation()},children:[Object(a.jsx)(Li,{disabled:!0,children:s["button.download.resolution.label"]}),[{width:549,height:800},{width:813,height:1185}].map((function(e){var t=e.width,n=e.height;return Object(a.jsxs)(Mi,{className:b[0]===t&&b[1]===n?"active-resolution":"",onClick:function(){p({resolution:[t,n]}),Wt()},children:[t," \xd7 ",n]},"".concat(t,"-").concat(n))}))]}),children:Object(a.jsx)("div",{className:"button-option",onClick:function(e){return e.stopPropagation()},children:Object(a.jsx)(Si.a,{})})})]})]})})),Ai=n(414),Bi=n(436),Wi=n(437);function Pi(){var e=Object(Kt.a)(["\n top: var(--spacing-xs);\n right: calc(var(--overlay-size) + 2 * var(--spacing-xs));\n"]);return Pi=function(){return e},e}function Di(){var e=Object(Kt.a)(["\n top: var(--spacing-xs);\n right: var(--spacing-xs);\n"]);return Di=function(){return e},e}function zi(){var e=Object(Kt.a)(["\n --overlay-size: 51px;\n position: absolute;\n z-index: 101;\n background: var(--main-primary);\n border-color: var(--main-active);\n color: var(--color-heavy);\n padding: var(--spacing);\n line-height: 1;\n font-size: var(--fs-3xl);\n text-align: center;\n width: var(--overlay-size);\n height: var(--overlay-size);\n border-radius: var(--br-lg);\n cursor: pointer;\n box-shadow: var(--bs-1);\n display: none;\n &:hover {\n background: var(--sub-primary);\n }\n"]);return zi=function(){return e},e}function Hi(){var e=Object(Kt.a)(["\n color: var(--main-danger);\n"]);return Hi=function(){return e},e}function Ki(){var e=Object(Kt.a)(["\n\tposition: fixed;\n\tright: var(--spacing);\n\tbottom: 0;\n\tfont-size: var(--fs-xs);\n\topacity: 0.5;\n\tpadding: var(--spacing-px) var(--spacing-xs);\n\tcolor: var(--color-dim);\n img {\n height: 10px;\n margin-left: 1px;\n }\n"]);return Ki=function(){return e},e}function Gi(){var e=Object(Kt.a)(["\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-image: linear-gradient(45deg, #333, #333);\n\tz-index: 4000;\n\tcolor: white;\n\ttext-shadow:\n\t\t0 1px #333,\n\t\t0 2px #111;\n\tfont-size: var(--fs-3xl);\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n"]);return Gi=function(){return e},e}function Yi(){var e=Object(Kt.a)(["\n width: var(--card-width);\n height: var(--card-height);\n margin-bottom: var(--spacing);\n transform: translateX(var(--translate-ratio)) translateY(var(--translate-ratio)) scale(var(--resize-ratio))\n translateZ(0);\n position: absolute;\n top: 0;\n left: 0;\n canvas {\n position: absolute;\n left: 0;\n z-index: 1;\n pointer-events: none;\n }\n &:hover {\n .reset-button,\n .lightbox-button {\n display: block;\n }\n #export-canvas.js-export-available {\n display: inline-block !important; // Override js-controlled inline style\n cursor: default;\n }\n #export-canvas-guard {\n display: flex;\n cursor: wait;\n transition: all 2s;\n }\n }\n #export-canvas {\n display: none;\n z-index: 100;\n pointer-events: all;\n }\n #export-canvas-guard {\n position: absolute;\n left: 0;\n display: none;\n align-items: center;\n justify-content: center;\n z-index: 101;\n // background-color: #ffffff08;\n width: var(--card-width);\n height: var(--card-height);\n .anticon {\n font-size: var(--fs-4xl);\n }\n .canvas-guard-alert {\n position: absolute;\n top: 0;\n right: 0;\n color: white;\n padding: var(--spacing-xs) var(--spacing);\n border-radius: 0 0 0 var(--br-lg);\n background-color: var(--main-active);\n box-shadow:\n 0 3px 6px rgba(0, 0, 0, 0.16),\n 0 3px 6px rgba(0, 0, 0, 0.23);\n }\n &.guard-on {\n display: flex !important; // Override js-controlled inline style\n }\n }\n .crop-canvas {\n position: relative;\n width: 416px;\n height: 416px;\n z-index: 0;\n visibility: hidden;\n }\n"]);return Yi=function(){return e},e}function Xi(){var e=Object(Kt.a)(["\n display: flex;\n column-gap: var(--spacing);\n border-radius: var(--br-lg);\n font-size: var(--fs-4xl);\n line-height: 1.5;\n margin: auto;\n max-width: var(--card-width);\n min-height: 59px;\n outline: none !important; // Avoid default state styling\n padding: var(--spacing);\n padding-right: 0;\n text-align: center;\n text-shadow: 0 1px 2px black;\n .anticon {\n cursor: pointer;\n }\n button {\n color: white;\n border-radius: var(--br-lg);\n outline: none !important; // Avoid default state styling\n cursor: pointer;\n }\n .save-button {\n flex: 1;\n font-size: var(--fs-xl);\n border: var(--bw) solid var(--sub-secondary);\n font-weight: 500;\n box-shadow: var(--bs-button);\n height: 39px; // Alignment\n line-height: 1;\n &:focus, &:active {\n color: white;\n }\n }\n #save-button-waiting {\n cursor: wait;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 1;\n }\n #save-button-ready {\n cursor: pointer;\n &:hover {\n background-color: var(--sub-info);\n box-shadow: none;\n }\n }\n .save-button-container {\n display: flex;\n flex: 1;\n font-size: var(--fs);\n line-height: 1.35;\n position: relative;\n }\n .imexport {\n flex: 0 0 210px;\n display: grid;\n grid-template-columns: 1fr 1fr;\n column-gap: var(--spacing);\n button {\n font-size: var(--fs);\n background-color: var(--main-tertiary);\n border: var(--bw) solid var(--sub-tertiary);\n box-shadow: var(--bs-button);\n &:hover {\n background-color: var(--sub-tertiary);\n box-shadow: none;\n }\n }\n }\n"]);return Xi=function(){return e},e}var Vi=Gt.b.div(Xi()),Ui=Gt.b.div(Yi()),qi=Gt.b.div(Gi()),Ji=Gt.b.div(Ki()),$i=Gt.b.span(Hi()),_i=Gt.b.div(zi()),Zi=Object(Gt.b)(_i)(Di()),Qi=Object(Gt.b)(_i)(Pi()),ec=n(154);Object(ec.configure)({ignoreTags:[]});var tc={EXPORT:["ctrl+d","command+d"],IMPORT:["ctrl+e","command+e"],MERGE:["ctrl+g","command+g"],VIEW:["ctrl+b","command+b"],DOWNLOAD:["ctrl+s","command+s"]},nc=f,rc=d;var ac=function(){var e,t=kn(Object(kr.useShallow)((function(e){var t=e.setting,n=t.allowHotkey;return{softMode:t.reduceMotionColor,allowHotkey:n}}))),n=t.allowHotkey,r=t.softMode,i=gn(Object(kr.useShallow)((function(e){return{isInitiating:e.isInitiating,isLoading:e.isLoading,language:e.language,isMetadataReady:e.isMetadataReady,languageInfo:e.languageInfo,initiate:e.initiate,loadDefaultLanguage:e.loadDefaultLanguage}}))),c=i.isInitiating,l=i.isLoading,b=i.language,p=i.isMetadataReady,m=i.languageInfo,h=i.initiate,g=i.loadDefaultLanguage,v=Object(o.useState)(!0),x=Object(u.a)(v,2),j=x[0],y=x[1],O=Object(o.useState)(""),w=Object(u.a)(O,2),k=w[0],F=w[1],C=Object(o.useState)("external"),S=Object(u.a)(C,2),T=S[0],R=S[1],N=Object(o.useState)(0),L=Object(u.a)(N,2),M=L[0],E=L[1],I=Object(o.useState)(!1),A=Object(u.a)(I,2),B=A[0],W=A[1],P=Object(o.useRef)(null),D=Object(o.useRef)(null),z=Object(o.useRef)(null),H=Object(o.useRef)(null),K=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(null),X=Object(o.useRef)(null),V=Object(o.useRef)(null),U=Object(o.useRef)(null),q=Object(o.useRef)(null),J=Object(o.useRef)(null),$=Object(o.useRef)(null),_=Object(o.useRef)(null),Z=Object(o.useRef)(null),Q=Object(o.useRef)(null),ee=Object(o.useRef)(null),te=Object(o.useRef)(null),ne=Object(o.useState)({artworkCanvasRef:D,backgroundCanvasRef:z,drawCanvasRef:H,frameCanvasRef:K,cardIconCanvasRef:G,pendulumScaleCanvasRef:Y,pendulumEffectCanvasRef:X,typeCanvasRef:V,effectCanvasRef:U,nameCanvasRef:q,statCanvasRef:J,setIdCanvasRef:$,passwordCanvasRef:_,creatorCanvasRef:Z,stickerCanvasRef:Q,finishCanvasRef:ee,lightboxCanvasRef:te}),re=Object(u.a)(ne,1)[0],ae=Object(o.useRef)(null),oe=Object(o.useState)(0),ie=Object(u.a)(oe,2),ce=ie[0],le=ie[1];Object(o.useEffect)((function(){h()}),[h]),Object(o.useEffect)((function(){p&&g()}),[p,g]),Object(o.useEffect)((function(){["font-family","letter-spacing","--width-label"].forEach((function(e){var t,n;document.body.style.setProperty(e,null!==(t=null===(n=m.style)||void 0===n?void 0:n[e])&&void 0!==t?t:"")}))}),[m]),Object(o.useEffect)((function(){var e,t=null===(e=H.current)||void 0===e?void 0:e.getContext("2d"),n=On.getState().setCard;t&&(t.setTransform(1,0,0,1,0,0),t.imageSmoothingQuality="high",Nn(t)),!1===c&&wr.a.load({custom:{families:["Matrix-Bold","MatrixBoldSmallCaps","MatrixBook","MatrixRegularSmallCaps","RoGSanSrfStd-Bd","YuGiOhITCStoneSerifBSc","matrix","palatino-linotype-bold","stone-serif-bold","stone-serif-regular"],urls:["asset/font.css"]},active:function(){var e=function(){try{var e=window.localStorage.getItem("card-version"),t=window.localStorage.getItem("card-data"),n=new URLSearchParams(window.location.search).get("data");return n?jn(n):null!==t&&"2.0.15"===e?Et(JSON.parse(t)):ot()}catch(r){return console.error(r),ot()}}();n(e),y(!1)},fontinactive:function(e,t){console.error("TCG fontinactive",e,t),fn.a.error({message:xn()["error.load.font.tcg"](e)})},inactive:function(){F(xn()["error.load.font.all-tcg"]),y(!1)}})}),[c]);var se=function(e){var t=e.isLanguageInitiating,n=e.onActive,r=e.onBeforeLoad,a=e.onFontInactive,i=e.onInactive,c=On(Object(kr.useShallow)((function(e){return{format:e.card.format,font:e.card.nameStyle.font}}))),l=c.font,s=c.format,d=Object(o.useState)(""),f=Object(u.a)(d,2),b=f[0],p=f[1],m=Object(o.useRef)(!1),h=Object(o.useRef)(0);return Object(o.useEffect)((function(){("ocg"===s||"OCG"===l)&&!1===m.current&&h.current<=3&&!1===t&&(h.current+=1,p("".concat("/ygocarder","/asset/ocg-font.css")),r(),wr.a.load({custom:{families:["DFHSGothic-W3-WIN-RKSJ-H","DFKakuTaiHiStd-W4","FOT-Rodin Pro M","Yu-Gi-Oh! DF Leisho 3"],urls:["asset/ocg-font.css"]},active:function(){m.current=!0,n()},inactive:function(){m.current=!0,i()},fontinactive:a}))}),[s,l,t,n,r,a,i]),{styleContent:b}}({isLanguageInitiating:c,onBeforeLoad:function(){var e;y(!0);var t=null===(e=H.current)||void 0===e?void 0:e.getContext("2d");t&&(t.setTransform(1,0,0,1,0,0),t.imageSmoothingQuality="high",Nn(t))},onActive:function(){y(!1)},onInactive:function(){F(xn()["error.load.font.all-ocg"]),y(!1)},onFontInactive:function(e,t){console.error("OCG fontinactive",e,t),fn.a.error({message:xn()["error.load.font.ocg"](e)})}}).styleContent,ue=Object(o.useState)(!1),de=Object(u.a)(ue,2),fe=de[0],be=de[1];Object(o.useEffect)((function(){var e=document.body.classList;r?e.add("reduced-color-motion"):e.remove("reduced-color-motion")}),[r]);var pe=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&!n||W((function(t){return"boolean"===typeof e?e:!t}))}),[n]),me=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||n){null===e||void 0===e||e.preventDefault();var r=window.prompt(b["prompt.import.message"]),a=On.getState().setCard;if(r){var o,i=jn(r);a(i),le((function(e){return e+1})),null===(o=P.current)||void 0===o||o.forceCardData(i),Wt()}}}),[n,b]),he=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||n){null===e||void 0===e||e.preventDefault();var r=window.prompt(b["prompt.import.message"]),a=On.getState().setCard;if(r){var o,i=jn(r,On.getState().card);a(i),le((function(e){return e+1})),null===(o=P.current)||void 0===o||o.forceCardData(i),Wt()}}}),[n,b]),ge=Object(o.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||n){null===e||void 0===e||e.preventDefault(),"internal"===T&&window.alert(b["prompt.export.offline-warning.message"]);var r=On.getState().card;window.prompt(b["prompt.export.message"],"".concat(Rt(r)))}}),[n,b,T]),ve=Object(o.useCallback)((function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];r&&!n||(null===e||void 0===e||e.preventDefault(),null===(t=ae.current)||void 0===t||t.download())}),[n]),xe=Object(o.useMemo)((function(){return{IMPORT:function(e){return me(e,!0)},MERGE:function(e){return he(e,!0)},EXPORT:function(e){return ge(e,!0)},VIEW:function(){return pe(!0,!0)},DOWNLOAD:function(e){return ve(e,!0)}}}),[ve,ge,me,he,pe]),je=Object(o.useCallback)((function(){be(!0),alert(b["prompt.download.tainted.message"])}),[b]),ye=Object(o.useCallback)((function(){E((function(e){return e+1})),le((function(e){return e+1})),be(!1)}),[]),Oe=Object(o.useCallback)((function(e,t){le((function(e){return e+1})),R(t)}),[]),we=Object(o.useCallback)((function(){le((function(e){return e+1})),be(!0)}),[]),ke=l||j;return Object(a.jsx)(ec.HotKeys,{keyMap:tc,handlers:xe,children:Object(a.jsxs)("div",{id:"app",onDrop:function(){},className:"language-".concat(m.codeName),style:Object(s.a)({backgroundImage:'url("'.concat("/ygocarder",'/asset/image/texture/debut-dark.png"), linear-gradient(180deg, #00000022, #00000044)'),height:zt()?"-webkit-fill-available":"100vh"},{"--card-height":"".concat(f,"px"),"--card-width":"".concat(d,"px")}),children:[se&&Object(a.jsx)("link",{rel:"stylesheet",type:"text/css",href:se}),Object(a.jsxs)("div",{className:"app-container",style:{backgroundImage:'url("'.concat("/ygocarder",'/asset/image/texture/dark-denim-3.png")')},children:[ke&&Object(a.jsx)(qi,{className:"app-loading",children:k.length>0?Object(a.jsx)($i,{children:k}):null!==(e=m.initialMessage)&&void 0!==e?e:""}),Object(a.jsxs)("div",{className:"card-preview-panel ".concat(fe?"export-tainted":"export-normal"),children:[Object(a.jsxs)(Vi,{className:"data-button-panel",children:[Object(a.jsxs)("div",{className:"imexport",children:[Object(a.jsx)(Xt.a,{overlay:n?Object(a.jsx)(a.Fragment,{children:"Ctrl-D / \u2318-D"}):null,children:Object(a.jsx)("button",{onClick:ge,children:b["button.export.label"]})}),Object(a.jsx)(Xt.a,{overlay:n?Object(a.jsxs)("div",{className:"center",children:[Object(a.jsx)("div",{children:"Ctrl-E / \u2318-E"}),Object(a.jsxs)("div",{children:["Ctrl-G / \u2318-G",b["prompt.import.merge.tooltip"]]})]}):null,children:Object(a.jsx)("button",{onClick:me,children:b["button.import.label"]})})]}),Object(a.jsx)(Ii,{ref:ae,canvasMap:re,imageChangeCount:ce,isTainted:fe,isInitializing:j,onDownloadError:je}),fe&&Object(a.jsx)("div",{id:"save-button-tainted",className:"save-button-container",children:Object(a.jsxs)("span",{children:[b["alert.download.tainted-first-line"],Object(a.jsx)("br",{}),b["alert.download.tainted-second-line"]," ",Object(a.jsx)(sa,{})]})})]}),Object(a.jsx)("div",{className:"card-canvas-container",children:Object(a.jsxs)(Ui,{className:"card-canvas-group",children:[Object(a.jsx)(Xt.a,{title:b["button.reset.tooltip"],children:Object(a.jsx)(Qi,{className:"reset-button",onClick:function(){if(window.confirm(b["prompt.reset.message"])){var e,t=On.getState(),n=t.setCard,r=t.card,a=ot(),o="tcg"===r.format?a:on(a,"ocg");n(o),le((function(e){return e+1})),null===(e=P.current)||void 0===e||e.forceCardData(o)}},children:Object(a.jsx)(Bi.a,{})})}),Object(a.jsx)(Xt.a,{title:Object(a.jsxs)("div",{className:"center",children:[b["button.full-size.label"],n?Object(a.jsxs)(a.Fragment,{children:[Object(a.jsx)("br",{}),"Ctrl-B / \u2318-B"]}):null]}),children:Object(a.jsx)(Zi,{className:"lightbox-button",onClick:function(){return pe()},children:Object(a.jsx)(Wi.a,{})})}),Object(a.jsx)("canvas",{id:"export-canvas",ref:H,width:rc,height:nc},M+.1),Object(a.jsx)("div",{id:"export-canvas-guard",onContextMenu:function(e){return e.preventDefault()}}),Object(a.jsx)("canvas",{id:"frameCanvas",ref:K,width:rc,height:nc},M),Object(a.jsx)("canvas",{id:"nameCanvas",ref:q,width:rc,height:148}),Object(a.jsx)("canvas",{id:"cardIconCanvas",ref:G,width:rc,height:222}),Object(a.jsx)("canvas",{id:"pendulumScaleCanvas",ref:Y,width:rc,height:889}),Object(a.jsx)("canvas",{id:"pendulumEffectCanvas",ref:X,width:rc,height:889}),Object(a.jsx)("canvas",{id:"typeCanvas",ref:V,width:rc,height:1037}),Object(a.jsx)("canvas",{id:"effectCanvas",ref:U,width:rc,height:1111}),Object(a.jsx)("canvas",{id:"statCanvas",ref:J,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"setIdCanvas",ref:$,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"passwordCanvas",ref:_,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"creatorCanvas",ref:Z,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"stickerCanvas",ref:Q,width:rc,height:nc}),Object(a.jsx)("canvas",{id:"finishCanvas",ref:ee,width:rc,height:nc}),Object(a.jsx)("canvas",{className:"crop-canvas",ref:D}),Object(a.jsx)("canvas",{className:"crop-canvas",ref:z})]})})]}),!1===ke&&Object(a.jsx)(ki,{ref:P,artworkCanvas:D.current,backgroundCanvas:z.current,onSourceLoaded:ye,onCropChange:Oe,onTainted:we})]}),Object(a.jsx)(Ai.a,{width:"843px",wrapClassName:"card-lightbox-overlay",visible:B,forceRender:!0,onCancel:function(){return W(!1)},footer:null,children:Object(a.jsx)("canvas",{id:"lightbox-canvas",ref:te,width:rc,height:nc},M+.1)}),Object(a.jsxs)(Ji,{className:"by-me",children:["Made by Lauqerm ",Object(a.jsx)("img",{src:"https://i.imgur.com/RY6IRqn.png",alt:"avatar"})]})]})})},oc=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,438)).then((function(t){var n=t.getCLS,r=t.getFID,a=t.getFCP,o=t.getLCP,i=t.getTTFB;n(e),r(e),a(e),o(e),i(e)}))};l.a.render(Object(a.jsx)(i.a.StrictMode,{children:Object(a.jsx)(ac,{})}),document.getElementById("root")),oc()}},[[407,1,2]]]); -//# sourceMappingURL=main.7ea04692.chunk.js.map \ No newline at end of file diff --git a/static/js/main.7ea04692.chunk.js.map b/static/js/main.7ea04692.chunk.js.map deleted file mode 100644 index ab141c8..0000000 --- a/static/js/main.7ea04692.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["model/canvas.ts","model/icon.tsx","model/name-preset.ts","model/coordinate-data.tsx","model/dictionary.ts","model/foil-finish.tsx","model/font-data-effect.tsx","model/font-data-name.ts","model/font-data-other.ts","model/format.tsx","model/frame.tsx","model/link.tsx","model/regex.tsx","model/index.tsx","util/categorize.tsx","util/condenser.ts","util/font.tsx","util/gradient.ts","util/navigation.ts","3rd/index.ts","util/codec.ts","util/index.tsx","component/loading/index.tsx","component/icon-button/index.tsx","service/format-change.tsx","service/use-i18n/processor.tsx","service/use-i18n/index.ts","service/use-card.ts","service/use-setting.ts","draw/canvas-util.ts","draw/image.ts","draw/letter.ts","draw/text-util.ts","draw/text-analyze.ts","draw/line.ts","draw/text-overhead.ts","draw/text.ts","draw/text-normalize.tsx","draw/predefined-section/effect.ts","draw/predefined-section/with-image.ts","draw/predefined-section/layout.ts","draw/predefined-section/name.ts","draw/predefined-section/type-ability.ts","draw/predefined-section/with-text.ts","service/use-master-seri/index.tsx","service/use-master-seri/prepare-style.ts","draw/predefined-section/password.ts","draw/predefined-section/creator.ts","component/image-cropper/index.tsx","component/link-marker/index.tsx","component/explanation/index.tsx","component/formatting-guide/index.tsx","component/frame-info-block/index.tsx","component/setting/index.tsx","component/app-header/index.tsx","component/index.tsx","page/input-panel/const.tsx","page/input-panel/char-picker/index.tsx","page/input-panel/name-style-picker/gradient-picker.tsx","page/input-panel/name-style-picker/style-picker.styled.tsx","page/input-panel/name-style-picker/grid-slider-input.tsx","page/input-panel/name-style-picker/predefined-option-grid.tsx","page/input-panel/name-style-picker/index.tsx","util/hook.ts","page/input-panel/input-train/input-train.styled.tsx","page/input-panel/input-train/radio-train.tsx","page/input-panel/input-train/frame-train.tsx","page/input-panel/input-train/checkbox-train.tsx","page/input-panel/layout-picker/background-input-group.tsx","page/input-panel/layout-picker/index.tsx","page/input-panel/input-group/card-icon-input-group.tsx","page/input-panel/input-text/util.ts","page/input-panel/input-text/card-text-area.tsx","page/input-panel/input-text/card-text-input.tsx","page/input-panel/input-group/effect-input-group.tsx","page/input-panel/input-checkbox-group.tsx","page/input-panel/input-panel.styled.tsx","page/input-panel/input-group/footer-input-group.tsx","page/input-panel/input-group/image-input-group.tsx","page/input-panel/input-group/name-set-input-group.tsx","page/input-panel/input-group/pendulum-input-group.tsx","page/input-panel/input-group/post-pendulum-input-group.tsx","page/input-panel/text-style-picker.tsx","page/input-panel/index.tsx","page/canvas-panel/download-button.tsx","service/use-card-export.ts","app.styled.tsx","app.tsx","service/use-ocg-font.ts","reportWebVitals.js","index.js"],"names":["CanvasConst","DEFAULT_BASE_FILL_COLOR","getDefaultCardOpacity","body","pendulum","text","name","baseFill","artBorder","nameBorder","boundless","CardArtCanvasCoordinateMap","normal","artFinishX","artFinishY","artWidth","artX","artY","ratio","type","extendedCard","extendedPendulum","truePendulum","fullCard","fullPendulum","getArtCanvasCoordinate","isPendulum","opacity","backgroundType","NO_ATTRIBUTE","AttributeList","nameKey","color","label","NO_ICON","IconList","CloseCircleOutlined","value","createPresetNameStyle","presetValue","hasGradient","hasOutline","hasShadow","pattern","PresetNameStyleMap","commonB","key","image","preset","fillStyle","commonW","skillDefault","lineWidth","lineColor","skillArial","font","lineOffsetX","rare","secretGradient","gradientAngle","gradientColor","secret","platinum2","ultra","ultra2","platinum","shadowColor","shadowOffsetY","shadowOffsetX","shadowBlur","gold","animeRed","lineOffsetY","animeSilver","animeGold","promo","PresetNameStyleList","Object","values","PatternMap","none","patternImage","blendMode","type1","type2","type3","type4","type5","overrideFill","type6","type7","type8","type9","PatternList","EffectCoordinateData","trueWidth","trueBaseline","trueEdge","PendulumEffectCoordinate","TypeAbilityCoordinateMap","tcg","small","medium","large","edgeAlignment","ocg","CreatorCoordinateMap","PasswordCoordinateMap","ocgKeywordDataList","shortForm","rubyForm","regexForm","rubyFormName","ocgKeywordDataMap","reduce","acc","cur","type3CommonInstruction","type8CommonInstruction","FinishMap","partInstructionMap","ArtFinishMap","art","DefaultFontSizeData","capitalLetterRatio","headTextFontRatio","headTextSpacing","largeSymbolRatio","letterSpacing","offsetY","ordinalFontOffsetY","ordinalFontRatio","squareBracketRatio","DefaultFontDeviation","DefaultFontData","DefaultEffectFontData","alphabetFont","furiganaFont","headTextHeightRatio","ordinalFont","symbolFont","symbolFontRatio","headTextGapRatio","DefaultTCGEffectFontData","fontStyle","fontList","DefaultTCGNormalFontData","DefaultOCGEffectFontData","metricMethod","EffectFontData","bulletSymbolWidth","fontSize","lineHeight","lineCount","TCGVanillaTypeStatFontList","PendulumEffectFontData","CondenseTolerantMap","veryStrict","strict","loose","veryLoose","relaxed","NameFontDataMap","Default","labelKey","fontData","letterDeviationMap","i","yOffset","yRatio","ì","í","î","ï","ĩ","ī","ĭ","į","ǐ","ȉ","ȋ","ɨ","ɩ","ᵹ","ᵼ","ᶖ","ḭ","ḯ","ỉ","ị","I","Ì","Í","Î","Ï","Ĩ","Ī","Ĭ","Į","İ","Ɩ","Ɨ","Ǐ","Ȉ","Ȋ","Ḭ","Ḯ","Ỉ","Ị","Arial","weight","OCG","headTextOverflow","headTextBold","numberFont","numberFontRatio","CreatorFontData","wordLetterSpacing","PasswordFontData","tcgTypeAbilityFontData","iconSymbolWidth","ocgTypeAbilityFontData","tcgToOCGLetterMap","ocgToTCGLetterMap","ocgNumberCircleMap","ocgToTCGTermMap","tcgToOCGTermMap","entries","ocgTerm","FrameInfoMap","labelColor","edition","labelBackgroundColor","labelBackgroundColorList","labelBackgroundImage","join","frameList","arrowPositionList","top","left","width","height","CapitalLetterRegex","RegExp","SquareBracketLetterRegex","WHOLE_WORD_SOURCE","WholeWordRegex","FragmentSplitRegex","NB_WORD_OPEN","NB_WORD_CLOSE","NB_LINE_OPEN","NB_LINE_CLOSE","NB_UNCOMPRESSED_START","NB_UNCOMPRESSED_END","NormalizeTextRegex","NON_BREAKABLE_SYMBOL_SOURCE","nonBreakableSymbolRegex","FLAVOR_CONDITION_SOURCE","TCGSymbolLetterRegex","OCG_KEYWORD_JOIN_REGEX","map","entry","OCG_KEYWORD_SOURCE","CHIISAI_KANA_JOINLIST","ChiisaiRegex","NOT_START_OF_LINE_SOURCE","NonCompressableRegex","OCGAlphabetRegex","OCGNumberRegex","NumberRegex","HiraganaRegex","KatakanaRegex","OCGDotRegex","ChoonpuRegex","NoSpaceRegex","OCGIncreasedLevel2WidthRegex","OCGIncreasedWidthRegex","OCGNoOverheadGapRegex","OCGOffsetMap","OCGLastOfLineOffsetMap","OCGBoxSpacingRatioMap","TCGOffsetMap","TCGLastOfLineOffsetMap","TCGBoxSpacingRatioMap","getBulletSpacing","format","RUBY_REGEX","BREAKABLE_LETTER","GAP_PER_WIDTH_RATIO","getDefaultCard","version","frame","foil","finish","artFinish","nameStyleType","nameStyle","headTextFillStyle","attribute","subFamily","cardIcon","star","starAlignment","artCrop","x","y","unit","aspect","hasBackground","background","backgroundCrop","linkMap","pendulumFrame","pendulumEffect","pendulumScaleRed","pendulumScaleBlue","typeAbility","effectStyle","condenseTolerant","effect","setId","atk","def","password","sticker","isFirstEdition","isSpeedCard","isDuelTerminalCard","creator","furiganaHelper","statTextStyle","typeTextStyle","effectTextStyle","pendulumTextStyle","getEmptyCard","OpacityList","subType","tooltipKey","DefaultColorList","checkXyz","card","checkLink","checkMonster","checkSpeedSkill","getCardIconFromFrame","checkLightHeader","checkLightFrame","includes","resolveNameStyle","isSpeedSkill","lightHeader","contextualFont","contextualColor","resultNameStyle","contextualOutline","strokeStyle","foilStyle","frameStyle","MAX_CONDENSER_THRESHOLD","createCondenser","minThreshold","maxThreshold","min","max","median","lastEffective","iterateCount","magnitude","magnitudeReductionRatio","reverseSearch","Math","searchDown","reset","getMedian","setMedian","newMedian","setLastEffective","forceMedian","getLastEffective","applyLastEffective","getIterateCount","condense","worker","effectiveMedian","condenser","finalMedian","satisfy","forcedMedian","createFontGetter","props","defaultWeight","defaultStyle","defaultSize","defaultFamily","style","size","sizeAsNumber","parseFloat","replaceAll","family","getFont","filter","part","getFontInfo","setWeight","nextWeight","this","setStyle","nextStyle","setSize","nextSize","calculatedSize","setFamily","nextFamily","stringifyPalette","palette","offset","parsePalette","stringifiedPalette","split","index","id","getNavigationProps","debug","optionLength","stopPropagation","setFocus","onTrigger","onCancel","onKeyPress","tabIndex","onFocus","console","info","onBlur","onKeyDown","e","preventDefault","JSONUncrush","n","substring","length","r","pop","JSONCrushSwap","o","replace","cardFieldShortenMap","_newKey","artFrame","passcode","picture","pictureCrop","compressCardData","shortenMap","serialize","condensedCard","normalizedCard","keys","forEach","fieldKey","fieldValue","Array","isArray","newFieldKey","newKey","JSON","stringify","decompressCardData","fullKey","shortenKey","shortendKey","legacyReverseCardDataShortener","normalizedCondensedCard","parse","decodeURIComponent","rebuildCardData","baseCard","migrateCardData","migratedCard","clone","kanjiHelper","undefined","randomCharacter","charSet","result","charactersLength","charAt","floor","random","insertUrlParam","window","history","pushState","searchParams","URLSearchParams","location","search","set","newurl","protocol","host","pathname","toString","path","normalizedCardName","forceRefocus","selector","document","querySelector","focus","HexColorRegex","hexToRGBA","hex","withAlpha","pureHex","rgbaList","parseInt","slice","isNaN","isMobileDevice","a","check","navigator","userAgent","vendor","opera","test","substr","mergeClass","args","Boolean","StyledLoadingFullViewContainer","styled","div","Loading","FullView","className","StyledIconButtonContainer","span","IconButton","Icon","onClick","iconProps","tooltipProps","containerProps","customOnClick","restContainerProps","changeCardFormat","targetFormat","termMap","newSetId","processLanguage","rawLanguageData","fallbackRawDictionary","normalizedRawDictionary","rawDictionary","getDictionaryEntry","applyTemplateNode","template","nodeMap","splitRegex","splittedString","Fragment","specializedDictionary","familyName","siteLink","author1","author2","artist1","artist2","artist3","artist4","settingIcon","openTag","closeTag","hotkey","hotkeyAlternative","separator","scaleType","dictionary","useI18N","create","get","defaultLanguageName","url","URL","href","initialParam","defaultLanguageFromURL","delete","replaceState","state","cachedLanguage","localStorage","getItem","error","languageMap","defaultLanguage","formalName","codeName","initialMessage","order","active","loadLanguageMetadata","fetch","process","headers","response","json","languageMetadataMap","Error","isMetadataReady","eng","loadLanguage","languageName","languageData","processedLanguage","changeLanguage","nextMeta","languageInfo","language","setItem","isLoading","isInitiating","initiate","loadDefaultLanguage","useLanguage","getLanguage","getState","decodeCardWithCompatibility","cardData","decodedCard","legacyRebuildCardData","notification","message","description","VariantConfigMap","debounce","wait","throttle","useCard","setCard","cardTransform","getUpdater","valueTransform","variant","returnFunction","current","target","variantConfig","useSetting","cachedStore","resolution","allowHotkey","reduceMotionColor","showCreativeOption","showExtraDecorativeOption","setting","updateSetting","transformerOrPayload","currentStore","newSetting","CanvasHeight","CanvasWidth","drawMarker","ctx","edge","baseline","xRatio","currentFillStyle","beginPath","rect","fillTextLeftWithSpacing","str","letterSpacingRatio","option","stroke","textAlign","charList","curLeft","char","fillText","strokeText","measureText","fillTextRightWithSpacing","curRight","c","clearCanvas","clearRect","getFinishIterator","finishMap","caller","Promise","resolve","finishType","finishInformation","instructionList","globalCompositeOperation","globalAlpha","DEFAULT_SHADOW_COLOR","DEFAULT_TEXT_COLOR","setTextStyle","blur","imageCacheMap","drawFrom","source","sx","sy","ready","normalizedX","normalizedY","drawImage","imageCached","cache","Image","src","addEventListener","once","drawAsset","drawFromWithSize","dw","dh","normalizedW","normalizedH","drawAssetWithSize","drawWithColor","canvas","sw","sh","dx","dy","cloneCanvasStyle","getContext","clonedCanvas","createElement","clonedCtx","willReadFrequently","rgbaColor","imageRasterData","getImageData","data","resetStyle","imageDataWithShadow","imageRasterDataWithShadow","combinedLayerData","combinedLayerRasterData","pixelCnt","destinationAlpha","putImageData","getLetterWidth","letter","isLastOfLine","boundWidth","boxSpacingRatioMap","offsetMap","lastOfLineOffsetMap","metric","actualBoundWidth","actualBoundingBoxLeft","actualBoundingBoxRight","kerningScaleRatio","spacingRatio","offsetRatio","letterBoxSpacing","standardMetricRatio","actualLetterWidth","drawLetter","deviation","letterMetric","textDrawer","deviationYOffset","letterWidth","scaledBoundingWidth","scaledBaseline","scaledEdge","boundingOffset","externalOffset","scale","tokenizeText","keepControlCharacter","regex","token","getTextWorker","fontSizeData","fontController","numberFontMemory","symbolFontMemory","ordinalFontMemory","furiganaFontMemory","largerTextFontMemory","applyNumberFont","stopApplyNumberFont","applyLargerText","fontRatio","stopApplyLargerText","applySymbolFont","stopApplySymbolFont","applyOrdinalFont","stopApplyOrdinalFont","applyFuriganaFont","bold","stopApplyFuriganaFont","applyAsymmetricScale","applyScale","xScale","yScale","resetScale","setTransform","reverseScale","scaleValue","drawBullet","spaceAfter","bulletRadius","arc","PI","fill","analyzeHeadText","footText","footTextWidth","headText","headTextLetterWidth","headTextGap","gapPadding","fitFootText","sentenceXRatio","noHeadText","condenseHeadText","alignCenterLetterSpacing","internalXRatio","alignCenterHeadTextWidth","alignEvenlyLetterSpacing","alignEvenlyHeadTextWidth","alignment","trueHeadTextWidth","headTextWidth","baseHalfGap","halfGap","headTextXRatio","getLostLeftWidth","prevGap","curGap","analyzeToken","rawToken","nextToken","previousTokenGap","textData","totalWidth","leftMostLetter","spaceCount","spaceAtEnd","rightGap","leftGap","currentFont","fontLevel","defaultGap","currentRightGap","offsetable","leftMostGap","fragmentList","cnt","isLeftmostFragment","fragment","fragmentWidth","rubyType","lostLeftWidth","normalizedWordSpacingRatio","remainFragment","currentLetter","nextRemainFragment","createLineList","paragraphList","additionalLineCount","currentLineList","currentLineCount","accumulatedLineCount","curr","baseXRatio","scaledWidth","tokenList","addedLineCount","wordList","currentLineWidth","currentGap","unCompressedFlag","tokenWidth","line","trim","push","isLast","actualLineWidth","fillHeadText","textWorker","externalHeadTextXRatio","overflow","baseLoneTokenRatio","finalizedRatio","currentEdge","drawLine","spaceWidth","iconPositionList","previousTokenRebalanceOffset","tokenEdge","tokenCnt","gapRatio","next2ndToken","analyzeTokenParameter","drawLetterParameter","tokenRightGap","totalTokenWidth","indent","fragmentEdge","fragmentCnt","nextFragment","next2ndFragment","vacantLeftWidth","isNextTokenOffsetable","nextLeftGap","lostRightWidth","totalVacantSpace","rebalancedSpace","nextTokenRebalanceOffset","footTextFragmentEdge","currentStrokeStyle","currentShadowColor","currentShadowOffsetX","currentShadowOffsetY","currentShadowBlur","fragmentNaiveWidth","currentPosition","drawLetterofWordParameter","letterOffset","round","normalizeCardText","multiline","dictionaryType","nonNullableText","normalizedText","letterSwapMap","textAfterJoinRow","textAfterDetectBlockWord","m","correspondingCircleSymbol","textAfterProcessing","keywordSubtitue","textAfterNormalizeBlockWord","currentDepth","getEffectFontAndCoordinate","isNormal","statInEffect","typeInEffect","coordinateKey","fontDataKey","sizeList","drawEffect","content","textStyle","effectSizeLevel","normalizedContent","tolerancePerSentence","materialReplacement","material","effectText","fullLineList","wholeLineRegex","exec","effectFlavorCondition","flavorConditionRegex","potentialFlavorConditionText","splitEffect","trueWidthStart","trueBaselineStart","lineListWithRatio","fullLineListWithRatio","totalContentWidth","lineSpaceCount","expectedSpaceWidth","analyzeLine","drawStarContent","onStarDraw","normalizedStarCount","leftEdge","resetShadow","all","coordinate","starWidth","drawSticker","toLowerCase","drawPredefinedMark","isLink","bordered","drawLinkRatingText","topToPendulumStructure","pendulumStructureHeight","leftToPendulumStructure","getLayoutDrawFunction","artworkCanvas","backgroundCanvas","bottomFrame","pendulumSize","isXyz","loopFinish","loopArtFinish","keepArtBorder","opacityBody","opacityName","opacityPendulum","opacityText","effectBoxY","hasFoil","frameBorderType","nameBorderType","applyArtFinish","resultAPI","calculateCardArtRedrawCoordination","imageCanvas","customOpacity","extraHeightRatio","customBackgroundType","normalizedOpacity","bodyOpacity","imageWidth","imageHeight","imageScaledRatio","sourceOffsetX","destinationOffsetX","sourceOffsetY","destinationOffsetY","offsetHeight","destinationX","destinationY","destinationWidth","destinationHeight","drawFrame","drawCardArt","drawBackground","boundary","backgroundWidth","backgroundHeight","redrawCoordination","backgroundSourceOffsetX","backgroundSourceOffsetY","backgroundOffsetHeight","backgroundDestinationX","backgroundDestinationY","backgroundDestinationWidth","backgroundDestinationHeight","drawAttribute","drawStar","normalizedCardIcon","drawPendulumScaleIcon","drawLinkArrowMap","isActive","baseLink","activeLink","drawStatBorder","drawNameBackground","drawEffectBackground","withPendulum","effectBoxX","drawFrameBorder","drawNameBorder","drawArtBorder","artFrameSource","drawPendulumBorder","foilType","drawEffectBorder","drawCardBorder","drawArtBorderFoil","drawEffectBorderFoil","drawLinkMapFoil","withBorder","drawNameFinish","drawAttributeFinish","drawArtFinish","drawArtOverlayFinish","drawArtBorderFinish","drawPendulumArtBorderFinish","drawBorderPendulumFinish","drawFrameFinish","drawFrameBackgroundFinish","drawOverlayFinish","overlayType","drawCardBorderFinish","getNameGradient","angleAsDegree","colorStopList","contentWidth","maxAscent","maxDescent","baseKAF","quarterSlot","KAF","originHeight","cx","cy","AD","sqrt","FDA","asin","AF","sin","AL","FL","cos","offsetX","topX","topY","botX","botY","gradient","createLinearGradient","addColorStop","drawName","cloneNode","cloneCtx","hasDefaultOutline","patternBlendMode","fontGetter","quoteConvertedValue","crudeTokenList","fontGetterForWidthCalculating","normalStyle","symbolStyle","textMetric","actualBoundingBoxAscent","actualBoundingBoxDescent","internalEffectiveMedian","lineJoin","defaultTextStyle","sizeMap","drawTypeAbilityText","drawTypeAbility","isMonster","willDrawTypeAbility","typeAbilityWithIcon","willDrawIcon","normalizedTypeAbilityText","defaultFillStyle","normalizedStyle","naturalWidth","drawScale","digitList","digit","accLeft","drawStatText","cursorEndOfATK","drawStat","statWidth","tokenizedText","prev","nextWidth","condenseRatio","_","arr","curText","nextEdge","useMasterSeriDrawer","canvasMap","drawCanvasRef","artworkCanvasRef","backgroundCanvasRef","frameCanvasRef","creatorCanvasRef","effectCanvasRef","nameCanvasRef","passwordCanvasRef","pendulumEffectCanvasRef","pendulumScaleCanvasRef","setIdCanvasRef","statCanvasRef","stickerCanvasRef","cardIconCanvasRef","typeCanvasRef","finishCanvasRef","lightboxCanvasRef","checkNormal","requireShadow","lightFooter","useMemo","levelColor","levelStyle","customEffectText","effectTextFillStyle","effectHasShadow","effectTextShadow","resolvedEffectTextStyle","customPendulumEffectText","pendulumEffectTextFillStyle","pendulumEffectHasShadow","pendulumEffectTextShadow","resolvedPendulumEffectTextStyle","customTypeText","typeTextFillStyle","typeHasShadow","typeTextShadow","resolvedTypeTextStyle","customStatText","statTextFillStyle","statHasShadow","statTextShadow","resolvedStatTextStyle","prepareStyle","normalizedSubFamily","toUpperCase","normalizedTypeAbility","isInitializing","imageChangeCount","readyToDraw","drawingPipeline","useRef","rerun","instructor","overlay","useEffect","hasArtBorder","fillBaseColor","w","h","fillRect","artHeight","withShadow","spacing","xOffset","drawSetId","endOfPassword","baselineOffset","isNumberPassword","internalTextData","internalTrueWidth","drawPasswordText","draw1stEdition","drawCreatorText","typeCtx","effectIndexSize","drawHistory","onExport","useCallback","exportProps","canvasRef","exportCtx","generateLayer","canvasLayer","delayQueue","setTimeout","toBlob","blob","createObjectURL","layer","onload","revokeObjectURL","onerror","sort","l","normalizeCrop","crop","cropWidth","cropHeight","scaleRatio","nextX","nextY","newWidth","naturalHeight","acceptableError","isRatioAcceptable","abs","ImageCropper","React","forwardRef","forwardedRef","title","backgroundColor","defaultExternalSource","receivingCanvas","children","beforeCropper","defaultCropInfo","onSourceLoaded","onSourceChange","onCropChange","onTainted","fileInputRef","useState","crossorigin","redrawSignal","setRedrawSignal","sourceType","setSourceType","inputMode","setInputMode","internalSource","setInternalSource","setLoading","setError","externalSource","setExternalSource","imgRef","completed","setCrop","isMigrated","setMigrated","currentCrop","completedCrop","pendingCrop","onLoad","img","internalId","pendingId","normalizedCrop","transform","zoomX","zoomY","cropUnit","pixelRatio","devicePixelRatio","expectedDrawWidth","drawWidth","expectedDrawHeight","drawHeight","drawCoordinateX","drawCoordinateY","imageSmoothingQuality","fitCropData","newValue","useImperativeHandle","hasImage","forceExternalSource","cropInfo","isDownloadable","DownloadOutlined","previewUrl","anchor","download","click","generateDownload","Group","onChange","Button","checked","ExclamationCircleOutlined","placeholder","maxLength","allowClear","ref","accept","files","reader","FileReader","readAsDataURL","alert","setValue","imageStyle","backgroundImage","onImageLoaded","onImageError","pixelCropData","percentCropData","onComplete","percentData","ruleOfThirds","LinkMarkChooser","defaultValue","choosenArrow","setChoosenArrow","rotateMap","literalChoosenArrow","normalizedIndex","newMap","Explanation","overlayClassName","rest","restIconProps","StyledCode","StyledContainer","StyledImageSection","StyledImageWithCaptionContainer","ImageWithCaption","caption","alt","FormattingHelpDrawer","modalOpen","setDrawerOpen","footer","visible","onClose","SettingFilled","BulbFilled","StyledFrameContainer","$withPillar","StyledFramePillar","FrameInfoBlock","rotate","keyframes","StyledSettingPanel","StyledSettingButtonContainer","$softMode","css","SettingButton","trigger","placement","Affiliation","rel","GithubFilled","StyledAppSettingContainer","AppHeader","TaintedCanvasWarning","StandaloneLabel","StyledDropdownOption","StyledDropdown","Container","Option","FormatButtonList","fontWeight","FinishButtonList","ArtFinishButtonList","getFrameButtonList","StarButtonList","IconTypeMap","fullLabelKey","icon","IconTypeList","StickerButtonList","CondenseThresholdButtonList","StyledCharPickerContainer","CharPicker","targetId","onPick","internalOnPick","inputTarget","getElementById","myValue","selection","createRange","position","selectionStart","startPos","endPos","selectionEnd","insertAtCursor","WrappedColorPicker","onSelect","onOffsetChange","onRemove","internalColor","setInternalColor","internalOffset","setInternalOffset","setInternalId","debouncedOnChange","setColor","setCurrentOffset","styles","default","picker","boxShadow","padding","disableAlpha","onChangeComplete","getPaletteInfo","newColorList","colorList","raw","TextGradientPicker","externalPalette","angle","externalAngle","memoizedOnChange","pickerRef","setAngle","intialPalette","currentControlId","setPalette","changePalette","nextColorList","newPalette","setPickerOnMount","relevant","targetColor","find","disabled","Number","paletteHeight","maxStops","minStops","stopRemovalDrop","onPaletteChange","onColorStopSelect","stopColor","nextId","StyledPickerButton","$active","StyledPatternContainer","StyledPatternOption","StyledPredefinedContainer","StyledPredefinedOption","GridSliderInput","fieldMap","labelMap","xField","yField","colorField","widthField","xValue","yValue","colorValue","widthValue","widthLabel","nextValue","keyList","axis","track","gridRow","thumb","zIndex","xmax","xmin","ymax","ymin","colors","PredefinedOptionGrid","containerRef","NameStylePicker","frameInfo","defaultType","undebouncedOnChange","optionGridRef","predefinedDropdownVisible","setPredefinedDropdownVisible","setType","setCnt","useRefresh","customStyleSignal","sendCustomStyleSignal","memoizedOnGradientChange","reduceColorMotion","shadowPickeRef","outlinePickeRef","currentValue","patternStyle","isStyleCustom","isStylePredefined","optionInputContainerId","applyAutoStyle","applyPredefinedStyle","applyCustomStyle","onVisibleChange","CaretDownOutlined","fontValue","InputTrainStyle","TrainGridStyle","StyledRadioTrainContainer","RadioTrain","activeValue","optionList","suffix","internalRef","isChecked","StyledFrameTrain","FrameTrain","onSTFrameChange","useShallow","changeFrame","frameValue","currentCard","nextFrame","isST","newTypeAbility","StyledCheckboxTrainContainer","CheckboxTrain","StyledImageCropper","BackgroundInputGroup","imageCropperRef","changeBackground","changeBackgroundCrop","StyledBoundlessOverlay","StyledLayoutPickerContainer","StyledBaseFillPickerContainer","LayoutPicker","backgroundInputVisible","setBackgroundInputVisible","backgroundInputHidden","setBackgroundInputHidden","setOpacity","backgroundInputRef","changeBackgroundType","changeHasBackground","noBackground","activable","destroyTooltipOnHide","fit","full","BorderOuterOutlined","step","StyledIconDropdown","StyledCheckboxStarTrain","CardIconInputGroup","isDarkSynchro","changeCardIcon","changeSubFamily","changeStar","changeStarAlignment","iconTypeData","iconDropdownText","IconDropdownLabel","IconDropdown","DropdownChildren","AlignLeftOutlined","AlignCenterOutlined","AlignRightOutlined","availableCommand","Set","resolveHotkey","allowNewLine","onResult","selectedText","keepInline","wrappedText","cursorOffset","placeCursorInInput","TextArea","Input","CardTextArea","onTakePicker","immediateValue","cursorData","setCursorData","internalOnChange","eventOrValue","normalizedValue","externalSetValue","getPickerRef","autoComplete","spellCheck","ev","ctrlKey","metaKey","currentTarget","has","joinedText","CardTextInput","EffectInputGroup","effectInputRef","changeEffect","rows","StyledCheckboxGroup","CardCheckboxGroup","onFirstEditionChange","onDuelTerminalCardChange","onSpeedCardChange","StyledPendulumFrameContainer","StyledInputLabelWithButton","StyledNameSetIdInputContainer","StyledFormatRadioTrain","StyledFooterInputContainer","FooterInputGroup","passwordInputRef","creatorInputRef","atkInputRef","defInputRef","changeATK","changeDEF","changePassword","onStickerChange","changeCreator","addonBefore","SyncOutlined","StyledImageRadioTrain","ImageInputGroup","changeLinkMap","changePicture","changeArtFinish","changeImageCrop","StyledNameInputContainer","StyledCopyButton","NameSetInputGroup","nameInputRef","setIdInputRef","changeSetId","changeName","clipboard","writeText","randomSetID","BottomFrameOptionGrid","recentCustomPendulumFrame","inputRef","StyledPendulumFrameInputContainer","StyledPendulumInputContainer","PendulumInputGroup","bottomFrameOptionGridRef","pendulumEffectInputRef","isMirrorScale","setMirrorScale","frameDropdownVisible","setFrameDropdownVisibleVisible","onRedScaleChange","onBlueScaleChange","changePendulumEffect","currentPendulumFrame","willBecomePendulum","StyledPostPendulumInputContainer","PostPendulumInputGroup","typeAbilitySeparator","typeAbilityInputRef","changeTypeAbility","toggleFuriganaHelper","typeLabel","isOCG","onCondenseTolerantChange","StyledInlineColorPickerContainer","InlineColorList","rgb","InlineColorPicker","currentText","setCurrentText","internalValue","setInternalValue","startsWith","dotColor","StyledTextStyleContainer","StyledTextStylePicker","TextStyleInfoMap","keyName","TextStylePicker","styleList","custom","shadow","applyStyle","applyShadow","shadowValue","CardInputPanel","stylePickerRef","stylePickerResetCount","setStylePickerResetCount","foilButtonList","getFoilList","imageInputGroupRef","layoutPickerRef","nameSetIdInputGroupRef","pendulumInputGroupRef","effectInputGroupRef","postPendulumInputGroupRef","footerInputGroupRef","pickerTarget","setPickerTarget","changeFoil","onFinishChange","changeOpacity","changeAttribute","changeNameStyle","attributeList","getAttributeList","forceCardData","formatValue","nextFormat","formatSwappedCard","StyledDownloadDropdownLabel","Menu","Item","StyledDownloadDropdownOption","StyledDownloadButton","DownloadButton","isTainted","onDownloadError","exportRef","currentPipeline","pipelineRunning","isDownloading","setDownloading","onDownloadComplete","onSave","pendingSave","drawCanvas","cloneCanvas","drawCanvasContext","cloneCanvasContext","normalizedName","link","toDataURL","classList","remove","confirmReload","setAttribute","isRelevant","add","removeEventListener","queuingSize","useCardExport","domEvent","MenuOutlined","StyledDataButtonPanelContainer","StyledCardCanvasGroupContainer","StyledAppLoading","StyledByMe","ErrorAlert","OverlayButton","LightboxButton","ResetButton","configure","ignoreTags","AppGlobalHotkeyMap","EXPORT","IMPORT","MERGE","VIEW","DOWNLOAD","App","softMode","isLanguageInitiating","isLanguageLoading","initiateI18N","setInitializing","canvasKey","setCanvasKey","lightboxVisible","setLightboxVisible","cardInputRef","downloadButtonRef","setImageChangeCount","styleName","setProperty","WebFont","load","families","urls","retrievedCard","localCardVersion","localCardData","cardURLData","retrieveSavedCard","fontinactive","fvd","inactive","ocgStyleFile","onActive","onBeforeLoad","onFontInactive","onInactive","styleContent","setStyleContent","ocgReady","loadAttempt","useOCGFont","setTainted","documentClassList","displayLightbox","status","fromHotkey","importData","event","prompt","mergeData","exportData","exportableCard","downloadFromHotkey","hotkeyHandlerMap","alertDownloadError","rerenderAllImage","rerenderCardImage","markTaintedImage","keyMap","handlers","onDrop","confirm","defaultCard","contextualDefaultCardData","ClearOutlined","ZoomInOutlined","onContextMenu","wrapClassName","forceRender","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode"],"mappings":"yeA2CaA,G,mCACF,KADEA,EAED,KAFCA,EAGe,IAHfA,EAIgB,IAJhBA,EAKgB,GAGhBC,EAA0B,UAC1BC,EAAwB,iBAAO,CACxCC,KAAM,IACNC,SAAU,IACVC,KAAM,IACNC,KAAM,IACNC,SAAUN,EACVO,WAAW,EACXC,YAAY,EACZC,WAAW,IAGFC,EAA6B,CACtCC,OAAQ,CACJC,WAAY,IACZC,WAAY,IACZC,SAAU,IACVC,KAAM,IACNC,KAAM,IACNC,MAAO,EACPC,KAAM,UAEVf,SAAU,CACNS,WAAY,GACZC,WAAY,IACZC,SAAU,IACVC,KAAM,GACNC,KAAM,IACNC,MAAO,MACPC,KAAM,YAGVC,aAAc,CACVP,WAAY,IACZC,WAAY,IACZC,SAAU,I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CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,KACXE,UAAW,gCACXD,SAAU,mDAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,KACXE,UAAW,oBACXD,SAAU,uCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,6CACXC,SAAU,gDAEd,CACID,UAAW,qBACXC,SAAU,8CAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,qCAEd,CACID,UAAW,iCACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,qBACXC,SAAU,yEAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,0DAEd,CACID,UAAW,qBACXC,SAAU,yEAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,uCACXC,SAAU,0CAEd,CACID,UAAW,qBACXC,SAAU,6DAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,qBACXC,SAAU,mEAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,2BACXC,SAAU,mEAEd,CACID,UAAW,SACXC,SAAU,qCAEd,CACID,UAAW,eACXC,SAAU,0DAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,2BACXC,SAAU,kFAEd,CACID,UAAW,uCACXC,SAAU,0CAEd,CACID,UAAW,2BACXC,SAAU,sEAEd,CACID,UAAW,qBACXC,SAAU,uDAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,+BAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,iCACXC,SAAU,iDAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,2BACXC,SAAU,oDAEd,CACID,UAAW,2BACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,qCAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,yBAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,uCACXC,SAAU,0CAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,MACXE,UAAW,qBACXD,SAAU,sEAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,gCAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,sCAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,0BAEd,CACID,UAAW,IACXE,UAAW,mBACXD,SAAU,4CAEd,CACID,UAAW,qBACXC,SAAU,wBAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,2BACXC,SAAU,8BAEd,CACID,UAAW,iCACXC,SAAU,oCAEd,CACID,UAAW,qBACXC,SAAU,qCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,0DAEd,CACID,UAAW,eACXC,SAAU,+BAEd,CACID,UAAW,eACXC,SAAU,yBAEd,CACID,UAAW,YACXE,UAAW,qCACXD,SAAU,gEACVE,aAAc,iEAElB,CACIH,UAAW,WACXE,UAAW,oCACXD,SAAU,6CACVE,aAAc,8CAElB,CACIH,UAAW,KACXE,UAAW,8BACXD,SAAU,yDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,kCAEd,CACID,UAAW,eACXC,SAAU,wCAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,eACXC,SAAU,oDAEd,CACID,UAAW,eACXC,SAAU,8CAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,+BAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,yBAEd,CACID,UAAW,SACXC,SAAU,mBAEd,CACID,UAAW,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BAAmB,KACnBC,SAAU,GACVC,WAAY,GACZC,UAAW,EACXmE,gBAAiB,GACjB/F,kBAAmB,IACnBC,gBAAiB,EACjBE,eAAgB,IAChBI,mBAAoB,W,SCxMnB0F,GAA4C,CACrD,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,SACL,SAAK,SACL,SAAK,SAEL,IAAK,SAKL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,SACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,KAEIC,GAA4C,CACrD,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAAK,IACL,SAA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ACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCDpBQ,IAASC,OACL,cAAC,IAAMC,WAAP,UACI,cAAC,GAAD,MAEJ71C,SAASy5B,eAAe,SAM5Byb,O","file":"static/js/main.7ea04692.chunk.js","sourcesContent":["export const getBackgroundTypeList = (dictionary: {\r\n fit: string,\r\n full: string,\r\n}) => [\r\n {\r\n value: 'fit' as const,\r\n label: dictionary.fit,\r\n },\r\n {\r\n value: 'full' as const,\r\n label: dictionary.full,\r\n },\r\n];\r\nexport type BackgroundType = ReturnType[0]['value'];\r\n\r\n/**\r\n * @summary About x y headache.\r\n * \r\n * * Normal (True): Actual position / size on the card. If the coordinate / size is multiplied by a ratio, it is likely a normal value.\r\n * * Scaled: Position or size on a hypothesis (scaled) canvas. For example a 1000px wide canvas with scaleX of 0.5 can be treated as a 2000px wide canvas with scaleX of 1. So draw a point at x 50 in this hypothesis canvas will result an actual point at x = 25. If the coordinate / size is divided by a ratio, it is likely a scaled value.\r\n * * Inverse-scaled: Position or size on a hypothesis canvas. For example a letter that much has exactly 50px wide on every scale. So in a 1000px wide canvas with scaleX of 0.5 the letter actually has 100px width, and vice versa in a 1000px wide canvas with scaleX of 2.0, the letter will have 25px width only.\r\n */\r\nexport type MasterSeriesCanvas = {\r\n artworkCanvasRef: React.RefObject,\r\n backgroundCanvasRef: React.RefObject,\r\n drawCanvasRef: React.RefObject,\r\n frameCanvasRef: React.RefObject,\r\n cardIconCanvasRef: React.RefObject,\r\n pendulumScaleCanvasRef: React.RefObject,\r\n pendulumEffectCanvasRef: React.RefObject,\r\n typeCanvasRef: React.RefObject,\r\n effectCanvasRef: React.RefObject,\r\n nameCanvasRef: React.RefObject,\r\n statCanvasRef: React.RefObject,\r\n setIdCanvasRef: React.RefObject,\r\n passwordCanvasRef: React.RefObject,\r\n creatorCanvasRef: React.RefObject,\r\n stickerCanvasRef: React.RefObject,\r\n finishCanvasRef: React.RefObject,\r\n lightboxCanvasRef: React.RefObject,\r\n};\r\n\r\n/** Some coordination data must be rounded into nearest integer so it does not create those janky ghost pixels. */\r\nexport const CanvasConst = {\r\n width: 813,\r\n height: 1185,\r\n topToPendulumStructure: 210,\r\n pendulumStructureHeight: 912,\r\n leftToPendulumStructure: 52,\r\n};\r\n\r\nexport const DEFAULT_BASE_FILL_COLOR = '#404040';\r\nexport const getDefaultCardOpacity = () => ({\r\n body: 100,\r\n pendulum: 100,\r\n text: 100,\r\n name: 100,\r\n baseFill: DEFAULT_BASE_FILL_COLOR,\r\n artBorder: true,\r\n nameBorder: true,\r\n boundless: false,\r\n});\r\nexport type CardOpacity = ReturnType;\r\nexport const CardArtCanvasCoordinateMap = {\r\n normal: {\r\n artFinishX: 100,\r\n artFinishY: 219,\r\n artWidth: 614,\r\n artX: 100,\r\n artY: 219,\r\n ratio: 1,\r\n type: 'normal' as const,\r\n },\r\n pendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 1.325,\r\n type: 'pendulum' as const,\r\n },\r\n /** Normal distribution, with artwork extends under effect's box. */\r\n extendedCard: {\r\n artFinishX: 100,\r\n artFinishY: 219,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 0.775,\r\n type: 'extendedCard' as const,\r\n },\r\n /** Pendulum distribution, with artwork extends under pendulum effect's box and effect's box. */\r\n extendedPendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 0.775,\r\n type: 'extendedPendulum' as const,\r\n },\r\n /** Pendulum distribution, with artwork extends under pendulum effect's box. It is actually the \"default\" mode of pendulum cards in practices. But most of the time the artwork only cut the visible image part because it is very hard to find the full image of a card unless an official source provide it. */\r\n truePendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 702,\r\n artX: 56,\r\n artY: 213,\r\n ratio: 1.057,\r\n type: 'truePendulum' as const,\r\n },\r\n /** Normal distribution with artwork span the entire card over the frame, use boundless mode to show frame above it. */\r\n fullCard: {\r\n artFinishX: 100,\r\n artFinishY: 219,\r\n artWidth: 758,\r\n artX: 28,\r\n artY: 28,\r\n ratio: 0.670,\r\n type: 'fullCard' as const,\r\n },\r\n /** Pendulum distribution with artwork span the entire card over the frame, use boundless mode to show frame above it. */\r\n fullPendulum: {\r\n artFinishX: 56,\r\n artFinishY: 213,\r\n artWidth: 758,\r\n artX: 28,\r\n artY: 28,\r\n ratio: 0.670,\r\n type: 'fullPendulum' as const,\r\n },\r\n};\r\nexport const getArtCanvasCoordinate = (\r\n isPendulum: boolean,\r\n opacity?: Partial,\r\n backgroundType?: BackgroundType,\r\n) => {\r\n const {\r\n boundless,\r\n body,\r\n pendulum,\r\n text,\r\n } = { ...getDefaultCardOpacity(), ...opacity };\r\n const normalizedBoundless = backgroundType === 'fit'\r\n ? false\r\n : boundless;\r\n\r\n if (backgroundType === 'full') return CardArtCanvasCoordinateMap.fullCard;\r\n const artType = normalizedBoundless || body < 100\r\n ? isPendulum\r\n ? 'fullPendulum'\r\n : 'fullCard'\r\n : isPendulum\r\n ? text < 100\r\n ? 'extendedPendulum'\r\n : pendulum < 100\r\n ? 'truePendulum'\r\n : 'pendulum'\r\n : text < 100\r\n ? 'extendedCard'\r\n : 'normal';\r\n\r\n return CardArtCanvasCoordinateMap[artType];\r\n};\r\n","import { CloseCircleOutlined } from '@ant-design/icons';\r\n\r\nexport const NO_ATTRIBUTE = 'NONE';\r\nexport const AttributeList = [\r\n {\r\n name: NO_ATTRIBUTE,\r\n nameKey: 'input.attribute.none',\r\n color: '#000000',\r\n },\r\n {\r\n name: 'DARK',\r\n nameKey: 'input.attribute.dark',\r\n label: 'Dark',\r\n color: '#b41dda',\r\n },\r\n {\r\n name: 'EARTH',\r\n nameKey: 'input.attribute.earth',\r\n label: 'Earth',\r\n color: '#8d8e8e',\r\n },\r\n {\r\n name: 'FIRE',\r\n nameKey: 'input.attribute.fire',\r\n label: 'Fire',\r\n color: '#e51b23',\r\n },\r\n {\r\n name: 'LIGHT',\r\n nameKey: 'input.attribute.light',\r\n label: 'Light',\r\n color: '#bfae32',\r\n },\r\n {\r\n name: 'WATER',\r\n nameKey: 'input.attribute.water',\r\n label: 'Water',\r\n color: '#008ecd',\r\n },\r\n {\r\n name: 'WIND',\r\n nameKey: 'input.attribute.wind',\r\n label: 'Wind',\r\n color: '#28ab35',\r\n },\r\n {\r\n name: 'DIVINE',\r\n nameKey: 'input.attribute.divine',\r\n label: 'Divine',\r\n color: '#ef6300',\r\n },\r\n {\r\n name: 'SPELL',\r\n nameKey: 'input.attribute.spell',\r\n label: 'Spell',\r\n color: '#1b8f83',\r\n },\r\n {\r\n name: 'TRAP',\r\n nameKey: 'input.attribute.trap',\r\n label: 'TRAP',\r\n color: '#c32a8c',\r\n },\r\n];\r\n\r\nexport const NO_ICON = 'NO ICON';\r\nexport const IconList = [\r\n {\r\n label: ,\r\n value: NO_ICON,\r\n nameKey: 'input.icon.none',\r\n },\r\n {\r\n label: 'Field',\r\n value: 'FIELD',\r\n nameKey: 'input.icon.field',\r\n },\r\n {\r\n label: 'Continuous',\r\n value: 'CONTINUOUS',\r\n nameKey: 'input.icon.continuous',\r\n },\r\n {\r\n label: 'Quick-Play',\r\n value: 'QUICK-PLAY',\r\n nameKey: 'input.icon.quick-play',\r\n },\r\n {\r\n label: 'Ritual',\r\n value: 'RITUAL',\r\n nameKey: 'input.icon.ritual',\r\n },\r\n {\r\n label: 'Equip',\r\n value: 'EQUIP',\r\n nameKey: 'input.icon.equip',\r\n },\r\n {\r\n label: 'Counter',\r\n value: 'COUNTER',\r\n nameKey: 'input.icon.counter',\r\n },\r\n];\r\n\r\nexport const StickerList = [\r\n 'no-sticker',\r\n 'gold',\r\n 'silver',\r\n 'beta',\r\n 'holo5',\r\n 'holo4',\r\n 'holo3',\r\n 'holo2',\r\n 'holo1',\r\n 'limited',\r\n 'unlimited',\r\n];","export type NameStyleType = 'auto' | 'custom' | 'predefined';\r\nexport type NameStyle = ReturnType;\r\nexport const getDefaultNameStyle = () => ({\r\n font: 'Default',\r\n fillStyle: '#000000',\r\n headTextFillStyle: '#000000',\r\n shadowColor: '#000000',\r\n shadowOffsetY: 0,\r\n shadowOffsetX: 0,\r\n shadowBlur: 0,\r\n hasShadow: false,\r\n lineColor: '#000000',\r\n lineWidth: 0,\r\n lineOffsetY: 0,\r\n lineOffsetX: 0,\r\n hasOutline: false,\r\n gradientAngle: 0,\r\n gradientColor: '0.000|#eef10b,0.5|#d78025,1.000|#7e20cf',\r\n hasGradient: false,\r\n preset: 'commonB' as PresetNameStyle,\r\n pattern: 'none',\r\n});\r\n\r\n/** Is it worth it? Store as array significantly reduces data size, but also make the code harder to ready. Maybe we should only apply it to simple fields. */\r\nexport type TextStyle = [\r\n custom: boolean,\r\n fillStyle: string,\r\n hasShadow: boolean,\r\n shadow: string,\r\n];\r\nexport const getDefaultTextStyle = (): TextStyle => [\r\n false,\r\n '#000000',\r\n false,\r\n '#000000',\r\n];\r\n\r\nconst createPresetNameStyle = (presetValue: Partial): Partial => ({\r\n hasGradient: false,\r\n hasOutline: false,\r\n hasShadow: false,\r\n pattern: 'none',\r\n ...presetValue\r\n});\r\nexport type PresetNameStyle = 'commonB' | 'commonW'\r\n| 'skillDefault' | 'skillArial'\r\n| 'rare' | 'secretGradient' | 'secret' | 'platinum2' | 'ultra' | 'ultra2' | 'platinum' | 'gold'\r\n| 'animeRed' | 'animeSilver' | 'animeGold'\r\n| 'promo';\r\nexport const PresetNameStyleMap: Record,\r\n}> = {\r\n commonB: {\r\n key: 'commonB',\r\n label: 'Common (Black)',\r\n image: 'asset/image/other/name-common-b.png',\r\n value: createPresetNameStyle({\r\n preset: 'commonB',\r\n fillStyle: '#000000',\r\n }),\r\n },\r\n commonW: {\r\n key: 'commonW',\r\n label: 'Common (White)',\r\n image: 'asset/image/other/name-common-w.png',\r\n value: createPresetNameStyle({\r\n preset: 'commonW',\r\n fillStyle: '#ffffff',\r\n }),\r\n },\r\n skillDefault: {\r\n key: 'skillDefault',\r\n label: 'Skill (Default)',\r\n image: 'asset/image/other/name-skill-default.png',\r\n value: createPresetNameStyle({\r\n preset: 'skillDefault',\r\n fillStyle: '#ffffff',\r\n lineWidth: 6,\r\n lineColor: '#000',\r\n hasOutline: true,\r\n }),\r\n },\r\n skillArial: {\r\n key: 'skillArial',\r\n label: 'Skill (Arial)',\r\n image: 'asset/image/other/name-skill-arial.png',\r\n value: createPresetNameStyle({\r\n preset: 'skillArial',\r\n font: 'Arial',\r\n fillStyle: '#ffffff',\r\n lineWidth: 6,\r\n lineColor: '#000',\r\n lineOffsetX: 1,\r\n hasOutline: true,\r\n }),\r\n },\r\n rare: {\r\n key: 'rare',\r\n label: 'Rare',\r\n image: 'asset/image/other/name-rare.png',\r\n value: createPresetNameStyle({\r\n preset: 'rare',\r\n fillStyle: '#cfc6de',\r\n }),\r\n },\r\n secretGradient: {\r\n key: 'secretGradient',\r\n label: 'Secret (Gradient)',\r\n image: 'asset/image/other/name-secret-gradient.png',\r\n value: createPresetNameStyle({\r\n preset: 'secretGradient',\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#7a71a6,1.000|#a8c1e5',\r\n hasGradient: true,\r\n }),\r\n },\r\n secret: {\r\n key: 'secret',\r\n label: 'Secret',\r\n image: 'asset/image/other/name-secret.png',\r\n value: createPresetNameStyle({\r\n preset: 'secret',\r\n fillStyle: '#8a8381',\r\n }),\r\n },\r\n platinum2: {\r\n key: 'platinum2',\r\n label: 'Platinum',\r\n image: 'asset/image/other/name-platinum.png',\r\n value: createPresetNameStyle({\r\n preset: 'platinum2',\r\n fillStyle: '#a49f9e',\r\n }),\r\n },\r\n ultra: {\r\n key: 'ultra',\r\n label: 'Ultra',\r\n image: 'asset/image/other/name-ultra.png',\r\n value: createPresetNameStyle({\r\n preset: 'ultra',\r\n fillStyle: '#dbb473',\r\n }),\r\n },\r\n ultra2: {\r\n key: 'ultra2',\r\n label: 'Ultra (Type 2)',\r\n image: 'asset/image/other/name-ultra-2.png',\r\n value: createPresetNameStyle({\r\n preset: 'ultra2',\r\n fillStyle: '#fee002',\r\n }),\r\n },\r\n platinum: {\r\n key: 'platinum',\r\n label: 'Foil Platinum',\r\n image: 'asset/image/other/name-foil-platinum.png',\r\n value: createPresetNameStyle({\r\n preset: 'platinum',\r\n fillStyle: '#CCCCCC',\r\n shadowColor: '#FFFFFF',\r\n shadowOffsetY: 1,\r\n shadowOffsetX: 0,\r\n shadowBlur: 1,\r\n hasShadow: true,\r\n }),\r\n },\r\n gold: {\r\n key: 'gold',\r\n label: 'Foil Gold',\r\n image: 'asset/image/other/name-foil-gold.png',\r\n value: createPresetNameStyle({\r\n preset: 'gold',\r\n fillStyle: '#b88c43',\r\n shadowColor: '#FCC400',\r\n shadowOffsetY: 1,\r\n shadowOffsetX: 0,\r\n shadowBlur: 1,\r\n hasShadow: true,\r\n }),\r\n },\r\n animeRed: {\r\n key: 'animeRed',\r\n label: 'Anime (Type Red)',\r\n image: 'asset/image/other/name-anime-red.png',\r\n value: createPresetNameStyle({\r\n preset: 'animeRed',\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#d81961,0.220|#b81654,0.270|#9e1348,0.330|#95093e,0.380|#95093e,0.450|#ba3264,0.530|#ff5e99,0.620|#ffa0c3,0.690|#ffffff,0.770|#ff5e99,0.870|#d81961,1.000|#b81654',\r\n hasGradient: true,\r\n hasOutline: true,\r\n hasShadow: true,\r\n lineColor: '#333333',\r\n lineOffsetX: 1,\r\n lineOffsetY: 0,\r\n lineWidth: 3,\r\n shadowBlur: 2,\r\n shadowColor: '#383838',\r\n shadowOffsetX: 2,\r\n shadowOffsetY: 3,\r\n }),\r\n },\r\n animeSilver: {\r\n key: 'animeSilver',\r\n label: 'Anime (Type Silver)',\r\n image: 'asset/image/other/name-anime-silver.png',\r\n value: createPresetNameStyle({\r\n preset: 'animeSilver',\r\n shadowColor: '#383838',\r\n shadowOffsetY: 3,\r\n shadowOffsetX: 2,\r\n shadowBlur: 2,\r\n hasShadow: true,\r\n lineColor: '#333333',\r\n lineWidth: 3,\r\n lineOffsetX: 1,\r\n lineOffsetY: 0,\r\n hasOutline: true,\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#cecbb8,0.220|#b0ad9b,0.270|#94917e,0.330|#797768,0.380|#797768,0.450|#d9d9d9,0.610|#ffffff,0.700|#ffffff,0.870|#d6d7c7,1.000|#c9cbb6',\r\n hasGradient: true,\r\n }),\r\n },\r\n animeGold: {\r\n key: 'animeGold',\r\n label: 'Anime (Type Gold)',\r\n image: 'asset/image/other/name-anime-gold.png',\r\n value: createPresetNameStyle({\r\n preset: 'animeGold',\r\n shadowColor: '#383838',\r\n shadowOffsetY: 3,\r\n shadowOffsetX: 2,\r\n shadowBlur: 2,\r\n hasShadow: true,\r\n lineColor: '#333333',\r\n lineWidth: 3,\r\n lineOffsetX: 1,\r\n lineOffsetY: 0,\r\n hasOutline: true,\r\n gradientAngle: 180,\r\n gradientColor: '0.000|#eee317,0.220|#dbbe15,0.270|#d0920c,0.330|#b57f0b,0.380|#d0920c,0.450|#ffff6b,0.610|#ffffff,0.700|#ffffff,0.870|#e5dd2d,1.000|#e3da23',\r\n hasGradient: true,\r\n }),\r\n },\r\n promo: {\r\n key: 'promo',\r\n label: 'Promo',\r\n image: 'asset/image/other/name-promo.png',\r\n value: createPresetNameStyle({\r\n preset: 'promo',\r\n fillStyle: '#c7080b',\r\n shadowColor: '#333333',\r\n shadowOffsetY: 0,\r\n shadowOffsetX: 0,\r\n shadowBlur: 1,\r\n hasShadow: true,\r\n lineColor: '#8a1801',\r\n lineWidth: 3,\r\n lineOffsetX: 0,\r\n hasOutline: true,\r\n lineOffsetY: 0\r\n }),\r\n },\r\n};\r\nexport const PresetNameStyleList = Object.values(PresetNameStyleMap);\r\n\r\nexport const PatternMap: Record = {\r\n none: {\r\n key: 'none',\r\n patternImage: '',\r\n blendMode: 'source-atop',\r\n },\r\n type1: {\r\n key: 'type1',\r\n patternImage: 'finish-name-type1',\r\n blendMode: 'source-atop',\r\n },\r\n type2: {\r\n key: 'type2',\r\n patternImage: 'finish-name-type2',\r\n blendMode: 'source-atop',\r\n },\r\n type3: {\r\n key: 'type3',\r\n patternImage: 'finish-name-type3',\r\n blendMode: 'source-atop',\r\n },\r\n type4: {\r\n key: 'type4',\r\n patternImage: 'finish-name-type4',\r\n blendMode: 'source-atop',\r\n },\r\n type5: {\r\n key: 'type5',\r\n patternImage: 'finish-name-type5',\r\n blendMode: 'multiply',\r\n overrideFill: true,\r\n },\r\n type6: {\r\n key: 'type6',\r\n patternImage: 'finish-name-type6',\r\n blendMode: 'source-atop',\r\n },\r\n type7: {\r\n key: 'type7',\r\n patternImage: 'finish-name-type7',\r\n blendMode: 'lighter',\r\n overrideFill: true,\r\n },\r\n type8: {\r\n key: 'type8',\r\n patternImage: 'finish-name-type8',\r\n blendMode: 'source-atop',\r\n },\r\n type9: {\r\n key: 'type9',\r\n patternImage: 'finish-name-type9',\r\n blendMode: 'source-atop',\r\n },\r\n};\r\nexport const PatternList = Object.values(PatternMap);","export type CoordinateData = {\r\n edgeAlignment?: 'left' | 'right',\r\n trueWidth: number,\r\n trueBaseline: number,\r\n trueEdge: number,\r\n};\r\n\r\nexport const EffectCoordinateData: Record = {\r\n 'tcg': [\r\n { trueWidth: 684, trueBaseline: 890.23, trueEdge: 64.8 },\r\n ],\r\n 'tcg-stat': [\r\n { trueWidth: 684, trueBaseline: 890.23, trueEdge: 64.8 },\r\n ],\r\n 'tcg-type-stat': [\r\n { trueWidth: 684, trueBaseline: 919.8, trueEdge: 64.5 },\r\n ],\r\n 'tcg-type': [\r\n { trueWidth: 684, trueBaseline: 921.8, trueEdge: 64.5 },\r\n ],\r\n 'ocg': [\r\n { trueWidth: 684, trueBaseline: 895.23, trueEdge: 64.8 },\r\n ],\r\n 'ocg-stat': [\r\n { trueWidth: 684, trueBaseline: 891.23, trueEdge: 64.8 },\r\n ],\r\n 'ocg-type-stat': [\r\n { trueWidth: 684, trueBaseline: 918.5, trueEdge: 64.5 },\r\n ],\r\n 'ocg-type': [\r\n { trueWidth: 684, trueBaseline: 918.5, trueEdge: 64.5 },\r\n ],\r\n};\r\n\r\nexport const PendulumEffectCoordinate: CoordinateData[] = [\r\n { trueWidth: 555.47, trueBaseline: 746.29, trueEdge: 128.94 },\r\n { trueWidth: 555.47, trueBaseline: 746.29, trueEdge: 128.94 },\r\n];\r\n\r\nexport const TypeAbilityCoordinateMap: Record> = {\r\n tcg: {\r\n small: {\r\n trueBaseline: 919,\r\n trueEdge: 62.50,\r\n trueWidth: 684.5,\r\n },\r\n medium: {\r\n trueBaseline: 920,\r\n trueEdge: 62.50,\r\n trueWidth: 684.5,\r\n },\r\n large: {\r\n trueBaseline: 187.5,\r\n trueEdge: 732.00,\r\n edgeAlignment: 'right',\r\n trueWidth: 648.5,\r\n },\r\n },\r\n ocg: {\r\n small: {\r\n trueBaseline: 917,\r\n trueEdge: 63.70,\r\n trueWidth: 684.5,\r\n },\r\n medium: {\r\n trueBaseline: 917,\r\n trueEdge: 63.70,\r\n trueWidth: 684.5,\r\n },\r\n large: {\r\n trueBaseline: 190.5,\r\n trueEdge: 728.00,\r\n edgeAlignment: 'right',\r\n trueWidth: 642.5,\r\n },\r\n },\r\n};\r\n\r\nexport const CreatorCoordinateMap: Record = {\r\n ocg: {\r\n trueBaseline: 1146.5,\r\n trueEdge: 736,\r\n trueWidth: 435,\r\n },\r\n tcg: {\r\n trueBaseline: 1149.5,\r\n trueEdge: 733,\r\n trueWidth: 380,\r\n },\r\n};\r\n\r\nexport const PasswordCoordinateMap: Record = {\r\n ocg: {\r\n trueBaseline: 1148.931,\r\n trueEdge: 37.031,\r\n trueWidth: 255,\r\n },\r\n tcg: {\r\n trueBaseline: 1149.431,\r\n trueEdge: 37.031,\r\n trueWidth: 311,\r\n },\r\n};","/** Dicitionary that convert popular letters combination into a fragment block with (most of the time) corresponding furigana attached.\r\n * \r\n * This is created based on pure survey only. Also this is based on regex, so do not add too many entries into this one. Around 300 would be a nice limit to stop, after all this is just a helper. There are much more rules and block words in practice that we basically have no way to collect and implement.\r\n * \r\n * Each dicitionary entry has at most 4 fields.\r\n * * `shortForm`: Pure letters without decoration, act as the primary key in this dictionary.\r\n * * `regexForm`: Some words may blend inside fragment and will get falsely detected, especially English letter. For example \"銀翼のAXE-サリー\" OCG has letter X in its name, which maybe detected as Xyz Monster. Regex form will (try to) solve this problem.\r\n * * `rubyForm`: The full version of `shortForm`, with furigana and control characters attached.\r\n * * `rubyFormName`: In very rare case, the same `shortForm` has different treatment based on the section it belong in. This field (if existed) will be preferred when converting the name of the card.\r\n * \r\n * Overall we want to sort this list based on the length of the shortForm, so we match larger entry first. For example, the letter \"族\" appears both as a standalone letter and in the word \"種族\", we naturally want to match the word \"種族\" first.\r\n */\r\nexport const ocgKeywordDataList = [\r\n {\r\n shortForm: '特殊召喚',\r\n rubyForm: '{特|とく}{殊|しゅ}{召|しょう}{喚|かん}',\r\n },\r\n {\r\n shortForm: 'カード',\r\n rubyForm: '{カード}',\r\n },\r\n {\r\n shortForm: 'デュエル',\r\n rubyForm: '{デュエル}',\r\n },\r\n {\r\n shortForm: 'マッチ',\r\n rubyForm: '{マッチ}',\r\n },\r\n {\r\n shortForm: 'ターン',\r\n rubyForm: '{ターン}',\r\n },\r\n {\r\n shortForm: 'プレイヤー',\r\n rubyForm: '{プレイヤー}',\r\n },\r\n {\r\n shortForm: '自分',\r\n rubyForm: '{自|じ}{分|ぶん}',\r\n },\r\n {\r\n shortForm: '相手',\r\n rubyForm: '{相|あい}{手|て}',\r\n },\r\n {\r\n shortForm: 'LP',\r\n regexForm: '(? {\r\n acc[cur.shortForm] = cur;\r\n return acc;\r\n}, {} as Record);","type FinishInstruction = { opacity?: number, blendMode?: GlobalCompositeOperation };\r\nconst type3CommonInstruction: FinishInstruction[] = [{ blendMode: 'overlay', opacity: 1 }];\r\nconst type8CommonInstruction: FinishInstruction[] = [\r\n { blendMode: 'overlay', opacity: 0.65 },\r\n { blendMode: 'multiply', opacity: 0.55 },\r\n];\r\n\r\n/** @summary Web engine has less blend mode than photoshop (or any desktop image manipulators for that matter), the behavior of similar blend mode is also different, so we currently we cannot have a 1:1 conversion between photoshop layer into canvas. */\r\n\r\nexport type FinishInformation = {\r\n value: string,\r\n label: React.ReactNode,\r\n partInstructionMap: Record,\r\n};\r\nexport const FinishMap: Record = {\r\n type1: {\r\n value: 'type1',\r\n label: '1',\r\n partInstructionMap: {},\r\n },\r\n type2: {\r\n value: 'type2',\r\n label: '2',\r\n partInstructionMap: {},\r\n },\r\n type3: {\r\n value: 'type3',\r\n label: '3',\r\n partInstructionMap: {\r\n 'art-overlay': type3CommonInstruction,\r\n 'art-border': type3CommonInstruction,\r\n 'art-border-pendulum': type3CommonInstruction,\r\n 'border-pendulum': type3CommonInstruction,\r\n 'attribute': type3CommonInstruction,\r\n 'frame': type3CommonInstruction,\r\n },\r\n },\r\n type4: {\r\n value: 'type4',\r\n label: '4',\r\n partInstructionMap: {},\r\n },\r\n type5: {\r\n value: 'type5',\r\n label: '5',\r\n partInstructionMap: {},\r\n },\r\n type6: {\r\n value: 'type6',\r\n label: '6',\r\n partInstructionMap: {},\r\n },\r\n type7: {\r\n value: 'type7',\r\n label: '7',\r\n partInstructionMap: {\r\n 'total-overlay': [{ blendMode: 'screen', opacity: 0.175 }, { blendMode: 'color-dodge', opacity: 0.125 }],\r\n },\r\n },\r\n type8: {\r\n value: 'type8',\r\n label: '8',\r\n partInstructionMap: {\r\n 'art-border': type8CommonInstruction,\r\n 'art-border-pendulum': type8CommonInstruction,\r\n 'border-pendulum': type8CommonInstruction,\r\n 'frame': type8CommonInstruction,\r\n 'frame-background': type8CommonInstruction,\r\n 'name': type8CommonInstruction,\r\n 'star': type8CommonInstruction,\r\n },\r\n },\r\n type9: {\r\n value: 'type9',\r\n label: '9',\r\n partInstructionMap: {\r\n 'total-overlay': [{ blendMode: 'screen', opacity: 0.45 }],\r\n },\r\n },\r\n};\r\n\r\nexport const ArtFinishMap: Record = {\r\n type1: {\r\n value: 'type1',\r\n label: '1',\r\n partInstructionMap: {\r\n art: [{}],\r\n },\r\n },\r\n type2: {\r\n value: 'type2',\r\n label: '2',\r\n partInstructionMap: {\r\n art: [\r\n { opacity: 0.08, blendMode: 'darken' },\r\n { opacity: 0.28, blendMode: 'color-dodge' },\r\n { opacity: 0.48, blendMode: 'multiply' },\r\n ],\r\n },\r\n },\r\n type3: {\r\n value: 'type3',\r\n label: '3',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.66, blendMode: 'color-dodge' }, { opacity: 0.64, blendMode: 'multiply' }],\r\n },\r\n },\r\n type4: {\r\n value: 'type4',\r\n label: '4',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.31, blendMode: 'color-dodge' }, { opacity: 0.6, blendMode: 'multiply' }]\r\n },\r\n },\r\n type5: {\r\n value: 'type5',\r\n label: '5',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.19, blendMode: 'color-dodge' }, { opacity: 0.6, blendMode: 'multiply' }]\r\n },\r\n },\r\n type6: {\r\n value: 'type6',\r\n label: '6',\r\n partInstructionMap: {\r\n art: [{ opacity: 0.25, blendMode: 'color-dodge' }, { opacity: 0.6, blendMode: 'multiply' }]\r\n },\r\n },\r\n type7: {\r\n value: 'type7',\r\n label: '7',\r\n partInstructionMap: {\r\n art: [{}],\r\n },\r\n },\r\n};\r\n\r\nexport type FoilDictionary = {\r\n normal: string,\r\n gold: string,\r\n platinum: string,\r\n};\r\nexport const getFoilList = (dictionary: FoilDictionary) => [\r\n {\r\n name: 'normal' as const,\r\n label: dictionary.normal,\r\n color: '#747b95',\r\n },\r\n {\r\n name: 'gold' as const,\r\n label: dictionary.gold,\r\n color: '#cfa65f',\r\n },\r\n {\r\n name: 'platinum' as const,\r\n label: dictionary.platinum,\r\n color: '#b1b1b1',\r\n },\r\n];\r\nexport type Foil = ReturnType[0]['name'];","export type FontGetter = {\r\n getFont: () => string,\r\n getFontInfo: () => {\r\n style: '' | 'italic' | 'small-caps',\r\n size: `${number}px`,\r\n sizeAsNumber: number,\r\n family: string,\r\n weight: '' | 'bold',\r\n },\r\n setWeight(nextWeight: '' | 'bold'): FontGetter,\r\n setStyle(nextStyle: '' | 'italic' | 'small-caps'): FontGetter,\r\n setSize(nextSize: number | `${number}px` | ((currentSize: number) => number | `${number}px`)): FontGetter,\r\n setFamily(nextFamily: string): FontGetter,\r\n};\r\n\r\nexport type FontSizeData = {\r\n bulletSymbolWidth: number,\r\n capitalLetterRatio?: number,\r\n fontSize: number,\r\n headTextFontRatio?: number,\r\n headTextSpacing?: number,\r\n iconSymbolWidth?: number,\r\n largeSymbolRatio?: number,\r\n letterSpacing?: number,\r\n lineCount: number,\r\n lineHeight: number,\r\n offsetY?: number,\r\n ordinalFontRatio?: number,\r\n ordinalFontOffsetY?: number,\r\n squareBracketRatio?: number,\r\n wordLetterSpacing?: number,\r\n};\r\nexport const DefaultFontSizeData = {\r\n capitalLetterRatio: 1,\r\n headTextFontRatio: 0.355,\r\n headTextSpacing: 0.5,\r\n largeSymbolRatio: 1.35,\r\n letterSpacing: 0,\r\n offsetY: 0,\r\n ordinalFontOffsetY: -2,\r\n ordinalFontRatio: 1 / 1.1,\r\n squareBracketRatio: 1,\r\n};\r\n\r\n/**\r\n * @summary For some weird reasons, letter sometime just got deviated from current baseline compare to other letters of the same font only in 1:1 scale. The only known case is with MatrixRegularSmallCaps font with font size bigger than around 85px. This deviation create a small but noticeable disruption in baseline, which currently we are unable to fix. We cannot fix this in canvas, and modify the font directly give no positive result.\r\n * \r\n * So for now we can only hardcode a list of problematic letters with their correpsonding treatment. This is just baffling.\r\n */\r\nexport const DefaultFontDeviation: Required = {\r\n yOffset: 0,\r\n yRatio: 1,\r\n};\r\nexport type FontDeviation = {\r\n yRatio?: number,\r\n yOffset?: number,\r\n};\r\n\r\nexport type MetricMethod = 'name' | 'standard' | 'compact' | 'creator' | 'furigana';\r\nexport type FontData = {\r\n alphabetFont: string,\r\n font: string,\r\n fontList: FontSizeData[],\r\n letterDeviationMap?: Record,\r\n fontStyle: string,\r\n furiganaFont: string,\r\n headTextBold?: boolean,\r\n headTextFillStyle?: string,\r\n headTextGapRatio?: number,\r\n headTextHeightRatio?: number,\r\n headTextOverflow?: 'normal' | 'condense',\r\n metricMethod?: MetricMethod,\r\n numberFont?: string,\r\n numberFontRatio?: number,\r\n ordinalFont: string,\r\n symbolFont: string,\r\n symbolFontRatio: number,\r\n weight?: 'bold',\r\n};\r\nexport const DefaultFontData = {\r\n headTextHeightRatio: 0.800,\r\n headTextOverflow: 'normal' as 'normal' | 'condense',\r\n headTextBold: true,\r\n headTextGapRatio: 0.03125,\r\n};\r\nexport type TextData = {\r\n fontData: FontData,\r\n fontLevel: number,\r\n currentFont: FontGetter,\r\n};\r\n\r\nconst DefaultEffectFontData = {\r\n alphabetFont: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n headTextFontRatio: 0.7,\r\n headTextHeightRatio: 0.815,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 1,\r\n headTextGapRatio: 0,\r\n};\r\nconst DefaultTCGEffectFontData: FontData = {\r\n ...DefaultEffectFontData,\r\n font: 'MatrixBook',\r\n headTextHeightRatio: 0.750,\r\n fontStyle: 'tcg',\r\n fontList: [],\r\n};\r\nexport const DefaultTCGNormalFontData: FontData = {\r\n ...DefaultEffectFontData,\r\n font: '\"stone-serif-regular\"',\r\n headTextHeightRatio: 0.750,\r\n fontStyle: 'tcg',\r\n fontList: [],\r\n};\r\nconst DefaultOCGEffectFontData: FontData = {\r\n ...DefaultEffectFontData,\r\n font: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n fontStyle: 'ocg',\r\n metricMethod: 'compact',\r\n fontList: [],\r\n};\r\n\r\nexport const EffectFontData: Record = {\r\n 'tcg': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 24.38, lineHeight: 24.7, lineCount: 8 },\r\n { bulletSymbolWidth: 23, fontSize: 19.94, lineHeight: 21.15, lineCount: 10 },\r\n ],\r\n },\r\n 'tcg-stat': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 25.2, lineHeight: 24.9, lineCount: 7 },\r\n ]\r\n },\r\n 'tcg-type-stat': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 25.2, lineHeight: 24.9, lineCount: 6 },\r\n { bulletSymbolWidth: 23, fontSize: 19.95, lineHeight: 21.5, lineCount: 7 },\r\n { bulletSymbolWidth: 23, fontSize: 18.8, lineHeight: 18.8, lineCount: 8 },\r\n { bulletSymbolWidth: 19, fontSize: 16.7, lineHeight: 16.7, lineCount: 9 },\r\n { bulletSymbolWidth: 19, fontSize: 15.0, lineHeight: 15.0, lineCount: 10 },\r\n ]\r\n },\r\n 'tcg-type': {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 25.2, lineHeight: 24.9, lineCount: 7 },\r\n ]\r\n },\r\n 'ocg': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22, lineHeight: 26, lineCount: 7 },\r\n { bulletSymbolWidth: 16, fontSize: 22, lineHeight: 26, lineCount: 8 },\r\n ]\r\n },\r\n 'ocg-stat': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22.05, lineHeight: 25.8, lineCount: 7 },\r\n ]\r\n },\r\n 'ocg-type-stat': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22.05, lineHeight: 25.8, lineCount: 6 },\r\n ]\r\n },\r\n 'ocg-type': {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 16, fontSize: 22.05, lineHeight: 25.8, lineCount: 7 },\r\n ]\r\n },\r\n};\r\n\r\nexport const TCGVanillaTypeStatFontList = [\r\n { bulletSymbolWidth: 23, fontSize: 21.8, lineHeight: 24.9, lineCount: 6 },\r\n { bulletSymbolWidth: 23, fontSize: 17.28, lineHeight: 21.5, lineCount: 7 },\r\n { bulletSymbolWidth: 23, fontSize: 16.28, lineHeight: 18.8, lineCount: 8 },\r\n { bulletSymbolWidth: 19, fontSize: 14.46, lineHeight: 16.7, lineCount: 9 },\r\n { bulletSymbolWidth: 19, fontSize: 12.99, lineHeight: 15.0, lineCount: 10 },\r\n];\r\n\r\nexport const PendulumEffectFontData: Record = {\r\n tcg: {\r\n ...DefaultTCGEffectFontData,\r\n fontList: [\r\n { bulletSymbolWidth: 23, fontSize: 24.3, lineHeight: 24.35, lineCount: 5 },\r\n ],\r\n },\r\n ocg: {\r\n ...DefaultOCGEffectFontData,\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 16,\r\n fontSize: 22.05,\r\n lineHeight: 25.2,\r\n headTextFontRatio: 0.4,\r\n lineCount: 5,\r\n },\r\n ],\r\n },\r\n};\r\n\r\nexport type CondenseType = 'veryStrict' | 'veryLoose' | 'strict' | 'loose' | 'relaxed';\r\nexport const CondenseTolerantMap: Record> = {\r\n veryStrict: {\r\n '1': 600,\r\n '2': 620,\r\n '3': 640,\r\n },\r\n strict: {\r\n '1': 645,\r\n '2': 665,\r\n '3': 685,\r\n },\r\n loose: {\r\n '1': 700,\r\n '2': 710,\r\n '3': 720,\r\n },\r\n veryLoose: {\r\n '1': 740,\r\n '2': 770,\r\n '3': 800,\r\n },\r\n relaxed: {\r\n '1': 800,\r\n '2': 850,\r\n '3': 900,\r\n },\r\n};\r\nexport const CondenseTolerantLabelMap: Record = {\r\n veryStrict: {\r\n label: '5',\r\n order: 1,\r\n },\r\n strict: {\r\n label: '4',\r\n order: 2,\r\n },\r\n loose: {\r\n label: '3',\r\n order: 3,\r\n },\r\n veryLoose: {\r\n label: '2',\r\n order: 4,\r\n },\r\n relaxed: {\r\n label: '1',\r\n order: 5,\r\n },\r\n};","import { FontData } from './font-data-effect';\r\n\r\nexport type NameFontData = {\r\n value: string,\r\n labelKey: string,\r\n fontData: FontData,\r\n};\r\nexport const NameFontDataMap: Record<'Default' | 'Arial' | 'OCG', NameFontData> = {\r\n Default: {\r\n value: 'Default',\r\n labelKey: 'input.name-style.font-type.default',\r\n fontData: {\r\n alphabetFont: 'MatrixRegularSmallCaps',\r\n font: 'MatrixRegularSmallCaps',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n fontStyle: 'tcg',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.775,\r\n headTextHeightRatio: 0.55,\r\n fontList: [{\r\n bulletSymbolWidth: 64,\r\n fontSize: 91.5,\r\n headTextFontRatio: 0.190,\r\n letterSpacing: 0.015,\r\n lineCount: 1,\r\n lineHeight: 91.5,\r\n offsetY: 0,\r\n }],\r\n letterDeviationMap: {\r\n i: { yOffset: 1, yRatio: 1.03 },\r\n ì: { yOffset: 1, yRatio: 1.03 },\r\n í: { yOffset: 1, yRatio: 1.03 },\r\n î: { yOffset: 1, yRatio: 1.03 },\r\n ï: { yOffset: 1, yRatio: 1.03 },\r\n ĩ: { yOffset: 1, yRatio: 1.03 },\r\n ī: { yOffset: 1, yRatio: 1.03 },\r\n ĭ: { yOffset: 1, yRatio: 1.03 },\r\n į: { yOffset: 1, yRatio: 1.03 },\r\n ǐ: { yOffset: 1, yRatio: 1.03 },\r\n ȉ: { yOffset: 1, yRatio: 1.03 },\r\n ȋ: { yOffset: 1, yRatio: 1.03 },\r\n ɨ: { yOffset: 1, yRatio: 1.03 },\r\n ɩ: { yOffset: 1, yRatio: 1.03 },\r\n ᵹ: { yOffset: 1, yRatio: 1.03 },\r\n ᵼ: { yOffset: 1, yRatio: 1.03 },\r\n ᶖ: { yOffset: 1, yRatio: 1.03 },\r\n ḭ: { yOffset: 1, yRatio: 1.03 },\r\n ḯ: { yOffset: 1, yRatio: 1.03 },\r\n ỉ: { yOffset: 1, yRatio: 1.03 },\r\n ị: { yOffset: 1, yRatio: 1.03 },\r\n I: { yOffset: 1, yRatio: 1.022 },\r\n Ì: { yOffset: 1, yRatio: 1.022 },\r\n Í: { yOffset: 1, yRatio: 1.022 },\r\n Î: { yOffset: 1, yRatio: 1.022 },\r\n Ï: { yOffset: 1, yRatio: 1.022 },\r\n Ĩ: { yOffset: 1, yRatio: 1.022 },\r\n Ī: { yOffset: 1, yRatio: 1.022 },\r\n Ĭ: { yOffset: 1, yRatio: 1.022 },\r\n Į: { yOffset: 1, yRatio: 1.022 },\r\n İ: { yOffset: 1, yRatio: 1.022 },\r\n Ɩ: { yOffset: 1, yRatio: 1.022 },\r\n Ɨ: { yOffset: 1, yRatio: 1.022 },\r\n Ǐ: { yOffset: 1, yRatio: 1.022 },\r\n Ȉ: { yOffset: 1, yRatio: 1.022 },\r\n Ȋ: { yOffset: 1, yRatio: 1.022 },\r\n Ḭ: { yOffset: 1, yRatio: 1.022 },\r\n Ḯ: { yOffset: 1, yRatio: 1.022 },\r\n Ỉ: { yOffset: 1, yRatio: 1.022 },\r\n Ị: { yOffset: 1, yRatio: 1.022 },\r\n },\r\n },\r\n },\r\n Arial: {\r\n value: 'Arial',\r\n labelKey: 'input.name-style.font-type.arial',\r\n fontData: {\r\n alphabetFont: 'Arial',\r\n font: 'Arial',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n fontStyle: 'tcg',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.775,\r\n headTextHeightRatio: 0.825,\r\n weight: 'bold',\r\n fontList: [{\r\n bulletSymbolWidth: 40.67,\r\n fontSize: 61,\r\n headTextFontRatio: 0.190,\r\n letterSpacing: -0.14,\r\n lineCount: 1,\r\n lineHeight: 61,\r\n offsetY: 3,\r\n }],\r\n },\r\n },\r\n OCG: {\r\n value: 'OCG',\r\n labelKey: 'input.name-style.font-type.ocg',\r\n fontData: {\r\n alphabetFont: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n font: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n headTextHeightRatio: 0.775,\r\n headTextOverflow: 'condense',\r\n headTextBold: true,\r\n metricMethod: 'name',\r\n numberFont: 'DFKakuTaiHiStd-W4',\r\n numberFontRatio: 1.00,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.775,\r\n fontStyle: 'ocg',\r\n fontList: [{\r\n bulletSymbolWidth: 42.67,\r\n fontSize: 64,\r\n headTextFontRatio: 0.175,\r\n headTextSpacing: 3,\r\n letterSpacing: -0.03,\r\n lineCount: 1,\r\n lineHeight: 64,\r\n offsetY: 0,\r\n }],\r\n }\r\n },\r\n};","import { FontData } from './font-data-effect';\r\n\r\nexport const tcgCreatorFontData: FontData = {\r\n font: 'stone-serif-regular',\r\n alphabetFont: 'stone-serif-regular',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: 'stone-serif-regular',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'tcg',\r\n fontList: [\r\n {\r\n offsetY: -1,\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 21.2,\r\n lineHeight: 21.2,\r\n lineCount: 1,\r\n letterSpacing: -0.01,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 20,\r\n lineHeight: 20,\r\n lineCount: 1,\r\n letterSpacing: -0.01,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n ],\r\n};\r\nexport const ocgCreatorFontData: FontData = {\r\n font: '\"FOT-Rodin Pro M\"',\r\n alphabetFont: '\"FOT-Rodin Pro M\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n metricMethod: 'creator',\r\n fontStyle: 'ocg',\r\n fontList: [{\r\n bulletSymbolWidth: 18,\r\n fontSize: 19.0,\r\n letterSpacing: 0.05,\r\n lineHeight: 20.5,\r\n lineCount: 1,\r\n headTextFontRatio: 0,\r\n wordLetterSpacing: 0.11,\r\n }],\r\n};\r\nexport const CreatorFontData: Record = {\r\n tcg: tcgCreatorFontData,\r\n ocg: ocgCreatorFontData,\r\n};\r\n\r\nexport const tcgPasswordFontData: FontData = {\r\n font: 'stone-serif-regular',\r\n alphabetFont: 'stone-serif-regular',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: 'stone-serif-regular',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'tcg',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 22.219,\r\n lineHeight: 22.219,\r\n lineCount: 1,\r\n letterSpacing: 0.1,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 21,\r\n lineHeight: 21,\r\n lineCount: 1,\r\n letterSpacing: 0,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n offsetY: 1,\r\n },\r\n ],\r\n};\r\nexport const ocgPasswordFontData: FontData = {\r\n font: '\"FOT-Rodin Pro M\"',\r\n alphabetFont: '\"FOT-Rodin Pro M\"',\r\n numberFont: 'stone-serif-regular',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'ocg',\r\n metricMethod: 'furigana',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 22.219,\r\n lineHeight: 22.219,\r\n lineCount: 1,\r\n letterSpacing: 0.1,\r\n headTextFontRatio: 0.4,\r\n largeSymbolRatio: 1.25,\r\n },\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 19.0,\r\n headTextFontRatio: 0,\r\n largeSymbolRatio: 1.25,\r\n lineCount: 1,\r\n lineHeight: 20.5,\r\n ordinalFontOffsetY: 1,\r\n ordinalFontRatio: 1.25,\r\n },\r\n ],\r\n};\r\nexport const PasswordFontData: Record = {\r\n tcg: tcgPasswordFontData,\r\n ocg: ocgPasswordFontData,\r\n};\r\n\r\nexport const tcgTypeAbilityFontData: FontData = {\r\n font: 'YuGiOhITCStoneSerifBSc',\r\n alphabetFont: 'YuGiOhITCStoneSerifBSc',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n ordinalFont: 'YuGiOhITCStoneSerifBSc',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'tcg',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 31.5,\r\n lineHeight: 31.5,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n capitalLetterRatio: 0.95,\r\n letterSpacing: 0.02,\r\n headTextFontRatio: 0.4,\r\n },\r\n {\r\n bulletSymbolWidth: 21.80,\r\n fontSize: 32.75,\r\n lineHeight: 32.75,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n capitalLetterRatio: 0.95,\r\n letterSpacing: -0.03,\r\n headTextFontRatio: 0.4,\r\n },\r\n {\r\n bulletSymbolWidth: 14.80,\r\n fontSize: 44.5,\r\n lineHeight: 44.5,\r\n lineCount: 1,\r\n iconSymbolWidth: 45,\r\n // Noticeable baseline mismatch when this ratio reach 0.9, some rounding magic fuckery is going on here\r\n capitalLetterRatio: 0.90001,\r\n squareBracketRatio: 0.94001,\r\n letterSpacing: -0.03,\r\n headTextFontRatio: 0.4,\r\n },\r\n ],\r\n};\r\nexport const ocgTypeAbilityFontData: FontData = {\r\n font: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n alphabetFont: '\"Yu-Gi-Oh! DF Leisho 3\"',\r\n symbolFont: 'matrix',\r\n symbolFontRatio: 0.8,\r\n headTextHeightRatio: 0.775,\r\n ordinalFont: '\"DFKakuTaiHiStd-W4\"',\r\n furiganaFont: 'DFHSGothic-W3-WIN-RKSJ-H',\r\n fontStyle: 'ocg',\r\n fontList: [\r\n {\r\n bulletSymbolWidth: 20.05,\r\n fontSize: 25.2,\r\n lineHeight: 25.2,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n headTextFontRatio: 0.300,\r\n },\r\n {\r\n bulletSymbolWidth: 21.80,\r\n fontSize: 26.5,\r\n lineHeight: 26.5,\r\n lineCount: 1,\r\n iconSymbolWidth: 26,\r\n headTextFontRatio: 0.300,\r\n },\r\n {\r\n bulletSymbolWidth: 36.80,\r\n fontSize: 48,\r\n lineHeight: 48,\r\n lineCount: 1,\r\n iconSymbolWidth: 45,\r\n headTextFontRatio: 0.25,\r\n headTextSpacing: 3,\r\n letterSpacing: -0.07,\r\n squareBracketRatio: 1.02501,\r\n },\r\n ],\r\n};\r\nexport const getTypeAbilityFontData = (): Record => ({\r\n tcg: tcgTypeAbilityFontData,\r\n ocg: ocgTypeAbilityFontData,\r\n});","/** Normalize various variant of a general letter into a single version for easier manage. For example OCG has their own version of full-width alphabet characters and digits. */\r\nexport const tcgToOCGLetterMap: Record = {\r\n '0': '0',\r\n '1': '1',\r\n '2': '2',\r\n '3': '3',\r\n '4': '4',\r\n '5': '5',\r\n '6': '6',\r\n '7': '7',\r\n '8': '8',\r\n '9': '9',\r\n 'a': 'a',\r\n 'b': 'b',\r\n 'c': 'c',\r\n 'd': 'd',\r\n 'e': 'e',\r\n 'f': 'f',\r\n 'g': 'g',\r\n 'h': 'h',\r\n 'i': 'i',\r\n 'j': 'j',\r\n 'k': 'k',\r\n 'l': 'l',\r\n 'm': 'm',\r\n 'n': 'n',\r\n 'o': 'o',\r\n 'p': 'p',\r\n 'q': 'q',\r\n 'r': 'r',\r\n 's': 's',\r\n 't': 't',\r\n 'u': 'u',\r\n 'v': 'v',\r\n 'w': 'w',\r\n 'x': 'x',\r\n 'y': 'y',\r\n 'z': 'z',\r\n 'A': 'A',\r\n 'B': 'B',\r\n 'C': 'C',\r\n 'D': 'D',\r\n 'E': 'E',\r\n 'F': 'F',\r\n 'G': 'G',\r\n 'H': 'H',\r\n 'I': 'I',\r\n 'J': 'J',\r\n 'K': 'K',\r\n 'L': 'L',\r\n 'M': 'M',\r\n 'N': 'N',\r\n 'O': 'O',\r\n 'P': 'P',\r\n 'Q': 'Q',\r\n 'R': 'R',\r\n 'S': 'S',\r\n 'T': 'T',\r\n 'U': 'U',\r\n 'V': 'V',\r\n 'W': 'W',\r\n 'X': 'X',\r\n 'Y': 'Y',\r\n 'Z': 'Z',\r\n '「': '「',\r\n '」': '」',\r\n '、': '、',\r\n // '/': '/',\r\n ':': ':',\r\n // 'ー': 'ー',\r\n // '・': '・',\r\n // '・': '・',\r\n // ':': ':',\r\n '∀': 'Ɐ',\r\n 'ꓯ': 'Ɐ',\r\n 'ꓛ': 'Ɔ',\r\n 'ꓱ': 'Ǝ',\r\n 'ꓞ': 'Ⅎ',\r\n 'ꓨ': '⅁',\r\n 'ꓘ': 'Ʞ',\r\n 'ꓶ': 'Ꞁ',\r\n '⅂': 'Ꞁ',\r\n 'ꓒ': 'Ԁ',\r\n 'ꓕ': 'Ʇ',\r\n 'Ո': 'ꓵ',\r\n 'ꓥ': 'Ʌ',\r\n '<': '<',\r\n '>': '>',\r\n '!': '!',\r\n '(': '(',\r\n ')': ')',\r\n '&': '&',\r\n ''': '\\'',\r\n '@': '@',\r\n};\r\nexport const ocgToTCGLetterMap: Record = {\r\n '0': '0',\r\n '1': '1',\r\n '2': '2',\r\n '3': '3',\r\n '4': '4',\r\n '5': '5',\r\n '6': '6',\r\n '7': '7',\r\n '8': '8',\r\n '9': '9',\r\n 'a': 'a',\r\n 'b': 'b',\r\n 'c': 'c',\r\n 'd': 'd',\r\n 'e': 'e',\r\n 'f': 'f',\r\n 'g': 'g',\r\n 'h': 'h',\r\n 'i': 'i',\r\n 'j': 'j',\r\n 'k': 'k',\r\n 'l': 'l',\r\n 'm': 'm',\r\n 'n': 'n',\r\n 'o': 'o',\r\n 'p': 'p',\r\n 'q': 'q',\r\n 'r': 'r',\r\n 's': 's',\r\n 't': 't',\r\n 'u': 'u',\r\n 'v': 'v',\r\n 'w': 'w',\r\n 'x': 'x',\r\n 'y': 'y',\r\n 'z': 'z',\r\n 'A': 'A',\r\n 'B': 'B',\r\n 'C': 'C',\r\n 'D': 'D',\r\n 'E': 'E',\r\n 'F': 'F',\r\n 'G': 'G',\r\n 'H': 'H',\r\n 'I': 'I',\r\n 'J': 'J',\r\n 'K': 'K',\r\n 'L': 'L',\r\n 'M': 'M',\r\n 'N': 'N',\r\n 'O': 'O',\r\n 'P': 'P',\r\n 'Q': 'Q',\r\n 'R': 'R',\r\n 'S': 'S',\r\n 'T': 'T',\r\n 'U': 'U',\r\n 'V': 'V',\r\n 'W': 'W',\r\n 'X': 'X',\r\n 'Y': 'Y',\r\n 'Z': 'Z',\r\n // '。': '。',\r\n '「': '「',\r\n '」': '」',\r\n '、': '、',\r\n // '/': '/',\r\n ':': ':',\r\n // 'ー': 'ー',\r\n // '・': '・',\r\n // '・': '・',\r\n // ':': ':',\r\n '∀': 'Ɐ',\r\n 'ꓯ': 'Ɐ',\r\n 'ꓛ': 'Ɔ',\r\n 'ꓱ': 'Ǝ',\r\n 'ꓞ': 'Ⅎ',\r\n 'ꓨ': '⅁',\r\n 'ꓘ': 'Ʞ',\r\n 'ꓶ': 'Ꞁ',\r\n '⅂': 'Ꞁ',\r\n 'ꓒ': 'Ԁ',\r\n 'ꓕ': 'Ʇ',\r\n 'Ո': 'ꓵ',\r\n 'ꓥ': 'Ʌ',\r\n '<': '<',\r\n '>': '>',\r\n '!': '!',\r\n '(': '(',\r\n ')': ')',\r\n '&': '&',\r\n ''': '\\'',\r\n '@': '@',\r\n};\r\n\r\n// const MirrorableLetter = {\r\n// 'ꟻ': 'F',\r\n// '⅃': 'L',\r\n// 'ꟼ': 'P',\r\n// 'И': 'N',\r\n// 'Я': 'R',\r\n// };\r\n\r\nexport const ocgNumberCircleMap: Record = {\r\n '(1)': '①',\r\n '(2)': '②',\r\n '(3)': '③',\r\n '(4)': '④',\r\n '(5)': '⑤',\r\n '(6)': '⑥',\r\n '(7)': '⑦',\r\n '(8)': '⑧',\r\n '(9)': '⑨',\r\n '(10)': '⑩',\r\n '(11)': '⑪',\r\n '(12)': '⑫',\r\n '(13)': '⑬',\r\n '(14)': '⑭',\r\n '(15)': '⑮',\r\n '(16)': '⑯',\r\n '(17)': '⑰',\r\n '(18)': '⑱',\r\n '(19)': '⑲',\r\n '(20)': '⑳',\r\n '(1)': '①',\r\n '(2)': '②',\r\n '(3)': '③',\r\n '(4)': '④',\r\n '(5)': '⑤',\r\n '(6)': '⑥',\r\n '(7)': '⑦',\r\n '(8)': '⑧',\r\n '(9)': '⑨',\r\n '(10)': '⑩',\r\n '(11)': '⑪',\r\n '(12)': '⑫',\r\n '(13)': '⑬',\r\n '(14)': '⑭',\r\n '(15)': '⑮',\r\n '(16)': '⑯',\r\n '(17)': '⑰',\r\n '(18)': '⑱',\r\n '(19)': '⑲',\r\n '(20)': '⑳',\r\n};\r\n\r\n/** Automatically convert popular OCG terms into their TCG counterpart. Never introduce machine translation here :'( */\r\nexport const ocgToTCGTermMap: Record = {\r\n /** monster type */\r\n '水族': 'Aqua',\r\n '獣族': 'Beast',\r\n '獣戦士族': 'Beast-Warrior',\r\n '創造神族': 'Creator God',\r\n 'サイバース族': 'Cyberse',\r\n '恐竜族': 'Dinosaur',\r\n '幻神獣族': 'Divine-Beast',\r\n 'ドラゴン族': 'Dragon',\r\n '天使族': 'Fairy',\r\n '悪魔族': 'Fiend',\r\n '魚族': 'Fish',\r\n 'ギャラクシー族': 'Galaxy',\r\n '幻想魔族': 'Illusion',\r\n '昆虫族': 'Insect',\r\n '機械族': 'Machine',\r\n '植物族': 'Plant',\r\n 'サイキック族': 'Psychic',\r\n '炎族': 'Pyro',\r\n '爬虫類族': 'Reptile',\r\n '岩石族': 'Rock',\r\n '海竜族': 'Sea Serpent',\r\n '魔法使い族': 'Spellcaster',\r\n '雷族': 'Thunder',\r\n '戦士族': 'Warrior',\r\n '鳥獣族': 'Winged Beast',\r\n '幻竜族': 'Wyrm',\r\n 'アンデット族': 'Zombie',\r\n 'サイボーグ族': 'Cyborg',\r\n '天界戦士族': 'Celestial Warrior',\r\n 'ハイドラゴン族': 'High Dragon',\r\n '魔導騎士族': 'Magical Knight',\r\n 'オメガサイキック族': 'Omega Psychic',\r\n /** type */\r\n 'モンスター': 'Monster',\r\n '魔法カード': 'Spell Card',\r\n '罠カード': 'Trap Card',\r\n 'アクション': 'Action',\r\n /** subType */\r\n '通常': 'Normal',\r\n '効果': 'Effect',\r\n '儀式': 'Ritual',\r\n 'フュージョン': 'Fusion', // This is Fusion in Rush Duel, when we translate this map into TCG one these two entries will have the same \"Fusion\" key. We place this one above so it will got overwritten by the normal OCG text for Fusion in the master series.\r\n '融合': 'Fusion',\r\n 'シンクロ': 'Synchro',\r\n 'エクシーズ': 'Xyz',\r\n 'ペンデュラム': 'Pendulum',\r\n 'リンク': 'Link',\r\n 'マキシマム': 'Maximum',\r\n 'トークン': 'Token',\r\n '特殊召喚': 'Special Summon',\r\n 'ダークシンクロモンスター': 'Dark Synchro',\r\n /** ability */\r\n 'チューナー': 'Tuner',\r\n 'デュアル': 'Gemini',\r\n 'リバース': 'Flip',\r\n 'トゥーン': 'Toon',\r\n 'スピリット': 'Spirit',\r\n 'ユニオン': 'Union',\r\n /** creator */\r\n '©高橋和希 スタジオ・ダイス/集英社': '©1996 KAZUKI TAKAHASHI',\r\n '©スタジオ・ダイス/集英社・テレビ東京・KONAMI': '©2020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI',\r\n /** sample card */\r\n '{純|ジュン}{狐|こ}': 'Junko',\r\n [`自分フィールドの効果モンスター×2体以上\r\n①:このカードがモンスターゾーンに存在する限り、相手フィールドのモンスターが効果を発動する度に、その相手の表側表示モンスターにピュアカウンターを1つ置く(最大1つまで)。②:このカードはピュアカウンターが置かれているモンスターが発動した効果を受けない。③:このカードはピュアカウンターが置かれているモンスターとの戦闘では破壊されない。`]: `[2+ Effect Monsters on your field]\r\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter.`,\r\n '※公式のデュエルでは使用できません。': 'This card cannot be used in a Duel.',\r\n // eslint-disable-next-line quotes\r\n '①:1ターンに1度、800LPを払って発動できる。このカードのPスケールを1つ上げる。': \"Once per turn: You can pay 800 LP, increase this card's Pendulum Scale by 1.\",\r\n};\r\nexport const tcgToOCGTermMap = Object.entries(ocgToTCGTermMap).reduce((acc, cur) => {\r\n const [ocgTerm, tcgTerm] = cur;\r\n acc[tcgTerm] = ocgTerm;\r\n\r\n return acc;\r\n}, {\r\n /** Safe fallback, because the single quote maybe converted into curly single quote */\r\n 'Once per turn: You can pay 800 LP, increase this card’s Pendulum Scale by 1.': '①:1ターンに1度、800LPを払って発動できる。このカードのPスケールを1つ上げる。',\r\n} as Record);","export type FrameInfo = {\r\n name: string,\r\n nameKey: string,\r\n edition: 'normal' | 'extendend',\r\n labelColor: string,\r\n labelBackgroundColor?: string,\r\n labelBackgroundColorList?: string[],\r\n labelBackgroundImage?: string,\r\n};\r\nexport const FrameInfoMap: Record = {\r\n 'normal': {\r\n name: 'normal',\r\n nameKey: 'input.frame.normal',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#c49c5e',\r\n },\r\n 'effect': {\r\n name: 'effect',\r\n nameKey: 'input.frame.effect',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#b96c49',\r\n },\r\n 'fusion': {\r\n name: 'fusion',\r\n nameKey: 'input.frame.fusion',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#8948a4',\r\n },\r\n 'synchro': {\r\n name: 'synchro',\r\n nameKey: 'input.frame.synchro',\r\n labelColor: '#000',\r\n edition: 'normal',\r\n labelBackgroundColor: '#efefef',\r\n },\r\n 'xyz': {\r\n name: 'xyz',\r\n nameKey: 'input.frame.xyz',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#000000',\r\n },\r\n 'link': {\r\n name: 'link',\r\n nameKey: 'input.frame.link',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#0c8ac6',\r\n },\r\n 'ritual': {\r\n name: 'ritual',\r\n nameKey: 'input.frame.ritual',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#5e85c9',\r\n },\r\n 'spell': {\r\n name: 'spell',\r\n nameKey: 'input.frame.spell',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#1b8f83',\r\n },\r\n 'trap': {\r\n name: 'trap',\r\n nameKey: 'input.frame.trap',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#c32a8c',\r\n },\r\n 'token': {\r\n name: 'token',\r\n nameKey: 'input.frame.token',\r\n labelColor: '#ffffff',\r\n edition: 'normal',\r\n labelBackgroundColor: '#6f6c6b',\r\n },\r\n 'dark-synchro': {\r\n name: 'dark-synchro',\r\n nameKey: 'input.frame.dark-synchro',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#4d4543',\r\n },\r\n 'obelisk': {\r\n name: 'obelisk',\r\n nameKey: 'input.frame.obelisk',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#515eb0',\r\n },\r\n 'osiris': {\r\n name: 'osiris',\r\n nameKey: 'input.frame.osiris',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#bd5044',\r\n },\r\n 'ra': {\r\n name: 'ra',\r\n nameKey: 'input.frame.ra',\r\n labelColor: '#000',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#b9ad34',\r\n },\r\n 'raviel': {\r\n name: 'raviel',\r\n nameKey: 'input.frame.raviel',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#313c5f',\r\n },\r\n 'uria': {\r\n name: 'uria',\r\n nameKey: 'input.frame.uria',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#623320',\r\n },\r\n 'hamon': {\r\n name: 'hamon',\r\n nameKey: 'input.frame.hamon',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#534a19',\r\n },\r\n 'lg-dragon': {\r\n name: 'lg-dragon',\r\n nameKey: 'input.frame.lg-dragon',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#4e84a4',\r\n },\r\n 'speed-skill': {\r\n name: 'speed-skill',\r\n nameKey: 'input.frame.speed-skill',\r\n labelColor: '#ffffff',\r\n edition: 'extendend',\r\n labelBackgroundColor: '#199cd5',\r\n },\r\n 'zarc': {\r\n name: 'zarc',\r\n nameKey: 'input.frame.zarc',\r\n labelColor: '#000',\r\n edition: 'extendend',\r\n labelBackgroundColorList: [\r\n 'rgba(185,108,73,1)',\r\n 'rgba(137,72,164,1)',\r\n 'rgba(239,239,239,1)',\r\n 'rgba(0,0,0,1)',\r\n ],\r\n labelBackgroundImage: `linear-gradient(90deg, ${[\r\n 'rgba(185,108,73,1) 23%',\r\n 'rgba(137,72,164,1) 27%',\r\n 'rgba(137,72,164,1) 48%',\r\n 'rgba(239,239,239,1) 52%',\r\n 'rgba(239,239,239,1) 73%',\r\n 'rgba(0,0,0,1) 77%',\r\n ].join(', ')})`,\r\n },\r\n};\r\nexport const frameList = Object.values(FrameInfoMap);","export const arrowPositionList = [\r\n { top: 175, left: 55, width: 100, height: 100 },\r\n { top: 165, left: 323, width: 170, height: 80 },\r\n { top: 175, left: 655, width: 100, height: 100 },\r\n { top: 442, left: 45, width: 70, height: 170 },\r\n { top: 0, left: 0, width: 0, height: 0 }, /** Middle */\r\n { top: 442, left: 700, width: 70, height: 170 },\r\n { top: 775, left: 55, width: 100, height: 100 },\r\n { top: 810, left: 323, width: 170, height: 80 },\r\n { top: 775, left: 655, width: 100, height: 100 },\r\n];","import { ocgKeywordDataList } from './dictionary';\r\n\r\nexport const ST_ICON_SYMBOL = '⦾';\r\n\r\nexport const CAPITAL_LETTER_SOURCE = '[A-ZA-Z]';\r\nexport const CapitalLetterRegex = new RegExp(CAPITAL_LETTER_SOURCE);\r\n\r\nexport const SQUARE_BRACKET_SOURCE = '[\\\\[\\\\]【】]';\r\nexport const SquareBracketLetterRegex = new RegExp(SQUARE_BRACKET_SOURCE);\r\n\r\nexport const WHOLE_WORD_SOURCE = '[#@∞a-za-zA-ZA-Z0-90-9!!+×##@∞‘“’”:;\\\\[\\\\]\\\\(\\\\)【】\\\\.,]+';\r\nexport const WholeWordRegex = new RegExp(WHOLE_WORD_SOURCE);\r\n\r\nexport const FragmentSplitRegex = new RegExp(`({[^{}]+?}|${WHOLE_WORD_SOURCE}|.)`);\r\n// export const FragmentSplitRegex = new RegExp('({[^{}]+?}|.)');\r\n\r\nexport const UNCOMPRESSED_SOURCE = '{{([^{}]+?)}}';\r\n\r\nexport const NB_WORD_OPEN = '⦉';\r\nexport const NB_WORD_CLOSE = '⦊';\r\nexport const NB_LINE_OPEN = '⟅';\r\nexport const NB_LINE_CLOSE = '⟆';\r\nexport const NB_UNCOMPRESSED_START = '⟬';\r\nexport const NB_UNCOMPRESSED_END = '⟭';\r\n/** Remove all control characters */\r\nexport const NormalizeTextRegex = new RegExp(`[${[\r\n NB_WORD_OPEN,\r\n NB_WORD_CLOSE,\r\n NB_LINE_OPEN,\r\n NB_LINE_CLOSE,\r\n NB_UNCOMPRESSED_START,\r\n NB_UNCOMPRESSED_END,\r\n].join('')}]|(\\\\|[^}]+})`, 'g');\r\n\r\nexport const NON_BREAKABLE_SYMBOL_SOURCE = `${NB_WORD_OPEN}|${NB_WORD_CLOSE}`;\r\nexport const nonBreakableSymbolRegex = new RegExp(NON_BREAKABLE_SYMBOL_SOURCE);\r\n\r\n/** Pretty hard to automatically detect condition clause inside flavor text. We must assume that the clause is always put inside a parentheses (as official cards do). */\r\nexport const FLAVOR_CONDITION_SOURCE = `(\\\\n^[\\\\r\\\\t\\\\f\\\\v \\\\u00a0\\\\u1680\\\\u2000-\\\\u200a\\\\u2028\\\\u2029\\\\u202f\\\\u205f\\\\u3000\\\\ufeff]*\\\\n${NB_WORD_OPEN}?\\\\([\\\\w\\\\W]+\\\\)${NB_WORD_CLOSE}?)\\\\s*$`;\r\n\r\n/** Small reminder: `g` flag turn regex into stateful, and cannot be reused without reset it first. */\r\nexport const TCG_LETTER_JOINLIST = '&A-Za-z0-9\\\\-/\\\\s\\\\(\\\\)!,.‘“’”:;<>\\\\[\\\\]\\\\\\\\';\r\nexport const TCG_SYMBOL_JOINLIST = '#★@∞';\r\nexport const TCGSymbolLetterRegex = new RegExp(`[${TCG_SYMBOL_JOINLIST}]`);\r\n\r\nexport const OCG_KEYWORD_JOIN_REGEX = ocgKeywordDataList.map(entry => entry.regexForm ?? entry.shortForm).join('|');\r\nexport const OCG_KEYWORD_SOURCE = `(${OCG_KEYWORD_JOIN_REGEX})(?![^{]*})`;\r\n\r\nexport const CHIISAI_KANA_JOINLIST = 'ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻';\r\nexport const ChiisaiRegex = new RegExp(`[${CHIISAI_KANA_JOINLIST}]`);\r\n\r\nexport const OCG_RUBY_SOURCE = '{[^{}]+?}';\r\nexport const NOT_START_OF_LINE_SOURCE = `.[${CHIISAI_KANA_JOINLIST})\\\\]}〕〉》」」』】〙〗〟'\"’”⦆»‐゠–〜?!‼⁇⁈⁉・、:;,。.。、]+`;\r\nexport const NOT_END_OF_LINE_SOURCE = '[(\\\\[{〔〈《「「『【〘〖〝\\'\"‘“⦅«●]+.';\r\nexport const NOT_SPLIT_SOURCE = '.[—...‥〳〴〵)]+[^\\\\s]';\r\nexport const OCG_BULLET_SOURCE = '[①-⑳]:.';\r\n\r\nexport const NON_COMPRESSABLE_SOURCE = '[①-⑳※]';\r\nexport const NonCompressableRegex = new RegExp(NON_COMPRESSABLE_SOURCE);\r\n\r\nexport const OCG_ALPHABET_SOURCE = '[A-Za-z]';\r\nexport const OCGAlphabetRegex = new RegExp(OCG_ALPHABET_SOURCE);\r\n\r\nexport const OCGNumberRegex = new RegExp('[0-9]');\r\nexport const NumberRegex = new RegExp('[0-9]');\r\n\r\nexport const HiraganaRegex = /[あいうえおかがきぎくぐけげこごさざしじすずせぜそぞただちぢつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもやゆよらりるれろわゐゑをんゔ]/;\r\n\r\nexport const KatakanaRegex = /[アイウエオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモヤユヨラリルレロワヰヱヲンヴヷヸヹヺ]/;\r\n\r\nexport const OCGDotRegex = new RegExp('[・]');\r\nexport const ChoonpuRegex = new RegExp('[ー]');\r\nexport const NoSpaceRegex = new RegExp('[―]');\r\n\r\nconst OCG_INCREASED_LEVEL_2_WIDTH_JOINLIST = ':';\r\nexport const OCGIncreasedLevel2WidthRegex = new RegExp(`[${OCG_INCREASED_LEVEL_2_WIDTH_JOINLIST}]`);\r\n\r\nconst OCG_INCREASED_WIDTH_JOINLIST = '。、';\r\nexport const OCGIncreasedWidthRegex = new RegExp(`[${OCG_INCREASED_WIDTH_JOINLIST}]`);\r\n\r\nconst OCG_NO_OVERHEAD_GAP_JOINLIST = ':';\r\nexport const OCGNoOverheadGapRegex = new RegExp(`[${OCG_NO_OVERHEAD_GAP_JOINLIST}]`);\r\n\r\nexport const OCGOffsetMap: Record = {\r\n '。': -0.2,\r\n '、': -0.2,\r\n '「': 0,\r\n '」': 0,\r\n ':': 0,\r\n '>': 0.25,\r\n '<': -0.25,\r\n};\r\nexport const OCGLastOfLineOffsetMap: Record = {\r\n '。': -0.5,\r\n ':': -0.25,\r\n};\r\nexport const OCGBoxSpacingRatioMap: Record = {\r\n '>': 0.125,\r\n '<': 0.125,\r\n};\r\nexport const TCGOffsetMap: Record = {\r\n '\\\\': -0.025,\r\n};\r\nexport const TCGLastOfLineOffsetMap: Record = {\r\n};\r\nexport const TCGBoxSpacingRatioMap: Record = {\r\n '\\\\': 0.3,\r\n};\r\n\r\nexport const OCG_REDUCED_AT_END_LINE_RATIO = 0.500;\r\n\r\nexport const BULLET_LETTER = '●';\r\nexport const getBulletSpacing = (format: string) => format === 'tcg' ? 7 : 1;\r\n\r\nexport const MAX_LINE_REVERSE_INDENT = 20;\r\nexport const START_OF_LINE_ALPHABET_OFFSET = 4;\r\n\r\nexport const RUBY_REGEX = /{[^{}]+?}/;\r\n/** If foot text consist of multiple letter and overflow mode is `condense`, head text will also condense but with a smaller rate (that mean they are less compressed), this is the bonus rate. So if foot text is compressed by 50%, head text only got compressed by 40%. */\r\nexport const RUBY_BONUS_RATIO = 0.1;\r\n\r\nexport const BREAKABLE_LETTER = '\\\\s\\\\-/';\r\n/** Default ratio to calculate the gap of a letter. We do not want head text to overlap, so a letter cannot give more space than half of it size. 40-50% is nice enough. */\r\nexport const LETTER_GAP_RATIO = -0.5;\r\nexport const GAP_PER_WIDTH_RATIO = -2.25;","import { BackgroundType, CardOpacity, getDefaultCardOpacity } from './canvas';\r\nimport { Foil } from './foil-finish';\r\nimport { CondenseType } from './font-data-effect';\r\nimport { NO_ICON } from './icon';\r\nimport { getDefaultNameStyle, getDefaultTextStyle, NameStyle, NameStyleType } from './name-preset';\r\n\r\nexport type Card = ReturnType;\r\nexport const getDefaultCard = () => ({\r\n version: 0,\r\n format: 'tcg',\r\n frame: 'fusion',\r\n foil: 'normal' as Foil,\r\n opacity: getDefaultCardOpacity() as Partial,\r\n finish: [] as string[],\r\n artFinish: 'normal',\r\n name: 'Junko',\r\n nameStyleType: 'auto' as NameStyleType,\r\n nameStyle: getDefaultNameStyle() as Partial,\r\n attribute: 'LIGHT',\r\n subFamily: NO_ICON,\r\n cardIcon: 'auto',\r\n star: 6,\r\n starAlignment: 'auto',\r\n art: 'https://i.imgur.com/h5kXZeC.png',\r\n artCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n } as Partial,\r\n hasBackground: false,\r\n background: '',\r\n backgroundType: 'fit' as BackgroundType,\r\n backgroundCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n } as Partial,\r\n linkMap: [\r\n '1',\r\n '3',\r\n '7',\r\n '9',\r\n ] as string[],\r\n isPendulum: false,\r\n pendulumFrame: 'auto',\r\n pendulumEffect: 'Once per turn: You can pay 800 LP, increase this card\\'s Pendulum Scale by 1.',\r\n pendulumScaleRed: '4',\r\n pendulumScaleBlue: '4',\r\n typeAbility: [\r\n 'Fairy',\r\n 'Fusion',\r\n 'Effect',\r\n ] as string[],\r\n effectStyle: {\r\n condenseTolerant: 'strict' as CondenseType,\r\n },\r\n effect: `[2+ Effect Monsters on your field]\r\nEach time an opponent's monster activates its effect, place 1 Pure Counter on that opponent's monster (max. 1) after that effect resolves. Unaffected by activated effects from monster with a Pure Counter. Cannot be destroyed by battle with monsters with a Pure Counter.`,\r\n setId: 'YGOC-EN001',\r\n atk: '2000',\r\n def: '2000',\r\n password: '18111996',\r\n sticker: 'holo5',\r\n isFirstEdition: true,\r\n isSpeedCard: false,\r\n isDuelTerminalCard: false,\r\n creator: '©2020 Studio Dice/SHUEISHA, TV TOKYO, KONAMI',\r\n furiganaHelper: true,\r\n statTextStyle: getDefaultTextStyle(),\r\n typeTextStyle: getDefaultTextStyle(),\r\n effectTextStyle: getDefaultTextStyle(),\r\n pendulumTextStyle: getDefaultTextStyle(),\r\n});\r\nexport const getEmptyCard = (): Card => ({\r\n version: 0,\r\n format: 'tcg',\r\n frame: 'effect',\r\n foil: 'normal',\r\n opacity: getDefaultCardOpacity(),\r\n finish: [],\r\n artFinish: 'normal',\r\n name: '',\r\n nameStyleType: 'auto',\r\n nameStyle: getDefaultNameStyle(),\r\n attribute: 'LIGHT',\r\n subFamily: NO_ICON,\r\n cardIcon: 'auto',\r\n star: 6,\r\n starAlignment: 'auto',\r\n art: 'https://i.imgur.com/jjtCuG5.png',\r\n artCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n },\r\n hasBackground: false,\r\n background: '',\r\n backgroundType: 'fit',\r\n backgroundCrop: {\r\n x: 0,\r\n y: 4,\r\n width: 100,\r\n height: 89.5,\r\n unit: '%',\r\n aspect: 1,\r\n },\r\n linkMap: [],\r\n isPendulum: false,\r\n pendulumFrame: 'auto',\r\n pendulumEffect: '',\r\n pendulumScaleRed: '4',\r\n pendulumScaleBlue: '4',\r\n typeAbility: [],\r\n effectStyle: {\r\n condenseTolerant: 'strict',\r\n },\r\n effect: '',\r\n setId: '',\r\n atk: '0',\r\n def: '0',\r\n password: '',\r\n sticker: 'no-sticker',\r\n isFirstEdition: false,\r\n isSpeedCard: false,\r\n isDuelTerminalCard: false,\r\n creator: '',\r\n furiganaHelper: true,\r\n statTextStyle: getDefaultTextStyle(),\r\n typeTextStyle: getDefaultTextStyle(),\r\n effectTextStyle: getDefaultTextStyle(),\r\n pendulumTextStyle: getDefaultTextStyle(),\r\n});\r\n\r\nexport const OpacityList = [\r\n {\r\n type: 'body' as const,\r\n subType: 'artBorder' as const,\r\n label: 'Card',\r\n labelKey: 'input.opacity.body.label',\r\n tooltipKey: 'input.opacity.art-border.tooltip',\r\n },\r\n {\r\n type: 'name' as const,\r\n subType: 'nameBorder' as const,\r\n label: 'Name',\r\n labelKey: 'input.opacity.name.label',\r\n tooltipKey: 'input.opacity.name-border.tooltip',\r\n },\r\n {\r\n type: 'pendulum' as const,\r\n label: 'Pendulum',\r\n labelKey: 'input.opacity.pendulum.label',\r\n tooltipKey: null,\r\n },\r\n {\r\n type: 'text' as const,\r\n label: 'Effect',\r\n labelKey: 'input.opacity.effect.label',\r\n tooltipKey: null,\r\n },\r\n];\r\n\r\nexport const DefaultColorList = [\r\n '#4D4D4D', '#999999', '#FFFFFF', '#FF7F7F', '#FFD27F', '#FFFF7F',\r\n '#7FFF7F', '#7FBF7F', '#7FFFFF', '#7F7FFF', '#BF7FBF', '#FF7FFF',\r\n\r\n '#333333', '#808080', '#cccccc', '#7F0000', '#7F5200', '#7F7F00',\r\n '#007F00', '#004000', '#007F7F', '#00007F', '#400040', '#7F007F',\r\n\r\n '#000000', '#666666', '#B3B3B3', '#FF0000', '#FFA500', '#FFFF00',\r\n '#00FF00', '#008000', '#00FFFF', '#0000FF', '#800080', '#FF00FF',\r\n];\r\n\r\nexport * from './icon';\r\nexport * from './canvas';\r\nexport * from './coordinate-data';\r\nexport * from './dictionary';\r\nexport * from './foil-finish';\r\nexport * from './font-data-effect';\r\nexport * from './font-data-name';\r\nexport * from './font-data-other';\r\nexport * from './format';\r\nexport * from './frame';\r\nexport * from './link';\r\nexport * from './name-preset';\r\nexport * from './regex';","import { Card, Foil, frameList, NameStyle, NameStyleType, PresetNameStyleMap } from '../model';\r\n\r\nexport const checkNormal = (card: Pick) => {\r\n return card.frame === 'normal' && checkMonster(card);\r\n};\r\nexport const checkXyz = (card: Pick) => {\r\n return card.frame === 'xyz';\r\n};\r\nexport const checkDarkSynchro = (card: Pick) => {\r\n return card.frame === 'dark-synchro';\r\n};\r\nexport const checkLink = (card: Pick) => {\r\n return card.frame === 'link' && checkMonster(card);\r\n};\r\nexport const checkSpeedSkill = (card: Pick) => {\r\n return card.frame === 'speed-skill' && !checkMonster(card);\r\n};\r\nexport const checkMonster = (card: Pick) => {\r\n return card.frame !== 'spell' && card.frame !== 'trap' && card.frame !== 'speed-skill';\r\n};\r\n\r\nexport const getCardFrame = (frame: string) => {\r\n return frameList.find(entry => entry.name === frame.toLowerCase())?.name ?? 'effect';\r\n};\r\nexport const getCardIconFromFrame = (frame: string) => {\r\n if (frame === 'spell' || frame === 'trap') return 'st';\r\n if (frame === 'xyz') return 'rank';\r\n if (frame === 'dark-synchro') return 'negative-level';\r\n if (frame === 'speed-skill') return 'none';\r\n return 'level';\r\n};\r\n\r\nexport const checkLightHeader = (frame: string) => {\r\n return !checkMonster({ frame }) || checkLightFrame(frame);\r\n};\r\n\r\nexport const checkLightFrame = (frame: string) => {\r\n return ['link', 'xyz', 'dark-synchro', 'speed-skill', 'hamon', 'uria', 'raviel'].includes(frame);\r\n};\r\n\r\nexport const resolveNameStyle = ({\r\n format,\r\n frame,\r\n nameStyle,\r\n nameStyleType,\r\n foil,\r\n}: {\r\n nameStyleType: NameStyleType,\r\n nameStyle: Partial,\r\n frame: string,\r\n format: string,\r\n foil: Foil,\r\n}) => {\r\n /** Custom style will be kept as is */\r\n if (nameStyleType === 'custom') {\r\n return nameStyle;\r\n }\r\n\r\n const isSpeedSkill = checkSpeedSkill({ frame });\r\n const lightHeader = checkLightHeader(frame);\r\n\r\n let contextualFont = 'Default';\r\n if (format === 'ocg') contextualFont = 'OCG';\r\n if (isSpeedSkill && format === 'tcg') contextualFont = 'Arial';\r\n\r\n /** Predefined name style has dynamic font based on format unless explictly stated */\r\n let contextualColor = {\r\n fillStyle: lightHeader ? '#ffffff' : '#000000',\r\n headTextFillStyle: lightHeader ? '#ffffff' : '#000000',\r\n };\r\n if (nameStyleType === 'predefined') {\r\n const resultNameStyle = { ...PresetNameStyleMap[nameStyle.preset ?? 'commonB'].value };\r\n if (!PresetNameStyleMap[resultNameStyle.preset ?? 'commonB'].value.font) {\r\n resultNameStyle.font = contextualFont;\r\n }\r\n\r\n return {\r\n ...contextualColor,\r\n ...resultNameStyle,\r\n };\r\n }\r\n\r\n let contextualOutline = isSpeedSkill\r\n ? {\r\n hasOutline: true,\r\n lineWidth: 6,\r\n strokeStyle: '#000',\r\n }\r\n : {};\r\n\r\n const foilStyle = foil !== 'normal' ? PresetNameStyleMap[foil].value ?? {} : {};\r\n const frameStyle = frame === 'zarc' ? PresetNameStyleMap.animeGold.value : {};\r\n\r\n /** Auto name style has dynamic font, outline, color, fully affected by foil and frame */\r\n return {\r\n font: contextualFont,\r\n ...contextualColor,\r\n ...contextualOutline,\r\n ...foilStyle,\r\n ...frameStyle,\r\n };\r\n};","const MAX_CONDENSER_THRESHOLD = 1000;\r\n/** Simple iteration method\r\n * 1 The initial threshold is 1000, initial step is 100, max step count is 30.\r\n * 1. If current threshold satisfy the driver, or step count is already 0, return the current threshold.\r\n * 1. Step down the threshold, and keep stepdown until driver return satisfy signal, reduce step count by 1 for each step made.\r\n * 1. Otherwise if step value is less than 1, finish with the current threshold.\r\n * 1. Otherwise step up the threshold by 1 step, and cut down the step value tenfold. Repeat from step 2.\r\n * \r\n * Example, we want to reach satisfy target at 487:\r\n *\r\n```\r\nCurr Step Count Explain\r\n1000 100 30 Initial\r\n900 100 29 Down\r\n800 100 28 Down\r\n700 100 27 Down\r\n600 100 26 Down\r\n500 100 25 Down\r\n400 100 24 Down\r\n500 10 24 Up => Step / 10\r\n490 10 23 Down\r\n480 10 22 Down\r\n490 1 21 Up => Step / 10\r\n489 1 20 Down\r\n488 1 19 Down\r\n487 1 18 Down => Satisfy\r\n * ```\r\n */\r\nexport const createCondenser = (minThreshold = 0, maxThreshold = MAX_CONDENSER_THRESHOLD) => {\r\n let min = minThreshold;\r\n let max = maxThreshold;\r\n let median = max;\r\n let lastEffective = median;\r\n let iterateCount = 30;\r\n let magnitude = 100;\r\n let magnitudeReductionRatio = 10;\r\n\r\n const reverseSearch = () => {\r\n if (magnitude === 1) finish();\r\n else {\r\n median += magnitude;\r\n magnitude /= magnitudeReductionRatio;\r\n median -= magnitude;\r\n }\r\n\r\n return Math.min(median, max);\r\n };\r\n\r\n const searchDown = () => {\r\n median -= magnitude;\r\n iterateCount -= 1;\r\n\r\n return median;\r\n };\r\n\r\n const reset = (minThreshold = min, maxThreshold = max) => {\r\n min = minThreshold;\r\n max = maxThreshold;\r\n median = maxThreshold;\r\n iterateCount = 30;\r\n magnitude = 100;\r\n lastEffective = maxThreshold;\r\n };\r\n\r\n const getMedian = () => median;\r\n const setMedian = (newMedian: number) => median = newMedian;\r\n\r\n const setLastEffective = (forceMedian = median) => lastEffective = forceMedian;\r\n const getLastEffective = () => lastEffective;\r\n const applyLastEffective = () => {\r\n median = lastEffective;\r\n iterateCount = -1;\r\n return median;\r\n };\r\n\r\n const getIterateCount = () => iterateCount;\r\n const finish = () => iterateCount = -1;\r\n\r\n return {\r\n reset,\r\n searchDown,\r\n reverseSearch,\r\n finish,\r\n getMedian,\r\n setMedian,\r\n setLastEffective,\r\n getLastEffective,\r\n applyLastEffective,\r\n getIterateCount,\r\n };\r\n};\r\n\r\nexport const condense = (\r\n worker: (currentMedian: number) => boolean,\r\n minThreshold = 100,\r\n) => {\r\n let effectiveMedian = MAX_CONDENSER_THRESHOLD;\r\n const condenser = createCondenser();\r\n while (condenser.getIterateCount() >= 0) {\r\n if (condenser.getIterateCount() <= 0) {\r\n /** Support minThreshold here, we don't want to deal with 0. In practices, most text become unreadable when condense with ratio of 400 or lower. */\r\n const finalMedian = condenser.getMedian();\r\n\r\n effectiveMedian = finalMedian;\r\n break;\r\n } else {\r\n const satisfy = worker(condenser.getMedian());\r\n\r\n if (!satisfy && condenser.getMedian() > 0) {\r\n /** If overflow, lower the median and apply it */\r\n condenser.searchDown();\r\n } else {\r\n /** Return immediately if max threshold is enough to satisfy the driver */\r\n if (condenser.getMedian() === MAX_CONDENSER_THRESHOLD) break;\r\n else effectiveMedian = condenser.reverseSearch();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Ensure worker does not run with undesirable threshold (it may have side effect depend on the current ratio, for example, scale canvas). So we run worker with the final median one last time to make sure any side effects from it is affected by the ratio we gonna return.\r\n */\r\n const forcedMedian = Math.max(minThreshold, Math.min(effectiveMedian, MAX_CONDENSER_THRESHOLD));\r\n if (forcedMedian !== effectiveMedian) worker(forcedMedian);\r\n return forcedMedian;\r\n};","import { FontGetter } from 'src/model';\r\n\r\nexport const createFontGetter = (props?: {\r\n defaultWeight?: '' | 'bold',\r\n defaultStyle?: '' | 'italic' | 'small-caps',\r\n defaultSize?: number | `${number}px`,\r\n defaultFamily?: string,\r\n}): FontGetter => {\r\n const {\r\n defaultWeight = '',\r\n defaultStyle = '',\r\n defaultSize = '10px',\r\n defaultFamily = 'Arial',\r\n } = props ?? {};\r\n let weight = defaultWeight;\r\n let style = defaultStyle;\r\n let size: `${number}px` = typeof defaultSize === 'number' ? `${defaultSize}px` : defaultSize;\r\n let sizeAsNumber = typeof defaultSize === 'number' ? defaultSize : parseFloat(defaultSize.replaceAll('px', ''));\r\n let family = defaultFamily;\r\n\r\n return {\r\n getFont: () => `${[style, weight, size, family].filter(part => part !== '').join(' ')}, Arial`,\r\n getFontInfo: () => ({ style, size, family, sizeAsNumber, weight }),\r\n setWeight(nextWeight) {\r\n weight = nextWeight;\r\n return this;\r\n },\r\n setStyle(nextStyle) {\r\n style = nextStyle;\r\n return this;\r\n },\r\n setSize(nextSize) {\r\n const calculatedSize = typeof nextSize === 'function' ? nextSize(sizeAsNumber) : nextSize;\r\n size = typeof calculatedSize === 'number' ? `${calculatedSize}px` : calculatedSize;\r\n sizeAsNumber = typeof calculatedSize === 'number' ? calculatedSize : parseFloat(calculatedSize.replaceAll('px', ''));\r\n return this;\r\n },\r\n setFamily(nextFamily) {\r\n family = nextFamily;\r\n return this;\r\n },\r\n };\r\n};","import { ColorPoint } from 'react-linear-gradient-picker';\r\nimport { getDefaultNameStyle } from 'src/model';\r\n\r\nexport const getDefaultGradientPalette = (): ColorPoint[] => parsePalette(getDefaultNameStyle().gradientColor);\r\n\r\nexport const stringifyPalette = (palette?: ColorPoint[]) => (palette ?? [])\r\n .map(({ color, offset }) => `${offset}|${color}`).join(',');\r\nexport const parsePalette = (stringifiedPalette?: string): ColorPoint[] => stringifiedPalette\r\n ? stringifiedPalette.split(',')\r\n .map((entry, index) => {\r\n const [offset, color] = entry.split('|');\r\n\r\n return { color, offset, id: index + 1 };\r\n })\r\n : parsePalette(getDefaultNameStyle().gradientColor);","export const getNavigationProps = ({\r\n debug,\r\n optionLength,\r\n stopPropagation = false,\r\n setFocus,\r\n onTrigger,\r\n onCancel,\r\n onKeyPress,\r\n}: {\r\n debug?: string,\r\n optionLength: number,\r\n stopPropagation?: boolean,\r\n setFocus: (value: React.SetStateAction) => void,\r\n onTrigger: () => void,\r\n onCancel?: () => void,\r\n onKeyPress?: (ev: React.KeyboardEvent) => (void | boolean),\r\n}) => {\r\n return {\r\n tabIndex: 0,\r\n onFocus: () => {\r\n if (debug) console.info('Navigation Focus', debug);\r\n setFocus(0);\r\n },\r\n onBlur: () => {\r\n if (debug) console.info('Navigation Blur', debug);\r\n setFocus(-1);\r\n },\r\n onKeyDown: (e: React.KeyboardEvent) => {\r\n if (stopPropagation) e.stopPropagation();\r\n if (debug) console.info('Navigation Keydown', debug, e.key);\r\n if (onKeyPress?.(e) === false) return;\r\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') {\r\n e.preventDefault();\r\n setFocus(cur => Math.max(0, optionLength + cur + 1) % optionLength);\r\n }\r\n else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') {\r\n e.preventDefault();\r\n setFocus(cur => Math.max(0, optionLength + cur - 1) % optionLength);\r\n }\r\n else if (e.key === 'Enter' || e.key === ' ') {\r\n onTrigger();\r\n }\r\n else if (e.key === 'Escape') {\r\n onCancel?.();\r\n }\r\n },\r\n };\r\n};","// @ts-nocheck\r\n/* eslint-disable */\r\n// JSONCrush by Frank Force [MIT] https://github.com/KilledByAPixel/JSONCrush\r\n\"use strict\"\r\nexport const JSONCrush=(e,n=50)=>{for(var r=[],o=127;--o;)(48<=o&&57>=o||65<=o&&90>=o||97<=o&&122>=o||\"-_.!~*'()\".includes(String.fromCharCode(o)))&&r.push(String.fromCharCode(o));for(o=32;255>o;++o){var t=String.fromCharCode(o);\"\\\\\"==t||r.includes(t)||r.unshift(t)}e=e.replace(/\\u0001/g,\"\"),e=JSONCrushSwap(e),o=r.length,t=\"\";for(var i={},l=2;l=a||55296<=g&&56319>=g)){for(a=1,g=e.indexOf(h,f+l);0<=g;++a)g=e.indexOf(h,g+l);1o)break;n=r[o];var d=void 0;l=0,f=encodeURI(encodeURIComponent(n)).replace(/%../g,\"i\").length;for(let e in i)h=((h=i[e])-1)*encodeURI(encodeURIComponent(e)).replace(/%../g,\"i\").length-(h+1)*f,t.length||(h-=encodeURI(encodeURIComponent(\"\u0001\")).replace(/%../g,\"i\").length),0>=h?delete i[e]:h>l&&(d=e,l=h);if(!d)break;e=e.split(d).join(n)+n+d,t=n+t,l={};for(let r in i){for(i=r.split(d).join(n),f=0,h=e.indexOf(i);0<=h;++f)h=e.indexOf(i,h+i.length);1{var n=(e=e.substring(0,e.length-1)).split(\"\u0001\");if(e=n[0],1{const r=[['\"',\"'\"],[\"':\",\"!\"],[\",'\",\"~\"],[\"}\",\")\",\"\\\\\",\"\\\\\"],[\"{\",\"(\",\"\\\\\",\"\\\\\"]],o=(e,n)=>e.replace(new RegExp(`${(n[2]?n[2]:\"\")+n[0]}|${(n[3]?n[3]:\"\")+n[1]}`,\"g\"),e=>e===n[0]?n[1]:n[0]);if(n)for(n=0;n> = {\r\n version: 've',\r\n format: 'fm',\r\n frame: 'fr',\r\n foil: 'fo',\r\n opacity: {\r\n _newKey: 'op',\r\n body: 'opbd',\r\n pendulum: 'oppd',\r\n name: 'opnm',\r\n text: 'optx',\r\n boundless: 'opbl',\r\n /** legacy */\r\n artFrame: 'opaf',\r\n artBorder: 'opab',\r\n nameBorder: 'opnb',\r\n baseFill: 'opbf',\r\n },\r\n finish: 'fn',\r\n art: 'ar',\r\n artFinish: 'afn',\r\n artCrop: {\r\n _newKey: 'arc',\r\n x: 'arx',\r\n y: 'ary',\r\n width: 'arw',\r\n height: 'arh',\r\n unit: 'aru',\r\n aspect: 'ara',\r\n },\r\n hasBackground: 'hbg',\r\n background: 'bg',\r\n backgroundType: 'bgt',\r\n backgroundCrop: {\r\n _newKey: 'bgc',\r\n x: 'bgx',\r\n y: 'bgy',\r\n width: 'bgw',\r\n height: 'bgh',\r\n unit: 'bgu',\r\n aspect: 'bga',\r\n },\r\n name: 'na',\r\n nameStyleType: 'nst',\r\n effectStyle: {\r\n _newKey: 'es',\r\n condenseTolerant: 'cdtl',\r\n },\r\n nameStyle: {\r\n _newKey: 'ns',\r\n font: 'nsft',\r\n fillStyle: 'nsfs',\r\n headTextFillStyle: 'nshfs',\r\n shadowColor: 'nssc',\r\n shadowOffsetY: 'nssoy',\r\n shadowOffsetX: 'nssox',\r\n shadowBlur: 'nssb',\r\n hasShadow: 'nshs',\r\n lineColor: 'nslc',\r\n lineWidth: 'nslw',\r\n lineOffsetY: 'nsloy',\r\n lineOffsetX: 'nslox',\r\n hasOutline: 'nshl',\r\n gradientAngle: 'nsgd',\r\n gradientColor: 'nscg',\r\n hasGradient: 'nshg',\r\n preset: 'nspr',\r\n pattern: 'nspt',\r\n },\r\n attribute: 'at',\r\n subFamily: 'sf',\r\n star: 'st',\r\n starAlignment: 'sa',\r\n cardIcon: 'it',\r\n linkMap: 'lm',\r\n isPendulum: 'ip',\r\n pendulumFrame: 'pf',\r\n pendulumEffect: 'pe',\r\n pendulumScaleRed: 'rs',\r\n pendulumScaleBlue: 'bs',\r\n typeAbility: 'ta',\r\n effect: 'ef',\r\n setId: 'si',\r\n atk: 'atk',\r\n def: 'def',\r\n password: 'pw',\r\n sticker: 'sti',\r\n isFirstEdition: 'ife',\r\n isSpeedCard: 'isp',\r\n isDuelTerminalCard: 'idt',\r\n creator: 'cr',\r\n furiganaHelper: 'fh',\r\n effectTextStyle: 'ets',\r\n pendulumTextStyle: 'pts',\r\n statTextStyle: 'sts',\r\n typeTextStyle: 'tts',\r\n};\r\nconst legacyCardFieldShortenMap = {\r\n passcode: 'pc',\r\n picture: 'pt',\r\n pictureCrop: {\r\n _newKey: 'ptc',\r\n x: 'ptx',\r\n y: 'pty',\r\n width: 'ptw',\r\n height: 'pth',\r\n unit: 'ptu',\r\n aspect: 'pta',\r\n },\r\n};\r\nconst cardFieldShortenMap = {\r\n ...currentCardFieldShortenMap,\r\n ...legacyCardFieldShortenMap,\r\n};\r\n\r\nexport const compressCardData = (\r\n card: Record,\r\n shortenMap: Record = cardFieldShortenMap,\r\n serialize = true,\r\n) => {\r\n const condensedCard: Record = {};\r\n const normalizedCard = { ...card };\r\n\r\n Object.keys(normalizedCard).forEach(fieldKey => {\r\n const fieldValue = normalizedCard[fieldKey];\r\n\r\n if (typeof fieldValue === 'object' && fieldValue !== null && !Array.isArray(fieldValue)) {\r\n const newKey = shortenMap[fieldKey]?._newKey;\r\n\r\n if (newKey) {\r\n condensedCard[newKey] = compressCardData(fieldValue, shortenMap[fieldKey], false);\r\n }\r\n } else {\r\n const newFieldKey = shortenMap[fieldKey];\r\n\r\n if (typeof newFieldKey === 'string') condensedCard[newFieldKey] = fieldValue;\r\n }\r\n });\r\n\r\n if (serialize) return JSON.stringify(condensedCard);\r\n return condensedCard;\r\n};\r\n\r\nexport const decompressCardData = (\r\n condensedCard: Record,\r\n shortenMap: Record = cardFieldShortenMap,\r\n) => {\r\n const fullCard: Record = {};\r\n Object.keys(shortenMap).forEach(fullKey => {\r\n const shortenKey = shortenMap[fullKey];\r\n\r\n if (typeof shortenKey === 'object' && shortenKey !== null && !Array.isArray(shortenKey)) {\r\n const shortendKey = shortenKey?._newKey;\r\n\r\n if (shortendKey && condensedCard[shortendKey]) {\r\n fullCard[fullKey] = decompressCardData(condensedCard[shortendKey], shortenMap[fullKey]);\r\n }\r\n } else {\r\n if (condensedCard[shortenKey] != null) {\r\n fullCard[fullKey] = condensedCard[shortenKey];\r\n }\r\n }\r\n });\r\n return fullCard;\r\n};\r\nexport const legacyReverseCardDataShortener = (\r\n condensedCard: Record | string,\r\n shortenMap: Record = cardFieldShortenMap,\r\n) => {\r\n const normalizedCondensedCard = typeof condensedCard === 'string'\r\n ? JSON.parse(JSONUncrush(decodeURIComponent(condensedCard)))\r\n : condensedCard;\r\n\r\n const fullCard: Record = {};\r\n Object.keys(shortenMap).forEach(fullKey => {\r\n const shortenKey = shortenMap[fullKey];\r\n\r\n if (typeof shortenKey === 'object' && shortenKey !== null && !Array.isArray(shortenKey)) {\r\n const shortendKey = shortenKey?._newKey;\r\n\r\n if (shortendKey && normalizedCondensedCard[shortendKey]) {\r\n fullCard[fullKey] = legacyReverseCardDataShortener(normalizedCondensedCard[shortendKey], shortenMap[fullKey]);\r\n }\r\n } else {\r\n if (normalizedCondensedCard[shortenKey] != null) {\r\n fullCard[fullKey] = normalizedCondensedCard[shortenKey];\r\n }\r\n }\r\n });\r\n return fullCard;\r\n};\r\n\r\nexport const rebuildCardData = (\r\n card: Record | string,\r\n baseCard?: Card,\r\n) => {\r\n const normalizedCard = typeof card === 'string'\r\n ? JSON.parse(card)\r\n : card;\r\n const fullCard: Record = decompressCardData(normalizedCard);\r\n\r\n return migrateCardData(fullCard, baseCard);\r\n};\r\nexport const legacyRebuildCardData = (\r\n card: Record | string,\r\n isCondensed = false,\r\n) => {\r\n let fullCard: Record;\r\n if (isCondensed) {\r\n fullCard = legacyReverseCardDataShortener(card);\r\n } else {\r\n fullCard = typeof card === 'string'\r\n ? JSON.parse(card)\r\n : card;\r\n }\r\n\r\n return migrateCardData(fullCard);\r\n};\r\n\r\n/** Migrate old version of card data into the new version without information loss */\r\nexport const migrateCardData = (card: Record, baseCard = getEmptyCard()): Card => {\r\n const migratedCard = {\r\n ...baseCard,\r\n ...clone(card)\r\n };\r\n\r\n if (migratedCard.effectStyle == null) {\r\n migratedCard.effectStyle = {\r\n ...getEmptyCard().effectStyle\r\n };\r\n }\r\n\r\n if (migratedCard.version == null) migratedCard.version = 1;\r\n if (migratedCard.format == null) migratedCard.format = 'tcg';\r\n if (migratedCard.pendulumFrame == null) migratedCard.pendulumFrame = 'auto';\r\n if (migratedCard.finish == null) migratedCard.finish = [];\r\n\r\n if (migratedCard.artFinish == null) migratedCard.artFinish = 'normal';\r\n if ((migratedCard as any).picture && !card.art) migratedCard.art = (migratedCard as any).picture;\r\n delete (migratedCard as any).picture;\r\n\r\n if ((migratedCard as any).pictureCrop && !card.artCrop) migratedCard.artCrop = (migratedCard as any).pictureCrop;\r\n delete (migratedCard as any).pictureCrop;\r\n\r\n /** Seems like no image is fine for now. */\r\n // if ((migratedCard.art ?? '') === '') migratedCard.art = 'https://i.imgur.com/jjtCuG5.png';\r\n if ((migratedCard.art ?? '') === '') migratedCard.art = '';\r\n\r\n if (typeof (migratedCard.opacity as any).artFrame === 'boolean' && migratedCard.opacity.boundless == null) {\r\n migratedCard.opacity.boundless = !(migratedCard.opacity as any).artFrame;\r\n delete (migratedCard.opacity as any).artFrame;\r\n }\r\n migratedCard.opacity = { ...getDefaultCardOpacity(), ...migratedCard.opacity };\r\n\r\n if ((migratedCard.background ?? '') === '') migratedCard.background = '';\r\n if (migratedCard.hasBackground == null && (migratedCard.background || migratedCard.opacity.baseFill)) migratedCard.hasBackground = true;\r\n\r\n if ((migratedCard as any).kanjiHelper && !card.furiganaHelper) migratedCard.furiganaHelper = (migratedCard as any).kanjiHelper;\r\n delete (migratedCard as any).kanjiHelper;\r\n if (migratedCard.furiganaHelper === undefined) migratedCard.furiganaHelper = true;\r\n\r\n if ((migratedCard as any).passcode && !card.password) migratedCard.password = (migratedCard as any).passcode;\r\n delete (migratedCard as any).passcode;\r\n\r\n if (!migratedCard.effectTextStyle) migratedCard.effectTextStyle = getDefaultTextStyle();\r\n if (!migratedCard.pendulumTextStyle) migratedCard.pendulumTextStyle = getDefaultTextStyle();\r\n if (!migratedCard.typeTextStyle) migratedCard.typeTextStyle = getDefaultTextStyle();\r\n if (!migratedCard.statTextStyle) migratedCard.statTextStyle = getDefaultTextStyle();\r\n\r\n if (!migratedCard.starAlignment) migratedCard.starAlignment = 'auto';\r\n\r\n return migratedCard;\r\n};","export const randomCharacter = (charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', length = 1) => {\r\n let result = '';\r\n const charactersLength = charSet.length;\r\n for (let i = 0; i < length; i++) {\r\n result += charSet.charAt(Math.floor(Math.random() * charactersLength));\r\n }\r\n return result;\r\n};\r\n\r\nexport const randomSetID = (format: string) => {\r\n return randomCharacter('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 4)\r\n + '-'\r\n + (format === 'OCG' ? 'JP' : 'EN')\r\n /** Most set does not reach 200+ index, so 0, 1 and 2 has significantly higher chance to roll */\r\n + randomCharacter('0000000000111111111122222222223456789', 1)\r\n + randomCharacter('0123456789', 2);\r\n};\r\n\r\nexport const randomPassword = () => {\r\n return `${randomCharacter('0123456789', 8)}`;\r\n};\r\n\r\nexport const nextChar = (c: string) => {\r\n return String.fromCharCode(c.charCodeAt(0) + 1);\r\n};\r\n\r\nexport function insertUrlParam(key: string, value: string) {\r\n if (window.history.pushState) {\r\n let searchParams = new URLSearchParams(window.location.search);\r\n searchParams.set(key, value);\r\n let newurl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + searchParams.toString();\r\n window.history.pushState({ path: newurl }, '', newurl);\r\n }\r\n};\r\n\r\nexport const normalizedCardName = (name: string) => {\r\n return name.replaceAll(/\\{([^{}|]*)\\|+?[^{}|]*\\}/g, '$1');\r\n};\r\n\r\nexport const forceRefocus = (selector = '.radio-train-input-group') => {\r\n document.querySelector(selector)?.focus();\r\n};\r\n\r\nexport const HexColorRegex = /^#[a-fA-F0-9]{3}([a-fA-F0-9]{3})?$/;\r\nexport const hexToRGBA = (hex: string, withAlpha = true) => {\r\n try {\r\n const pureHex = hex.replace('#', '');\r\n let rgbaList = [0, 0, 0, 1];\r\n\r\n if (pureHex.length === 3 || pureHex.length === 4) {\r\n rgbaList = [\r\n parseInt(`${pureHex[0]}${pureHex[0]}`, 16),\r\n parseInt(`${pureHex[1]}${pureHex[1]}`, 16),\r\n parseInt(`${pureHex[2]}${pureHex[2]}`, 16),\r\n parseInt(`${pureHex[3] ?? 'f'}${pureHex[3] ?? 'f'}`, 16),\r\n ];\r\n }\r\n if (pureHex.length === 6 || pureHex.length === 8) {\r\n rgbaList = [\r\n parseInt(pureHex.slice(0, 2), 16),\r\n parseInt(pureHex.slice(2, 4), 16),\r\n parseInt(pureHex.slice(4, 6), 16),\r\n parseInt(pureHex.slice(6, 8) ?? 'ff', 16),\r\n ];\r\n }\r\n\r\n return rgbaList.map(entry => isNaN(entry) ? 255 : entry).slice(0, withAlpha ? 4 : 3);\r\n } catch (e) {\r\n return [0, 0, 0, 1].slice(0, withAlpha ? 4 : 3);\r\n }\r\n};\r\n\r\n/** Seriously, what the hell? */\r\nexport const isMobileDevice = () => {\r\n let check = false;\r\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0,4))) check = true;})(\r\n navigator.userAgent\r\n || navigator.vendor\r\n || (window as any).opera);\r\n return check;\r\n};\r\n\r\nexport function mergeClass(...args: (boolean | string | undefined | null)[]) {\r\n return args.filter(Boolean).join(' ');\r\n}\r\n\r\nexport * from './categorize';\r\nexport * from './condenser';\r\nexport * from './font';\r\nexport * from './gradient';\r\nexport * from './hook';\r\nexport * from './navigation';\r\nexport * from './codec';","import { Spin } from 'antd';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledLoadingFullViewContainer = styled.div`\r\n display: flex;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-image: linear-gradient(#fafafaaa, #fafafaaa);\r\n justify-content: center;\r\n align-items: center;\r\n z-index: 999;\r\n`;\r\n\r\nexport const Loading = () => {\r\n return ;\r\n};\r\nLoading.FullView = () => {\r\n return \r\n \r\n ;\r\n};","import { Tooltip } from 'antd';\r\nimport { SyncOutlined } from '@ant-design/icons';\r\nimport { ExtractProps } from 'src/type';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledIconButtonContainer = styled.span`\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n margin-left: var(--spacing-xs);\r\n width: 24px;\r\n height: 24px;\r\n border: var(--bw) solid var(--sub-level-1);\r\n background-color: var(--main-level-4);\r\n border-radius: var(--br-lg);\r\n box-shadow: var(--bs-button);\r\n\tcursor: pointer;\r\n\t&:hover {\r\n\t\tbackground-color: var(--sub-level-4);\r\n\t}\r\n`;\r\n\r\nexport type IconButton = {\r\n Icon: typeof SyncOutlined,\r\n onClick: () => void,\r\n iconProps?: ExtractProps,\r\n tooltipProps: ExtractProps,\r\n containerProps?: React.HTMLAttributes,\r\n}\r\nexport const IconButton = ({\r\n Icon,\r\n onClick,\r\n iconProps,\r\n tooltipProps,\r\n containerProps,\r\n}: IconButton) => {\r\n const { className, onClick: customOnClick, onKeyDown, ...restContainerProps } = containerProps ?? {};\r\n\r\n return \r\n {\r\n onClick();\r\n customOnClick?.(e);\r\n }}\r\n onKeyDown={e => {\r\n onKeyDown?.(e);\r\n if (e.key === 'Enter') {\r\n onClick();\r\n }\r\n }}\r\n className={['icon-button', className ?? ''].join(' ')}\r\n >\r\n \r\n \r\n ;\r\n};","import { Card, ocgToTCGTermMap, tcgToOCGTermMap } from 'src/model';\r\n\r\nexport const changeCardFormat = (card: Card, targetFormat: string): Card => {\r\n const {\r\n creator,\r\n effect,\r\n format,\r\n isFirstEdition,\r\n name,\r\n password,\r\n pendulumEffect,\r\n setId,\r\n typeAbility,\r\n } = card;\r\n\r\n if (format === targetFormat) return card;\r\n\r\n const termMap = targetFormat === 'ocg' ? tcgToOCGTermMap : ocgToTCGTermMap;\r\n const newSetId = (targetFormat === 'ocg' && /-EN/.test(setId))\r\n ? setId.replace('-EN', '-JP')\r\n : targetFormat === 'tcg' && /-JP/.test(setId)\r\n ? setId.replace('-JP', '-EN')\r\n : setId;\r\n\r\n return {\r\n ...card,\r\n name: termMap[name] ?? name,\r\n format: targetFormat,\r\n effect: termMap[effect] ?? effect,\r\n pendulumEffect: termMap[pendulumEffect] ?? pendulumEffect,\r\n typeAbility: typeAbility.map(entry => termMap[entry] ?? entry),\r\n creator: termMap[creator] ?? creator,\r\n password: termMap[password] ?? password,\r\n setId: newSetId,\r\n isFirstEdition: targetFormat === 'ocg' ? false : isFirstEdition,\r\n };\r\n};","import React from 'react';\r\n\r\nexport type LanguageMetadata = {\r\n name: string,\r\n formalName: string,\r\n codeName: string,\r\n initialMessage: string,\r\n active: boolean,\r\n order: number,\r\n style?: React.CSSProperties & Record,\r\n};\r\nexport const getDefaultLanguageMetadata = () => ({\r\n name: 'Default',\r\n formalName: 'Default',\r\n codeName: 'def',\r\n initialMessage: '',\r\n order: 1000,\r\n active: false,\r\n});\r\nexport type RawLanguageData = LanguageMetadata & {\r\n rawDictionary: Record,\r\n};\r\nexport type LanguageData = ReturnType;\r\nexport type LanguageDataDictionary = LanguageData['dictionary'];\r\n\r\nexport const processLanguage = (rawLanguageData: RawLanguageData, fallbackRawDictionary: Record = {}) => {\r\n const normalizedRawDictionary = {\r\n ...fallbackRawDictionary,\r\n ...rawLanguageData.rawDictionary,\r\n };\r\n const getDictionaryEntry = (entry: string) => {\r\n return normalizedRawDictionary[entry] ?? '';\r\n };\r\n const applyTemplateNode = (template: string, nodeMap: Record) => {\r\n const splitRegex = new RegExp(`\\\\{(${Object.keys(nodeMap).join('|')})\\\\}`);\r\n /** Expectation: Odd slots belong to actual string, even slots belong to template node, we use index base */\r\n const splittedString = template.split(splitRegex);\r\n\r\n return <>\r\n {splittedString.map((entry, index) => {\r\n if (index % 2 === 0) return {entry};\r\n return nodeMap[entry];\r\n })}\r\n ;\r\n };\r\n const specializedDictionary = {\r\n 'error.load.font.tcg': (familyName: string) => {\r\n return getDictionaryEntry('error.load.font.tcg').replaceAll('{familyName}', familyName);\r\n },\r\n 'error.load.font.ocg': (familyName: string) => {\r\n return getDictionaryEntry('error.load.font.ocg').replaceAll('{familyName}', familyName);\r\n },\r\n 'contributor.disclaimer.line-1': (siteLink: React.ReactNode) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('contributor.disclaimer.line-1'),\r\n { siteLink },\r\n );\r\n },\r\n 'contributor.disclaimer.line-5': (author1: React.ReactNode, author2: React.ReactNode) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('contributor.disclaimer.line-5'),\r\n { author1, author2 },\r\n );\r\n },\r\n 'contributor.template-maker': (\r\n artist1: React.ReactNode,\r\n artist2: React.ReactNode,\r\n artist3: React.ReactNode,\r\n artist4: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('contributor.template-maker'),\r\n { artist1, artist2, artist3, artist4 },\r\n );\r\n },\r\n 'guide.format.introduction': (settingIcon: React.ReactNode) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.introduction'),\r\n { settingIcon },\r\n );\r\n },\r\n 'guide.format.section-1.content': (\r\n openTag: React.ReactNode,\r\n closeTag: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-1.content'),\r\n { openTag, closeTag, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-2.content': (\r\n openTag: React.ReactNode,\r\n closeTag: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-2.content'),\r\n { openTag, closeTag, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-3.content': (\r\n separator: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-3.content'),\r\n { separator, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-4.content': (\r\n separator: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-4.content'),\r\n { separator, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'guide.format.section-5.content': (\r\n openTag: React.ReactNode,\r\n closeTag: React.ReactNode,\r\n hotkey: React.ReactNode,\r\n hotkeyAlternative: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('guide.format.section-5.content'),\r\n { openTag, closeTag, hotkey, hotkeyAlternative },\r\n );\r\n },\r\n 'input.scale.label': (\r\n scaleType: React.ReactNode,\r\n ) => {\r\n return applyTemplateNode(\r\n getDictionaryEntry('input.scale.label'),\r\n { scaleType },\r\n );\r\n },\r\n };\r\n\r\n return {\r\n ...rawLanguageData,\r\n rawDictionary: normalizedRawDictionary,\r\n dictionary: {\r\n ...normalizedRawDictionary,\r\n ...specializedDictionary,\r\n } as typeof specializedDictionary & Record,\r\n };\r\n};","import { create } from 'zustand';\r\nimport {\r\n getDefaultLanguageMetadata,\r\n LanguageData,\r\n LanguageMetadata,\r\n processLanguage,\r\n RawLanguageData,\r\n} from './processor';\r\n\r\nexport type I18NStore = {\r\n languageInfo: LanguageMetadata,\r\n languageMetadataMap: Record,\r\n language: LanguageData['dictionary'],\r\n error: any,\r\n isLoading: boolean,\r\n isMetadataReady: boolean,\r\n isInitiating: boolean,\r\n initiate: () => Promise,\r\n loadLanguage: (language: string) => Promise,\r\n loadDefaultLanguage: () => Promise,\r\n changeLanguage: (language: string) => Promise,\r\n};\r\nexport const useI18N = create((set, get) => {\r\n const defaultLanguageName = (() => {\r\n /** Direct request from URL is preferred */\r\n const url = new URL(window.location.href);\r\n const initialParam = url.searchParams;\r\n const defaultLanguageFromURL = initialParam.get('language');\r\n /** Side effect: Remove default language after load */\r\n initialParam.delete('language');\r\n window.history.replaceState(window.history.state, '', url.href);\r\n if (defaultLanguageFromURL) return defaultLanguageFromURL;\r\n\r\n try {\r\n const cachedLanguage = window.localStorage.getItem('language');\r\n\r\n if (cachedLanguage) return cachedLanguage;\r\n return 'eng';\r\n } catch (e) {\r\n console.error('useSetting: Error when getting cached language', e);\r\n return 'eng';\r\n }\r\n })();\r\n const languageMap: Partial> = {};\r\n const defaultLanguage = processLanguage({\r\n ...getDefaultLanguageMetadata(),\r\n rawDictionary: {},\r\n });\r\n const loadLanguageMetadata = async () => {\r\n try {\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/asset/i18n/metadata.json`,\r\n {\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n }\r\n );\r\n const languageMetadataMap: Record = await response.json();\r\n\r\n if (!languageMetadataMap) throw (new Error('No metadata found'));\r\n\r\n set({\r\n languageMetadataMap,\r\n isMetadataReady: true,\r\n });\r\n } catch (e) {\r\n console.error('loadLanguageMetadata: Could not load language metadata, try to use English', e);\r\n set({\r\n languageMetadataMap: {\r\n eng: {\r\n name: 'English',\r\n formalName: 'English',\r\n codeName: 'eng',\r\n initialMessage: 'Loading fonts and scripts…',\r\n order: 1,\r\n active: true\r\n },\r\n },\r\n isMetadataReady: true,\r\n });\r\n }\r\n };\r\n const loadLanguage = async (languageName: string) => {\r\n if (languageMap[languageName]) return null;\r\n try {\r\n const response = await fetch(\r\n `${process.env.PUBLIC_URL}/asset/i18n/${languageName}.json`,\r\n {\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n 'Accept': 'application/json'\r\n }\r\n }\r\n );\r\n const languageData: RawLanguageData = await response.json();\r\n\r\n if (!languageData.rawDictionary) throw (new Error('No dictionary found'));\r\n const processedLanguage = processLanguage(languageData, languageMap.eng?.rawDictionary);\r\n languageMap[languageName] = processedLanguage;\r\n\r\n return processedLanguage;\r\n } catch (e) {\r\n console.error('loadLanguage: Could not load language, revert back to default', e);\r\n return null;\r\n }\r\n };\r\n const changeLanguage = async (languageName: string) => {\r\n const nextMeta = get().languageMetadataMap[languageName];\r\n if (!nextMeta) return;\r\n\r\n /** Currently it is better to NOT show language loading process, just let everything magically replaced. */\r\n // set({ isLoading: true });\r\n const languageData = !languageMap[languageName]\r\n ? await loadLanguage(languageName)\r\n : languageMap[languageName];\r\n\r\n if (languageData) {\r\n set({\r\n languageInfo: get().languageMetadataMap[languageName],\r\n language: languageData.dictionary,\r\n });\r\n window.localStorage.setItem('language', languageName);\r\n set({\r\n isLoading: false,\r\n languageInfo: nextMeta,\r\n });\r\n } else {\r\n set({\r\n isLoading: false,\r\n languageInfo: get().languageMetadataMap.eng,\r\n language: defaultLanguage.dictionary,\r\n });\r\n }\r\n };\r\n\r\n return {\r\n languageMetadataMap: {},\r\n languageInfo: getDefaultLanguageMetadata(),\r\n language: defaultLanguage.dictionary,\r\n error: null,\r\n isInitiating: true,\r\n isLoading: true,\r\n isMetadataReady: false,\r\n initiate: async () => {\r\n loadLanguageMetadata();\r\n },\r\n loadDefaultLanguage: async () => {\r\n /** Load english first regardless, so it can act as a fallback language */\r\n await loadLanguage('eng');\r\n await changeLanguage(defaultLanguageName);\r\n set({\r\n isInitiating: false,\r\n });\r\n },\r\n loadLanguage,\r\n changeLanguage,\r\n };\r\n});\r\n\r\nexport const useLanguage = () => {\r\n const language = useI18N(({ language }) => language);\r\n\r\n return language;\r\n};\r\nexport const getLanguage = () => useI18N.getState().language;\r\nexport * from './processor';","import { Card, getDefaultCard, getEmptyCard } from 'src/model';\r\nimport { create } from 'zustand';\r\nimport debounce from 'lodash.debounce';\r\nimport throttle from 'lodash.throttle';\r\nimport { rebuildCardData, migrateCardData, legacyRebuildCardData } from 'src/util';\r\nimport { notification } from 'antd';\r\nimport { getLanguage } from './use-i18n';\r\n\r\nexport const decodeCardWithCompatibility = (\r\n cardData: Record | string | null,\r\n baseCard?: Card,\r\n): Card => {\r\n let decodedCard = getEmptyCard();\r\n if (!cardData) return decodedCard;\r\n try {\r\n decodedCard = rebuildCardData(cardData, baseCard);\r\n } catch (e) {\r\n console.error('decodedCard', cardData, e);\r\n try {\r\n decodedCard = legacyRebuildCardData(cardData, true) as Card;\r\n notification.info({\r\n message: getLanguage()['service.decode.outdated.message'],\r\n description: getLanguage()['service.decode.outdated.description'],\r\n });\r\n } catch (e) {\r\n console.error('cardData', cardData, e);\r\n notification.error({\r\n message: getLanguage()['service.decode.error.message'],\r\n description: getLanguage()['service.decode.error.description'],\r\n });\r\n }\r\n }\r\n return decodedCard;\r\n};\r\n\r\n/**\r\n * Acquire saved card when the session is just initialized. URL source is preferred over local storage source.\r\n */\r\nexport const retrieveSavedCard = () => {\r\n try {\r\n const localCardVersion = window.localStorage.getItem('card-version');\r\n const localCardData = window.localStorage.getItem('card-data');\r\n\r\n const cardURLData = (new URLSearchParams(window.location.search)).get('data');\r\n if (cardURLData) {\r\n return decodeCardWithCompatibility(cardURLData);\r\n } else if (localCardData !== null && localCardVersion === process.env.REACT_APP_VERSION) {\r\n return migrateCardData(JSON.parse(localCardData)) as Card;\r\n }\r\n return getDefaultCard();\r\n } catch (e) {\r\n console.error(e);\r\n return getDefaultCard();\r\n }\r\n};\r\n\r\nconst VariantConfigMap = {\r\n debounce: { type: 'debounce' as const, wait: 400 },\r\n throttle: { type: 'throttle' as const, wait: 1000 },\r\n};\r\nexport type CardStore = {\r\n card: Card,\r\n setCard: (cardTransform: Card | ((currentCard: Card) => Card)) => void,\r\n getUpdater: (\r\n key: string,\r\n valueTransform?: (value: any) => any,\r\n variant?: 'throttle' | 'debounce' | { type: 'throttle', wait: number } | { type: 'debounce', wait: number },\r\n ) => (e: any) => void,\r\n};\r\nexport const useCard = create((set, get) => {\r\n return {\r\n card: getDefaultCard(),\r\n setCard: cardTransform => {\r\n if (typeof cardTransform === 'function') set(cur => ({ card: cardTransform(cur.card) }));\r\n else set({ card: cardTransform });\r\n },\r\n getUpdater: (\r\n key: string,\r\n valueTransform: (value: any) => any = (value) => value,\r\n variant,\r\n ) => {\r\n const { setCard } = get();\r\n const returnFunction = (e: any) => {\r\n setCard(current => ({\r\n ...current,\r\n [key]: valueTransform(typeof e === 'string' || typeof e === 'number' || Array.isArray(e) ? e : e?.target?.value),\r\n }));\r\n };\r\n\r\n if (!variant) return returnFunction;\r\n const variantConfig = typeof variant === 'string'\r\n ? VariantConfigMap[variant] ?? undefined\r\n : variant;\r\n\r\n if (!variantConfig) return returnFunction;\r\n const { wait, type } = variantConfig;\r\n\r\n if (type === 'debounce') return debounce(returnFunction, wait);\r\n if (type === 'throttle') return throttle(returnFunction, wait);\r\n\r\n return returnFunction;\r\n }\r\n };\r\n});","import { CanvasConst } from 'src/model';\r\nimport { create } from 'zustand';\r\n\r\nexport type Setting = {\r\n resolution: [number, number],\r\n showCreativeOption: boolean,\r\n showExtraDecorativeOption: boolean,\r\n allowHotkey: boolean,\r\n reduceMotionColor: boolean,\r\n};\r\nexport type SettingStore = {\r\n setting: Setting,\r\n updateSetting: (transformerOrPayload: Partial | ((currentSetting: Setting) => Setting)) => void,\r\n};\r\nexport const useSetting = create((set) => {\r\n const {\r\n resolution,\r\n allowHotkey,\r\n reduceMotionColor,\r\n showCreativeOption,\r\n showExtraDecorativeOption,\r\n } = ((): Record => {\r\n try {\r\n const cachedStore = JSON.parse(window.localStorage.getItem('setting') ?? '{}');\r\n\r\n if (cachedStore && typeof cachedStore === 'object' && !Array.isArray(cachedStore)) return cachedStore;\r\n return {};\r\n } catch (e) {\r\n console.error('useSetting: Error when getting cached setting', e);\r\n return {};\r\n }\r\n })();\r\n\r\n return {\r\n setting: {\r\n resolution: Array.isArray(resolution) && typeof resolution[0] === 'number' && typeof resolution[1] === 'number'\r\n ? resolution as [number, number]\r\n : [CanvasConst.width, CanvasConst.height],\r\n allowHotkey: typeof allowHotkey === 'boolean' ? allowHotkey : true,\r\n reduceMotionColor: typeof reduceMotionColor === 'boolean' ? reduceMotionColor : false,\r\n showCreativeOption: typeof showCreativeOption === 'boolean' ? showCreativeOption : true,\r\n showExtraDecorativeOption: typeof showExtraDecorativeOption === 'boolean' ? showExtraDecorativeOption : true,\r\n },\r\n updateSetting: transformerOrPayload => {\r\n set(currentStore => {\r\n const newSetting = typeof transformerOrPayload === 'function'\r\n ? transformerOrPayload(currentStore.setting)\r\n : { ...currentStore.setting, ...transformerOrPayload };\r\n\r\n window.localStorage.setItem('setting', JSON.stringify(newSetting));\r\n\r\n return {\r\n setting: newSetting,\r\n };\r\n });\r\n }\r\n };\r\n});","import { CanvasConst, FinishInformation, FinishMap } from 'src/model';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\nconst { height: CanvasHeight, width: CanvasWidth } = CanvasConst;\r\n\r\nexport const randomDarkColor = () => '#000000'.replace(/0/g, () => (~~(Math.random() * 12 + 2)).toString(16));\r\n\r\n/** Draw a straight line with random color, used for measurement debug. It take true edge and width, but will draw based on the current scale ratio. */\r\nexport const drawMarker = ({\r\n ctx,\r\n color = randomDarkColor(), width,\r\n offset = 4,\r\n edge, baseline,\r\n xRatio,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n color?: string, width: number,\r\n offset?: number,\r\n edge: number, baseline: number,\r\n xRatio: number,\r\n}) => {\r\n const currentFillStyle = ctx.fillStyle;\r\n ctx.fillStyle = color;\r\n ctx.beginPath();\r\n ctx.rect(edge / xRatio, baseline + 1 + Math.random() * offset, width / xRatio, 2);\r\n // ctx.fill();\r\n ctx.fillStyle = currentFillStyle;\r\n};\r\n\r\n/**\r\n * @summary Letter spacing rules:\r\n * * It is based on the letter width (so each letter has different spacing), default is no spacing (0).\r\n * * Positive letter spacing will create a gap between each letter, and vice versa.\r\n * * Each letter distribute the gap evenly to their left and right side. So for example if letter spacing is 50% (0.5), it will have a gap equal to 25% (0.25) of its width.\r\n */\r\n\r\n/** Draw a left-aligned text with provided letter spacing. This function take true edge and baseline. It return the right side of the newly created text. */\r\nexport const fillTextLeftWithSpacing = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n str: string,\r\n letterSpacingRatio: number,\r\n edge: number,\r\n baseline: number,\r\n option?: {\r\n stroke?: boolean,\r\n }\r\n) => {\r\n if (!ctx || !str) return edge;\r\n\r\n const { stroke = false } = option ?? {};\r\n ctx.textAlign = 'left';\r\n const charList = str.split('');\r\n let curLeft = edge;\r\n\r\n charList.forEach(char => {\r\n ctx.fillText(char, curLeft, baseline);\r\n if (stroke) ctx.strokeText(char, curLeft, baseline);\r\n curLeft += ctx.measureText(char).width * (2 + letterSpacingRatio) / 2;\r\n });\r\n\r\n return curLeft;\r\n};\r\n/** Draw a right-aligned text with provided letter spacing. This function take true edge and baseline. It return the left side of the newly created text. */\r\nexport const fillTextRightWithSpacing = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n str: string,\r\n letterSpacing: number,\r\n edge: number,\r\n baseline: number,\r\n option?: {\r\n stroke?: boolean,\r\n }\r\n) => {\r\n if (!ctx || !str) return edge;\r\n\r\n const { stroke = false } = option ?? {};\r\n ctx.textAlign = 'right';\r\n const charList = str.split('');\r\n let curRight = edge;\r\n\r\n charList.forEach((c, index) => {\r\n const char = charList[charList.length - index - 1];\r\n ctx.fillText(char, curRight, baseline);\r\n if (stroke) ctx.strokeText(char, curRight, baseline);\r\n curRight -= ctx.measureText(char).width * (2 + letterSpacing) / 2;\r\n });\r\n return curRight;\r\n};\r\n\r\n/** Clear current canvas, it also ensure canvas existed so we do not need to check for afterward. */\r\nexport const clearCanvas = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n width = CanvasWidth,\r\n height = CanvasHeight,\r\n): ctx is CanvasRenderingContext2D => {\r\n if (ctx) {\r\n ctx.clearRect(0, 0, width, height);\r\n\r\n return true;\r\n };\r\n return false;\r\n};\r\n\r\n/** Each finish object may contain many parts, each part has its own set of instruction. This function will abstract all the looping logic so we can instantly apply a finish to some card's part. */\r\nexport const getFinishIterator = (\r\n finish: string[],\r\n finishMap: Record = FinishMap,\r\n) => {\r\n return async (\r\n ctx?: CanvasRenderingContext2D | null,\r\n name?: string,\r\n caller?: (finishType: string) => Promise,\r\n ) => {\r\n if (!ctx || !Array.isArray(finish) || finish.length <= 0) return Promise.resolve();\r\n for (const finishType of finish) {\r\n const finishInformation = finishMap[finishType];\r\n if (caller && finishMap[finishType]) {\r\n const { partInstructionMap } = finishInformation;\r\n const instructionList = name ? partInstructionMap[name] ?? [] : [];\r\n\r\n if (instructionList.length) {\r\n for (const { blendMode = 'source-over', opacity = 1 } of instructionList) {\r\n ctx.globalCompositeOperation = blendMode;\r\n ctx.globalAlpha = opacity;\r\n\r\n await caller(finishType);\r\n }\r\n } else {\r\n await caller(finishType);\r\n }\r\n ctx.globalAlpha = 1;\r\n ctx.globalCompositeOperation = 'source-over';\r\n }\r\n }\r\n ctx.globalAlpha = 1;\r\n ctx.globalCompositeOperation = 'source-over';\r\n };\r\n};\r\n\r\nconst DEFAULT_SHADOW_OFFSET_X = 0;\r\nconst DEFAULT_SHADOW_OFFSET_Y = 0;\r\nconst DEFAULT_SHADOW_BLUR = 0;\r\nconst DEFAULT_SHADOW_COLOR = '#000000';\r\nconst DEFAULT_TEXT_COLOR = '#000000';\r\n\r\nexport const setTextStyle = ({\r\n ctx,\r\n x = DEFAULT_SHADOW_OFFSET_X,\r\n y = DEFAULT_SHADOW_OFFSET_Y,\r\n blur = DEFAULT_SHADOW_BLUR,\r\n color = DEFAULT_TEXT_COLOR,\r\n shadowColor = DEFAULT_SHADOW_COLOR,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n} & CanvasTextStyle) => {\r\n ctx.shadowOffsetX = x;\r\n ctx.shadowOffsetY = y;\r\n ctx.shadowBlur = blur;\r\n ctx.shadowColor = shadowColor;\r\n ctx.fillStyle = color;\r\n\r\n return () => {\r\n ctx.shadowOffsetX = DEFAULT_SHADOW_OFFSET_X;\r\n ctx.shadowOffsetY = DEFAULT_SHADOW_OFFSET_Y;\r\n ctx.shadowBlur = DEFAULT_SHADOW_BLUR;\r\n ctx.shadowColor = DEFAULT_SHADOW_COLOR;\r\n ctx.fillStyle = DEFAULT_TEXT_COLOR;\r\n };\r\n};","import { CanvasTextStyle } from 'src/service';\r\nimport { hexToRGBA } from 'src/util';\r\nimport { setTextStyle } from './canvas-util';\r\n\r\nconst imageCacheMap: Record = {};\r\n\r\nexport const drawFrom = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n source: string,\r\n sx: number | ((image: HTMLImageElement) => number) = 0,\r\n sy: number | ((image: HTMLImageElement) => number) = 0,\r\n) => {\r\n if (!ctx || source === '') return new Promise(resolve => resolve(false));\r\n return new Promise(resolve => {\r\n /** @todo Do manual caching really needed? Need proper benchmark for this. */\r\n if (imageCacheMap[source]?.ready === true) {\r\n const image = imageCacheMap[source].image;\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n\r\n ctx.drawImage(image, normalizedX, normalizedY);\r\n resolve(true);\r\n } else {\r\n if (imageCacheMap[source]?.error) {\r\n resolve(true);\r\n return;\r\n }\r\n const imageCached = imageCacheMap[source] && (imageCacheMap[source].cache || imageCacheMap[source].ready);\r\n const image = imageCached\r\n ? imageCacheMap[source].image\r\n : new Image();\r\n\r\n if (!imageCached) image.src = process.env.PUBLIC_URL + source;\r\n image.addEventListener(\r\n 'load',\r\n () => {\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n\r\n ctx.drawImage(image, normalizedX, normalizedY);\r\n imageCacheMap[source].ready = true;\r\n imageCacheMap[source].error = false;\r\n resolve(true);\r\n },\r\n { once: true },\r\n );\r\n image.addEventListener(\r\n 'error',\r\n () => {\r\n imageCacheMap[source].error = true;\r\n resolve(false);\r\n },\r\n { once: true },\r\n );\r\n\r\n if (!imageCached) imageCacheMap[source] = {\r\n image: image,\r\n ready: false,\r\n error: false,\r\n cache: true,\r\n };\r\n };\r\n });\r\n};\r\nexport const drawAsset = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n source: string,\r\n sx: number | ((image: HTMLImageElement) => number) = 0,\r\n sy: number | ((image: HTMLImageElement) => number) = 0,\r\n) => {\r\n return await drawFrom(\r\n ctx,\r\n '/asset/image/' + source,\r\n sx, sy,\r\n );\r\n};\r\n\r\nexport const drawFromWithSize = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n source: string,\r\n sx: number | ((image: HTMLImageElement) => number),\r\n sy: number | ((image: HTMLImageElement) => number),\r\n dw: number | ((image: HTMLImageElement) => number),\r\n dh: number | ((image: HTMLImageElement) => number),\r\n) => {\r\n if (!ctx || source === '') return new Promise(resolve => resolve(false));\r\n return new Promise(resolve => {\r\n if (imageCacheMap[source]?.ready === true) {\r\n const image = imageCacheMap[source].image;\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n const normalizedW = typeof dw === 'number' ? dw : dw(image);\r\n const normalizedH = typeof dh === 'number' ? dh : dh(image);\r\n\r\n ctx.drawImage(image, normalizedX, normalizedY, normalizedW, normalizedH);\r\n resolve(true);\r\n } else {\r\n if (imageCacheMap[source]?.error) {\r\n resolve(true);\r\n return;\r\n }\r\n const imageCached = imageCacheMap[source] && (imageCacheMap[source].cache || imageCacheMap[source].ready);\r\n const image = imageCached\r\n ? imageCacheMap[source].image\r\n : new Image();\r\n\r\n if (!imageCached) image.src = process.env.PUBLIC_URL + source;\r\n image.addEventListener(\r\n 'load',\r\n () => {\r\n const normalizedX = typeof sx === 'number' ? sx : sx(image);\r\n const normalizedY = typeof sy === 'number' ? sy : sy(image);\r\n const normalizedW = typeof dw === 'number' ? dw : dw(image);\r\n const normalizedH = typeof dh === 'number' ? dh : dh(image);\r\n \r\n ctx.drawImage(image, normalizedX, normalizedY, normalizedW, normalizedH);\r\n imageCacheMap[source].ready = true;\r\n imageCacheMap[source].error = false;\r\n resolve(true);\r\n },\r\n { once: true },\r\n );\r\n image.addEventListener(\r\n 'error',\r\n () => {\r\n imageCacheMap[source].error = true;\r\n resolve(false);\r\n },\r\n { once: true },\r\n );\r\n\r\n if (!imageCached) imageCacheMap[source] = {\r\n image: image,\r\n ready: false,\r\n error: false,\r\n cache: true,\r\n };\r\n };\r\n });\r\n};\r\nexport const drawAssetWithSize: typeof drawFromWithSize = async (\r\n ctx,\r\n source,\r\n sx, sy,\r\n dw, dh,\r\n) => {\r\n return await drawFromWithSize(\r\n ctx,\r\n '/asset/image/' + source,\r\n sx, sy,\r\n dw, dh,\r\n );\r\n};\r\n\r\nexport const drawWithColor = async (\r\n canvas: HTMLCanvasElement,\r\n source: string,\r\n color: string,\r\n sw: number, sh: number,\r\n dx: number, dy: number,\r\n cloneCanvasStyle?: CanvasTextStyle,\r\n) => {\r\n const ctx = canvas.getContext('2d');\r\n const clonedCanvas = document.createElement('canvas');\r\n clonedCanvas.width = sw;\r\n clonedCanvas.height = sh;\r\n const clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true });\r\n\r\n if (!clonedCtx || !ctx) return;\r\n await drawAsset(clonedCtx, source, 0, 0);\r\n\r\n const rgbaColor = hexToRGBA(color);\r\n const imageRasterData = clonedCtx.getImageData(0, 0, sw, sh).data;\r\n\r\n /** In some rare case, this image need shadow (for example \"LINK\" text).\r\n * So we apply shadow into the clone node, then DRAW THE IMAGE AGAIN. This time image data will be a combined data from both the original image and the newly applied shadow.\r\n */\r\n const resetStyle = setTextStyle({ ctx: clonedCtx, ...cloneCanvasStyle });\r\n await drawAsset(clonedCtx, source, 0, 0);\r\n const imageDataWithShadow = clonedCtx.getImageData(0, 0, sw, sh);\r\n const imageRasterDataWithShadow = imageDataWithShadow.data;\r\n resetStyle();\r\n\r\n /** Because the new image data will replace the old one (no blending mode), it will erase the pixel of the current canvas underneath. To solve this we will draw the current canvas into the clone canvas first, before putting new image into it. */\r\n clonedCtx.clearRect(0, 0, sw, sh);\r\n clonedCtx.drawImage(canvas, dx, dy, sw, sh, 0, 0, sw, sh);\r\n\r\n const combinedLayerData = clonedCtx.getImageData(0, 0, sw, sh);\r\n const combinedLayerRasterData = combinedLayerData.data;\r\n\r\n for (let pixelCnt = 0; pixelCnt < combinedLayerRasterData.length; pixelCnt += 4) {\r\n /** If raster data at this pixel have the same coordinate with raster data from the original image, draw it with manipulated color. */\r\n if (imageRasterData[pixelCnt + 3] > 0) {\r\n /** Change ratio based on the original color value, compare to pitch black #000000 */\r\n combinedLayerRasterData[pixelCnt + 0] = rgbaColor[0] * (1 - imageRasterData[pixelCnt + 0] / 255);\r\n combinedLayerRasterData[pixelCnt + 1] = rgbaColor[1] * (1 - imageRasterData[pixelCnt + 1] / 255);\r\n combinedLayerRasterData[pixelCnt + 2] = rgbaColor[2] * (1 - imageRasterData[pixelCnt + 2] / 255);\r\n combinedLayerRasterData[pixelCnt + 3] = 255;\r\n }\r\n /** If raster data at this pixel have the same coordinate with raster data from the image with shadow, draw the shadow. */\r\n else if (imageRasterDataWithShadow[pixelCnt + 3] > 0) {\r\n const destinationAlpha = imageRasterDataWithShadow[pixelCnt + 3] / 255;\r\n\r\n combinedLayerRasterData[pixelCnt + 0] = (1 - destinationAlpha) * combinedLayerRasterData[pixelCnt + 0]\r\n + destinationAlpha * imageRasterDataWithShadow[pixelCnt + 0];\r\n combinedLayerRasterData[pixelCnt + 1] = (1 - destinationAlpha) * combinedLayerRasterData[pixelCnt + 1]\r\n + destinationAlpha * imageRasterDataWithShadow[pixelCnt + 1];\r\n combinedLayerRasterData[pixelCnt + 2] = (1 - destinationAlpha) * combinedLayerRasterData[pixelCnt + 2]\r\n + destinationAlpha * imageRasterDataWithShadow[pixelCnt + 2];\r\n combinedLayerRasterData[pixelCnt + 3] = 255;\r\n }\r\n /** Otherwise all other pixel belong to the background canvas, and is untouched. */\r\n }\r\n\r\n ctx.putImageData(combinedLayerData, dx, dy);\r\n};","import {\r\n ChiisaiRegex,\r\n ChoonpuRegex,\r\n DefaultFontDeviation,\r\n FontDeviation,\r\n HiraganaRegex,\r\n KatakanaRegex,\r\n MetricMethod,\r\n NoSpaceRegex,\r\n OCGBoxSpacingRatioMap,\r\n OCGDotRegex,\r\n OCGIncreasedLevel2WidthRegex,\r\n OCGIncreasedWidthRegex,\r\n OCGLastOfLineOffsetMap,\r\n OCGNumberRegex,\r\n OCGOffsetMap,\r\n OCG_REDUCED_AT_END_LINE_RATIO,\r\n TCGBoxSpacingRatioMap,\r\n TCGLastOfLineOffsetMap,\r\n TCGOffsetMap,\r\n nonBreakableSymbolRegex,\r\n} from 'src/model';\r\n\r\n/**\r\n * Return the width of a letter. This function return true width of a scalable letter, but will return the inverse-scaled width of a non-scalable letter (based on the `xRatio` property). For example:\r\n * * Canvas does not scaled: Letter \"A\" return 50px, while letter \"①\" (non-scalable) return 50px.\r\n * * Canvas scaled down by 0.5: Letter \"A\" return 50px, while letter \"①\" (non-scalable) return 100px.\r\n *\r\n * Each letter has 3 main values:\r\n * * `width`: The width of a character based on font size, for example all kanji with the same font size will have the same width, because each letter is designed within a consistent box.\r\n * * `actualBoundWidth`: The width of actual image of a character based on its shape, for example letter of the sokuon \"ァ\" will have actualBoundingWidth much smaller than the kanji letter \"道\", even though they have the same font-size (and therefore same width).\r\n * * `boundWidth`: It is actualBoundWidth + small padding at left and right so that the letter does not stick closely to each other.\r\n * \r\n * `metricMethod` dictate the ratio and calculation method of a letter, used for different use-cases.\r\n * \r\n * DO NOT apply font weight to the canvas while calling this function, as the result will become inconsistent.\r\n */\r\nexport const getLetterWidth = ({\r\n ctx,\r\n letter,\r\n isLastOfLine = false,\r\n debug,\r\n fontStyle,\r\n xRatio,\r\n metricMethod = 'standard',\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n letter: string,\r\n isLastOfLine?: boolean,\r\n fontStyle: string,\r\n xRatio: number,\r\n metricMethod?: MetricMethod,\r\n debug?: string,\r\n}) => {\r\n if (nonBreakableSymbolRegex.test(letter)) return {\r\n width: 0,\r\n boundWidth: 0,\r\n };\r\n\r\n const boxSpacingRatioMap = fontStyle === 'tcg'\r\n ? TCGBoxSpacingRatioMap\r\n : OCGBoxSpacingRatioMap;\r\n const offsetMap = fontStyle === 'tcg'\r\n ? TCGOffsetMap\r\n : OCGOffsetMap;\r\n const lastOfLineOffsetMap = fontStyle === 'tcg'\r\n ? TCGLastOfLineOffsetMap\r\n : OCGLastOfLineOffsetMap;\r\n const metric = ctx.measureText(letter);\r\n const {\r\n width,\r\n actualBoundingBoxLeft,\r\n actualBoundingBoxRight,\r\n } = metric;\r\n const actualBoundWidth = actualBoundingBoxLeft + actualBoundingBoxRight;\r\n let kerningScaleRatio = 1;\r\n if (metricMethod === 'name') {\r\n kerningScaleRatio = 1 + (1 - xRatio) * 8;\r\n }\r\n const spacingRatio = metricMethod === 'name' || metricMethod === 'compact' || metricMethod === 'furigana'\r\n ? 0.046875\r\n : 0;\r\n let boundWidth = actualBoundWidth;\r\n let offsetRatio = (isLastOfLine\r\n ? lastOfLineOffsetMap[letter]\r\n : offsetMap[letter]) ?? 0;\r\n\r\n if (fontStyle === 'tcg') {\r\n let letterBoxSpacing = (boxSpacingRatioMap[letter] ?? 0) * width;\r\n\r\n return {\r\n width,\r\n actualBoundWidth,\r\n boundWidth: width + 2 * letterBoxSpacing,\r\n metric,\r\n offsetRatio,\r\n };\r\n }\r\n\r\n let letterBoxSpacing = (boxSpacingRatioMap[letter] ?? 0) * width\r\n + (metricMethod === 'furigana'\r\n ? 0\r\n : Math.min(\r\n width * 0.075,\r\n Math.max(0.450, width * spacingRatio) * kerningScaleRatio,\r\n ));\r\n let letterRatio = 1;\r\n let endLineRatio = 1;\r\n let standardMetricRatio = 1.000;\r\n if (OCGDotRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana'\r\n ? actualBoundWidth\r\n : actualBoundWidth * (metricMethod === 'creator' ? 1.750 : 2.500);\r\n standardMetricRatio = 0.600;\r\n }\r\n else if (ChoonpuRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.75);\r\n letterBoxSpacing = 2;\r\n }\r\n else if (ChiisaiRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.7);\r\n }\r\n else if (OCGNumberRegex.test(letter)) {\r\n boundWidth = width;\r\n }\r\n else if (OCGIncreasedLevel2WidthRegex.test(letter)) {\r\n boundWidth = actualBoundWidth * 2;\r\n }\r\n else if (OCGIncreasedWidthRegex.test(letter)) {\r\n boundWidth = actualBoundWidth * 1.250 * (isLastOfLine ? OCG_REDUCED_AT_END_LINE_RATIO : 1);\r\n }\r\n else if (HiraganaRegex.test(letter)) {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.750);\r\n }\r\n else if (KatakanaRegex.test(letter)) {\r\n boundWidth = Math.max(actualBoundWidth, width * 0.690)\r\n * (metricMethod === 'creator' ? 0.97500 : 1.000);\r\n }\r\n else if (NoSpaceRegex.test(letter)) {\r\n boundWidth = width;\r\n letterBoxSpacing = 0;\r\n }\r\n else {\r\n boundWidth = metricMethod === 'furigana' ? actualBoundWidth : Math.max(actualBoundWidth, width * 0.750);\r\n }\r\n letterBoxSpacing = metricMethod === 'furigana' ? 0 : letterBoxSpacing;\r\n\r\n const actualLetterWidth = width * letterRatio * endLineRatio;\r\n\r\n if (debug) console.info(`getLetterWidth ${debug}`, letter, metric, letterRatio, endLineRatio, '|', actualLetterWidth);\r\n return {\r\n width,\r\n actualBoundWidth,\r\n boundWidth: metricMethod === 'standard'\r\n ? width * standardMetricRatio\r\n : boundWidth + letterBoxSpacing * 2,\r\n metric,\r\n offsetRatio,\r\n };\r\n};\r\n\r\nexport type TextDrawer = (props: {\r\n ctx: CanvasRenderingContext2D,\r\n letter: string,\r\n scaledEdge: number,\r\n scaledBaseline: number,\r\n}) => void;\r\n/** \r\n * Draw the letter with a provided worker. It take true edge as paramter, but will pass scaled edge to the worker.\r\n */\r\nexport const drawLetter = ({\r\n ctx,\r\n baseline,\r\n edge,\r\n letter,\r\n xRatio,\r\n deviation = {},\r\n letterMetric,\r\n textDrawer,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n letter: string,\r\n letterMetric?: ReturnType,\r\n edge: number,\r\n baseline: number,\r\n xRatio: number,\r\n deviation?: FontDeviation,\r\n textDrawer?: TextDrawer,\r\n}) => {\r\n const {\r\n boundWidth,\r\n metric = ctx.measureText(letter),\r\n offsetRatio = 0,\r\n } = letterMetric ?? {};\r\n const {\r\n yOffset: deviationYOffset = DefaultFontDeviation.yOffset,\r\n yRatio = DefaultFontDeviation.yRatio,\r\n } = xRatio < 1 ? {} : deviation;\r\n\r\n const letterWidth = metric.width * xRatio;\r\n const scaledBoundingWidth = boundWidth ? boundWidth * xRatio : letterWidth;\r\n const worker = textDrawer ?? (({\r\n ctx,\r\n letter,\r\n scaledBaseline,\r\n scaledEdge,\r\n }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n });\r\n\r\n const boundingOffset = (letterWidth - scaledBoundingWidth) / 2;\r\n const externalOffset = scaledBoundingWidth * offsetRatio;\r\n ctx.scale(1, yRatio);\r\n worker({\r\n ctx,\r\n letter,\r\n scaledEdge: edge / xRatio - boundingOffset - externalOffset,\r\n scaledBaseline: (baseline + deviationYOffset) / yRatio,\r\n });\r\n ctx.scale(1, 1 / yRatio);\r\n};","import {\r\n BREAKABLE_LETTER,\r\n DefaultFontSizeData,\r\n FontData,\r\n FontSizeData,\r\n NB_WORD_CLOSE,\r\n NB_WORD_OPEN,\r\n} from 'src/model';\r\nimport { createFontGetter } from 'src/util';\r\n\r\nexport const tokenizeText = (text: string, keepControlCharacter = false) => {\r\n const regex = keepControlCharacter\r\n ? new RegExp(`([${BREAKABLE_LETTER}])|(${NB_WORD_OPEN}[\\\\w\\\\W]+?${NB_WORD_CLOSE})|(.+?)`)\r\n : new RegExp(`([${BREAKABLE_LETTER}])|${NB_WORD_OPEN}([\\\\w\\\\W]+?)${NB_WORD_CLOSE}|(.+?)`);\r\n\r\n return text\r\n .split(regex)\r\n .filter(token => token != null && token !== '');\r\n};\r\n\r\nexport const getTextWorker = (\r\n ctx: CanvasRenderingContext2D,\r\n fontData: FontData,\r\n fontSizeData: FontSizeData,\r\n fontController: ReturnType,\r\n) => {\r\n const {\r\n fontSize,\r\n ordinalFontRatio = DefaultFontSizeData.ordinalFontRatio,\r\n headTextFontRatio = DefaultFontSizeData.headTextFontRatio,\r\n } = fontSizeData;\r\n const {\r\n font,\r\n ordinalFont,\r\n symbolFont,\r\n symbolFontRatio,\r\n numberFont = font,\r\n numberFontRatio = 1,\r\n furiganaFont,\r\n } = fontData;\r\n\r\n let numberFontMemory = fontController.getFontInfo();\r\n const applyNumberFont = () => {\r\n numberFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(numberFont).setSize(fontSize * numberFontRatio).getFont();\r\n };\r\n const stopApplyNumberFont = () => {\r\n ctx.font = fontController\r\n .setFamily(numberFontMemory.family)\r\n .setSize(numberFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n let symbolFontMemory = fontController.getFontInfo();\r\n const applySymbolFont = () => {\r\n symbolFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(symbolFont).setSize(fontSize * symbolFontRatio).getFont();\r\n };\r\n const stopApplySymbolFont = () => {\r\n ctx.font = fontController\r\n .setFamily(symbolFontMemory.family)\r\n .setSize(symbolFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n let ordinalFontMemory = fontController.getFontInfo();\r\n const applyOrdinalFont = () => {\r\n ordinalFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(ordinalFont).setSize(fontSize * ordinalFontRatio).getFont();\r\n };\r\n const stopApplyOrdinalFont = () => {\r\n ctx.font = fontController\r\n .setFamily(ordinalFontMemory.family)\r\n .setSize(ordinalFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n const resetScale = () => {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n };\r\n\r\n const applyAsymmetricScale = (xRatio = 1, yRatio = 1) => {\r\n ctx.scale(xRatio, yRatio);\r\n };\r\n\r\n let furiganaFontMemory = fontController.getFontInfo();\r\n const applyFuriganaFont = (bold = false) => {\r\n furiganaFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setFamily(furiganaFont).setWeight(bold ? 'bold' : '').setSize(fontSize * headTextFontRatio).getFont();\r\n };\r\n const stopApplyFuriganaFont = () => {\r\n ctx.font = fontController\r\n .setFamily(furiganaFontMemory.family)\r\n .setWeight(furiganaFontMemory.weight)\r\n .setSize(furiganaFontMemory.size)\r\n .getFont();\r\n };\r\n\r\n const applyScale = (xScale = 1, yScale = xScale) => {\r\n ctx.scale(xScale, yScale);\r\n };\r\n\r\n const reverseScale = (scaleValue = 1) => {\r\n ctx.scale(1 / scaleValue, 1 / scaleValue);\r\n };\r\n\r\n let largerTextFontMemory = fontController.getFontInfo();\r\n const applyLargerText = (fontRatio = 1) => {\r\n largerTextFontMemory = fontController.getFontInfo();\r\n ctx.font = fontController.setSize(fontSize * fontRatio).getFont();\r\n };\r\n const stopApplyLargerText = () => {\r\n ctx.font = fontController.setSize(largerTextFontMemory.size).getFont();\r\n };\r\n\r\n return {\r\n applyNumberFont, stopApplyNumberFont,\r\n applyLargerText, stopApplyLargerText,\r\n applySymbolFont, stopApplySymbolFont,\r\n applyOrdinalFont, stopApplyOrdinalFont,\r\n applyFuriganaFont, stopApplyFuriganaFont,\r\n\r\n applyAsymmetricScale,\r\n applyScale,\r\n resetScale,\r\n reverseScale,\r\n };\r\n};\r\n\r\n/** We do not actually use the ● letter for bullet, instead we a draw a black circle with fixed size. Bullets not only does not condense, but also does not actually scale with font-size. They are the same size even if we use smaller font to add more lines (\"Agave Dragon\" TCG), this in turn prevent us from reducing the font size too small.\r\n * \r\n * In TCG the space behind bullet is fixed, so multiple lines with bullet at the start will align perfectly, it is not seems to be the case in OCG.\r\n*/\r\nexport const drawBullet = (ctx: CanvasRenderingContext2D, edge: number, baseline: number, width: number, spaceAfter: number) => {\r\n const bulletRadius = (width - spaceAfter) / 2;\r\n ctx.beginPath();\r\n ctx.arc(edge + bulletRadius, baseline - bulletRadius - 1, bulletRadius, 0, 2 * Math.PI, false);\r\n ctx.fill();\r\n ctx.lineWidth = 1;\r\n ctx.strokeStyle = '#003300';\r\n ctx.stroke();\r\n};\r\n\r\n/**\r\n * This function analyze head text of a token, and return various information: its width (same calculation rule with `analyzeToken`), alignment type, gap as well as drawing information (letter spacing and customized condense ratio).\r\n * \r\n * @summary All ruby (head text) rules:\r\n * * A token may or may not has head text.\r\n * * Head text take space above foot text, if foot text still has space left, the token has negative gap. On the other hand if head text is too long it may growth out of foot text's vertical boundary (overflowing), in this case the token has positive gap.\r\n * * Head text with positive gap may take negative gap from the previous token. Read knoweledge diagram for a visual presentation. They take available gap in such a way that head text never overlap with each other, and foot text also does not overlap with each other.\r\n * * Foot text may got pushed around a bit so empty space is distributed uniformly (\"Beyond the Pendulum\" OCG). The current implementation cannot achieve such effect automatically, but only to a degree.\r\n * * Head text above a single letter is always center-aligned. Head text above multiple letters is align using space-around distribution if it does not overflow, and center otherwise.\r\n * * Head text that is way too long compare to its foot text underneath will be condensed and has negative letter spacing (\"PenduLuMoon\" OCG), in some cases make it completely unreadable.\r\n * * Head text of the first token of a line can \"spill\" out of line's boundary. (\"Beyond the Pendulum\" OCG) Even if this is the case, all foot text must be perfectly aligned vertically.\r\n * * Head text above a single letter will not be condensed (\"Recette de Poisson (Fish Recipe)\" OCG) unless forced to by special syntax.\r\n * * Head text above multiple-letters foot text condeses with a slower rate than normal (\"CXyz N.As.Ch. Knight\" OCG).\r\n * * Head text above a whole line will be condensed so it does not overflow (\"Amaze Attraction Viking Vortex\" OCG).\r\n * * Those letters do not have gap, and therefore do not allow head text to overflow over them: Bullet ●, ordinal letter lie ⑤ (\"Pendulum Dimension\" OCG).\r\n * */\r\nexport const analyzeHeadText = ({\r\n footText, footTextWidth,\r\n headText, headTextLetterWidth,\r\n headTextGap,\r\n headTextSpacing,\r\n gapPadding,\r\n debug,\r\n fitFootText,\r\n sentenceXRatio,\r\n xRatio,\r\n}: {\r\n headText: string,\r\n headTextLetterWidth: number,\r\n footText: string,\r\n footTextWidth: number,\r\n headTextGap: number,\r\n headTextSpacing: number,\r\n gapPadding: number,\r\n debug?: string,\r\n fitFootText: boolean,\r\n sentenceXRatio: number,\r\n xRatio: number,\r\n}) => {\r\n const noHeadText = headText.length === 0;\r\n const condenseHeadText = headTextLetterWidth / footTextWidth * sentenceXRatio;\r\n let alignCenterLetterSpacing = headTextSpacing;\r\n let internalXRatio = 0;\r\n /** We use width ratio between head text (letters only) and foot text to determine that it is too long or not. For each ratio threshold, a different treatment is applied. */\r\n if (condenseHeadText <= 0.95) {\r\n /** Most case fall to this category */\r\n alignCenterLetterSpacing = headTextSpacing;\r\n }\r\n else if (condenseHeadText <= 1.175) {\r\n /** If the head text is a bit too long, we force all head text's letters to stay close together. Example like \"EX\" - Extra Deck in OCG. */\r\n alignCenterLetterSpacing = headTextSpacing >= 0\r\n ? 0\r\n : headTextSpacing * 3;\r\n }\r\n else if (condenseHeadText <= 1.560) {\r\n /** If the head text is too long, we start to introduce negative spacing. Example like \"S\" - Synchro in OCG. */\r\n alignCenterLetterSpacing = headTextSpacing >= 0\r\n ? headTextSpacing * -1/4\r\n : headTextSpacing * 3;\r\n }\r\n else {\r\n /** If the head text is way too long, not only we introduce negative spacing, but also condense the actual letter. \"P\" - Pendulum is a notorious example. */\r\n internalXRatio = 0.66;\r\n alignCenterLetterSpacing = headTextSpacing >= 0\r\n ? headTextSpacing * -1/4\r\n : headTextSpacing * 2;\r\n }\r\n if (fitFootText || (xRatio > 0 && xRatio < 1)) {\r\n alignCenterLetterSpacing = headTextSpacing;\r\n }\r\n\r\n const alignCenterHeadTextWidth = headTextLetterWidth * ((xRatio && !fitFootText)\r\n ? xRatio\r\n : (!internalXRatio || fitFootText) ? 1 : internalXRatio)\r\n + alignCenterLetterSpacing * (headText.length - 1);\r\n const alignEvenlyLetterSpacing = noHeadText ? 0 : (footTextWidth - headTextLetterWidth) / headText.length;\r\n const alignEvenlyHeadTextWidth = footTextWidth;\r\n\r\n const alignment = footText.length === 1 || (gapPadding * 2 + alignCenterHeadTextWidth > footTextWidth)\r\n ? 'center' as const\r\n : 'space-around' as const;\r\n const letterSpacing = alignment === 'center'\r\n ? alignCenterLetterSpacing\r\n : alignEvenlyLetterSpacing;\r\n const trueHeadTextWidth = alignment === 'center'\r\n ? gapPadding * 2 + alignCenterHeadTextWidth\r\n : alignEvenlyHeadTextWidth;\r\n const headTextWidth = fitFootText\r\n ? Math.min(trueHeadTextWidth, footTextWidth)\r\n : trueHeadTextWidth;\r\n const baseHalfGap = alignment === 'center'\r\n ? (alignCenterHeadTextWidth - footTextWidth) / 2\r\n : 0;\r\n const halfGap = Math.max(\r\n headTextGap,\r\n fitFootText ? Math.min(baseHalfGap, 0) : baseHalfGap,\r\n );\r\n\r\n if (debug) console.info(\r\n `analyzeHeadText ${debug}`,\r\n alignment,\r\n letterSpacing,\r\n '|',\r\n headText, headTextWidth, trueHeadTextWidth,\r\n footText, footTextWidth,\r\n halfGap,\r\n );\r\n return {\r\n gapPadding,\r\n letterSpacing,\r\n trueHeadTextWidth,\r\n headTextWidth,\r\n /**\r\n * Simple visualization:\r\n * * Center: `[gap][letter + spacing][gap]`\r\n * * Space-around: `[half-gap][letter][gap][letter][half-gap]`\r\n */\r\n alignment,\r\n /** \r\n * * Positive gap will take space from other.\r\n * * Negative app allow other to use their space.\r\n */\r\n halfGap,\r\n headTextXRatio: alignment === 'center' ? internalXRatio : 0,\r\n };\r\n};\r\n\r\n/**\r\n * Calculate the lost width from the left side of a token becaues of gap. This width is scalar and therefore ALWAYS positive. Visit knowledge diagram for a clearer visualization.\r\n * \r\n * * If the previous gap is positive (push to their right):\r\n * * If current gap is positive (push to the left): No space is lost, they simply stand next to each other.\r\n * * If current gap is negative (previous token pull them): Current token lose some width, but no more than what the previous token can take.\r\n * * If the previous gap is negative (pull the next token to them):\r\n * * If current gap is positive (push to the left): Current token lose some width, but no more than what the previous token can give.\r\n * * If current gap is negative (previous token pull them): No space is lost, they do not interfere with each other.\r\n */\r\nexport const getLostLeftWidth = (prevGap: number, curGap: number) => {\r\n return prevGap >= 0\r\n ? curGap >= 0\r\n ? 0\r\n : Math.max(prevGap * -1, curGap) * -1\r\n : curGap >= 0\r\n ? Math.max(prevGap, curGap * -1) * -1\r\n : 0;\r\n};","import {\r\n FontData,\r\n BULLET_LETTER,\r\n TCGSymbolLetterRegex,\r\n OCGAlphabetRegex,\r\n MAX_LINE_REVERSE_INDENT,\r\n START_OF_LINE_ALPHABET_OFFSET,\r\n FragmentSplitRegex,\r\n WholeWordRegex,\r\n DefaultFontSizeData,\r\n ST_ICON_SYMBOL,\r\n TextData,\r\n NoSpaceRegex,\r\n LETTER_GAP_RATIO,\r\n NB_UNCOMPRESSED_START,\r\n NB_UNCOMPRESSED_END,\r\n SquareBracketLetterRegex,\r\n CapitalLetterRegex,\r\n NumberRegex,\r\n OCGNoOverheadGapRegex,\r\n GAP_PER_WIDTH_RATIO,\r\n RUBY_REGEX,\r\n DefaultFontData,\r\n RUBY_BONUS_RATIO,\r\n NON_BREAKABLE_SYMBOL_SOURCE,\r\n NonCompressableRegex,\r\n} from 'src/model';\r\nimport { getTextWorker, analyzeHeadText, tokenizeText, getLostLeftWidth } from './text-util';\r\nimport { createFontGetter } from 'src/util';\r\nimport { getLetterWidth } from './letter';\r\n\r\n/** \r\n * Return information of a token.\r\n * @returns\r\n * * `totalWidth`: The width of the token based on xRatio. In the same fashion with `getLetterWidth`, we get the true width for scalable letter, and inverse-scaled width of a non-scalable letter. `totalWidth` does no include whitespaces since they are not calculate traditionally.\r\n * * `leftMostLetter`: The left most letter of a token (not counting control characters), there is a special treatment based on what is the left most letter of a token (mainly indentation).\r\n * * `spaceCount`: Number of whitespaces in a token, their width will be calculated afterward.\r\n * * `spaceAtEnd`: Whether or not the token end with a space, for example most of English word requires a whitespace between words, while Japanese does not. We also does not allow a line to end with a whitespace unless it is the last line.\r\n * * `rightGap`, `leftGap`: Gap of a token based on its overhead letters. The token may consist of multiple letters each with their own gap, so it is easy to see that right and left gap of a token is respectively left gap of the leftmost letter and right gap of the rightmost letter.\r\n */\r\nexport const analyzeToken = ({\r\n ctx,\r\n token: rawToken, nextToken,\r\n xRatio,\r\n previousTokenGap = 0,\r\n letterSpacing = DefaultFontSizeData.letterSpacing,\r\n format,\r\n textData,\r\n // debug = false,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n token: string,\r\n nextToken: string | undefined,\r\n xRatio: number,\r\n previousTokenGap?: number,\r\n letterSpacing?: number,\r\n format: string,\r\n // debug?: boolean,\r\n textData: {\r\n fontData: FontData,\r\n fontLevel: number,\r\n currentFont: ReturnType,\r\n },\r\n}) => {\r\n if (!ctx || !rawToken) return {\r\n totalWidth: 0,\r\n leftMostLetter: '',\r\n spaceCount: 0,\r\n spaceAtEnd: false,\r\n rightGap: 0,\r\n leftGap: 0,\r\n };\r\n const {\r\n currentFont,\r\n fontData,\r\n fontLevel,\r\n } = textData;\r\n const {\r\n metricMethod,\r\n headTextGapRatio = DefaultFontData.headTextGapRatio,\r\n headTextOverflow = DefaultFontData.headTextOverflow,\r\n fontStyle,\r\n } = fontData;\r\n const fontSizeData = fontData.fontList[fontLevel];\r\n const {\r\n bulletSymbolWidth,\r\n capitalLetterRatio,\r\n fontSize,\r\n iconSymbolWidth = bulletSymbolWidth,\r\n largeSymbolRatio = DefaultFontSizeData.largeSymbolRatio,\r\n headTextSpacing = DefaultFontSizeData.headTextSpacing,\r\n squareBracketRatio,\r\n wordLetterSpacing,\r\n } = fontSizeData;\r\n const defaultGap = fontSize * LETTER_GAP_RATIO;\r\n const {\r\n applyScale, reverseScale,\r\n applyLargerText, stopApplyLargerText,\r\n applyFuriganaFont, stopApplyFuriganaFont,\r\n applyOrdinalFont, stopApplyOrdinalFont,\r\n applySymbolFont, stopApplySymbolFont,\r\n applyNumberFont, stopApplyNumberFont,\r\n } = getTextWorker(ctx, fontData, fontSizeData, currentFont);\r\n const token = rawToken.replaceAll(new RegExp(NON_BREAKABLE_SYMBOL_SOURCE, 'g'), '');\r\n const letterSpacingRatio = 1 + letterSpacing / 2;\r\n let leftMostLetter = '';\r\n let totalWidth = 0;\r\n let spaceCount = 0;\r\n let spaceAtEnd = false;\r\n const isLastOfLine = nextToken === undefined;\r\n /** The right gap of a token will influence the left gap of the next token */\r\n let currentRightGap = previousTokenGap ?? 0;\r\n /** Whether or not it is affected by rebalance calculation */\r\n let offsetable = false;\r\n let leftMostGap = 0;\r\n\r\n const fragmentList = token.split(FragmentSplitRegex).filter(entry => entry != null && entry !== '');\r\n for (let cnt = 0; cnt < fragmentList.length; cnt++) {\r\n const isLeftmostFragment = cnt === 0;\r\n const fragment = fragmentList[cnt];\r\n\r\n /** S/T symbol is unscalable (it does not condense no matter the ratio) */\r\n if (fragment === ST_ICON_SYMBOL) {\r\n currentRightGap = 0;\r\n const fragmentWidth = iconSymbolWidth / xRatio;\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** Bullet symbol is unscalable (\"Agave Dragon\" OCG/TCG) */\r\n else if (fragment === BULLET_LETTER) {\r\n currentRightGap = 0;\r\n const fragmentWidth = bulletSymbolWidth / xRatio;\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** Copyright symbol © is unscalable (creator text) */\r\n else if (/[©]/.test(fragment)) {\r\n currentRightGap = 0;\r\n applyLargerText(largeSymbolRatio);\r\n const fragmentWidth = ctx.measureText(fragment).width / xRatio;\r\n stopApplyLargerText();\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** OCG Ordinal symbol is unscalable */\r\n else if (NonCompressableRegex.test(fragment)) {\r\n currentRightGap = 0;\r\n applyOrdinalFont();\r\n const fragmentWidth = ctx.measureText(fragment).width / xRatio;\r\n stopApplyOrdinalFont();\r\n totalWidth += fragmentWidth * letterSpacingRatio;\r\n\r\n spaceCount += 1;\r\n if (isLeftmostFragment) {\r\n leftMostGap = 0;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n /** Process ruby syntax */\r\n else if (RUBY_REGEX.test(fragment)) {\r\n const [footText, rubyType, headText = ''] = fragment.replaceAll(/{|}/g, '').split(/(\\|+)/);\r\n const fitFootText = rubyType === '||';\r\n /** Calculate foot text's width */\r\n const {\r\n totalWidth: footTextWidth,\r\n } = analyzeToken({ ctx, token: footText, nextToken, xRatio, letterSpacing, previousTokenGap: 0, format, textData });\r\n\r\n /** Calculate head text's width */\r\n applyFuriganaFont();\r\n const headTextLetterWidth = headText\r\n .split('')\r\n .map(letter => getLetterWidth({ ctx, letter, fontStyle, metricMethod: 'furigana', xRatio: 1 }).boundWidth)\r\n .reduce((acc, cur) => acc + cur, 0);\r\n stopApplyFuriganaFont();\r\n\r\n /** Calculate gap */\r\n const { halfGap: baseHalfGap, headTextWidth } = analyzeHeadText({\r\n headText,\r\n headTextLetterWidth: headTextLetterWidth / xRatio,\r\n footText,\r\n footTextWidth,\r\n headTextGap: defaultGap / xRatio,\r\n headTextSpacing,\r\n gapPadding: headTextGapRatio * fontSize / xRatio,\r\n fitFootText,\r\n sentenceXRatio: xRatio,\r\n xRatio: (headTextOverflow === 'condense' && footText.length > 1) ? Math.min(1, xRatio + RUBY_BONUS_RATIO) : 0,\r\n });\r\n const halfGap = headText.length === 0\r\n ? Math.max(defaultGap, footTextWidth / GAP_PER_WIDTH_RATIO)\r\n : baseHalfGap;\r\n const leftGap = halfGap;\r\n const rightGap = halfGap;\r\n const boundWidth = Math.max(headTextWidth, footTextWidth);\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n currentRightGap = rightGap;\r\n totalWidth += boundWidth - lostLeftWidth;\r\n spaceCount += 1;\r\n\r\n if (isLeftmostFragment) {\r\n offsetable = true;\r\n leftMostGap = leftGap;\r\n leftMostLetter = footText[0];\r\n }\r\n }\r\n /** Process whole word. Because the font has contextual kerning, the width when we draw the whole word will be different compare to the width when we draw each letter next to each other, sometimes the different may become noticeable (for example in the word \"AWA\", there is a very noticeable distance between these letters), so we try to simulate that behavior. */\r\n else if (WholeWordRegex.test(fragment)) {\r\n /** Whole word may have their own spacing ratio */\r\n const normalizedWordSpacingRatio = wordLetterSpacing\r\n ? 1 + wordLetterSpacing / 2\r\n : letterSpacingRatio;\r\n ctx.letterSpacing = `${(normalizedWordSpacingRatio - 1) * currentFont.getFontInfo().sizeAsNumber}px`;\r\n\r\n let remainFragment = fragment;\r\n let fragmentWidth = 0;\r\n /** A simple algorithm to simulate contextual kerning, for each letter, we do these steps:\r\n * * Split the current word into two part: The first letter and the rest of the word.\r\n * * Calculate the width of a letter, then calculate the width of the remaining word.\r\n * * By subtract them, we will have the actual width of a letter, when put into the word and affected by contextual kerning.\r\n */\r\n while (remainFragment !== '') {\r\n let currentLetter = remainFragment[0];\r\n let nextRemainFragment = remainFragment.slice(1);\r\n let actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n /** Square brackets (\"[\" and \"]\") may have different scaling */\r\n if (SquareBracketLetterRegex.test(currentLetter)) {\r\n applyScale(squareBracketRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n reverseScale(squareBracketRatio);\r\n }\r\n /** Captial letters may have different scaling */\r\n else if (CapitalLetterRegex.test(currentLetter)) {\r\n applyScale(capitalLetterRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n reverseScale(capitalLetterRatio);\r\n }\r\n /** Number letters may use different font, for the sake of simplicity, we assume that the font does not affect (too much) to the letter's width. In short, we assume that the letter \"8\" in font X have the same width with the letter \"8\" in font Y, just different shape. */\r\n else if (NumberRegex.test(currentLetter)) {\r\n applyNumberFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n stopApplyNumberFont();\r\n }\r\n /** Special symbol in TCG card (\"Evil☆Twin\") may use different font, again we assume the letter have similar size. */\r\n else if (TCGSymbolLetterRegex.test(currentLetter) && fontStyle === 'tcg') {\r\n applySymbolFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n stopApplySymbolFont();\r\n }\r\n /** No special treatment for the usual letters */\r\n else {\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n }\r\n fragmentWidth += actualLetterWidth;\r\n remainFragment = nextRemainFragment;\r\n }\r\n\r\n const leftGap = Math.max(defaultGap, fragmentWidth / GAP_PER_WIDTH_RATIO);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n totalWidth += fragmentWidth - lostLeftWidth;\r\n currentRightGap = rightGap;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = leftGap;\r\n leftMostLetter = fragment[0];\r\n }\r\n ctx.letterSpacing = '0px';\r\n }\r\n /** Special symbol in TCG card (\"Evil☆Twin\") may use different font */\r\n else if (TCGSymbolLetterRegex.test(fragment) && fontStyle === 'tcg') {\r\n applySymbolFont();\r\n const fragmentWidth = ctx.measureText(fragment).width * letterSpacingRatio;\r\n stopApplySymbolFont();\r\n\r\n const leftGap = Math.max(defaultGap, fragmentWidth / GAP_PER_WIDTH_RATIO);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n totalWidth += fragmentWidth - lostLeftWidth;\r\n currentRightGap = rightGap;\r\n\r\n if (isLeftmostFragment) {\r\n leftMostGap = leftGap;\r\n leftMostLetter = fragment[0];\r\n }\r\n }\r\n else {\r\n const { boundWidth } = getLetterWidth({ ctx, letter: fragment, isLastOfLine, fontStyle, metricMethod, xRatio });\r\n const fragmentWidth = boundWidth * letterSpacingRatio;\r\n const leftGap = Math.max(defaultGap, fragmentWidth / GAP_PER_WIDTH_RATIO);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n totalWidth += fragmentWidth - lostLeftWidth;\r\n currentRightGap = rightGap;\r\n if (\r\n (format === 'ocg' || (format === 'tcg' && /\\s+/.test(fragment)))\r\n && NoSpaceRegex.test(fragment) === false\r\n ) {\r\n spaceCount += 1;\r\n if (cnt === fragmentList.length - 1) spaceAtEnd = true;\r\n }\r\n if (isLeftmostFragment) {\r\n leftMostGap = leftGap;\r\n leftMostLetter = fragment[0];\r\n }\r\n if (OCGNoOverheadGapRegex.test(fragment)) {\r\n leftMostGap = 0;\r\n currentRightGap = 0;\r\n }\r\n }\r\n }\r\n\r\n return {\r\n totalWidth,\r\n spaceCount,\r\n spaceAtEnd,\r\n leftMostLetter,\r\n rightGap: currentRightGap,\r\n leftGap: leftMostGap,\r\n offsetable,\r\n };\r\n};\r\n\r\n/**\r\n * Analyze a line again after we split it with suitable ratio. Text in line are justify-aligned, so we will calculate the sum of width of all tokens, then distribute the remaining space to the amount of whitespaces in the line, that means each whitespace will have additional width add into them so that the line fit perfectly into the available space.\r\n * \r\n * Special treatment for last line of a paragraph, because the last line may not be filled entirely unlike all the lines above, we will decide a threshold for them, if the remaining space is too large, we do not distribute them and just left the line as-is.\r\n */\r\nexport const analyzeLine = ({\r\n ctx,\r\n line,\r\n width,\r\n xRatio: baseXRatio,\r\n format,\r\n isLast,\r\n textData,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n line: string,\r\n width: number,\r\n xRatio: number,\r\n format: string,\r\n isLast: boolean,\r\n textData: TextData,\r\n}) => {\r\n const tokenList = tokenizeText(line);\r\n let totalContentWidth = 0;\r\n let lineSpaceCount = 0;\r\n let currentGap = 0;\r\n\r\n for (let cnt = 0, xRatio = baseXRatio; cnt < tokenList.length; cnt++) {\r\n const token = tokenList[cnt];\r\n const nextToken = tokenList[cnt + 1];\r\n /** Non-compressable mode */\r\n if (token === NB_UNCOMPRESSED_START) {\r\n xRatio = 1;\r\n continue;\r\n }\r\n else if (token === NB_UNCOMPRESSED_END) {\r\n xRatio = baseXRatio;\r\n continue;\r\n }\r\n const {\r\n spaceCount,\r\n totalWidth,\r\n spaceAtEnd,\r\n leftGap,\r\n rightGap,\r\n leftMostLetter,\r\n } = analyzeToken({ ctx, token, nextToken, xRatio, previousTokenGap: currentGap / xRatio, textData, format });\r\n /** Check `createLineList` function about first token indentation. */\r\n const indent = (\r\n (cnt === 0 && leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT, leftGap * xRatio) * -1 : 0)\r\n +\r\n (cnt === 0 && OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET * xRatio : 0)\r\n );\r\n\r\n currentGap = rightGap * xRatio;\r\n totalContentWidth += totalWidth * xRatio + indent;\r\n lineSpaceCount += spaceCount - (spaceAtEnd && nextToken === undefined ? 1 : 0);\r\n }\r\n const expectedSpaceWidth = lineSpaceCount > 0 ? (width - totalContentWidth) / lineSpaceCount : 0;\r\n const spaceWidth = isLast\r\n ? format === 'tcg'\r\n ? expectedSpaceWidth > 1.500 ? 0 : expectedSpaceWidth\r\n : expectedSpaceWidth > 3.650 ? 0 : expectedSpaceWidth\r\n : expectedSpaceWidth;\r\n\r\n return {\r\n tokenList,\r\n spaceWidth,\r\n };\r\n};","import {\r\n OCGAlphabetRegex,\r\n MAX_LINE_REVERSE_INDENT,\r\n START_OF_LINE_ALPHABET_OFFSET,\r\n TextData,\r\n NB_UNCOMPRESSED_END,\r\n NB_UNCOMPRESSED_START,\r\n} from 'src/model';\r\nimport { tokenizeText } from './text-util';\r\nimport { analyzeToken } from './text-analyze';\r\n\r\n/** Turn a paragraph into a list of lines with provided ratio (median). Basically we test with some ratio until reach a desirable list. Each line contains the information about its content, its actual width and whether or not it is the last line of a paragraph. Easy to see that actual width of all tokens on a line is always smaller or equal to the hypothesis width of the line. */\r\nexport const createLineList = ({\r\n ctx,\r\n median,\r\n paragraphList,\r\n additionalLineCount = 0,\r\n width,\r\n format,\r\n textData,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n median: number,\r\n width: number,\r\n paragraphList: string[],\r\n additionalLineCount?: number,\r\n format: string,\r\n textData: TextData,\r\n}) => {\r\n const { fontData, fontLevel } = textData;\r\n const { letterSpacing } = fontData.fontList[fontLevel];\r\n const currentLineList: { line: string, isLast: boolean, effectiveMedian: number, actualLineWidth: number }[] = [];\r\n const currentLineCount = paragraphList.reduce((accumulatedLineCount, curr) => {\r\n // Calculate hypothesis canvas width with the provided median ratio\r\n const baseXRatio = (median <= 100 ? 100 : median) / 1000;\r\n const scaledWidth = width / baseXRatio;\r\n const tokenList = tokenizeText(curr, true);\r\n let addedLineCount = 1;\r\n let wordList: string[] = [];\r\n let currentLineWidth = 0;\r\n let currentGap = 0;\r\n let unCompressedFlag = 0;\r\n\r\n for (let cnt = 0, xRatio = baseXRatio; cnt < tokenList.length; cnt++) {\r\n const token = tokenList[cnt];\r\n const nextToken = tokenList[cnt + 1];\r\n /** Because NB_UNCOMPRESS control letters may affect multiple lines, but we want to reduce the dependencies between each line as much as possible (in other words, each line should not know about the line below or above it).\r\n * To solve this, we will automatically add a NB_UNCOMPRESS_END letter to the end of a sentence, if it has an unclosed NB_UNCOMPRESS_START letter somewhere. Then we will add a NB_UNCOMPRESS_START letter immediately at the start of the next line.\r\n * Control letters do not get draw so this will not affect the calculation result.\r\n */\r\n if (token === NB_UNCOMPRESSED_START) {\r\n unCompressedFlag += 1;\r\n xRatio = 1;\r\n } else if (token === NB_UNCOMPRESSED_END) {\r\n unCompressedFlag -= 1;\r\n xRatio = baseXRatio;\r\n }\r\n let {\r\n leftMostLetter,\r\n totalWidth,\r\n rightGap,\r\n leftGap,\r\n } = analyzeToken({ ctx, token, nextToken, xRatio, previousTokenGap: currentGap, format, letterSpacing, textData });\r\n\r\n /** First token of a line may have the head text overflow to the left of the paragraph. On one hand we ensure that the foot text of that token does not overflow, on the other hand we also ensure that the head text cannot overflow too far so it overlap with the section's border (if any).\r\n */\r\n const indent = cnt === 0\r\n ? (leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT / xRatio, leftGap) * -1 : 0)\r\n + (OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET : 0)\r\n : 0;\r\n let tokenWidth = totalWidth / (unCompressedFlag > 0 ? baseXRatio : 1) + indent;\r\n /** Last token is not allowed to become overflow (no known cases said otherwise). */\r\n if (currentLineWidth + tokenWidth > scaledWidth) {\r\n let line = wordList.join('').trim();\r\n if (unCompressedFlag > 0) line = line + NB_UNCOMPRESSED_END;\r\n if (unCompressedFlag < 0) line = NB_UNCOMPRESSED_START + line;\r\n unCompressedFlag = 0;\r\n currentLineList.push({\r\n line,\r\n effectiveMedian: median,\r\n isLast: false,\r\n actualLineWidth: currentLineWidth,\r\n });\r\n /** If the next token is gonna made the line become overflow, we will create a new line with it becoming the first token. We also re-calulate the width of that token since now the right side of it is not the \"previous token\" anymore, but the edge of a new line. */\r\n let {\r\n totalWidth,\r\n rightGap,\r\n leftGap,\r\n } = analyzeToken({ ctx, token, nextToken, xRatio, previousTokenGap: 0, format, textData });\r\n /** Of course we also re-calculate overflow possibility. */\r\n const indent = (leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT / xRatio, leftGap) * -1 : 0)\r\n + (OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET : 0);\r\n let tokenWidth = totalWidth + indent;\r\n currentLineWidth = tokenWidth;\r\n currentGap = rightGap;\r\n wordList = [token];\r\n addedLineCount += 1;\r\n } else {\r\n currentLineWidth += tokenWidth;\r\n currentGap = rightGap;\r\n wordList.push(token);\r\n }\r\n }\r\n\r\n /** If no more tokens left in the sentence, wrap them into the last line. */\r\n let line = wordList.join('').trim();\r\n if (unCompressedFlag > 0) line = line + NB_UNCOMPRESSED_END;\r\n if (unCompressedFlag < 0) line = NB_UNCOMPRESSED_START + line;\r\n unCompressedFlag = 0;\r\n currentLineList.push({\r\n line,\r\n effectiveMedian: median,\r\n isLast: true,\r\n actualLineWidth: currentLineWidth,\r\n });\r\n\r\n return accumulatedLineCount + addedLineCount;\r\n }, 0) + (additionalLineCount ?? 0);\r\n\r\n return { currentLineList, currentLineCount };\r\n};","import {\r\n analyzeHeadText,\r\n getTextWorker,\r\n} from './text-util';\r\nimport { getLetterWidth } from './letter';\r\nimport { RUBY_BONUS_RATIO } from 'src/model';\r\n\r\n/** Fill head text, by furigana rules, they have their own scaling space so they do not necessarily respect current ratio of the foot text. This function receive true coordinations.\r\n * \r\n * Head text has four cases of compression:\r\n * * Case 1: They do not condense at all, this is the default case for single-letter foot text.\r\n * * Case 2: They condense with a smaller rate compare to foot text, this is the default case for multiple-letters foot text.\r\n * * Case 3: They condense because the head text is way wider than the foot text, especially in the case of single-letter foot text.\r\n * * Case 4: They condense because overflow mode is explicitly set to `condense` by compressable ruby syntax. This prevent them from growth out of foot text's boundary, and has the highest priority, but only apply in the case of multiple-letters foot text.\r\n*/\r\nexport const fillHeadText = ({\r\n ctx,\r\n fontSize,\r\n edge, baseline,\r\n headText, headTextLetterWidth,\r\n footText, footTextWidth,\r\n headTextGap,\r\n headTextSpacing,\r\n headTextHeightRatio,\r\n headTextBold,\r\n headTextGapRatio,\r\n xRatio,\r\n fontStyle,\r\n textWorker,\r\n fitFootText,\r\n headTextOverflow,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n fontSize: number,\r\n headText: string, headTextLetterWidth: number,\r\n footText: string, footTextWidth: number,\r\n edge: number, baseline: number,\r\n headTextGap: number,\r\n headTextSpacing: number,\r\n headTextHeightRatio: number,\r\n headTextBold: boolean,\r\n headTextGapRatio: number,\r\n xRatio: number,\r\n fontStyle: string,\r\n textWorker: ReturnType,\r\n fitFootText: boolean,\r\n headTextOverflow: 'normal' | 'condense',\r\n}) => {\r\n const { applyFuriganaFont, stopApplyFuriganaFont, resetScale, applyScale } = textWorker;\r\n /** Custom ratio for case 2 */\r\n const externalHeadTextXRatio = (headTextOverflow === 'condense' && footText.length > 1)\r\n ? Math.min(1, xRatio + RUBY_BONUS_RATIO)\r\n : 0;\r\n const {\r\n gapPadding,\r\n letterSpacing,\r\n trueHeadTextWidth,\r\n halfGap,\r\n alignment,\r\n headTextXRatio,\r\n } = analyzeHeadText({\r\n headText, headTextLetterWidth,\r\n footText, footTextWidth: footTextWidth * xRatio,\r\n headTextGap, headTextSpacing: headTextSpacing * xRatio,\r\n gapPadding: fontSize * headTextGapRatio,\r\n fitFootText,\r\n sentenceXRatio: xRatio,\r\n xRatio: externalHeadTextXRatio,\r\n });\r\n const overflow = trueHeadTextWidth > footTextWidth * xRatio;\r\n\r\n if (headText.length === 0) return {\r\n trueHeadTextWidth,\r\n halfGap,\r\n };\r\n\r\n /** Custom ratio for case 4 */\r\n const baseLoneTokenRatio = fitFootText\r\n ? Math.min(1, footTextWidth * xRatio / trueHeadTextWidth)\r\n : 1;\r\n\r\n /** Priority: Case 4 => Case 3 and 2, in practice, case 2 and 3 are usually mutual exclusive, because case 2 currently only apply in card's name, while all case 3 only happens in card's effect. */\r\n const finalizedRatio = fitFootText\r\n ? baseLoneTokenRatio\r\n : (externalHeadTextXRatio && alignment === 'center')\r\n ? externalHeadTextXRatio\r\n : headTextXRatio;\r\n\r\n let currentEdge = edge;\r\n resetScale();\r\n if (fitFootText || finalizedRatio) {\r\n applyScale(finalizedRatio, 1);\r\n currentEdge = edge / finalizedRatio;\r\n }\r\n\r\n if (alignment === 'center') {\r\n currentEdge += gapPadding;\r\n /** Adjust head text's drawing position to fit case. */\r\n if (!overflow) {\r\n currentEdge += (footTextWidth * xRatio - trueHeadTextWidth) / 2;\r\n } else if (finalizedRatio > baseLoneTokenRatio) {\r\n currentEdge += (footTextWidth * xRatio / finalizedRatio - trueHeadTextWidth) / 2 / finalizedRatio;\r\n }\r\n } else {\r\n currentEdge += letterSpacing / 2;\r\n }\r\n\r\n for (const letter of headText) {\r\n /** `getLetterWidth` does not run properly in the case of bold font, so we must turn it off when calculating text width, before turn in on again and draw the actual text. */\r\n applyFuriganaFont();\r\n const { width, boundWidth } = getLetterWidth({ ctx, letter, fontStyle, metricMethod: 'furigana', xRatio: 1 });\r\n const boundingOffset = (width - boundWidth) / 2;\r\n stopApplyFuriganaFont();\r\n\r\n applyFuriganaFont(headTextBold);\r\n ctx.fillText(letter, currentEdge - boundingOffset, baseline - fontSize * headTextHeightRatio);\r\n stopApplyFuriganaFont();\r\n currentEdge += (boundWidth + letterSpacing);\r\n }\r\n if (fitFootText || finalizedRatio) {\r\n resetScale();\r\n }\r\n applyScale(xRatio, 1);\r\n\r\n return {\r\n trueHeadTextWidth,\r\n halfGap,\r\n };\r\n};","import {\r\n BULLET_LETTER,\r\n CapitalLetterRegex,\r\n DefaultFontData,\r\n DefaultFontSizeData,\r\n FragmentSplitRegex,\r\n LETTER_GAP_RATIO,\r\n MAX_LINE_REVERSE_INDENT,\r\n NB_UNCOMPRESSED_END,\r\n NB_UNCOMPRESSED_START,\r\n NoSpaceRegex,\r\n NonCompressableRegex,\r\n NumberRegex,\r\n OCGAlphabetRegex,\r\n OCGNoOverheadGapRegex,\r\n RUBY_BONUS_RATIO,\r\n RUBY_REGEX,\r\n START_OF_LINE_ALPHABET_OFFSET,\r\n ST_ICON_SYMBOL,\r\n SquareBracketLetterRegex,\r\n TCGSymbolLetterRegex,\r\n TextData,\r\n WholeWordRegex,\r\n getBulletSpacing,\r\n} from 'src/model';\r\nimport {\r\n drawBullet,\r\n getLostLeftWidth,\r\n analyzeHeadText,\r\n getTextWorker,\r\n tokenizeText,\r\n} from './text-util';\r\nimport { analyzeToken } from './text-analyze';\r\nimport { TextDrawer, drawLetter, getLetterWidth } from './letter';\r\nimport { fillHeadText } from './text-overhead';\r\nimport { drawMarker } from './canvas-util';\r\n\r\n/**\r\n * This is the heart and soul of drawer, please test this thoroughly for each change.\r\n * \r\n * @summary Text hierachy\r\n * * Letter: Individual (1) letter. E.g. \"a\", \"1\", \"み\", \"装\", \"-\", \"①\"\r\n * * Fragment: Multiple letters with decorate control characters. E.g. \"{無|む}\", \"Damage\"\r\n * * Token: Multiple fragments with group control characters (NB_WORD_OPEN and NB_WORD_CLOSE) or a whole word, splitted by space or other breakable letters. E.g. \"⦉{相|あい}{手|て}⦊\"\r\n * * Sentence: Sequence of tokens. E.g. \"Cannot be destroyed by battle or card effects\"\r\n * * Paragraph: Consecutive sentences without new line characters (\"\\n\").\r\n * * Block: Whole text in a section.\r\n * \r\n * Line: Line is a special unit, when a sentence hit the end of current text box, it wrap to new line without using the actual new line character. In this case the sentence is broke down into multiple lines. Line can be manully enforced with line control characters (NB_LINE_OPEN and NB_LINE_CLOSE), or created from text split function.\r\n * **/\r\nexport const drawLine = ({\r\n ctx,\r\n tokenList,\r\n trueEdge, trueBaseline,\r\n spaceWidth = 0,\r\n xRatio: baseXRatio, yRatio = 1,\r\n textData,\r\n format,\r\n textDrawer,\r\n debug = false,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n format: string,\r\n tokenList: string[],\r\n xRatio: number,\r\n yRatio?: number,\r\n trueEdge: number,\r\n trueBaseline: number,\r\n spaceWidth?: number,\r\n textData: TextData,\r\n textDrawer?: TextDrawer,\r\n debug?: boolean,\r\n}) => {\r\n const {\r\n currentFont,\r\n fontData,\r\n fontLevel,\r\n } = textData;\r\n const fontSizeData = fontData.fontList[fontLevel];\r\n const {\r\n headTextFillStyle,\r\n headTextBold = DefaultFontData.headTextBold,\r\n headTextHeightRatio = DefaultFontData.headTextHeightRatio,\r\n headTextOverflow = DefaultFontData.headTextOverflow,\r\n headTextGapRatio = DefaultFontData.headTextGapRatio,\r\n metricMethod,\r\n fontStyle,\r\n letterDeviationMap = {},\r\n } = fontData;\r\n const {\r\n bulletSymbolWidth,\r\n capitalLetterRatio = DefaultFontSizeData.capitalLetterRatio,\r\n fontSize,\r\n headTextSpacing = DefaultFontSizeData.headTextSpacing,\r\n iconSymbolWidth = bulletSymbolWidth,\r\n largeSymbolRatio = DefaultFontSizeData.largeSymbolRatio,\r\n letterSpacing = DefaultFontSizeData.letterSpacing,\r\n ordinalFontOffsetY = DefaultFontSizeData.ordinalFontOffsetY,\r\n squareBracketRatio = DefaultFontSizeData.squareBracketRatio,\r\n wordLetterSpacing,\r\n } = fontSizeData;\r\n const textWorker = getTextWorker(ctx, fontData, fontSizeData, currentFont);\r\n const {\r\n stopApplyFuriganaFont, applyFuriganaFont,\r\n stopApplyLargerText, applyLargerText,\r\n stopApplyNumberFont, applyNumberFont,\r\n stopApplyOrdinalFont, applyOrdinalFont,\r\n applyScale, reverseScale,\r\n applySymbolFont, stopApplySymbolFont,\r\n applyAsymmetricScale, resetScale,\r\n } = textWorker;\r\n\r\n const letterSpacingRatio = 1 + letterSpacing / 2;\r\n const baseline = trueBaseline / yRatio;\r\n let previousTokenGap = 0;\r\n let iconPositionList: { edge: number, size: number, baseline: number }[] = [];\r\n let previousTokenRebalanceOffset = 0;\r\n let tokenEdge = trueEdge;\r\n\r\n /** To reach a acceptable degree of calculation, we usually need to look ahead 1 or 2 next tokens, same with fragments. */\r\n /** To prevent cascading calculation, we disconnect the relationship between fragments and tokens. We use all information to calculate an empty space for each token, then fragments of that token is drawn inside that empty space assuming they would fit. In other words, drawing fragments of a token DOES NOT interfere with the next token. That means in theory we can skip all fragments of a token to draw the next token right away.\r\n */\r\n for (let tokenCnt = 0, xRatio = baseXRatio; tokenCnt < tokenList.length; tokenCnt++) {\r\n const token = tokenList[tokenCnt];\r\n /** Turn on/off non-condenseable mode */\r\n if (token === NB_UNCOMPRESSED_START) {\r\n xRatio = 1;\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n continue;\r\n }\r\n else if (token === NB_UNCOMPRESSED_END) {\r\n xRatio = baseXRatio;\r\n ctx.scale(xRatio, 1);\r\n continue;\r\n }\r\n const gapRatio = LETTER_GAP_RATIO * xRatio;\r\n const defaultGap = fontSize * gapRatio;\r\n const nextToken = tokenList[tokenCnt + 1];\r\n const next2ndToken = tokenList[tokenCnt + 2];\r\n const analyzeTokenParameter = {\r\n ctx,\r\n xRatio,\r\n letterSpacing,\r\n format,\r\n textData,\r\n };\r\n const drawLetterParameter = {\r\n ctx,\r\n baseline,\r\n xRatio,\r\n textDrawer,\r\n };\r\n const fragmentList = token.split(FragmentSplitRegex).filter(entry => entry != null && entry !== '');\r\n /** Analyze current token again, this will dictate the width of a token, no matter what is actually drawn. We expect to draw nothing but the calculation must stay correct. */\r\n const {\r\n leftMostLetter,\r\n leftGap,\r\n rightGap: tokenRightGap,\r\n totalWidth: totalTokenWidth,\r\n spaceCount,\r\n } = analyzeToken({\r\n token, nextToken, previousTokenGap: previousTokenGap / xRatio, ...analyzeTokenParameter,\r\n });\r\n\r\n /** Again, first token indentation. */\r\n const indent = tokenCnt === 0\r\n ? (leftGap > 0 ? Math.min(MAX_LINE_REVERSE_INDENT, leftGap * xRatio) * -1 : 0)\r\n + (OCGAlphabetRegex.test(leftMostLetter) ? START_OF_LINE_ALPHABET_OFFSET : 0)\r\n : 0;\r\n let fragmentEdge = tokenEdge + indent;\r\n let currentRightGap = previousTokenGap;\r\n\r\n /** Draw all the fragments of a token. */\r\n for (let fragmentCnt = 0; fragmentCnt < fragmentList.length; fragmentCnt++) {\r\n const fragment = fragmentList[fragmentCnt];\r\n const nextFragment = fragmentList[fragmentCnt + 1] ?? nextToken;\r\n const next2ndFragment = fragmentList[tokenCnt + 2] ?? next2ndToken;\r\n\r\n /** These fragments do not have any visual */\r\n if (token === NB_UNCOMPRESSED_START || token === NB_UNCOMPRESSED_END) {}\r\n /** We do not actually draw S/T Icon here, but we record its position and leave a suitable space for it. */\r\n else if (fragment === ST_ICON_SYMBOL) {\r\n iconPositionList.push({ edge: fragmentEdge, size: iconSymbolWidth, baseline });\r\n fragmentEdge += iconSymbolWidth * letterSpacingRatio;\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** Bullet symbol ● is not condenseable, and has specialized draw worker. */\r\n else if (fragment === BULLET_LETTER) {\r\n resetScale();\r\n drawBullet(ctx, fragmentEdge, trueBaseline, bulletSymbolWidth, getBulletSpacing(format));\r\n fragmentEdge += bulletSymbolWidth * letterSpacingRatio;\r\n applyAsymmetricScale(xRatio, yRatio);\r\n\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** Copyright symbol © is not condenseable and use larger font. */\r\n else if (/[©]/.test(fragment)) {\r\n resetScale();\r\n applyLargerText(largeSymbolRatio);\r\n drawLetter({\r\n ...drawLetterParameter,\r\n letter: fragment,\r\n edge: fragmentEdge * xRatio,\r\n baseline: trueBaseline + (format === 'tcg' ? 1 : 2),\r\n });\r\n fragmentEdge += ctx.measureText(fragment).width * letterSpacingRatio;\r\n stopApplyLargerText();\r\n applyAsymmetricScale(xRatio, yRatio);\r\n\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** OCG Ordinal symbol is not condenseable and use different font. */\r\n else if (NonCompressableRegex.test(fragment)) {\r\n resetScale();\r\n applyOrdinalFont();\r\n drawLetter({\r\n ...drawLetterParameter,\r\n letter: fragment,\r\n edge: fragmentEdge * xRatio,\r\n baseline: trueBaseline + ordinalFontOffsetY,\r\n });\r\n fragmentEdge += ctx.measureText(fragment).width * letterSpacingRatio;\r\n stopApplyOrdinalFont();\r\n applyAsymmetricScale(xRatio, yRatio);\r\n\r\n fragmentEdge += spaceWidth;\r\n currentRightGap = 0;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** Fragment with overhead text. */\r\n else if (RUBY_REGEX.test(fragment)) {\r\n const [footText, rubyType, headText = ''] = fragment.replaceAll(/{|}/g, '').split(/(\\|+)/);\r\n const fitFootText = rubyType === '||';\r\n /** We do not support nested overhead text. */\r\n const { totalWidth: footTextWidth } = analyzeToken({\r\n token: footText, nextToken: nextFragment,\r\n previousTokenGap: 0,\r\n ...analyzeTokenParameter,\r\n });\r\n\r\n /** Calculate letter width first before deciding the spacing. */\r\n applyFuriganaFont();\r\n const headTextLetterWidth = headText\r\n .split('')\r\n .map(letter => getLetterWidth({ ctx, letter, fontStyle, metricMethod: 'furigana', xRatio: 1 }).boundWidth)\r\n .reduce((acc, cur) => acc + cur, 0);\r\n stopApplyFuriganaFont();\r\n\r\n /** Notice what is scaled and what is not in those params. It is a headache to work with sometime. */\r\n const {\r\n headTextWidth,\r\n halfGap: baseHalfGap,\r\n } = analyzeHeadText({\r\n headText,\r\n headTextLetterWidth,\r\n footText,\r\n footTextWidth: footTextWidth * xRatio,\r\n headTextGap: defaultGap,\r\n headTextSpacing: headTextSpacing * xRatio,\r\n gapPadding: fontSize * headTextGapRatio,\r\n fitFootText,\r\n sentenceXRatio: xRatio,\r\n xRatio: (headTextOverflow === 'condense' && footText.length > 1) ? Math.min(1, xRatio + RUBY_BONUS_RATIO) : 0,\r\n });\r\n const halfGap = headText.length === 0\r\n ? Math.max(defaultGap, footTextWidth * gapRatio)\r\n : baseHalfGap;\r\n const rightGap = halfGap;\r\n const leftGap = halfGap;\r\n /** Lost left width because of negative gap of the previous fragment OR token */\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n const vacantLeftWidth = leftGap > 0 ? leftGap - lostLeftWidth : 0;\r\n\r\n const {\r\n offsetable: isNextTokenOffsetable,\r\n leftGap: nextUncompressedLeftGap\r\n } = analyzeToken({\r\n token: nextFragment, nextToken: next2ndFragment,\r\n previousTokenGap: rightGap / xRatio,\r\n ...analyzeTokenParameter,\r\n });\r\n const nextLeftGap = nextUncompressedLeftGap * xRatio;\r\n const lostRightWidth = getLostLeftWidth(rightGap, nextLeftGap);\r\n const vacantRightWidth = rightGap > 0 ? rightGap - lostRightWidth : 0;\r\n const totalVacantSpace = vacantLeftWidth + vacantRightWidth;\r\n let rebalancedSpace = 0;\r\n let nextTokenRebalanceOffset = 0;\r\n\r\n /** Rebalance tactic here. In essential, we try to calculate the empty space of a fragment. These spaces are because the head text is too long compare to the foot text underneath. Then we divide those spaces in such a way that the foot text has roughly equal space each side so they looks more pleasant. */\r\n if (totalVacantSpace > 0 && nextLeftGap >= -2 && isNextTokenOffsetable) {\r\n rebalancedSpace = (totalVacantSpace + Math.max(nextLeftGap, 0) * 2) / 3;\r\n nextTokenRebalanceOffset = Math.max(nextLeftGap, 0) - rebalancedSpace;\r\n } else {\r\n // rebalancedSpace = totalVacantSpace / 2;\r\n rebalancedSpace = vacantLeftWidth;\r\n }\r\n const footTextFragmentEdge = fragmentEdge\r\n + (halfGap < 0 ? -lostLeftWidth : (indent ? -indent : rebalancedSpace))\r\n + previousTokenRebalanceOffset;\r\n previousTokenRebalanceOffset = nextTokenRebalanceOffset;\r\n\r\n /** Draw actual foot text here */\r\n drawLine({\r\n ctx,\r\n format,\r\n textData,\r\n tokenList: tokenizeText(footText),\r\n trueBaseline: baseline,\r\n trueEdge: footTextFragmentEdge,\r\n xRatio,\r\n yRatio,\r\n spaceWidth: 0,\r\n textDrawer,\r\n debug: false,\r\n });\r\n\r\n /** Head text may have different text style than foot text, so we store the current style before start drawing head text. */\r\n const currentFillStyle = ctx.fillStyle;\r\n const currentStrokeStyle = ctx.strokeStyle;\r\n const currentShadowColor = ctx.shadowColor;\r\n const currentShadowOffsetX = ctx.shadowOffsetX;\r\n const currentShadowOffsetY = ctx.shadowOffsetY;\r\n const currentShadowBlur = ctx.shadowBlur;\r\n if (headTextFillStyle) {\r\n ctx.fillStyle = headTextFillStyle;\r\n ctx.strokeStyle = '';\r\n ctx.shadowColor = '';\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowBlur = 0;\r\n }\r\n /** Draw head text here, remember head text and foot text most of the time do not align at all. */\r\n const headTextFragmentEdge = fragmentEdge - lostLeftWidth;\r\n fillHeadText({\r\n ctx,\r\n fontSize,\r\n edge: headTextFragmentEdge, baseline,\r\n headText, headTextLetterWidth,\r\n footText, footTextWidth,\r\n headTextGap: defaultGap,\r\n headTextSpacing,\r\n headTextHeightRatio,\r\n headTextBold,\r\n headTextGapRatio,\r\n xRatio,\r\n fontStyle,\r\n textWorker,\r\n fitFootText,\r\n headTextOverflow,\r\n });\r\n /** Restore foot text's original style */\r\n ctx.fillStyle = currentFillStyle;\r\n ctx.strokeStyle = currentStrokeStyle;\r\n ctx.shadowColor = currentShadowColor;\r\n ctx.shadowOffsetX = currentShadowOffsetX;\r\n ctx.shadowOffsetY = currentShadowOffsetY;\r\n ctx.shadowBlur = currentShadowBlur;\r\n\r\n fragmentEdge += Math.max(footTextWidth * xRatio, headTextWidth) - lostLeftWidth + spaceWidth;\r\n currentRightGap = rightGap;\r\n }\r\n /** Draw \"whole words\". */\r\n else if (WholeWordRegex.test(fragment)) {\r\n const normalizedWordSpacingRatio = wordLetterSpacing\r\n ? 1 + wordLetterSpacing / 2\r\n : letterSpacingRatio;\r\n ctx.letterSpacing = `${(normalizedWordSpacingRatio - 1) * currentFont.getFontInfo().sizeAsNumber}px`;\r\n\r\n /**\r\n * A problem here: We cannot calculate the gap of a fragment unless knowing its actual width, so that means we must calculate it first, then calculate the gap, then go back and calculate the actual width all over again when we draw. These are doable but it make this ugly long code become needlessly more ugly and long. So we just naively measure the word without any kind of special treatment, take the gap based on it and call it a day.\r\n * \r\n * Even if the actual width of the fragment is different than when we measure it naively, the gap ratio itself have a bit of room for error (around 50%), so most of the time we can avoid any overlap unless in extreme condensing situation.\r\n */\r\n const fragmentNaiveWidth = ctx.measureText(fragment).width * xRatio;\r\n const leftGap = Math.max(defaultGap, fragmentNaiveWidth * gapRatio);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n fragmentEdge -= lostLeftWidth;\r\n\r\n /** Read the comment in `analyzeToken` function, we repeat exactly the treatment there, the different is we actually draw the letter along the way. */\r\n let remainFragment = fragment;\r\n let currentPosition = fragmentEdge;\r\n while (remainFragment !== '') {\r\n let currentLetter = remainFragment[0];\r\n let nextRemainFragment = remainFragment.slice(1);\r\n let actualLetterWidth = 0;\r\n const drawLetterofWordParameter = {\r\n ...drawLetterParameter,\r\n deviation: letterDeviationMap[currentLetter],\r\n letter: currentLetter,\r\n edge: currentPosition,\r\n };\r\n if (SquareBracketLetterRegex.test(currentLetter)) {\r\n applyScale(squareBracketRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter({\r\n ...drawLetterofWordParameter,\r\n edge: currentPosition / squareBracketRatio,\r\n baseline: baseline / squareBracketRatio,\r\n });\r\n reverseScale(squareBracketRatio);\r\n } else if (CapitalLetterRegex.test(currentLetter)) {\r\n applyScale(capitalLetterRatio);\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n const letterOffset = (actualLetterWidth > ctx.measureText(currentLetter).width * capitalLetterRatio)\r\n ? Math.round(actualLetterWidth * (1 - capitalLetterRatio)) / 2\r\n : 0;\r\n drawLetter({\r\n ...drawLetterofWordParameter,\r\n edge: currentPosition / capitalLetterRatio + letterOffset,\r\n baseline: baseline / capitalLetterRatio\r\n });\r\n reverseScale(capitalLetterRatio);\r\n } else if (NumberRegex.test(currentLetter)) {\r\n applyNumberFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter(drawLetterofWordParameter);\r\n stopApplyNumberFont();\r\n } else if (TCGSymbolLetterRegex.test(currentLetter) && fontStyle === 'tcg') {\r\n applySymbolFont();\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter(drawLetterofWordParameter);\r\n stopApplySymbolFont();\r\n } else {\r\n actualLetterWidth = ctx.measureText(remainFragment).width - ctx.measureText(nextRemainFragment).width;\r\n drawLetter(drawLetterofWordParameter);\r\n }\r\n currentPosition += actualLetterWidth * xRatio;\r\n remainFragment = nextRemainFragment;\r\n }\r\n\r\n fragmentEdge = currentPosition;\r\n currentRightGap = rightGap;\r\n previousTokenRebalanceOffset = 0;\r\n ctx.letterSpacing = '0px';\r\n }\r\n /** Some specific letter (\"Evil★Twin's Trouble Sunny\" TCG) requires different font. */\r\n else if (TCGSymbolLetterRegex.test(fragment) && fontStyle === 'tcg') {\r\n const letter = fragment;\r\n applySymbolFont();\r\n\r\n const letterWidth = ctx.measureText(letter).width * letterSpacingRatio * xRatio;\r\n const leftGap = Math.max(defaultGap, letterWidth * gapRatio);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n fragmentEdge -= lostLeftWidth;\r\n drawLetter({ ...drawLetterParameter, letter, edge: fragmentEdge });\r\n fragmentEdge += letterWidth;\r\n\r\n stopApplySymbolFont();\r\n\r\n currentRightGap = rightGap;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n /** All other fragments */\r\n else {\r\n const letter = fragment;\r\n const letterMetric = getLetterWidth({\r\n ctx,\r\n letter,\r\n fontStyle,\r\n metricMethod,\r\n isLastOfLine: nextFragment === undefined,\r\n xRatio,\r\n });\r\n const letterWidth = letterMetric.boundWidth * letterSpacingRatio * xRatio;\r\n const leftGap = Math.max(defaultGap, letterWidth * gapRatio);\r\n const rightGap = leftGap;\r\n const lostLeftWidth = getLostLeftWidth(currentRightGap, leftGap);\r\n\r\n fragmentEdge -= lostLeftWidth;\r\n drawLetter({\r\n ...drawLetterParameter,\r\n letter,\r\n edge: fragmentEdge,\r\n deviation: letterDeviationMap[letter],\r\n letterMetric,\r\n });\r\n fragmentEdge += letterWidth;\r\n if (\r\n (format === 'ocg' || (format === 'tcg' && /\\s+/.test(letter)))\r\n && NoSpaceRegex.test(letter) !== true\r\n ) {\r\n fragmentEdge += spaceWidth;\r\n }\r\n if (!OCGNoOverheadGapRegex.test(letter)) currentRightGap = rightGap;\r\n previousTokenRebalanceOffset = 0;\r\n }\r\n }\r\n\r\n /** Make space for the next token, as we can see it does not involve any variables from the fragment drawing process. */\r\n previousTokenGap = tokenRightGap * xRatio;\r\n if (debug) drawMarker({ ctx, baseline, edge: tokenEdge, width: totalTokenWidth * xRatio, xRatio });\r\n tokenEdge += totalTokenWidth * xRatio + spaceCount * spaceWidth + indent;\r\n }\r\n\r\n return {\r\n tokenEdge,\r\n iconPositionList,\r\n };\r\n};","import {\r\n NB_LINE_OPEN,\r\n NB_LINE_CLOSE,\r\n OCG_RUBY_SOURCE,\r\n OCG_KEYWORD_SOURCE,\r\n ocgKeywordDataMap,\r\n WHOLE_WORD_SOURCE,\r\n NOT_END_OF_LINE_SOURCE,\r\n NOT_START_OF_LINE_SOURCE,\r\n NOT_SPLIT_SOURCE,\r\n OCG_BULLET_SOURCE,\r\n tcgToOCGLetterMap,\r\n ocgToTCGLetterMap,\r\n UNCOMPRESSED_SOURCE,\r\n ocgNumberCircleMap,\r\n NB_WORD_OPEN,\r\n NB_WORD_CLOSE,\r\n FLAVOR_CONDITION_SOURCE,\r\n NB_UNCOMPRESSED_START,\r\n NB_UNCOMPRESSED_END\r\n} from 'src/model';\r\n\r\nexport const splitEffect = (effect: string, isNormal = false) => {\r\n let effectText = effect;\r\n\r\n let fullLineList = [];\r\n const wholeLineRegex = new RegExp(`^(${NB_LINE_OPEN}([^${NB_LINE_CLOSE}]*)${NB_LINE_CLOSE}\\\\s*)`);\r\n let materialReplacement;\r\n let material;\r\n do {\r\n materialReplacement = wholeLineRegex.exec(effectText)?.[1];\r\n material = wholeLineRegex.exec(effectText)?.[2];\r\n\r\n if (material && materialReplacement) {\r\n fullLineList.push(material);\r\n effectText = effectText.replace(materialReplacement, '');\r\n }\r\n } while (materialReplacement && material);\r\n\r\n let effectFlavorCondition = '';\r\n const flavorConditionRegex = new RegExp(FLAVOR_CONDITION_SOURCE, 'm');\r\n const potentialFlavorConditionText = flavorConditionRegex.exec(effect)?.[1];\r\n if (potentialFlavorConditionText && isNormal) {\r\n effectFlavorCondition = potentialFlavorConditionText;\r\n effectText = effectText.replace(potentialFlavorConditionText, '');\r\n } else effectFlavorCondition = '';\r\n\r\n return {\r\n fullLineList,\r\n effectText,\r\n effectFlavorCondition,\r\n };\r\n};\r\n\r\nexport const normalizeCardText = (\r\n text: string,\r\n format: string,\r\n option?: { multiline?: boolean, furiganaHelper?: boolean, dictionaryType?: 'rubyForm' | 'rubyFormName' },\r\n) => {\r\n const {\r\n multiline = true,\r\n furiganaHelper = true,\r\n dictionaryType = 'rubyForm',\r\n } = option ?? {};\r\n const nonNullableText = text ?? '';\r\n\r\n /** Normalize the text based on format, by swapping letters to their corresponding form. For example full-width captial A \"A\" will become normal capital \"A\" after normalized. */\r\n let normalizedText = '';\r\n let letterSwapMap = format === 'ocg'\r\n ? tcgToOCGLetterMap\r\n : ocgToTCGLetterMap;\r\n for (const letter of nonNullableText) {\r\n normalizedText += letterSwapMap[letter] ?? letter;\r\n }\r\n\r\n /** OCG text sometimes enter new line follow letter \"、\" or \"。\", we will automatically join them. It is debatable whether this feature is need or not. */\r\n // const textAfterJoinRow = normalizedText.replace(/(、|。|。|、)\\n(?!●)/g, '$1');\r\n const textAfterJoinRow = normalizedText;\r\n\r\n /** Translate non-wrappable line syntax into internal control characters, beware that \"Qliphort Scout\" does use square brackets in its flavor text, so the regex must exclude that case. */\r\n const textAfterSplitBlockRow = multiline\r\n ? textAfterJoinRow\r\n .replace(/^\\[([\\w\\W]*?)\\](?=(\\n|$))/gm, `${NB_LINE_OPEN}$1${NB_LINE_CLOSE}`)\r\n : textAfterJoinRow;\r\n\r\n /** Various contextual swaps */\r\n const textAfterSwapLetter = textAfterSplitBlockRow\r\n .replace(/(^|[-\\u2014\\s([\"])'/g, '$1\\u2018') /** Turn straight single quote ' into contextual curly quote ‘ */\r\n .replace(/'/g, '\\u2019') /** Close open curly quote ’ */\r\n .replace(/(^|[-\\u2014/[(\\u2018\\s])\"/g, '$1\\u201c') /** Turn straight double quote \" into contextual curly double quote “ */\r\n .replace(/\"/g, '\\u201d') /** Close open curly double quote ” */\r\n .replace(/--/g, '\\u2014') /** Turn double dash \"--\" into em-dash \"—\" */\r\n .replace(/● /g, '●') /** Remove direct whitespace after bullet, bullet have their own fixed space that we will draw later */\r\n /** Convert ordinal shorthand syntax, for example \"(15)\" will become \"⑮\", used in OCG effect */\r\n .replace(/(\\([0-90-9]{1,2}\\))/g, m => {\r\n const correspondingCircleSymbol = ocgNumberCircleMap[m];\r\n\r\n return correspondingCircleSymbol ?? m;\r\n });\r\n\r\n const textAfterDetectBlockWord = textAfterSwapLetter\r\n /** Convert non-compressable syntax into internal control characters */\r\n .replaceAll(new RegExp(UNCOMPRESSED_SOURCE, 'g'), m => m.replaceAll('{{', NB_UNCOMPRESSED_START).replaceAll('}}', NB_UNCOMPRESSED_END))\r\n /** Convert ruby syntax into internal control characters */\r\n .replaceAll(new RegExp(OCG_RUBY_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`);\r\n\r\n /** Apply dictionary */\r\n const textAfterDictionaryMatch = format === 'tcg' || furiganaHelper === false\r\n ? textAfterDetectBlockWord\r\n : textAfterDetectBlockWord\r\n .replaceAll(new RegExp(OCG_KEYWORD_SOURCE, 'g'), m => {\r\n const keywordSubtitue = ocgKeywordDataMap[m][dictionaryType] ?? ocgKeywordDataMap[m].rubyForm;\r\n\r\n return `${NB_WORD_OPEN}${keywordSubtitue}${NB_WORD_CLOSE}`;\r\n });\r\n /** Analyze various typography rules in OCG card (mainly Kinsoku Shorit)\r\n * * Some letters cannot stand at the start of the line, so they form a block with the token before them.\r\n * * Some letters cannot stand at the end of a line, so they form a block with the token next to them.\r\n * * Some letters cannot be splitted into two lines, so they form a block with both tokens around them.\r\n * * Ordinal letters must always followed by a colon \":\", and cannot stand at the end of a line.\r\n */\r\n const textAfterProcessing = textAfterDictionaryMatch\r\n .replaceAll(new RegExp(WHOLE_WORD_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(NOT_END_OF_LINE_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(NOT_START_OF_LINE_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(NOT_SPLIT_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`)\r\n .replaceAll(new RegExp(OCG_BULLET_SOURCE, 'g'), m => `${NB_WORD_OPEN}${m}${NB_WORD_CLOSE}`);\r\n\r\n /** Eliminate overlapping group control characters, we perform a simple algorithm to reduce various overlapping forms into non-overlapping ones.\r\n * * `((()))` => `()`\r\n * * `(()())` => `()`\r\n * * `((()()))` => `()`\r\n * * `()()()` => `()()()`\r\n */\r\n let textAfterNormalizeBlockWord = [];\r\n let currentDepth = 0;\r\n for (const letter of textAfterProcessing) {\r\n if (letter === NB_WORD_OPEN) {\r\n if (currentDepth === 0) textAfterNormalizeBlockWord.push(letter);\r\n currentDepth += 1;\r\n } else if (letter === NB_WORD_CLOSE) {\r\n currentDepth -= 1;\r\n if (currentDepth === 0) textAfterNormalizeBlockWord.push(letter);\r\n } else textAfterNormalizeBlockWord.push(letter);\r\n }\r\n /** Non-wrappable line syntax has higher priority than non-wrappable word syntax, so we re-arrange control characters to fit such case. */\r\n const finalizedText = textAfterNormalizeBlockWord.join('')\r\n .replaceAll(`${NB_LINE_CLOSE}${NB_WORD_CLOSE}`, `${NB_WORD_CLOSE}${NB_LINE_CLOSE}`)\r\n .replaceAll(`${NB_WORD_OPEN}${NB_LINE_OPEN}`, `${NB_LINE_OPEN}${NB_WORD_OPEN}`)\r\n .replaceAll(`${NB_UNCOMPRESSED_START}${NB_WORD_CLOSE}`, `${NB_WORD_CLOSE}${NB_UNCOMPRESSED_START}`)\r\n .replaceAll(`${NB_WORD_OPEN}${NB_UNCOMPRESSED_END}`, `${NB_UNCOMPRESSED_END}${NB_WORD_OPEN}`)\r\n .replaceAll(`${NB_LINE_OPEN}${NB_LINE_CLOSE}`, '')\r\n .replaceAll(`${NB_WORD_OPEN}${NB_WORD_CLOSE}`, '');\r\n\r\n return finalizedText;\r\n};","import { CanvasTextStyle } from 'src/service';\r\nimport {\r\n CanvasConst,\r\n CondenseType,\r\n EffectFontData,\r\n CoordinateData,\r\n EffectCoordinateData,\r\n CondenseTolerantMap,\r\n FontData,\r\n TCGVanillaTypeStatFontList,\r\n DefaultTCGNormalFontData,\r\n} from '../../model';\r\nimport { condense, createFontGetter } from '../../util';\r\nimport { setTextStyle } from '../canvas-util';\r\nimport { createLineList } from '../line';\r\nimport { drawLine } from '../text';\r\nimport { analyzeLine } from '../text-analyze';\r\nimport { normalizeCardText, splitEffect } from '../text-normalize';\r\nimport { tokenizeText } from '../text-util';\r\n\r\n/** Sections inside effect box (stats and type) will affect the amount of line and applicaable font size use for the text. */\r\nexport const getEffectFontAndCoordinate = ({\r\n format,\r\n isNormal,\r\n statInEffect,\r\n typeInEffect,\r\n}: {\r\n format: string,\r\n statInEffect: boolean,\r\n typeInEffect: boolean,\r\n isNormal: boolean,\r\n}) => {\r\n const coordinateKey = [format, typeInEffect ? 'type' : '', statInEffect ? 'stat' : '']\r\n .filter(entry => entry !== '').join('-');\r\n const fontDataKey = [format, typeInEffect ? 'type' : '', statInEffect ? 'stat' : '']\r\n .filter(entry => entry !== '').join('-');\r\n\r\n let fontData = EffectFontData[fontDataKey];\r\n if (statInEffect && typeInEffect && isNormal && format === 'tcg') {\r\n fontData = DefaultTCGNormalFontData;\r\n fontData.fontList = TCGVanillaTypeStatFontList;\r\n }\r\n\r\n return {\r\n fontData,\r\n sizeList: EffectCoordinateData[coordinateKey],\r\n };\r\n};\r\n\r\nconst {\r\n width: CanvasWidth,\r\n} = CanvasConst;\r\nexport const drawEffect = ({\r\n ctx,\r\n content,\r\n isNormal = false,\r\n fontData = EffectFontData.tcg,\r\n textStyle,\r\n sizeList = EffectCoordinateData['tcg-type'],\r\n condenseTolerant = 'strict',\r\n format,\r\n furiganaHelper,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n content: string,\r\n isNormal?: boolean,\r\n fontData?: FontData,\r\n textStyle?: CanvasTextStyle,\r\n sizeList?: CoordinateData[],\r\n condenseTolerant?: CondenseType,\r\n format: string,\r\n furiganaHelper: boolean,\r\n}) => {\r\n let effectSizeLevel = 0;\r\n if (!ctx || !content) return effectSizeLevel;\r\n\r\n const normalizedContent = normalizeCardText(content.trim(), format, { furiganaHelper });\r\n const tolerancePerSentence: Record = format === 'tcg'\r\n ? CondenseTolerantMap[condenseTolerant] ?? CondenseTolerantMap['strict']\r\n : {\r\n '1': 800,\r\n '2': 800,\r\n '3': 800,\r\n };\r\n const {\r\n effectText,\r\n effectFlavorCondition,\r\n fullLineList,\r\n } = splitEffect(normalizedContent, isNormal);\r\n\r\n const additionalLineCount = (fullLineList.length ?? 0) + (effectFlavorCondition.length > 0 ? 1 : 0);\r\n const paragraphList = effectText ? effectText.split('\\n') : [];\r\n\r\n const { font, fontList } = fontData;\r\n const yRatio = 1;\r\n /** We basically go through each font size, then iterating the content multiple time with different condense ratio until the text is both fit inside the max amount of lines AND the ratio is larger than the current limit threshold. */\r\n while (effectSizeLevel < fontList.length) {\r\n const fontSizeData = fontList[effectSizeLevel];\r\n const {\r\n fontSize,\r\n lineHeight,\r\n lineCount,\r\n } = fontSizeData;\r\n const {\r\n trueEdge,\r\n trueWidth: trueWidthStart,\r\n trueBaseline: trueBaselineStart,\r\n } = sizeList[effectSizeLevel] ?? sizeList[sizeList.length - 1];\r\n const width = (isNormal && format === 'tcg') ? trueWidthStart - 2 : trueWidthStart;\r\n\r\n const currentFont = createFontGetter();\r\n ctx.font = currentFont\r\n .setStyle(isNormal && format === 'tcg' ? 'italic' : '')\r\n .setWeight(format === 'tcg' ? '' : '')\r\n .setSize(fontSize)\r\n .setFamily(font)\r\n .getFont();\r\n ctx.textAlign = 'left';\r\n const textData = {\r\n fontData,\r\n fontLevel: effectSizeLevel,\r\n currentFont,\r\n };\r\n // [CREATE SENTENCE ON EACH LINE]\r\n let lineListWithRatio: { line: string, isLast: boolean, effectiveMedian: number }[] = [];\r\n\r\n // [FIND SUITABLE CONDENSE RATIO]\r\n const effectiveMedian = condense(\r\n median => {\r\n const { currentLineList, currentLineCount } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList,\r\n additionalLineCount,\r\n format, textData,\r\n width,\r\n });\r\n lineListWithRatio = currentLineList;\r\n\r\n if (currentLineCount > lineCount) return false;\r\n return true;\r\n },\r\n 200,\r\n );\r\n\r\n // [START DRAWING]\r\n /** Usually effect only consist of 1 or 2 paragraphs, but in TCG they try to put each bullet clause in a new line, resulting many more. Still we don't know if having different tolerance based on amount of paragraph is correct or not, since it is very hard to survey the condensation of a real card. */\r\n const resetStyle = setTextStyle({ ctx, ...textStyle });\r\n const tolerantValue = tolerancePerSentence[`${paragraphList.length}`] ?? tolerancePerSentence['3'];\r\n if (\r\n (effectiveMedian < tolerantValue)\r\n && (effectSizeLevel < fontList.length - 1)\r\n ) {\r\n effectSizeLevel += 1;\r\n } else {\r\n ctx.clearRect(0, 0, CanvasWidth, 1111);\r\n\r\n let trueBaseline = trueBaselineStart + lineHeight;\r\n /** Naturally, non-brekable lines have their own condense ratio. */\r\n const fullLineListWithRatio = fullLineList.map(line => {\r\n return {\r\n line,\r\n isLast: true,\r\n effectiveMedian: condense(\r\n median => {\r\n const { currentLineCount } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [line],\r\n format, textData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n return true;\r\n },\r\n )\r\n };\r\n });\r\n\r\n /** Draw each line based on their token list and corresponding ratio. */\r\n [\r\n ...fullLineListWithRatio,\r\n ...lineListWithRatio,\r\n ].forEach(({\r\n line,\r\n isLast,\r\n effectiveMedian,\r\n }) => {\r\n const xRatio = effectiveMedian / 1000;\r\n const { tokenList, spaceWidth } = analyzeLine({ ctx, line, xRatio, format, isLast, textData, width });\r\n\r\n ctx.scale(xRatio, yRatio);\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge, trueBaseline,\r\n spaceWidth,\r\n textData,\r\n format,\r\n });\r\n trueBaseline += lineHeight;\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n });\r\n\r\n /** Condition clause of flavor text in TCG cards do not use italic font style (\"Summoned Skull\" TCG). */\r\n if (effectFlavorCondition.length > 0) {\r\n const internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [effectFlavorCondition],\r\n format, textData,\r\n width,\r\n });\r\n\r\n if (currentLineCount > 1) return false;\r\n return true;\r\n },\r\n );\r\n const xRatio = internalEffectiveMedian / 1000;\r\n\r\n ctx.scale(xRatio, yRatio);\r\n ctx.font = currentFont.setStyle('').getFont();\r\n let tokenList = tokenizeText(effectFlavorCondition);\r\n /** We use two new line character to identify condition clause among flavor text. Because in normal case the user will try to put in many new lines to ensure that the condition clause is placed at bottom of the card text.\r\n * \r\n * But this method has a caveat: For example if current line limit is 6, and the flavor text already take 5 lines. If user put the condition clause at line 6, it is indistinguishable from a normal paragraph, and therefore drawn with italic font. But if user put a new line between, it will force the draw function to increase the line limit into 7.\r\n * \r\n * To combat this, we perform a simple remove that additional new line, that means if conditional clause is present, two new lines in textare actually result only one new line. This does not create much hassle since user rarely notice this behavior.\r\n * */\r\n tokenList = tokenList[0] === '\\n'\r\n ? tokenList.slice(1)\r\n : tokenList;\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge, trueBaseline,\r\n textData,\r\n format,\r\n });\r\n trueBaseline += lineHeight;\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n }\r\n break;\r\n }\r\n resetStyle();\r\n }\r\n\r\n return effectSizeLevel;\r\n};","\r\nimport { CanvasConst } from 'src/model';\r\nimport { drawAsset, drawAssetWithSize, drawWithColor } from '../image';\r\nimport { clearCanvas, setTextStyle } from '../canvas-util';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\nconst {\r\n width: CanvasWidth,\r\n} = CanvasConst;\r\n\r\nexport const drawStarContent = async ({\r\n ctx,\r\n cardIcon,\r\n text,\r\n star,\r\n starAlignment = 'auto',\r\n style,\r\n onStarDraw,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n cardIcon: string,\r\n text: string | null,\r\n star: string | number,\r\n starAlignment: string,\r\n style?: CanvasTextStyle,\r\n onStarDraw: (coordinate: [number, number]) => Promise,\r\n}) => {\r\n const starWidth = 50;\r\n const startSpacing = 4;\r\n let normalizedStarCount = typeof star === 'string'\r\n ? star === '' ? 0 : 1\r\n : typeof star === 'number' ? star : 0;\r\n let totalWidth = starWidth * normalizedStarCount + startSpacing * (normalizedStarCount - 1);\r\n const baseline = 145;\r\n\r\n let alignment = 'right';\r\n if (['rank', 'negative-level'].includes(cardIcon)) alignment = 'left';\r\n alignment = starAlignment === 'auto'\r\n ? alignment\r\n : starAlignment;\r\n if (normalizedStarCount > 12) alignment = 'center';\r\n\r\n if (text && alignment === 'center') {\r\n normalizedStarCount = 0;\r\n totalWidth = 0;\r\n }\r\n\r\n /** Level / Rank 13 is center-aligned. */\r\n const leftEdge = alignment === 'center'\r\n ? (CanvasWidth + totalWidth) / 2\r\n : alignment === 'left'\r\n ? 85.9125 + totalWidth\r\n : 728.775;\r\n\r\n let offset = 0 - (starWidth + startSpacing);\r\n\r\n if (ctx && text && cardIcon !== 'st') {\r\n const fontSize = 50;\r\n const resetShadow = setTextStyle({ ctx, ...style });\r\n ctx.textAlign = alignment === 'left' || alignment === 'right'\r\n ? alignment\r\n : 'left';\r\n ctx.font = `bold ${fontSize}px RoGSanSrfStd-Bd`;\r\n const offset = alignment === 'center'\r\n ? ctx.measureText(text).width / -2\r\n : alignment === 'left'\r\n ? startSpacing\r\n : (starWidth + startSpacing * 2) * -1;\r\n ctx.fillText(text, leftEdge + offset, baseline + fontSize * 0.9);\r\n ctx.textAlign = 'left';\r\n resetShadow();\r\n }\r\n\r\n return await Promise.all([...Array(normalizedStarCount)]\r\n .map(async () => {\r\n offset += (starWidth + startSpacing);\r\n let coordinate: [number, number] = [\r\n leftEdge - (starWidth + offset),\r\n baseline,\r\n ];\r\n await drawAsset(ctx, `subfamily/subfamily-${cardIcon}.png`, ...coordinate);\r\n return await onStarDraw(coordinate);\r\n })\r\n );\r\n};\r\n\r\nexport const drawSticker = async ({\r\n ctx,\r\n sticker,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n sticker: string,\r\n}) => {\r\n if (!clearCanvas(ctx)) return;\r\n\r\n if (sticker === 'no-sticker') return Promise.resolve();\r\n return drawAsset(ctx, `sticker/sticker-${sticker.toLowerCase()}.png`, 739.1438, 1110.938);\r\n};\r\n\r\n/** Duel terminal mark and Speed card mark. They overlap if draw together, so we make them mutually exclusive. Maybe it is not worth the effort. */\r\nexport const drawPredefinedMark = async ({\r\n ctx,\r\n type,\r\n isPendulum,\r\n isLink,\r\n isDuelTerminalCard,\r\n isSpeedCard,\r\n bordered,\r\n}: {\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n type: string,\r\n isPendulum: boolean,\r\n isLink: boolean,\r\n isDuelTerminalCard: boolean,\r\n isSpeedCard: boolean,\r\n bordered: boolean,\r\n}) => {\r\n if (!ctx) return;\r\n\r\n if (isDuelTerminalCard) {\r\n const coordinate: [number, number, number, number] = isPendulum\r\n ? [250, 1087, 180, 20]\r\n : isLink\r\n ? [151, 848, 216, 24]\r\n : [80, 843, 270, 30];\r\n\r\n await drawAssetWithSize(ctx, `text/text-duel-terminal-${type}${bordered ? '-bordered' : ''}.png`, ...coordinate);\r\n }\r\n if (isSpeedCard) {\r\n const coordinate: [number, number, number, number] = isPendulum\r\n ? [250, 1090, 176.4, 18]\r\n : isLink\r\n ? [151, 855, 215.6, 22]\r\n : [80, 850, 245, 25];\r\n\r\n await drawAssetWithSize(ctx, `text/text-speed-duel-${type}${bordered ? '-bordered' : ''}.png`, ...coordinate);\r\n }\r\n};\r\n\r\nexport const drawLinkRatingText = async (\r\n canvas: HTMLCanvasElement,\r\n linkMap: string[],\r\n cloneCanvasStyle: CanvasTextStyle,\r\n) => {\r\n const ctx = canvas.getContext('2d');\r\n\r\n if (!ctx || !Array.isArray(linkMap)) return;\r\n\r\n const color = cloneCanvasStyle.color ?? '#000000';\r\n await drawWithColor(\r\n canvas,\r\n 'link/link-text.png',\r\n color,\r\n 120, 30,\r\n 600, 1080,\r\n cloneCanvasStyle,\r\n );\r\n // await drawAsset(ctx, 'link/link-text.png', 600, 1080);\r\n ctx.textAlign = 'right';\r\n ctx.scale(1.2, 1);\r\n ctx.font = 'bold 26.55px RoGSanSrfStd-Bd';\r\n ctx.fillText(`${linkMap.length}`, 622.75, 1105);\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.textAlign = 'left';\r\n};","import {\r\n arrowPositionList,\r\n BackgroundType,\r\n CanvasConst,\r\n CardOpacity,\r\n Foil,\r\n getArtCanvasCoordinate,\r\n NO_ATTRIBUTE,\r\n} from 'src/model';\r\nimport { drawAsset, drawAssetWithSize, drawWithColor } from '../image';\r\nimport { getCardIconFromFrame } from 'src/util';\r\nimport { drawStarContent } from './with-image';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\nconst {\r\n topToPendulumStructure,\r\n pendulumStructureHeight,\r\n leftToPendulumStructure,\r\n} = CanvasConst;\r\n/** Various function used to draw the layout of a card is abstracted to this factory. */\r\nexport const getLayoutDrawFunction = ({\r\n canvas,\r\n artworkCanvas,\r\n backgroundCanvas,\r\n format,\r\n hasBackground,\r\n frame, bottomFrame,\r\n backgroundType,\r\n cardIcon,\r\n attribute,\r\n star,\r\n foil,\r\n pendulumSize,\r\n opacity,\r\n isLink, isSpeedSkill, isXyz,\r\n isPendulum,\r\n loopFinish,\r\n loopArtFinish,\r\n}: {\r\n canvas: HTMLCanvasElement,\r\n artworkCanvas: HTMLCanvasElement | null,\r\n backgroundCanvas: HTMLCanvasElement | null,\r\n format: string,\r\n frame: string, bottomFrame: string,\r\n hasBackground: boolean,\r\n backgroundType: BackgroundType,\r\n cardIcon: string,\r\n attribute: string,\r\n star: number | string,\r\n foil: Foil,\r\n pendulumSize: string,\r\n opacity: CardOpacity,\r\n isXyz: boolean, isSpeedSkill: boolean, isLink: boolean,\r\n isPendulum: boolean,\r\n loopFinish: (\r\n ctx?: CanvasRenderingContext2D | null,\r\n name?: string,\r\n caller?: (finishType: string) => Promise,\r\n ) => Promise,\r\n loopArtFinish: (\r\n ctx?: CanvasRenderingContext2D | null,\r\n name?: string,\r\n caller?: (finishType: string) => Promise,\r\n ) => Promise,\r\n}) => {\r\n const ctx = canvas.getContext('2d');\r\n const {\r\n artBorder: keepArtBorder,\r\n nameBorder,\r\n body: opacityBody,\r\n name: opacityName,\r\n pendulum: opacityPendulum,\r\n text: opacityText,\r\n boundless,\r\n } = opacity;\r\n const {\r\n artX,\r\n artY,\r\n artFinishX,\r\n artFinishY,\r\n artWidth,\r\n } = getArtCanvasCoordinate(isPendulum, opacity);\r\n const artBorder = opacityBody > 0 ? true : keepArtBorder;\r\n const artBoxY = 170, artBoxX = 60;\r\n const effectBoxY = 860, effectBoxX = 35;\r\n const backgroundEffectBoxY = effectBoxY + 24, backgroundEffectBoxX = effectBoxX + 19;\r\n\r\n const hasFoil = foil !== 'normal';\r\n const frameBorderType = isXyz || isSpeedSkill\r\n ? frame\r\n : 'normal';\r\n const nameBorderType = frameBorderType;\r\n const applyArtFinish = !boundless && artBorder;\r\n\r\n const resultAPI = {\r\n /** Calculate new art coordination for creative mode, some configurations may result in the art getting drawn at different location compare to default one used by `drawArtwork` function. A lots of calculation is involved here since we:\r\n * \r\n * * Trying to draw only a portion of the image.\r\n * * The source image has totally different size compare to the destination boundary.\r\n * * Various anchor points must be located based on the current card layout. Kinda regret making this feature, but they work pretty well so.\r\n */\r\n calculateCardArtRedrawCoordination(\r\n imageCanvas: HTMLCanvasElement,\r\n customOpacity?: CardOpacity,\r\n extraHeightRatio = 1,\r\n customBackgroundType?: BackgroundType,\r\n ) {\r\n const normalizedOpacity = customOpacity ?? opacity;\r\n const {\r\n body: bodyOpacity\r\n } = normalizedOpacity;\r\n const {\r\n artX,\r\n artY,\r\n artWidth,\r\n } = getArtCanvasCoordinate(isPendulum, normalizedOpacity, customBackgroundType);\r\n const { width: imageWidth, height: imageHeight } = imageCanvas;\r\n const imageScaledRatio = artWidth / imageWidth;\r\n const sourceOffsetX = bodyOpacity < 100\r\n ? (leftToPendulumStructure - artX) / imageScaledRatio\r\n : 0;\r\n const destinationOffsetX = sourceOffsetX * imageScaledRatio;\r\n const sourceOffsetY = bodyOpacity < 100\r\n ? (topToPendulumStructure - artY) / imageScaledRatio\r\n : 0;\r\n const destinationOffsetY = sourceOffsetY * imageScaledRatio;\r\n const offsetHeight = bodyOpacity < 100\r\n ? imageHeight - (pendulumStructureHeight / imageScaledRatio)\r\n : 0;\r\n\r\n const destinationX = artX + destinationOffsetX;\r\n const destinationY = artY + destinationOffsetY;\r\n const destinationWidth = artWidth - destinationOffsetX * 2;\r\n const destinationHeight = artWidth / (imageWidth / imageHeight) * extraHeightRatio - offsetHeight * imageScaledRatio;\r\n\r\n return {\r\n imageScaledRatio,\r\n sourceOffsetX,\r\n sourceOffsetY,\r\n destinationOffsetX,\r\n destinationOffsetY,\r\n offsetHeight,\r\n destinationX,\r\n destinationY,\r\n destinationWidth,\r\n destinationHeight,\r\n };\r\n },\r\n\r\n /** Main frame consists of top half and bottom half (for pendulum-like) card. */\r\n drawFrame: async () => {\r\n if (!ctx) return;\r\n\r\n ctx.globalAlpha = opacityBody / 100;\r\n await drawAsset(ctx, `frame/frame-${frame}.png`, 0, 0);\r\n await drawAsset(ctx, `frame-pendulum/frame-pendulum-${bottomFrame}.png`, 0, 0);\r\n ctx.globalAlpha = 1;\r\n },\r\n /** Draw card artwork is synchronous because the image is already loaded from cropper's canvas. */\r\n drawCardArt: () => {\r\n if (!artworkCanvas || !ctx) return;\r\n const { width: imageWidth, height: imageHeight } = artworkCanvas;\r\n\r\n if (imageHeight <= 0) return;\r\n ctx.drawImage(\r\n artworkCanvas,\r\n 0, 0,\r\n imageWidth, imageHeight,\r\n artX, artY,\r\n artWidth, artWidth / (imageWidth / imageHeight),\r\n );\r\n },\r\n drawBackground: (\r\n boundary?: 'pendulum',\r\n ) => {\r\n if (!backgroundCanvas || !ctx || !hasBackground) return;\r\n const { width: backgroundWidth, height: backgroundHeight } = backgroundCanvas;\r\n\r\n if (backgroundHeight <= 0) return;\r\n if (boundary === 'pendulum') {\r\n let redrawCoordination = resultAPI.calculateCardArtRedrawCoordination(backgroundCanvas);\r\n\r\n if (backgroundType === 'full') {\r\n redrawCoordination = resultAPI.calculateCardArtRedrawCoordination(\r\n backgroundCanvas,\r\n { ...opacity, body: 0 },\r\n undefined,\r\n 'full',\r\n );\r\n } else if (backgroundType === 'fit') {\r\n redrawCoordination = resultAPI.calculateCardArtRedrawCoordination(\r\n backgroundCanvas,\r\n opacity,\r\n undefined,\r\n 'fit'\r\n );\r\n }\r\n\r\n const {\r\n sourceOffsetX: backgroundSourceOffsetX, sourceOffsetY: backgroundSourceOffsetY,\r\n offsetHeight: backgroundOffsetHeight,\r\n destinationX: backgroundDestinationX, destinationY: backgroundDestinationY,\r\n destinationWidth: backgroundDestinationWidth, destinationHeight: backgroundDestinationHeight,\r\n } = redrawCoordination;\r\n ctx.drawImage(\r\n backgroundCanvas,\r\n backgroundSourceOffsetX, backgroundSourceOffsetY,\r\n backgroundWidth - backgroundSourceOffsetX * 2, backgroundHeight - backgroundOffsetHeight,\r\n backgroundDestinationX, backgroundDestinationY,\r\n backgroundDestinationWidth, backgroundDestinationHeight,\r\n );\r\n return;\r\n }\r\n\r\n const {\r\n artX,\r\n artY,\r\n artWidth,\r\n } = getArtCanvasCoordinate(\r\n isPendulum,\r\n { ...opacity, boundless: true },\r\n backgroundType,\r\n );\r\n ctx.drawImage(\r\n backgroundCanvas,\r\n 0, 0,\r\n backgroundWidth, backgroundHeight,\r\n artX, artY,\r\n artWidth, artWidth / (backgroundWidth / backgroundHeight)\r\n );\r\n },\r\n drawAttribute: async () => {\r\n await drawAsset(ctx, `attribute/attr-${format}-${attribute.toLowerCase()}.png`, 678, 55);\r\n },\r\n drawStar: async ({ style, starAlignment }: { style?: CanvasTextStyle, starAlignment: string }) => {\r\n const normalizedCardIcon = cardIcon === 'auto' ? getCardIconFromFrame(frame) : cardIcon;\r\n await drawStarContent({\r\n ctx,\r\n cardIcon: normalizedCardIcon,\r\n text: typeof star === 'string' ? star : null,\r\n star,\r\n starAlignment,\r\n style,\r\n onStarDraw: async coordinate => {\r\n return normalizedCardIcon === 'st'\r\n ? Promise.resolve()\r\n : await loopFinish(\r\n ctx,\r\n 'star',\r\n async type => drawAsset(ctx, `finish/finish-${type}-star.png`, ...coordinate),\r\n );\r\n },\r\n });\r\n },\r\n drawPendulumScaleIcon: async () => {\r\n await drawAsset(ctx, `frame-pendulum/pendulum-scale-${pendulumSize}.png`, 0, 750);\r\n },\r\n /** Individual arrows has two state (active/inactive) and two different parts (base and core) */\r\n drawLinkArrowMap: async (linkMap: string[]) => {\r\n await Promise.all([1, 2, 3, 4, 6, 7, 8, 9]\r\n .map(async entry => {\r\n const { left, top, height, width } = arrowPositionList[entry - 1];\r\n const isActive = linkMap.includes(`${entry}`);\r\n const baseLink = `link/link-inactive-${entry}`;\r\n const activeLink = `link/link-active-${entry}`;\r\n const coordinate = [left, top, width, height] as const;\r\n\r\n await drawAssetWithSize(ctx, `${baseLink}-base${boundless ? '-full' : ''}.png`, ...coordinate);\r\n await drawAssetWithSize(ctx, `${baseLink}-core.png`, ...coordinate);\r\n if (isActive) {\r\n await drawAssetWithSize(ctx, `${activeLink}-base.png`, ...coordinate);\r\n return drawAssetWithSize(ctx, `${activeLink}-core.png`, ...coordinate);\r\n } else return;\r\n })\r\n );\r\n },\r\n drawStatBorder: async (color: string) => {\r\n await drawWithColor(\r\n canvas,\r\n 'frame/frame-stat-border.png',\r\n color,\r\n 813, 20,\r\n 0, 1070,\r\n );\r\n },\r\n\r\n /** @summary BACKGROUND section */\r\n\r\n drawNameBackground: async () => {\r\n if (!ctx) return;\r\n\r\n ctx.globalAlpha = opacityName / 100;\r\n await drawAsset(ctx, `background/background-name-${frame}.png`, 0, 0);\r\n ctx.globalAlpha = 1;\r\n },\r\n /** Background is based on bottom frame. This function draws both background for pendulum part and normal effect part. */\r\n drawEffectBackground: async (withPendulum = false) => {\r\n if (!ctx) return;\r\n\r\n ctx.globalAlpha = opacityText / 100;\r\n await drawAsset(\r\n ctx,\r\n `background/background-text-${bottomFrame}.png`,\r\n backgroundEffectBoxX, backgroundEffectBoxY,\r\n );\r\n if (withPendulum) {\r\n ctx.globalAlpha = opacityPendulum / 100;\r\n await drawAsset(ctx, `background/background-pendulum-${bottomFrame}.png`, 55, 738);\r\n }\r\n ctx.globalAlpha = 1;\r\n },\r\n\r\n /** @summary BORDER section */\r\n\r\n drawFrameBorder: async () => {\r\n return drawAsset(ctx, `frame/frame-border-${frameBorderType}.png`, 0, 0);\r\n },\r\n drawNameBorder: async () => {\r\n return nameBorder\r\n ? drawAsset(ctx, `frame/name-border-${nameBorderType}.png`, 0, 0)\r\n : Promise.resolve();\r\n },\r\n drawArtBorder: async () => {\r\n if (artBorder) {\r\n let artFrameSource = '';\r\n if (isXyz || isSpeedSkill) {\r\n artFrameSource = `frame/art-border-${frame}.png`;\r\n } else if (isLink || ['zarc', 'hamon', 'uria', 'raviel'].includes(frame)) {\r\n artFrameSource = 'frame/art-border-special.png';\r\n } else {\r\n artFrameSource = 'frame/art-border.png';\r\n }\r\n await drawAsset(ctx, artFrameSource, artBoxX, artBoxY);\r\n }\r\n },\r\n drawPendulumBorder: async (artBorder: boolean, foilType: Foil) => {\r\n await drawAsset(\r\n ctx,\r\n `frame-pendulum/border-pendulum-${pendulumSize}`\r\n + `-${foilType}`\r\n + (artBorder ? '' : '-artless')\r\n + '.png',\r\n 30, 185,\r\n );\r\n },\r\n /** Usually we can draw foil on top of effect border, but speed skill's effect border is thicker so foil cannot cover it properly, in this case we will not draw the effect border knowing foil will be applied. In fact the effect border of speed skill is kinda buggy and not align really well, but we can't really do anything about it. Speed skill is also just a non-standard frame. */\r\n drawEffectBorder: async () => {\r\n if (!hasFoil && bottomFrame === 'speed-skill') {\r\n await drawAsset(ctx, 'frame/effect-border-speed-skill.png', effectBoxX, effectBoxY);\r\n } else {\r\n await drawAsset(ctx, 'frame/effect-border.png', effectBoxX, effectBoxY);\r\n }\r\n },\r\n drawCardBorder: async () => {\r\n await drawAsset(ctx, `frame/card-border${hasFoil ? `-${foil}` : ''}.png`, 0, 0);\r\n },\r\n\r\n /** @summary FOIL section */\r\n\r\n drawArtBorderFoil: async () => {\r\n if (artBorder) await drawAsset(ctx, `frame/art-border-${foil}.png`, artBoxX, artBoxY);\r\n },\r\n drawEffectBorderFoil: async () => {\r\n await drawAsset(ctx, `frame/effect-border-${foil}.png`, effectBoxX, effectBoxY);\r\n },\r\n drawLinkMapFoil: async (withBorder = artBorder) => {\r\n await drawAsset(ctx, `link/link-overlay-arrow-${foil}${withBorder ? '' : '-artless'}.png`, 0, 175);\r\n },\r\n\r\n /** @summary FINISH section */\r\n\r\n drawNameFinish: async () => {\r\n if (artBorder || nameBorder) await loopFinish(\r\n ctx,\r\n 'name',\r\n async type => {\r\n return drawAsset(ctx, `finish/finish-${type}-name.png`, 0, 0);\r\n },\r\n );\r\n },\r\n drawAttributeFinish: async () => {\r\n if (attribute !== NO_ATTRIBUTE) {\r\n await loopFinish(ctx, 'attribute', async type => drawAsset(ctx, `finish/finish-${type}-attribute.png`, 678, 55));\r\n }\r\n },\r\n drawArtFinish: async () => {\r\n if (applyArtFinish) await loopArtFinish(\r\n ctx,\r\n 'art',\r\n async finishType => await drawAsset(\r\n ctx,\r\n `finish/art-finish-${finishType}${isPendulum ? `-pendulum-${pendulumSize}` : ''}.png`,\r\n artFinishX, artFinishY,\r\n ),\r\n );\r\n },\r\n /**\r\n * * ArtFinish: Controlled by `artFinish` attribute.\r\n * * ArtOverlayFinish: Controlled by `finish` attribute, and therfore support multiple layers.\r\n * \r\n * * OverlayFinish type `art`: Apply only when art border is present, for example a dark finish will darken all the card EXCEPT the artwork. But when art border is no longer present (for example full-art card), it will darken the whole card.\r\n * * OverlayFinish type `unart`: Apply only when art border is not present.\r\n */\r\n drawArtOverlayFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'art-overlay',\r\n async type => {\r\n return drawAsset(\r\n ctx,\r\n 'finish/finish'\r\n + `-${type}`\r\n + `-${applyArtFinish ? 'art' : 'unart'}`\r\n + '-overlay'\r\n + (isPendulum ? `-pendulum-${pendulumSize}` : '')\r\n + '.png',\r\n artFinishX, artFinishY,\r\n );\r\n },\r\n );\r\n },\r\n drawArtBorderFinish: async () => {\r\n if (artBorder) {\r\n await loopFinish(\r\n ctx,\r\n 'art-border',\r\n async finishType => drawAsset(ctx, `finish/finish-${finishType}-art-border.png`, 0, 0),\r\n );\r\n }\r\n },\r\n drawPendulumArtBorderFinish: async () => {\r\n if (artBorder) await loopFinish(\r\n ctx,\r\n 'art-border-pendulum',\r\n finishType => drawAsset(ctx, `finish/finish-${finishType}-art-border-pendulum-${pendulumSize}.png`, 0, 0)\r\n );\r\n },\r\n drawBorderPendulumFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'border-pendulum',\r\n async finishType => drawAsset(ctx, `finish/finish-${finishType}-border-pendulum-${pendulumSize}.png`, 0, 0)\r\n );\r\n },\r\n drawFrameFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'frame',\r\n async type => {\r\n return drawAsset(ctx, `finish/finish-${type}-frame${isPendulum ? `-pendulum-${pendulumSize}` : ''}.png`, 0, 0);\r\n },\r\n );\r\n },\r\n drawFrameBackgroundFinish: async () => {\r\n await loopFinish(\r\n ctx,\r\n 'frame-background',\r\n async type => {\r\n return drawAsset(ctx, `finish/finish-${type}-frame-background${isPendulum ? `-pendulum-${pendulumSize}` : ''}.png`, 0, 0);\r\n },\r\n );\r\n },\r\n /** Unlike total overlay, this finish layer lies below card text (name, effect, etc...) */\r\n drawOverlayFinish: async () => {\r\n await loopFinish(ctx, 'overlay', async overlayType => drawAsset(ctx, `finish/finish-${overlayType}-overlay.png`, 0, 0));\r\n },\r\n drawCardBorderFinish: async () => {\r\n await loopFinish(ctx, 'card-border', async type => drawAsset(ctx, `finish/finish-${type}-card-border.png`, 0, 0));\r\n },\r\n };\r\n\r\n return resultAPI;\r\n};","import {\r\n DefaultFontSizeData,\r\n NormalizeTextRegex,\r\n NameFontDataMap,\r\n NameStyle,\r\n PatternMap,\r\n TCG_LETTER_JOINLIST,\r\n getDefaultNameStyle,\r\n} from 'src/model';\r\nimport { parsePalette, createFontGetter, condense } from 'src/util';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { drawAsset, drawAssetWithSize } from '../image';\r\n\r\nconst getNameGradient = (\r\n ctx: CanvasRenderingContext2D,\r\n angleAsDegree: number,\r\n colorStopList: { offset: string, color: string }[],\r\n edge: number,\r\n contentWidth: number,\r\n baseline: number,\r\n maxAscent: number,\r\n maxDescent: number,\r\n) => {\r\n /** Use the knowledge diagram to understand more about the geometry for this, but basically we want to create a rectangle to put the gradient in, this rectangle can be rotated, but no matter what the rotation angle is, it must be large just enought to contains all the card name inside, no more no less.\r\n * \r\n * This is deceptively hard because each letters has their own \"hanging\" or \"protruding\" part, magnified by the fact that the gradient is rotable. */\r\n const baseKAF = angleAsDegree % 360;\r\n const quarterSlot = `${Math.floor(baseKAF / 90)}`;\r\n const KAF = baseKAF % 90;\r\n const originWidth = contentWidth;\r\n const originHeight = maxAscent + maxDescent;\r\n // Testing only\r\n // const originWidth = 16;\r\n // const originHeight = 8;\r\n // const edge = 0, baseline = 4, maxDescent = 4, maxAscent = 4;\r\n const cx = edge + originWidth / 2;\r\n const cy = baseline + (maxDescent - maxAscent) / 2;\r\n\r\n let width = originWidth, height = originHeight;\r\n if (quarterSlot === '1' || quarterSlot === '3') { width = originHeight; height = originWidth }\r\n\r\n /**\r\n * The coordinate system is put in the middle of the card name, with its origin lies exactly at the center, thanks to the information about its bounding from parameters.\r\n * \r\n * We avoid want to obtuse angle, so we only calculate one quarter, then mirror it vertically and horizontally to fill all fours.\r\n */\r\n const AD = Math.sqrt(width ** 2 / 4 + height ** 2 / 4);\r\n if (AD > 0) {\r\n const KAD = Math.asin((width / 2) / AD) * 180 / Math.PI;\r\n const DAF = KAD - KAF;\r\n const FDA = 90 - DAF;\r\n const AF = Math.sin(FDA / 180 * Math.PI) * AD;\r\n const AL = Math.sin(KAF / 180 * Math.PI) * AF;\r\n const FL = Math.cos(KAF / 180 * Math.PI) * AF;\r\n let offsetX = AL;\r\n let offsetY = FL;\r\n if (quarterSlot === '1') { offsetX = FL; offsetY = -AL }\r\n if (quarterSlot === '2') { offsetX = -AL; offsetY = -FL }\r\n if (quarterSlot === '3') { offsetX = -FL; offsetY = AL }\r\n\r\n const topX = cx + offsetX;\r\n const topY = cy - offsetY;\r\n const botX = cx - offsetX;\r\n const botY = cy + offsetY;\r\n // console.info('metric', {\r\n // quarterSlot, baseKAF,\r\n // '\\n', width, height, cx, cy,\r\n // '\\n', KAF, KAD, DAF, FDA,\r\n // '\\n', AD, AF, AL, FL,\r\n // '\\n', maxAscent, maxDescent, baseline,\r\n // '\\n', topX, topY, botX, botY,\r\n // });\r\n const gradient = ctx.createLinearGradient(topX, topY, botX, botY);\r\n colorStopList.forEach(({ color, offset }) => gradient.addColorStop(parseFloat(offset), color));\r\n\r\n return gradient;\r\n }\r\n return undefined;\r\n};\r\n\r\n/**\r\n * Draw card name, while the foot text is affected by every custom method, head text ONLY affected by its own color.\r\n */\r\nexport const drawName = async (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n edge: number,\r\n trueBaseline: number,\r\n width: number,\r\n style: Partial,\r\n option: {\r\n frame: string,\r\n cloneNode: HTMLCanvasElement | null | undefined,\r\n format: string,\r\n isSpeedSkill?: boolean,\r\n furiganaHelper: boolean,\r\n },\r\n) => {\r\n const { isSpeedSkill, format, cloneNode, frame, furiganaHelper } = option;\r\n const cloneCtx = cloneNode?.getContext('2d');\r\n if (ctx && cloneCtx && value) {\r\n const {\r\n font,\r\n fillStyle,\r\n headTextFillStyle,\r\n shadowBlur,\r\n hasShadow,\r\n shadowColor,\r\n shadowOffsetX,\r\n shadowOffsetY,\r\n hasOutline: hasDefaultOutline,\r\n lineColor,\r\n lineWidth,\r\n lineOffsetX,\r\n lineOffsetY,\r\n hasGradient,\r\n gradientAngle,\r\n gradientColor,\r\n pattern,\r\n } = { ...getDefaultNameStyle(), ...style };\r\n const { patternImage, blendMode: patternBlendMode } = PatternMap[pattern ?? ''] ?? {};\r\n const hasOutline = hasDefaultOutline;\r\n\r\n ctx.textAlign = 'left';\r\n if (hasShadow) {\r\n ctx.shadowColor = shadowColor;\r\n ctx.shadowOffsetY = shadowOffsetY;\r\n ctx.shadowOffsetX = shadowOffsetX;\r\n ctx.shadowBlur = shadowBlur;\r\n }\r\n if (hasDefaultOutline) {\r\n ctx.lineWidth = lineWidth;\r\n ctx.strokeStyle = lineColor;\r\n }\r\n const fontData = {\r\n ...(NameFontDataMap[font as keyof typeof NameFontDataMap] ?? NameFontDataMap.Default).fontData,\r\n headTextFillStyle,\r\n };\r\n const fontGetter = createFontGetter({\r\n defaultFamily: fontData.font,\r\n defaultSize: fontData.fontList[0].fontSize,\r\n defaultWeight: fontData.weight,\r\n });\r\n const textData = {\r\n fontLevel: 0,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n const quoteConvertedValue = normalizeCardText(\r\n value,\r\n format,\r\n { multiline: false, furiganaHelper, dictionaryType: 'rubyFormName' },\r\n );\r\n\r\n /** Calculate the bounding box that contains all card name's graphic, and passing it to gradient calculator. Beware - gradient does not apply to head text. */\r\n const crudeTokenList = format === 'ocg'\r\n ? [quoteConvertedValue]\r\n : quoteConvertedValue.split(new RegExp(`([^${TCG_LETTER_JOINLIST}])`, 'g'));\r\n const fontGetterForWidthCalculating = createFontGetter({\r\n defaultFamily: fontData.font,\r\n defaultSize: fontData.fontList[0].fontSize,\r\n defaultWeight: fontData.weight,\r\n });\r\n const normalStyle = fontGetterForWidthCalculating.getFont();\r\n const symbolStyle = fontGetterForWidthCalculating\r\n .setSize(cur => cur * fontData.symbolFontRatio)\r\n .setStyle('small-caps')\r\n .setFamily(fontData.symbolFont)\r\n .getFont();\r\n let maxAscent = 0;\r\n let maxDescent = 0;\r\n crudeTokenList.forEach((cur, index) => {\r\n ctx.font = index % 2 === 0 ? normalStyle : symbolStyle;\r\n\r\n const textMetric = ctx.measureText(cur.replaceAll(NormalizeTextRegex, ''));\r\n maxAscent = Math.max(maxAscent, textMetric.actualBoundingBoxAscent);\r\n maxDescent = Math.max(maxDescent, textMetric.actualBoundingBoxDescent);\r\n }, 0);\r\n\r\n ctx.font = normalStyle;\r\n /** Calculate fitting ratio like normal */\r\n let actualLineWidth = 0;\r\n const internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [quoteConvertedValue],\r\n format, textData,\r\n width,\r\n });\r\n\r\n if (currentLineCount > 1) return false;\r\n actualLineWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n\r\n ctx.scale(xRatio, yRatio);\r\n\r\n /** Calculate gradient and offset based on card's frame. */\r\n const offsetY = fontData.fontList[0].offsetY ?? DefaultFontSizeData.offsetY;\r\n const tokenList = tokenizeText(quoteConvertedValue);\r\n const gradient = actualLineWidth > 0 && hasGradient\r\n ? getNameGradient(\r\n ctx,\r\n gradientAngle,\r\n parsePalette(gradientColor),\r\n edge,\r\n actualLineWidth,\r\n trueBaseline,\r\n maxAscent, maxDescent,\r\n )\r\n : undefined;\r\n\r\n\r\n /** First iteration: Draw the card name with color, shadow and gradient */\r\n ctx.fillStyle = gradient ?? fillStyle;\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge: edge, trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline - (isSpeedSkill ? offsetY : 0));\r\n },\r\n });\r\n\r\n /** Second iteration, draw pattern, we follow these steps:\r\n * * We create a second, temporary canvas node.\r\n * * We fill the node with pattern. The pattern is not skewed, but maybe scaled to fit exactly the bounding box of the card name (we reuse the same information when calculate gradient).\r\n * * We place the temporary node above the card name's canvas, using suitable blend mode, this way we essential \"coating\" the pattern on top of the text, without damaging it's surrounding.\r\n */\r\n if (patternImage && cloneNode) {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n /** Some patterns are partially transparent, so we need to draw the current frame under it first. */\r\n await drawAsset(cloneCtx, `frame/frame-${frame}.png`, 0, 0);\r\n await drawAsset(cloneCtx, `background/background-name-${frame}.png`, 0, 0);\r\n cloneCtx.globalCompositeOperation = patternBlendMode;\r\n await drawAssetWithSize(\r\n cloneCtx, `finish-name/${patternImage}.png`,\r\n edge, trueBaseline - maxAscent,\r\n width,\r\n maxAscent + maxDescent,\r\n );\r\n ctx.globalCompositeOperation = 'source-in';\r\n ctx.drawImage(cloneNode, 0, 0);\r\n ctx.scale(xRatio, yRatio);\r\n ctx.globalCompositeOperation = 'source-over';\r\n\r\n /** Again, foot text is not affected by pattern, so we draw the whole name again but without the foot text part.\r\n * \r\n * Because head text is not affected by shadow and outline, and their color is always solid. When placed on top of the head text with pattern, they will cover the pattern perfectly.\r\n */\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge: edge, trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: () => {},\r\n });\r\n }\r\n\r\n /** Third iteration, we apply \"outline\" to card name. We use stroke method to simulate outline behavior. This is not ideal (like at all), but current canvas has no way to do it properly. */\r\n if (hasOutline) {\r\n ctx.globalCompositeOperation = 'destination-over';\r\n drawLine({\r\n ctx,\r\n tokenList,\r\n xRatio, yRatio,\r\n trueEdge: edge, trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.lineJoin = 'round';\r\n ctx.strokeText(\r\n letter,\r\n scaledEdge + lineOffsetX,\r\n scaledBaseline + lineOffsetY - (isSpeedSkill ? offsetY : 0),\r\n );\r\n },\r\n });\r\n }\r\n ctx.globalCompositeOperation = 'source-over';\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n const defaultTextStyle = getDefaultNameStyle();\r\n ctx.fillStyle = defaultTextStyle.fillStyle;\r\n ctx.shadowColor = defaultTextStyle.shadowColor;\r\n ctx.shadowOffsetY = defaultTextStyle.shadowOffsetY;\r\n ctx.shadowOffsetX = defaultTextStyle.shadowOffsetX;\r\n ctx.shadowBlur = defaultTextStyle.shadowBlur;\r\n ctx.lineWidth = defaultTextStyle.lineWidth;\r\n ctx.strokeStyle = defaultTextStyle.lineColor;\r\n ctx.lineJoin = 'miter';\r\n ctx.globalCompositeOperation = 'source-over';\r\n }\r\n};","import { clearCanvas, setTextStyle } from '../canvas-util';\r\nimport { condense, createFontGetter , checkLightFrame, checkSpeedSkill } from 'src/util';\r\nimport { ST_ICON_SYMBOL, FontData, TypeAbilityCoordinateMap, getTypeAbilityFontData, NO_ICON } from 'src/model';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { drawAssetWithSize } from '../image';\r\nimport { CanvasTextStyle } from 'src/service';\r\n\r\n/** Small and medium size are used for type / ability text in effect box. Large type is used for \"Spell/Trap type\" under card's name. */\r\nconst sizeMap: Record = {\r\n small: 0,\r\n medium: 1,\r\n large: 2,\r\n};\r\nexport const drawTypeAbilityText = ({\r\n ctx,\r\n value,\r\n format,\r\n metricMethod,\r\n size,\r\n furiganaHelper,\r\n}: {\r\n ctx: CanvasRenderingContext2D,\r\n value: string,\r\n format: string,\r\n metricMethod?: FontData['metricMethod'],\r\n size: 'small' | 'medium' | 'large',\r\n furiganaHelper: boolean,\r\n}) => {\r\n const {\r\n edgeAlignment = 'left',\r\n trueEdge,\r\n trueBaseline,\r\n trueWidth: width,\r\n } = TypeAbilityCoordinateMap[format]?.[size] ?? TypeAbilityCoordinateMap['tcg']['medium'];\r\n const fontData = getTypeAbilityFontData()[format];\r\n if (metricMethod) fontData.metricMethod = metricMethod;\r\n const { font } = fontData;\r\n const fontLevel = sizeMap[size];\r\n const fontSizeData = fontData.fontList[fontLevel];\r\n const fontGetter = createFontGetter({\r\n defaultFamily: font,\r\n defaultSize: `${fontSizeData.fontSize}px`,\r\n });\r\n const textData = {\r\n fontLevel,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n let actualLineWidth = 0;\r\n\r\n ctx.font = fontGetter.getFont();\r\n ctx.textAlign = 'left';\r\n const normalizedText = normalizeCardText(value, format, { multiline: false, furiganaHelper });\r\n const internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [normalizedText],\r\n format, textData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n actualLineWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n ctx.scale(xRatio, yRatio);\r\n const result = drawLine({\r\n ctx,\r\n tokenList: tokenizeText(normalizedText),\r\n xRatio, yRatio,\r\n trueEdge: edgeAlignment === 'left' ? trueEdge : (trueEdge - actualLineWidth * xRatio),\r\n trueBaseline,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n },\r\n });\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n return {\r\n ...result,\r\n xRatio,\r\n };\r\n};\r\n\r\nexport const drawTypeAbility = async ({\r\n ctx,\r\n typeAbility,\r\n subFamily,\r\n format,\r\n frame,\r\n size,\r\n isMonster,\r\n textStyle,\r\n furiganaHelper,\r\n}: {\r\n ctx?: CanvasRenderingContext2D | null,\r\n typeAbility: string,\r\n subFamily: string,\r\n format: string,\r\n frame: string,\r\n size: 'small' | 'medium' | 'large',\r\n isMonster: boolean,\r\n textStyle: CanvasTextStyle,\r\n furiganaHelper: boolean,\r\n}) => {\r\n if (!clearCanvas(ctx)) return;\r\n\r\n const willDrawTypeAbility = typeAbility.length > 0;\r\n const willDrawIcon = subFamily !== NO_ICON && size === 'large';\r\n const typeAbilityWithIcon = typeAbility\r\n + (willDrawIcon ? ST_ICON_SYMBOL : '');\r\n const normalizedTypeAbilityText = willDrawTypeAbility\r\n ? format === 'tcg'\r\n ? size === 'large'\r\n ? `[  ${typeAbilityWithIcon}  ]`\r\n : `[${typeAbilityWithIcon}]`\r\n : `【${typeAbilityWithIcon}】`\r\n : '';\r\n if (!willDrawTypeAbility) return;\r\n\r\n /** Special treatment for speed skill */\r\n const defaultFillStyle = checkLightFrame(frame) && !checkSpeedSkill({ frame }) && size === 'large'\r\n ? '#ffffff'\r\n : '#000000';\r\n const normalizedStyle = { color: defaultFillStyle, ...textStyle };\r\n const resetStyle = setTextStyle({ ctx, ...normalizedStyle });\r\n const { iconPositionList, xRatio } = drawTypeAbilityText({\r\n ctx,\r\n format,\r\n size,\r\n value: normalizedTypeAbilityText,\r\n metricMethod: !isMonster ? 'compact' : undefined,\r\n furiganaHelper,\r\n });\r\n resetStyle();\r\n\r\n let offsetY = format === 'ocg' ? -4 : 0;\r\n let offsetX = format === 'ocg' ? -3 : 0;\r\n\r\n if (willDrawIcon) {\r\n const { edge, baseline } = iconPositionList[0];\r\n await drawAssetWithSize(\r\n ctx,\r\n `subfamily/subfamily-${subFamily.toLowerCase()}.png`,\r\n image => edge + image.naturalWidth * 0.175 * xRatio + offsetX,\r\n image => baseline - image.naturalWidth * 0.8 + offsetY,\r\n image => image.naturalWidth,\r\n image => image.naturalWidth,\r\n );\r\n } else {\r\n /** Currently, draw icon in place of monster type is undesirable, as the icon seems out of place and user may not know how to turn them off properly if they want to. */\r\n // await Promise.all(iconPositionList.map(({ edge, baseline, size }) => {\r\n // const iconSize = size * 0.9;\r\n\r\n // return drawAssetWithSize(\r\n // ctx,\r\n // `subfamily/subfamily-${subFamily.toLowerCase()}.png`,\r\n // () => edge + size * 0.125,\r\n // baseline - size * 0.850,\r\n // () => iconSize,\r\n // () => iconSize,\r\n // );\r\n // }));\r\n }\r\n};","import { fillTextLeftWithSpacing, fillTextRightWithSpacing } from '../canvas-util';\r\n\r\nexport const drawScale = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n edge: number,\r\n baseline: number,\r\n) => {\r\n if (ctx && value) {\r\n const fontSize = 60.5;\r\n ctx.font = `${fontSize}px MatrixBoldSmallCaps`;\r\n ctx.textAlign = 'left';\r\n\r\n const digitScaleRatio = 0.65;\r\n const digitList = `${value}`.split('');\r\n let totalWidth = 0;\r\n\r\n digitList.forEach(digit => {\r\n totalWidth += ctx.measureText(digit).width * (digit === '1' ? digitScaleRatio : 1);\r\n });\r\n let accLeft = edge - totalWidth / 2;\r\n\r\n digitList.forEach(digit => {\r\n ctx.fillText(digit, digit === '1' ? accLeft - 3 : accLeft, baseline + fontSize);\r\n accLeft += ctx.measureText(digit).width * (digit === '1' ? digitScaleRatio : 1);\r\n });\r\n }\r\n};\r\n\r\nexport const draw1stEdition = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n edge = 99,\r\n baselineOffset = 0,\r\n option = { stroke: false },\r\n) => {\r\n if (!ctx) return;\r\n\r\n const { stroke = false } = option ?? {};\r\n ctx.font = 'bold 23.7px palatino-linotype-bold';\r\n\r\n let left = edge;\r\n ctx.fillText('1', left, 1150.93 + baselineOffset);\r\n if (stroke) ctx.strokeText('1', left, 1150.93);\r\n left += ctx.measureText('1').width - 2;\r\n\r\n ctx.font = 'bold 17.78px palatino-linotype-bold';\r\n ctx.fillText('st', left, 1143.53 + baselineOffset);\r\n if (stroke) ctx.strokeText('st', left, 1143.53);\r\n left += ctx.measureText('st').width;\r\n\r\n ctx.font = 'bold 22.22px palatino-linotype-bold';\r\n ctx.fillText(' Edition', left, 1150.93 + baselineOffset);\r\n if (stroke) ctx.strokeText(' Edition', left, 1150.93);\r\n};\r\n\r\nexport const drawStatText = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n edge: number,\r\n baseline: number,\r\n) => {\r\n if (!ctx) return;\r\n\r\n ctx.scale(1, 0.98);\r\n ctx.font = 'bold 35.73px Matrix-Bold';\r\n const cursorEndOfATK = fillTextLeftWithSpacing(ctx, value, 0.075, edge, baseline / 0.98);\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.scale(1, 1.01);\r\n ctx.font = 'bold 34.74px Matrix-Bold';\r\n fillTextLeftWithSpacing(ctx, '/', 0.15, cursorEndOfATK + 5, baseline / 1.01);\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n};\r\n\r\n/** Stats have two special case: \"?\" stat (\"Slifer the Sky Dragon\" TCG) and \"∞\" stat (\"Divine Serpent Geh\" Anime) */\r\nexport const drawStat = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string | number,\r\n edge: number,\r\n baseline: number,\r\n) => {\r\n if (!ctx || value == null) return;\r\n\r\n const statWidth = 73.97;\r\n if (value === '∞') {\r\n ctx.textAlign = 'right';\r\n ctx.font = 'bold 37px matrix';\r\n ctx.fillText(value, edge + statWidth, baseline);\r\n } else\r\n if (value === '?') {\r\n ctx.textAlign = 'right';\r\n ctx.font = 'bold 34px matrix';\r\n ctx.fillText(value, edge + statWidth, baseline);\r\n } else {\r\n ctx.textAlign = 'left';\r\n const tokenizedText = `${value}`.split('?');\r\n\r\n let totalWidth = tokenizedText.reduce((prev, curr, index) => {\r\n ctx.font = '37px MatrixBoldSmallCaps';\r\n let nextWidth = prev + ctx.measureText(curr).width;\r\n\r\n if (index < tokenizedText.length - 1) {\r\n ctx.font = '37px matrix';\r\n nextWidth += ctx.measureText('?').width;\r\n }\r\n\r\n return nextWidth;\r\n }, 0);\r\n\r\n if (totalWidth > 0) {\r\n const condenseRatio = Math.min(statWidth / totalWidth, 1);\r\n\r\n ctx.scale(condenseRatio, 1);\r\n tokenizedText.reduce((prev, _, index, arr) => {\r\n const curText = arr[arr.length - 1 - index];\r\n let nextEdge = prev;\r\n ctx.font = '37px MatrixBoldSmallCaps';\r\n nextEdge -= ctx.measureText(curText).width * condenseRatio;\r\n ctx.fillText(curText, nextEdge / condenseRatio, baseline);\r\n\r\n if (index < tokenizedText.length - 1) {\r\n ctx.font = 'bold 37px matrix';\r\n nextEdge -= ctx.measureText('?').width * condenseRatio;\r\n ctx.fillText('?', nextEdge / condenseRatio, baseline);\r\n }\r\n\r\n return nextEdge;\r\n }, edge + statWidth);\r\n ctx.scale(1 / condenseRatio, 1);\r\n }\r\n }\r\n};\r\n\r\nexport const drawSetId = (\r\n ctx: CanvasRenderingContext2D | null | undefined,\r\n value: string,\r\n option: { isPendulum: boolean, isLink: boolean, withShadow: boolean, format: string, lightFooter: boolean }\r\n) => {\r\n if (!ctx) return;\r\n\r\n const { isPendulum, isLink, withShadow, format, lightFooter } = option;\r\n let spacing = 0.175;\r\n let offsetY = 0;\r\n let xOffset = 0;\r\n ctx.fillStyle = (lightFooter && !isPendulum) ? '#ffffff' : '#000000';\r\n ctx.shadowColor = withShadow\r\n ? lightFooter ? '#000000' : '#ffffff'\r\n : '#000000';\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowBlur = withShadow && !isPendulum ? 3 : 0;\r\n ctx.font = `${withShadow ? 'bold' : ''} 22px stone-serif-regular`;\r\n if (format === 'ocg') {\r\n spacing = 0.145;\r\n offsetY = -1;\r\n xOffset = -3;\r\n }\r\n\r\n if (isPendulum) {\r\n fillTextLeftWithSpacing(ctx, value, spacing, 66.65 + xOffset, 1105.01 + offsetY);\r\n } else if (isLink) {\r\n fillTextRightWithSpacing(ctx, value, spacing, 666.56 + xOffset, 872.94 + offsetY);\r\n } else {\r\n fillTextRightWithSpacing(ctx, value, spacing, 728.78 + xOffset, 871.50 + offsetY);\r\n }\r\n};","import { useCallback, useEffect, useMemo, useRef } from 'react';\r\nimport {\r\n clearCanvas,\r\n draw1stEdition,\r\n drawCreatorText,\r\n drawEffect,\r\n drawName,\r\n drawScale,\r\n drawStat,\r\n drawStatText,\r\n drawSetId,\r\n drawSticker,\r\n getFinishIterator,\r\n drawTypeAbility,\r\n getEffectFontAndCoordinate,\r\n drawAsset,\r\n getLayoutDrawFunction,\r\n drawLinkRatingText,\r\n drawPredefinedMark,\r\n setTextStyle,\r\n drawPasswordText,\r\n} from 'src/draw';\r\nimport {\r\n CanvasConst,\r\n MasterSeriesCanvas,\r\n NO_ATTRIBUTE,\r\n getArtCanvasCoordinate,\r\n getDefaultCardOpacity,\r\n PendulumEffectFontData,\r\n PendulumEffectCoordinate,\r\n FinishMap,\r\n ArtFinishMap,\r\n CardOpacity,\r\n CardArtCanvasCoordinateMap,\r\n DEFAULT_BASE_FILL_COLOR,\r\n} from 'src/model';\r\nimport {\r\n checkLightHeader,\r\n checkLink,\r\n checkMonster,\r\n checkNormal,\r\n checkSpeedSkill,\r\n checkXyz,\r\n resolveNameStyle,\r\n} from 'src/util';\r\nimport { useCard } from '../use-card';\r\nimport { prepareStyle } from './prepare-style';\r\n\r\nconst {\r\n height: CanvasHeight,\r\n width: CanvasWidth,\r\n} = CanvasConst;\r\ntype DrawerProp = {\r\n imageChangeCount: number,\r\n pendulumSize?: 'medium',\r\n isInitializing: boolean,\r\n};\r\nexport const useMasterSeriDrawer = (active: boolean, canvasMap: MasterSeriesCanvas, props: DrawerProp) => {\r\n const {\r\n card,\r\n } = useCard();\r\n const {\r\n drawCanvasRef,\r\n artworkCanvasRef,\r\n backgroundCanvasRef,\r\n frameCanvasRef,\r\n creatorCanvasRef,\r\n effectCanvasRef,\r\n nameCanvasRef,\r\n passwordCanvasRef,\r\n pendulumEffectCanvasRef,\r\n pendulumScaleCanvasRef,\r\n setIdCanvasRef,\r\n statCanvasRef,\r\n stickerCanvasRef,\r\n cardIconCanvasRef,\r\n typeCanvasRef,\r\n finishCanvasRef,\r\n lightboxCanvasRef,\r\n } = canvasMap;\r\n const {\r\n format,\r\n hasBackground, backgroundType,\r\n frame, foil, finish, artFinish, opacity,\r\n name, nameStyle, nameStyleType,\r\n effectTextStyle, pendulumTextStyle, typeTextStyle, statTextStyle,\r\n effect,\r\n effectStyle,\r\n typeAbility,\r\n isPendulum, pendulumFrame, pendulumEffect, pendulumScaleBlue, pendulumScaleRed,\r\n atk, def, linkMap,\r\n attribute,\r\n cardIcon, subFamily, star, starAlignment,\r\n setId,\r\n password, creator, sticker,\r\n isFirstEdition, isDuelTerminalCard, isSpeedCard,\r\n furiganaHelper,\r\n } = card;\r\n\r\n const bottomFrame = pendulumFrame === 'auto'\r\n ? isPendulum\r\n ? 'spell'\r\n : frame\r\n : pendulumFrame;\r\n\r\n const condenseTolerant = effectStyle?.condenseTolerant;\r\n\r\n const isNormal = checkNormal(card);\r\n const isXyz = checkXyz(card);\r\n const isLink = checkLink(card);\r\n const isMonster = checkMonster(card);\r\n const isSpeedSkill = checkSpeedSkill(card);\r\n\r\n const { body = 100, boundless } = opacity;\r\n const requireShadow = !!(body < 50 || boundless);\r\n const lightFooter = ['xyz', 'dark-synchro', 'speed-skill', 'hamon', 'uria', 'raviel'].includes(bottomFrame);\r\n const lightHeader = checkLightHeader(frame);\r\n const {\r\n levelStyle,\r\n resolvedEffectTextStyle,\r\n resolvedPendulumEffectTextStyle,\r\n resolvedStatTextStyle,\r\n resolvedTypeTextStyle,\r\n } = useMemo(() => {\r\n return prepareStyle({\r\n lightFooter,\r\n lightHeader,\r\n requireShadow,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n statTextStyle,\r\n typeTextStyle,\r\n });\r\n }, [\r\n lightFooter,\r\n lightHeader,\r\n requireShadow,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n statTextStyle,\r\n typeTextStyle,\r\n ]);\r\n\r\n const normalizedSubFamily = subFamily.toUpperCase();\r\n const normalizedTypeAbility = typeAbility.map(text => text.trim()).join(format === 'ocg' ? '/' : '/');\r\n const statInEffect = pendulumFrame !== 'auto' || isPendulum\r\n ? !!(atk || def || (isLink && linkMap.length))\r\n : isMonster;\r\n const typeInEffect = cardIcon === 'auto'\r\n ? isMonster || isSpeedSkill\r\n : cardIcon !== 'st' || isLink;\r\n\r\n const {\r\n isInitializing,\r\n imageChangeCount,\r\n pendulumSize = 'medium',\r\n } = props;\r\n const readyToDraw = active && isInitializing === false;\r\n\r\n const loopFinish = useMemo(() => getFinishIterator(finish, FinishMap), [finish]);\r\n const loopArtFinish = useMemo(() => getFinishIterator([artFinish], ArtFinishMap), [artFinish]);\r\n\r\n const drawingPipeline = useRef Promise }>>({\r\n frame: {\r\n name: 'frame',\r\n order: 1,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n attribute: {\r\n name: 'attribute',\r\n order: 2,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n sticker: {\r\n name: 'sticker',\r\n order: 3,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n name: {\r\n name: 'name',\r\n order: 4,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n typeAbility: {\r\n name: 'typeAbility',\r\n order: 5,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n overlay: {\r\n name: 'overlay',\r\n order: 6,\r\n rerun: 0,\r\n instructor: () => Promise.resolve(),\r\n },\r\n });\r\n\r\n /** DRAW CARD STRUCTURE */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = frameCanvasRef.current?.getContext('2d');\r\n const artworkCanvas = artworkCanvasRef.current;\r\n const backgroundCanvas = backgroundCanvasRef.current;\r\n\r\n drawingPipeline.current.frame.rerun += 1;\r\n drawingPipeline.current.frame.instructor = async () => {\r\n if (!frameCanvasRef.current || !clearCanvas(ctx)) return;\r\n\r\n const normalizedOpacity = { ...getDefaultCardOpacity(), ...opacity };\r\n const {\r\n artBorder: keepArtBorder,\r\n body: opacityBody,\r\n boundless,\r\n baseFill,\r\n } = normalizedOpacity;\r\n\r\n const fillBaseColor = (x: number, y: number, w: number, h: number) => {\r\n ctx.fillStyle = hasBackground ? baseFill : DEFAULT_BASE_FILL_COLOR;\r\n ctx.fillRect(x, y, w, h);\r\n };\r\n const hasArtBorder = opacityBody > 0 ? true : keepArtBorder;\r\n\r\n /** Base colored background so the card is not see-through even with transparent artwork */\r\n fillBaseColor(0, 0, CanvasWidth, CanvasHeight);\r\n\r\n const {\r\n drawFrame,\r\n drawCardArt,\r\n drawBackground,\r\n drawPendulumScaleIcon,\r\n drawLinkArrowMap,\r\n drawStar,\r\n drawAttribute,\r\n\r\n drawNameBackground,\r\n drawEffectBackground,\r\n\r\n drawFrameBorder,\r\n drawNameBorder,\r\n drawArtBorder,\r\n drawPendulumBorder,\r\n drawBorderPendulumFinish,\r\n drawEffectBorder,\r\n drawCardBorder,\r\n drawStatBorder,\r\n\r\n drawAttributeFinish,\r\n drawArtBorderFoil,\r\n drawEffectBorderFoil,\r\n drawLinkMapFoil,\r\n\r\n drawNameFinish,\r\n drawArtFinish,\r\n drawArtOverlayFinish,\r\n drawArtBorderFinish,\r\n drawPendulumArtBorderFinish,\r\n drawFrameFinish,\r\n drawFrameBackgroundFinish,\r\n drawOverlayFinish,\r\n drawCardBorderFinish,\r\n\r\n calculateCardArtRedrawCoordination,\r\n } = getLayoutDrawFunction({\r\n canvas: frameCanvasRef.current,\r\n artworkCanvas, backgroundCanvas,\r\n format,\r\n frame, bottomFrame,\r\n hasBackground,\r\n backgroundType,\r\n attribute,\r\n cardIcon, star,\r\n foil,\r\n pendulumSize,\r\n opacity: normalizedOpacity,\r\n isLink, isSpeedSkill, isXyz,\r\n isPendulum,\r\n loopFinish,\r\n loopArtFinish,\r\n });\r\n\r\n /** Start with artwork at the bottom, then main frame, then outer card border. */\r\n if (backgroundCanvas && ctx) drawBackground();\r\n if (artworkCanvas && ctx && !boundless) drawCardArt();\r\n await drawFrame();\r\n await drawCardBorder();\r\n await drawCardBorderFinish();\r\n\r\n /** @summary Draw NON-PENDULUM card layout */\r\n if (!isPendulum) {\r\n if (!boundless) {\r\n await drawNameBackground();\r\n await drawEffectBackground();\r\n await drawEffectBorder();\r\n /** Foil DOES NOT contains shadow, so it relies on the shadow of the border below. */\r\n await drawEffectBorderFoil();\r\n }\r\n await drawArtBorder();\r\n await drawArtBorderFoil();\r\n await drawArtBorderFinish();\r\n }\r\n\r\n /** @summary Draw PENDULUM-LIKE card layout. Does not apply to Link frame since it contains link arrows. */\r\n if (isPendulum && !isLink && !boundless) {\r\n /** Since pendulum art boundary is wider, we cannot relies on the artwork under frame, instead we must draw the artwork again, this time with different size. */\r\n if (artworkCanvas && ctx && artworkCanvas.height > 0) {\r\n const { width: artWidth, height: artHeight } = artworkCanvas;\r\n const {\r\n sourceOffsetX, sourceOffsetY,\r\n offsetHeight,\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n } = calculateCardArtRedrawCoordination(artworkCanvas);\r\n\r\n /** To avoid stacking transprency, we clear the area before redrawing */\r\n fillBaseColor(\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n );\r\n\r\n drawBackground('pendulum');\r\n ctx.drawImage(\r\n artworkCanvas,\r\n sourceOffsetX, sourceOffsetY,\r\n artWidth - sourceOffsetX * 2, artHeight - offsetHeight,\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n );\r\n }\r\n\r\n await drawNameBackground();\r\n await drawEffectBackground(true);\r\n }\r\n\r\n /** We must draw art finish first because pendulum's border have those little corners that spread into the artwork. */\r\n await drawArtFinish();\r\n await drawArtOverlayFinish();\r\n\r\n /** Scale and pendulum border frame, these will be covered by extended artwork so we doesn't draw them if the artwork is boundless */\r\n if (isPendulum && !isLink && !boundless) {\r\n await drawPendulumScaleIcon();\r\n /** Draw normal border first so we got the shadow ready. Again foiled border DOES NOT have shadow by their own. */\r\n await drawPendulumBorder(hasArtBorder, 'normal');\r\n await drawPendulumBorder(hasArtBorder, foil);\r\n await drawPendulumArtBorderFinish();\r\n if (hasArtBorder) await drawBorderPendulumFinish();\r\n }\r\n\r\n if (!boundless) {\r\n await drawFrameFinish();\r\n await drawNameFinish();\r\n }\r\n if (hasArtBorder) await drawFrameBackgroundFinish();\r\n\r\n /** Boundless art behavior here. If rigid frame is off, card image will extends beyond the current art border (on top of it). The extended card image is still below name, level, attribute, effect (both card and pendulum) and other predefined texts. */\r\n if (boundless) {\r\n if (isLink) {\r\n /** For link layout, the artwork is above the art border, but still below the link arrows */\r\n await drawArtBorderFinish();\r\n } else if (isPendulum) {\r\n /** We want to fill the area inside pendulum border only, so that the outside frame remains intact. */\r\n const extraHeightRatio = CardArtCanvasCoordinateMap.fullCard.ratio\r\n / CardArtCanvasCoordinateMap.extendedPendulum.ratio;\r\n /** Fill area with base color before start draw overlay artwork. In this case we do not want to fill everywhere, we just need to fill exactly the area contains inside pendulum border frame. */\r\n if (artworkCanvas && ctx && artworkCanvas.height > 0) {\r\n const {\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n } = calculateCardArtRedrawCoordination(\r\n artworkCanvas,\r\n { ...getDefaultCardOpacity(), ...opacity, body: 100, boundless: false },\r\n extraHeightRatio,\r\n );\r\n \r\n fillBaseColor(\r\n destinationX, destinationY,\r\n destinationWidth, destinationHeight,\r\n );\r\n drawBackground('pendulum');\r\n }\r\n if (hasArtBorder) {\r\n await drawPendulumBorder(hasArtBorder, 'normal');\r\n await drawPendulumBorder(hasArtBorder, foil);\r\n }\r\n await drawPendulumArtBorderFinish();\r\n }\r\n await drawNameBackground();\r\n await drawNameFinish();\r\n await drawNameBorder();\r\n if (artworkCanvas && ctx) drawCardArt();\r\n await drawArtOverlayFinish();\r\n\r\n /** Redraw various part here because the extended artwork may overlap with those */\r\n if (isPendulum && !isLink) {\r\n await drawEffectBackground(true);\r\n await drawPendulumScaleIcon();\r\n await drawPendulumBorder(false, 'normal');\r\n await drawPendulumBorder(false, foil);\r\n await drawBorderPendulumFinish();\r\n } else {\r\n await drawEffectBackground();\r\n await drawEffectBorder();\r\n await drawEffectBorderFoil();\r\n }\r\n await drawFrameFinish();\r\n }\r\n\r\n if (statInEffect) await drawStatBorder(resolvedStatTextStyle.color ?? '#000000');\r\n\r\n /** Individual arrows has two state (active/inactive) and two different parts (base and core) */\r\n if (!isPendulum && isLink) {\r\n await drawLinkArrowMap(linkMap);\r\n await drawLinkMapFoil(false);\r\n const resetStyle = setTextStyle({ ctx, ...resolvedStatTextStyle });\r\n await drawLinkRatingText(frameCanvasRef.current, linkMap ?? [], resolvedStatTextStyle);\r\n resetStyle();\r\n }\r\n\r\n await drawAttribute();\r\n await drawAttributeFinish();\r\n if (!isLink) await drawStar({ style: levelStyle, starAlignment });\r\n if (!boundless) await drawNameBorder();\r\n await drawFrameBorder();\r\n await drawPredefinedMark({\r\n ctx,\r\n type: (lightFooter && !isPendulum) ? 'white' : 'black',\r\n bordered: (opacityBody < 50 || boundless) && !isPendulum,\r\n isDuelTerminalCard, isSpeedCard,\r\n isLink, isPendulum,\r\n });\r\n await drawOverlayFinish();\r\n };\r\n }, [\r\n readyToDraw,\r\n artworkCanvasRef,\r\n backgroundCanvasRef,\r\n frameCanvasRef,\r\n frame,\r\n format,\r\n hasBackground,\r\n backgroundType,\r\n attribute,\r\n bottomFrame,\r\n foil,\r\n star,\r\n starAlignment,\r\n cardIcon,\r\n isDuelTerminalCard,\r\n isLink,\r\n isPendulum,\r\n isSpeedCard,\r\n isSpeedSkill,\r\n isXyz,\r\n lightFooter,\r\n linkMap,\r\n resolvedStatTextStyle,\r\n loopArtFinish,\r\n loopFinish,\r\n opacity,\r\n pendulumSize,\r\n statInEffect,\r\n levelStyle,\r\n imageChangeCount, // Special dependency, do not remove even though it is not used in the effect itself\r\n ]);\r\n\r\n /** DRAW SCALE */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = pendulumScaleCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx)) return;\r\n if (isPendulum) {\r\n drawScale(ctx, pendulumScaleBlue ?? 0, 84.4, 790);\r\n drawScale(ctx, pendulumScaleRed ?? 0, 728.0, 790);\r\n }\r\n }, [readyToDraw, isPendulum, pendulumScaleBlue, pendulumScaleRed, pendulumScaleCanvasRef]);\r\n\r\n /** DRAW NAME */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n drawingPipeline.current.name.rerun += 1;\r\n drawingPipeline.current.name.instructor = async () => {\r\n const ctx = nameCanvasRef.current?.getContext('2d');\r\n const cloneNode = nameCanvasRef.current?.cloneNode() as HTMLCanvasElement | undefined;\r\n\r\n if (!clearCanvas(ctx) || !cloneNode) return;\r\n\r\n await drawName(\r\n ctx,\r\n name,\r\n format === 'tcg' ? 60 : 68, 116,\r\n attribute === NO_ATTRIBUTE\r\n ? (format === 'tcg' ? 688 : 674)\r\n : (format === 'tcg' ? 608 : 598),\r\n resolveNameStyle({ format, frame, nameStyle, nameStyleType, foil }),\r\n { isSpeedSkill, format, cloneNode, frame, furiganaHelper },\r\n );\r\n };\r\n }, [\r\n readyToDraw,\r\n attribute,\r\n foil,\r\n format,\r\n frame,\r\n furiganaHelper,\r\n isSpeedSkill,\r\n name,\r\n nameCanvasRef,\r\n nameStyle,\r\n nameStyleType,\r\n ]);\r\n\r\n /** DRAW STAT (ATK / DEF) */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = statCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx) || !statInEffect) return;\r\n\r\n const resetStyle = setTextStyle({ ctx, ...resolvedStatTextStyle });\r\n drawStatText(ctx, 'ATK', 432.10, 1106.494);\r\n drawStat(ctx, atk, 508.824, 1106.494);\r\n if (!isLink) {\r\n drawStatText(ctx, 'DEF', 600.85, 1106.494);\r\n drawStat(ctx, def, 673.865, 1106.494);\r\n }\r\n resetStyle();\r\n }, [readyToDraw, atk, def, isLink, isMonster, resolvedStatTextStyle, statCanvasRef, statInEffect]);\r\n\r\n /** DRAW SET ID */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = setIdCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx)) return;\r\n\r\n drawSetId(\r\n ctx,\r\n setId,\r\n {\r\n isLink, isPendulum,\r\n withShadow: requireShadow && !isPendulum,\r\n format,\r\n lightFooter,\r\n }\r\n );\r\n }, [readyToDraw, format, isLink, isPendulum, lightFooter, setIdCanvasRef, setId, isSpeedSkill, bottomFrame, requireShadow]);\r\n\r\n /** DRAW FIRST EDITION NOTICE AND PASSWORD */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = passwordCanvasRef.current?.getContext('2d');\r\n if (!clearCanvas(ctx)) return;\r\n\r\n const endOfPassword = drawPasswordText({\r\n ctx,\r\n value: password,\r\n lightFooter,\r\n alignment: 'left',\r\n format,\r\n hasShadow: bottomFrame === 'zarc' || requireShadow,\r\n });\r\n if (isFirstEdition && !isDuelTerminalCard) {\r\n ctx.fillStyle = lightFooter ? '#ffffff' : '#000000';\r\n\r\n draw1stEdition(\r\n ctx,\r\n Math.max(endOfPassword + 14.813, 142.2) - (format === 'ocg' ? 10 : 0),\r\n isSpeedSkill ? -2 : -1,\r\n );\r\n }\r\n }, [\r\n readyToDraw,\r\n isDuelTerminalCard,\r\n isFirstEdition,\r\n password,\r\n passwordCanvasRef,\r\n lightFooter,\r\n format,\r\n requireShadow,\r\n isSpeedSkill,\r\n bottomFrame,\r\n ]);\r\n\r\n /** DRAW CREATOR TEXT */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n\r\n drawCreatorText({\r\n ctx: creatorCanvasRef.current?.getContext('2d'),\r\n format,\r\n value: creator,\r\n alignment: 'right',\r\n baselineOffset: isSpeedSkill ? -2 : 0,\r\n hasShadow: requireShadow,\r\n lightFooter,\r\n });\r\n }, [readyToDraw, isPendulum, lightFooter, creator, creatorCanvasRef, format, requireShadow, isSpeedSkill]);\r\n\r\n /** DRAW STICKER */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n\r\n drawingPipeline.current.sticker.rerun += 1;\r\n drawingPipeline.current.sticker.instructor = async () => {\r\n return await drawSticker({\r\n ctx: stickerCanvasRef.current?.getContext('2d'),\r\n sticker,\r\n });\r\n };\r\n }, [readyToDraw, sticker, stickerCanvasRef]);\r\n\r\n /** DRAW CARD EFFECT + TYPE ABILITY */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n\r\n const ctx = effectCanvasRef.current?.getContext('2d');\r\n const typeCtx = typeCanvasRef.current?.getContext('2d');\r\n\r\n drawingPipeline.current.typeAbility.rerun += 1;\r\n drawingPipeline.current.typeAbility.instructor = async () => {\r\n if (!clearCanvas(ctx) || !clearCanvas(typeCtx)) return;\r\n\r\n const effectIndexSize = drawEffect({\r\n ctx,\r\n content: effect,\r\n isNormal,\r\n condenseTolerant,\r\n format,\r\n furiganaHelper,\r\n ...getEffectFontAndCoordinate({\r\n format,\r\n statInEffect,\r\n typeInEffect,\r\n isNormal,\r\n }),\r\n textStyle: resolvedEffectTextStyle,\r\n });\r\n await drawTypeAbility({\r\n ctx: typeCtx,\r\n format,\r\n frame,\r\n furiganaHelper,\r\n isMonster,\r\n textStyle: resolvedTypeTextStyle,\r\n size: !typeInEffect\r\n ? 'large'\r\n : effectIndexSize === 0 ? 'medium' : 'small',\r\n subFamily: normalizedSubFamily,\r\n typeAbility: normalizedTypeAbility,\r\n });\r\n };\r\n }, [\r\n readyToDraw,\r\n typeInEffect,\r\n statInEffect,\r\n condenseTolerant,\r\n effect,\r\n effectCanvasRef,\r\n format,\r\n frame,\r\n furiganaHelper,\r\n isMonster,\r\n isNormal,\r\n resolvedTypeTextStyle,\r\n resolvedEffectTextStyle,\r\n normalizedSubFamily,\r\n normalizedTypeAbility,\r\n typeCanvasRef,\r\n ]);\r\n\r\n /** DRAW PENDULUM EFFECT */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = pendulumEffectCanvasRef.current?.getContext('2d');\r\n\r\n if (!clearCanvas(ctx)) return;\r\n if (isPendulum) {\r\n drawEffect({\r\n ctx,\r\n content: pendulumEffect,\r\n isNormal: false,\r\n fontData: PendulumEffectFontData[format],\r\n textStyle: resolvedPendulumEffectTextStyle,\r\n sizeList: PendulumEffectCoordinate,\r\n condenseTolerant,\r\n format,\r\n furiganaHelper,\r\n });\r\n }\r\n }, [readyToDraw, condenseTolerant, format, isPendulum, pendulumEffectCanvasRef, pendulumEffect, furiganaHelper, resolvedPendulumEffectTextStyle]);\r\n\r\n /** DRAW TOTAL OVERLAY */\r\n useEffect(() => {\r\n if (!readyToDraw) return;\r\n const ctx = finishCanvasRef.current?.getContext('2d');\r\n\r\n drawingPipeline.current.overlay.rerun += 1;\r\n drawingPipeline.current.overlay.instructor = async () => {\r\n if (!clearCanvas(ctx)) return;\r\n await loopFinish(\r\n ctx,\r\n 'total-overlay',\r\n overlayType => drawAsset(ctx, `finish/finish-${overlayType}-total-overlay.png`, 0, 0),\r\n );\r\n };\r\n }, [readyToDraw, finishCanvasRef, loopFinish, name]);\r\n\r\n const drawHistory = useRef>({});\r\n const onExport = useCallback(async (exportProps: {\r\n isPendulum: boolean,\r\n opacity: Partial,\r\n // isRelevant: () => boolean,\r\n }) => {\r\n const {\r\n // isRelevant,\r\n isPendulum = false,\r\n opacity,\r\n } = exportProps;\r\n const canvasRef = drawCanvasRef.current;\r\n const exportCtx = canvasRef?.getContext('2d');\r\n /** Delay queue and relevant checker is used for potential performance improvement, but currently performance is not a making a hard impact to the app. */\r\n const generateLayer = (\r\n canvasLayer: React.RefObject,\r\n exportCtx: CanvasRenderingContext2D | null | undefined,\r\n delayQueue: number = 0,\r\n ) => {\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n if (!canvasLayer.current || !exportCtx) resolve(false);\r\n else {\r\n try {\r\n canvasLayer.current.toBlob(blob => {\r\n if (!blob) resolve(false);\r\n else {\r\n const url = URL.createObjectURL(blob);\r\n if (!url) resolve(false);\r\n else {\r\n const layer = new Image();\r\n layer.src = url;\r\n layer.onload = () => {\r\n exportCtx.drawImage(layer, 0, 0);\r\n URL.revokeObjectURL(url);\r\n resolve(true);\r\n };\r\n layer.onerror = () => {\r\n URL.revokeObjectURL(url);\r\n resolve(false);\r\n };\r\n }\r\n }\r\n });\r\n } catch (e) {\r\n console.error(e);\r\n resolve(false);\r\n }\r\n }\r\n }, delayQueue * 25);\r\n });\r\n };\r\n\r\n if (canvasRef && exportCtx) {\r\n exportCtx.clearRect(0, 0, CanvasConst.width, CanvasConst.height);\r\n await Promise.all(Object\r\n .values(drawingPipeline.current)\r\n .sort((l, r) => l.order - r.order)\r\n .map(({ instructor, rerun, name }) => {\r\n if (\r\n (rerun !== 0 && drawHistory.current[name] !== rerun)\r\n || !drawHistory.current[name]\r\n ) {\r\n drawHistory.current[name] = rerun;\r\n\r\n return instructor();\r\n }\r\n return Promise.resolve();\r\n }));\r\n // await generateLayer(frameCanvas, exportCtx);\r\n const artworkCanvas = artworkCanvasRef.current;\r\n if (artworkCanvas && exportCtx) {\r\n const { artX, artY, artWidth } = getArtCanvasCoordinate(isPendulum, opacity);\r\n const { width: imageWidth, height: imageHeight } = artworkCanvas;\r\n\r\n if (imageHeight > 0) {\r\n exportCtx.drawImage(\r\n artworkCanvas,\r\n 0, 0,\r\n imageWidth, imageHeight,\r\n artX, artY,\r\n artWidth, artWidth / (imageWidth / imageHeight),\r\n );\r\n }\r\n }\r\n /** It is not worth to use promise all here, just let them go sequentially to avoid too much blob generating call. */\r\n await generateLayer(frameCanvasRef, exportCtx, 0);\r\n await generateLayer(nameCanvasRef, exportCtx, 0);\r\n await generateLayer(cardIconCanvasRef, exportCtx, 0);\r\n await generateLayer(pendulumScaleCanvasRef, exportCtx, 0);\r\n await generateLayer(pendulumEffectCanvasRef, exportCtx, 0);\r\n await generateLayer(typeCanvasRef, exportCtx, 0);\r\n await generateLayer(effectCanvasRef, exportCtx, 0);\r\n await generateLayer(statCanvasRef, exportCtx, 0);\r\n await generateLayer(setIdCanvasRef, exportCtx, 0);\r\n await generateLayer(passwordCanvasRef, exportCtx, 0);\r\n await generateLayer(creatorCanvasRef, exportCtx, 0);\r\n await generateLayer(stickerCanvasRef, exportCtx, 0);\r\n await generateLayer(finishCanvasRef, exportCtx, 0);\r\n\r\n lightboxCanvasRef.current?.getContext('2d')?.drawImage(canvasRef, 0, 0);\r\n }\r\n }, [\r\n artworkCanvasRef, \r\n cardIconCanvasRef, \r\n creatorCanvasRef, \r\n drawCanvasRef, \r\n effectCanvasRef, \r\n finishCanvasRef, \r\n lightboxCanvasRef, \r\n nameCanvasRef, \r\n passwordCanvasRef, \r\n pendulumEffectCanvasRef, \r\n pendulumScaleCanvasRef, \r\n setIdCanvasRef, \r\n frameCanvasRef, \r\n statCanvasRef, \r\n stickerCanvasRef, \r\n typeCanvasRef,\r\n ]);\r\n\r\n return {\r\n drawingPipeline,\r\n onExport,\r\n };\r\n};\r\n\r\nexport * from './prepare-style';","import { TextStyle } from 'src/model';\r\n\r\nexport type CanvasTextStyle = {\r\n x?: number,\r\n y?: number,\r\n blur?: number,\r\n color?: string,\r\n shadowColor?: string,\r\n};\r\n\r\nexport const prepareStyle = ({\r\n lightFooter,\r\n lightHeader,\r\n requireShadow,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n statTextStyle,\r\n typeTextStyle,\r\n}: {\r\n requireShadow: boolean,\r\n lightHeader: boolean,\r\n lightFooter: boolean,\r\n effectTextStyle: TextStyle,\r\n pendulumTextStyle: TextStyle,\r\n statTextStyle: TextStyle,\r\n typeTextStyle: TextStyle,\r\n}) => {\r\n const levelColor = { color: lightHeader ? '#ffffff' : '#000000' };\r\n const levelStyle = requireShadow\r\n ? {\r\n blur: 2,\r\n y: 1,\r\n shadowColor: lightHeader ? '#000000' : '#ffffff',\r\n ...levelColor,\r\n }\r\n : levelColor;\r\n\r\n const [customEffectText, effectTextFillStyle, effectHasShadow, effectTextShadow] = effectTextStyle;\r\n const resolvedEffectTextStyle: CanvasTextStyle = customEffectText\r\n ? {\r\n ...(effectHasShadow ? { y: 0, blur: 4, shadowColor: effectTextShadow } : {}),\r\n color: effectTextFillStyle,\r\n }\r\n : {};\r\n\r\n const [customPendulumEffectText, pendulumEffectTextFillStyle, pendulumEffectHasShadow, pendulumEffectTextShadow] = pendulumTextStyle;\r\n const resolvedPendulumEffectTextStyle: CanvasTextStyle = customPendulumEffectText\r\n ? {\r\n ...(pendulumEffectHasShadow ? { y: 0, blur: 4, shadowColor: pendulumEffectTextShadow } : {}),\r\n color: pendulumEffectTextFillStyle,\r\n }\r\n : {};\r\n\r\n const [customTypeText, typeTextFillStyle, typeHasShadow, typeTextShadow] = typeTextStyle;\r\n const resolvedTypeTextStyle: CanvasTextStyle = customTypeText\r\n ? {\r\n ...(typeHasShadow ? { y: 1, blur: 1, shadowColor: typeTextShadow } : {}),\r\n color: typeTextFillStyle,\r\n }\r\n : {};\r\n\r\n const [customStatText, statTextFillStyle, statHasShadow, statTextShadow] = statTextStyle;\r\n const resolvedStatTextStyle: CanvasTextStyle = customStatText\r\n ? {\r\n ...(statHasShadow ? { y: 1, blur: 1, shadowColor: statTextShadow } : {}),\r\n color: statTextFillStyle,\r\n }\r\n : {};\r\n\r\n return {\r\n levelStyle,\r\n resolvedEffectTextStyle,\r\n resolvedPendulumEffectTextStyle,\r\n resolvedTypeTextStyle,\r\n resolvedStatTextStyle,\r\n };\r\n};","import { PasswordFontData, PasswordCoordinateMap, DefaultFontSizeData } from 'src/model';\r\nimport { condense, createFontGetter } from 'src/util';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { clearCanvas } from '../canvas-util';\r\n\r\nexport const drawPasswordText = ({\r\n ctx,\r\n value,\r\n format,\r\n alignment,\r\n baselineOffset = 0,\r\n lightFooter,\r\n hasShadow,\r\n}: {\r\n ctx?: CanvasRenderingContext2D | null,\r\n value: string,\r\n format: string,\r\n alignment: 'left' | 'right',\r\n baselineOffset?: number,\r\n lightFooter: boolean,\r\n hasShadow?: boolean,\r\n}) => {\r\n if (!clearCanvas(ctx)) return 0;\r\n\r\n ctx.fillStyle = lightFooter ? '#ffffff' : '#000000';\r\n ctx.shadowColor = hasShadow\r\n ? lightFooter ? '#000000' : '#ffffff'\r\n : '#000000';\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowBlur = hasShadow ? 3 : 0;\r\n\r\n const { trueEdge, trueBaseline, trueWidth: width } = PasswordCoordinateMap[format] ?? PasswordCoordinateMap['tcg'];\r\n const isNumberPassword = /^[0-9]*$/.test(value);\r\n const fontData = PasswordFontData[format];\r\n const { font } = fontData;\r\n const normalizedText = normalizeCardText(value, format, { multiline: false, furiganaHelper: false });\r\n\r\n /** Calculation */\r\n let textData = {\r\n fontLevel: !isNumberPassword ? 1 : 0,\r\n fontData,\r\n currentFont: createFontGetter(),\r\n };\r\n let actualLineWidth = 0;\r\n let internalEffectiveMedian = 1000;\r\n let fontSizeData = fontData.fontList[0];\r\n for (let fontLevel = 0; fontLevel < fontData.fontList.length; fontLevel++) {\r\n fontSizeData = fontData.fontList[fontLevel];\r\n const fontGetter = createFontGetter({\r\n defaultFamily: font,\r\n defaultSize: `${fontSizeData.fontSize}px`,\r\n defaultWeight: hasShadow ? 'bold' : '',\r\n });\r\n let internalTextData = {\r\n fontLevel,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n let internalTrueWidth = 0;\r\n ctx.font = fontGetter.getFont();\r\n ctx.textAlign = 'left';\r\n internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [normalizedText],\r\n format, textData: internalTextData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n internalTrueWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n\r\n actualLineWidth = internalTrueWidth;\r\n textData = internalTextData;\r\n if (internalEffectiveMedian >= 1000) break;\r\n }\r\n\r\n /** Drawing */\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n ctx.scale(xRatio, yRatio);\r\n const result = drawLine({\r\n ctx,\r\n tokenList: tokenizeText(normalizedText),\r\n xRatio, yRatio,\r\n trueEdge: alignment === 'left' ? trueEdge : (trueEdge - actualLineWidth * xRatio),\r\n trueBaseline: trueBaseline + (fontSizeData.offsetY ?? DefaultFontSizeData.offsetY) + baselineOffset,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n },\r\n });\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n return result.tokenEdge;\r\n};","import { CreatorFontData, CreatorCoordinateMap, DefaultFontSizeData } from 'src/model';\r\nimport { condense, createFontGetter } from 'src/util';\r\nimport { tokenizeText } from '../text-util';\r\nimport { drawLine } from '../text';\r\nimport { createLineList } from '../line';\r\nimport { normalizeCardText } from '../text-normalize';\r\nimport { clearCanvas } from '../canvas-util';\r\n\r\nexport const drawCreatorText = ({\r\n ctx,\r\n value,\r\n format,\r\n alignment,\r\n baselineOffset = 0,\r\n lightFooter,\r\n hasShadow,\r\n}: {\r\n ctx?: CanvasRenderingContext2D | null,\r\n value: string,\r\n format: string,\r\n alignment: 'left' | 'right',\r\n baselineOffset?: number,\r\n lightFooter: boolean,\r\n hasShadow?: boolean,\r\n}) => {\r\n if (!clearCanvas(ctx)) return;\r\n\r\n ctx.fillStyle = lightFooter ? '#ffffff' : '#000000';\r\n ctx.shadowColor = hasShadow\r\n ? lightFooter ? '#000000' : '#ffffff'\r\n : '#000000';\r\n ctx.shadowOffsetY = 0;\r\n ctx.shadowOffsetX = 0;\r\n ctx.shadowBlur = hasShadow ? 3 : 0;\r\n\r\n const { trueEdge, trueBaseline, trueWidth: width } = CreatorCoordinateMap[format] ?? CreatorCoordinateMap['tcg'];\r\n const fontData = CreatorFontData[format];\r\n const { font } = fontData;\r\n const normalizedText = normalizeCardText(value, format, { multiline: false, furiganaHelper: false });\r\n\r\n /** Calculation */\r\n let textData = {\r\n fontLevel: 0,\r\n fontData,\r\n currentFont: createFontGetter(),\r\n };\r\n let actualLineWidth = 0;\r\n let internalEffectiveMedian = 1000;\r\n let fontSizeData = fontData.fontList[0];\r\n for (let fontLevel = 0; fontLevel < fontData.fontList.length; fontLevel++) {\r\n fontSizeData = fontData.fontList[fontLevel];\r\n const fontGetter = createFontGetter({\r\n defaultFamily: font,\r\n defaultSize: `${fontSizeData.fontSize}px`,\r\n defaultWeight: hasShadow ? 'bold' : '',\r\n });\r\n let internalTextData = {\r\n fontLevel,\r\n fontData,\r\n currentFont: fontGetter,\r\n };\r\n let internalTrueWidth = 0;\r\n ctx.font = fontGetter.getFont();\r\n ctx.textAlign = 'left';\r\n internalEffectiveMedian = condense(\r\n median => {\r\n const { currentLineCount, currentLineList } = createLineList({\r\n ctx,\r\n median,\r\n paragraphList: [normalizedText],\r\n format, textData: internalTextData,\r\n width,\r\n });\r\n \r\n if (currentLineCount > 1) return false;\r\n internalTrueWidth = currentLineList[0].actualLineWidth;\r\n return true;\r\n },\r\n );\r\n\r\n actualLineWidth = internalTrueWidth;\r\n textData = internalTextData;\r\n if (internalEffectiveMedian >= 1000) break;\r\n }\r\n\r\n /** Drawing */\r\n const xRatio = internalEffectiveMedian / 1000;\r\n const yRatio = 1;\r\n ctx.scale(xRatio, yRatio);\r\n const result = drawLine({\r\n ctx,\r\n tokenList: tokenizeText(normalizedText),\r\n xRatio, yRatio,\r\n trueEdge: alignment === 'left' ? trueEdge : (trueEdge - actualLineWidth * xRatio),\r\n trueBaseline: trueBaseline + (fontSizeData.offsetY ?? DefaultFontSizeData.offsetY) + baselineOffset,\r\n textData,\r\n format,\r\n textDrawer: ({ ctx, letter, scaledEdge, scaledBaseline }) => {\r\n ctx.fillText(letter, scaledEdge, scaledBaseline);\r\n },\r\n });\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n\r\n return result;\r\n};","import { Input, Radio, Tooltip } from 'antd';\r\nimport React, { useState, useCallback, useRef, useEffect, useImperativeHandle } from 'react';\r\nimport ReactCrop from 'react-image-crop';\r\nimport { DownloadOutlined, ExclamationCircleOutlined } from '@ant-design/icons';\r\nimport { Loading } from '../loading';\r\nimport { IconButton } from '../icon-button';\r\nimport 'react-image-crop/dist/ReactCrop.css';\r\nimport './image-cropper.scss';\r\nimport { useLanguage } from 'src/service';\r\n\r\nfunction generateDownload(canvas: HTMLCanvasElement | null, crop: ReactCrop.Crop | null) {\r\n if (!crop || !canvas) return;\r\n canvas.toBlob(\r\n (blob) => {\r\n if (blob !== null) {\r\n const previewUrl = window.URL.createObjectURL(blob);\r\n\r\n const anchor = document.createElement('a');\r\n anchor.download = 'crop-preview.png';\r\n anchor.href = URL.createObjectURL(blob);\r\n anchor.click();\r\n\r\n window.URL.revokeObjectURL(previewUrl);\r\n }\r\n },\r\n 'image/png',\r\n 1\r\n );\r\n}\r\n\r\n/**\r\n * Historic reason: cropData initially used `px` as unit, but this create a hard link between cropData and size of the cropper (NOT the actual image). This means the cropData only match a specific cropper size, and will become incorrect if the size change (which is happening when we got to v2).\r\n * \r\n * So from now on every cropData with `px` unit in it (old data) will be converted into the new one that use `%` data, which is more tricky to calculate but remove the link entirely.\r\n */\r\nconst normalizeCrop = (crop: Partial, image: HTMLImageElement | null, ratio: number) => {\r\n if (!image) return crop;\r\n const { width: cropWidth, height: cropHeight, x = 0, y = 0, unit } = crop;\r\n\r\n /** Migrate old unit */\r\n if (unit === 'px') {\r\n const oldHeightToWidthRatio = 300 / 375;\r\n const newHeightToWidthRatio = 400 / 300;\r\n const { width: imageWidth, height: imageHeight } = image;\r\n\r\n const isHeightRestricted = (imageHeight / imageWidth) >= oldHeightToWidthRatio;\r\n const scaleRatio = isHeightRestricted ? newHeightToWidthRatio : 1;\r\n const nextX = Math.min((x ?? 0) * scaleRatio, imageWidth);\r\n const nextY = Math.min((y ?? 0) * scaleRatio, imageHeight);\r\n const newWidth = Math.min((cropWidth ?? 0) * scaleRatio, imageWidth);\r\n\r\n return {\r\n unit: '%' as 'px' | '%',\r\n x: nextX / imageWidth * 100,\r\n y: nextY / imageHeight * 100,\r\n width: newWidth / imageWidth * 100,\r\n height: newWidth / (ratio ?? 1) / imageHeight * 100,\r\n aspect: ratio,\r\n };\r\n }\r\n\r\n if (x < 0) return { ...crop, x: 0 };\r\n if (y < 0) return { ...crop, y: 0 };\r\n const { naturalHeight, naturalWidth } = image;\r\n const width = cropWidth ?? 0;\r\n const height = cropHeight ?? 0;\r\n /** Avoid recalculate if current ratio is in acceptable limit, so we don't cascade calculation error */\r\n const acceptableError = (naturalHeight > naturalWidth ? naturalHeight : naturalWidth) * 0.05;\r\n const isRatioAcceptable = Math.abs(height * naturalHeight * ratio - width * naturalWidth) <= acceptableError;\r\n\r\n return {\r\n ...crop,\r\n x: x < 0 ? 0 : x,\r\n y: y < 0 ? 0 : y,\r\n height: isRatioAcceptable\r\n ? height\r\n : width * image.naturalWidth /** Restore original size */\r\n / ratio /** Get height with corresponding aspect ratio */\r\n / image.naturalHeight /** Convert back to percent */,\r\n aspect: ratio,\r\n };\r\n};\r\n\r\nexport type ImageCropperRef = {\r\n hasImage: () => boolean,\r\n forceExternalSource: (artLink: string, cropInfo: Partial) => void,\r\n}\r\nexport type ImageCropper = {\r\n title?: React.ReactNode,\r\n backgroundColor?: string,\r\n className?: string,\r\n defaultExternalSource?: string,\r\n receivingCanvas?: HTMLCanvasElement | null,\r\n children?: React.ReactNode,\r\n beforeCropper?: React.ReactNode,\r\n defaultCropInfo: Partial,\r\n ratio: number,\r\n onSourceChange?: (source: string) => void,\r\n onSourceLoaded?: () => void,\r\n onCropChange?: (cropInfo: Partial, sourceType: 'internal' | 'external') => void,\r\n onTainted: () => void,\r\n}\r\nexport const ImageCropper = React.forwardRef(({\r\n title,\r\n backgroundColor,\r\n className,\r\n defaultExternalSource = '',\r\n receivingCanvas,\r\n children,\r\n beforeCropper,\r\n defaultCropInfo,\r\n ratio,\r\n onSourceLoaded = () => { },\r\n onSourceChange = () => { },\r\n onCropChange = () => { },\r\n onTainted = () => { },\r\n}: ImageCropper, forwardedRef) => {\r\n const language = useLanguage();\r\n const fileInputRef = useRef(null);\r\n const [\r\n crossorigin,\r\n // setCrossOrigin,\r\n ] = useState<'anonymous' | 'use-credentials' | undefined>('anonymous');\r\n const [redrawSignal, setRedrawSignal] = useState(0);\r\n const [sourceType, setSourceType] = useState<'internal' | 'external'>('external');\r\n const [inputMode, setInputMode] = useState<'internal' | 'external'>('external');\r\n const [internalSource, setInternalSource] = useState('');\r\n const [isLoading, setLoading] = useState(false);\r\n const [error, setError] = useState(null);\r\n const [externalSource, setExternalSource] = useState(defaultExternalSource);\r\n const imgRef = useRef(null);\r\n const [crop, setCrop] = useState({\r\n current: defaultCropInfo,\r\n completed: null as ReactCrop.Crop | null,\r\n });\r\n // const [completedCrop, setCompletedCrop] = useState(null);\r\n const [isMigrated, setMigrated] = useState(defaultCropInfo.unit === '%');\r\n const {\r\n current: currentCrop,\r\n completed: completedCrop,\r\n } = crop;\r\n\r\n const applyOfflineSource = (e: React.ChangeEvent) => {\r\n if (e.target.files && e.target.files.length > 0) {\r\n setLoading(true);\r\n const reader = new FileReader();\r\n reader.addEventListener('load', () => {\r\n if (typeof reader.result === 'string') {\r\n setInternalSource(reader.result);\r\n setSourceType('internal');\r\n setInputMode('internal');\r\n setLoading(false);\r\n }\r\n });\r\n reader.readAsDataURL(e.target.files[0]);\r\n } else alert(language['image-cropper.not-found-warning']);\r\n };\r\n\r\n const pendingCrop = useRef({\r\n source: '',\r\n crop: null as Partial | null,\r\n });\r\n const onLoad = useCallback((img: HTMLImageElement) => {\r\n setLoading(false);\r\n setError(null);\r\n onSourceLoaded();\r\n imgRef.current = img;\r\n /** @todo Check if we really need timeout delay here */\r\n if (img.src === pendingCrop.current.source && pendingCrop.current.crop) {\r\n const internalId = pendingId.current;\r\n setTimeout(() => {\r\n if (internalId !== pendingId.current || !pendingCrop.current.crop) return;\r\n const normalizedCrop = normalizeCrop(pendingCrop.current.crop, img, ratio);\r\n setCrop({\r\n completed: normalizedCrop,\r\n current: normalizedCrop,\r\n });\r\n setMigrated(true);\r\n pendingCrop.current = {\r\n source: '',\r\n crop: null,\r\n };\r\n }, 250);\r\n } else {\r\n setTimeout(() => {\r\n setCrop(cur => {\r\n const normalizedCrop = normalizeCrop(cur.current, img, ratio);\r\n\r\n return {\r\n completed: normalizedCrop,\r\n current: normalizedCrop,\r\n };\r\n });\r\n setMigrated(true);\r\n }, 250);\r\n }\r\n }, [onSourceLoaded, ratio]);\r\n\r\n const applyOnlineSource = (e: React.ChangeEvent) => {\r\n const source = e.target.value;\r\n\r\n setLoading(true);\r\n setSourceType('external');\r\n setInputMode('external');\r\n onSourceChange(source);\r\n setExternalSource(source);\r\n };\r\n\r\n useEffect(() => {\r\n const image = imgRef.current;\r\n if (!completedCrop || !receivingCanvas || !image) return;\r\n\r\n const { aspect: ratio } = completedCrop;\r\n\r\n /** Increase image size for a bit */\r\n receivingCanvas.style.transform = 'scale(2)';\r\n const ctx = receivingCanvas.getContext('2d');\r\n if (!ctx || typeof ratio !== 'number' || ratio <= 0) return;\r\n\r\n const { naturalHeight, naturalWidth } = image;\r\n const zoomX = naturalWidth / image.width;\r\n const zoomY = naturalHeight / image.height;\r\n const cropUnit = completedCrop.unit ?? 'px';\r\n const pixelRatio = window.devicePixelRatio;\r\n\r\n ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);\r\n /** Snap sizing into whole pixel for a more crispy image. */\r\n let expectedDrawWidth = Math.floor((completedCrop.width ?? 0) * (cropUnit === 'px' ? zoomX : naturalWidth / 100));\r\n let drawWidth = Math.min(naturalWidth, expectedDrawWidth);\r\n let expectedDrawHeight = Math.floor(expectedDrawWidth / ratio);\r\n let drawHeight = Math.min(naturalHeight, expectedDrawHeight);\r\n let drawCoordinateX = Math.min(\r\n naturalWidth,\r\n Math.floor((completedCrop.x ?? 0) * (cropUnit === 'px' ? zoomX : naturalWidth / 100))\r\n );\r\n let drawCoordinateY = Math.min(\r\n naturalHeight,\r\n Math.floor((completedCrop.y ?? 0) * (cropUnit === 'px' ? zoomY : naturalHeight / 100))\r\n );\r\n ctx.imageSmoothingQuality = 'high';\r\n if (drawWidth <= 0 || drawHeight <= 0) return;\r\n\r\n let fitCropData: Partial | undefined = undefined;\r\n /** If the crop section is overflowed (mainly because change of ratio), we try to snap it back to the cropper. */\r\n if (\r\n // Size overflow\r\n (drawCoordinateX + drawWidth) > naturalWidth\r\n || (drawCoordinateY + drawHeight) > naturalHeight\r\n // Edge overflow\r\n || drawCoordinateX < 0\r\n || drawCoordinateY < 0\r\n // Ratio overflow\r\n || Math.abs((expectedDrawWidth - drawWidth) / drawWidth) > 0.01\r\n || Math.abs((expectedDrawHeight - drawHeight) / drawHeight) > 0.01\r\n ) {\r\n /** Try to maximize new crop section's area */\r\n const prominentSide = ratio * naturalHeight > naturalWidth ? 'width' : 'height';\r\n /** Automatically center current crop section. @todo For the best UX, it should actually be proportional based on the x and y before the snap. */\r\n if (prominentSide === 'width') {\r\n drawWidth = naturalWidth;\r\n drawHeight = drawWidth / ratio;\r\n drawCoordinateX = 0;\r\n drawCoordinateY = (naturalHeight - drawHeight) / 2;\r\n fitCropData = {\r\n unit: '%',\r\n aspect: ratio,\r\n height: drawHeight / naturalHeight * 100,\r\n width: drawWidth / naturalWidth * 100,\r\n x: 0,\r\n y: drawCoordinateY / naturalHeight * 100,\r\n };\r\n } else {\r\n drawWidth = naturalHeight * ratio;\r\n drawHeight = naturalHeight;\r\n drawCoordinateX = (naturalWidth - drawWidth) / 2;\r\n drawCoordinateY = 0;\r\n fitCropData = {\r\n unit: '%',\r\n aspect: ratio,\r\n height: drawHeight / naturalHeight * 100,\r\n width: drawWidth / naturalWidth * 100,\r\n x: drawCoordinateX / naturalWidth * 100,\r\n y: 0,\r\n };\r\n }\r\n }\r\n // const boundingWidth = Math.ceil(receivingCanvas.getBoundingClientRect().width);\r\n // const boundingHeight = Math.ceil(receivingCanvas.getBoundingClientRect().height);\r\n\r\n receivingCanvas.width = (drawWidth ?? 0);\r\n receivingCanvas.height = (drawHeight ?? 0);\r\n\r\n ctx.drawImage(\r\n image,\r\n drawCoordinateX,\r\n drawCoordinateY,\r\n drawWidth,\r\n drawHeight,\r\n 0,\r\n 0,\r\n drawWidth,\r\n drawHeight,\r\n );\r\n if (sourceType === 'internal' && (internalSource ?? '').length <= 0) { }\r\n else if (ratio === completedCrop.aspect) {\r\n onCropChange(completedCrop, sourceType);\r\n }\r\n if (fitCropData) {\r\n setCrop(cur => ({ ...cur, current: fitCropData }));\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [completedCrop, receivingCanvas, redrawSignal]);\r\n\r\n useEffect(() => {\r\n setCrop(cur => {\r\n if (imgRef.current != null && cur.current) {\r\n const newValue = normalizeCrop(cur.current, imgRef.current, ratio);\r\n return {\r\n current: newValue,\r\n completed: newValue,\r\n };\r\n }\r\n return cur;\r\n });\r\n }, [ratio]);\r\n\r\n const pendingId = useRef(0);\r\n useImperativeHandle(forwardedRef, () => ({\r\n hasImage: () => (typeof internalSource === 'string' && internalSource.length > 0 && sourceType === 'internal')\r\n || (typeof externalSource === 'string' && externalSource.length > 0 && sourceType === 'external'),\r\n forceExternalSource: (source, cropInfo) => {\r\n const currentSource = sourceType === 'internal' ? internalSource : externalSource;\r\n if (currentSource !== source) {\r\n setLoading(true);\r\n setSourceType('external');\r\n setInputMode('external');\r\n onSourceChange(source);\r\n setExternalSource(source);\r\n }\r\n setMigrated(cropInfo.unit === '%');\r\n pendingId.current += 1;\r\n pendingCrop.current = {\r\n source,\r\n crop: cropInfo,\r\n };\r\n setRedrawSignal(cur => cur + 1);\r\n }\r\n }));\r\n\r\n const isDownloadable = receivingCanvas && !isLoading && completedCrop?.width && completedCrop?.height;\r\n return (\r\n
\r\n
\r\n {children}\r\n
\r\n
\r\n \r\n {title} (isDownloadable && receivingCanvas) && generateDownload(receivingCanvas, completedCrop)}\r\n />\r\n \r\n {\r\n const value = e.target.value;\r\n setInputMode(value);\r\n if (\r\n ((internalSource ?? '').length > 0 && value === 'internal')\r\n || ((externalSource ?? '').length > 0 && value === 'external')\r\n ) setSourceType(value);\r\n }}\r\n value={inputMode}\r\n >\r\n \r\n {language['image-cropper.source.online.tooltip']}\r\n \r\n \r\n {language['image-cropper.offline-warning']}\r\n
}>\r\n \r\n {language['image-cropper.source.offline.tooltip']} \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n {error\r\n ?
\r\n {language['image-cropper.not-found-warning']}\r\n
\r\n :
\r\n {language['image-cropper.online-tip']}\r\n
}\r\n
\r\n
\r\n fileInputRef.current?.setValue('')}\r\n />\r\n
\r\n {language['image-cropper.offline-warning']}\r\n
\r\n
\r\n
\r\n {beforeCropper}\r\n
\r\n {isLoading && }\r\n {\r\n pendingCrop.current = {\r\n source: '',\r\n crop: null,\r\n };\r\n setError('Image error');\r\n setLoading(false);\r\n if (sourceType === 'external' && (externalSource ?? '') === '' && receivingCanvas) {\r\n const { width, height } = receivingCanvas;\r\n const ctx = receivingCanvas.getContext('2d');\r\n\r\n ctx?.clearRect(0, 0, width, height);\r\n if (completedCrop) onCropChange(completedCrop, sourceType);\r\n onSourceLoaded();\r\n } else {\r\n onTainted();\r\n }\r\n // setCrossOrigin(undefined);\r\n }}\r\n crop={currentCrop}\r\n onChange={(pixelCropData, percentCropData) => {\r\n const image = imgRef.current;\r\n if (pendingCrop.current.crop) return;\r\n if (!isMigrated) {\r\n setMigrated(true);\r\n setCrop(cur => {\r\n return {\r\n ...cur,\r\n current: normalizeCrop(pixelCropData, image, ratio)\r\n };\r\n });\r\n } else {\r\n setCrop(cur => {\r\n return {\r\n ...cur,\r\n current: normalizeCrop(percentCropData, image, ratio)\r\n };\r\n });\r\n }\r\n }}\r\n onComplete={(_, percentData) => {\r\n if (!pendingCrop.current.crop) setCrop(cur => ({ ...cur, completed: percentData }));\r\n }}\r\n ruleOfThirds={true}\r\n crossorigin={crossorigin}\r\n />\r\n
\r\n \r\n );\r\n});\r\n","import { Tooltip } from 'antd';\r\nimport { useEffect, useState } from 'react';\r\nimport { CloseCircleOutlined } from '@ant-design/icons';\r\nimport { useLanguage } from 'src/service';\r\nimport './link-marker.scss';\r\n\r\nexport type LinkMarkChooser = {\r\n defaultValue?: string[],\r\n onChange?: (value: string[]) => void,\r\n};\r\nexport const LinkMarkChooser = ({\r\n defaultValue = [],\r\n onChange = () => {},\r\n}: LinkMarkChooser) => {\r\n const [choosenArrow, setChoosenArrow] = useState(defaultValue);\r\n const rotateMap = [-45, 0, 45, -90, 0, 90, -135, 180, 135];\r\n const language = useLanguage();\r\n\r\n const literalChoosenArrow = JSON.stringify(choosenArrow);\r\n useEffect(() => {\r\n onChange(choosenArrow);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [literalChoosenArrow]);\r\n\r\n return
\r\n
\r\n {language['link-picker.label']}\r\n
\r\n
\r\n {[...Array(9)].map((_, index) => {\r\n const normalizedIndex = `${index + 1}`;\r\n\r\n if (normalizedIndex === '5') return \r\n
{\r\n setChoosenArrow([]);\r\n }}>\r\n \r\n
\r\n
;\r\n\r\n return
{\r\n setChoosenArrow(cur => {\r\n let newMap = [...cur];\r\n\r\n if (newMap.includes(normalizedIndex)) newMap = newMap.filter(entry => entry !== normalizedIndex);\r\n else newMap.push(normalizedIndex);\r\n\r\n return newMap;\r\n });\r\n }}\r\n >\r\n
\r\n
;\r\n })}\r\n
\r\n
;\r\n};","import { Popover } from 'antd';\r\nimport { ExclamationCircleOutlined } from '@ant-design/icons';\r\nimport { ExtractProps } from 'src/type';\r\nimport './explanation.scss';\r\n\r\nexport type Explanation = {\r\n iconProps?: ExtractProps,\r\n} & ExtractProps;\r\nexport const Explanation = ({\r\n overlayClassName,\r\n iconProps,\r\n ...rest\r\n}: Explanation) => {\r\n const { className, ...restIconProps } = iconProps ?? {};\r\n\r\n return \r\n \r\n ;\r\n};","import { Button, Drawer } from 'antd';\r\nimport { useState } from 'react';\r\nimport styled from 'styled-components';\r\nimport { BulbFilled, SettingFilled } from '@ant-design/icons';\r\nimport './formatting-guide.scss';\r\nimport { useLanguage } from 'src/service';\r\n\r\nconst StyledCode = styled.span`\r\n background: var(--main-level-1);\r\n padding: var(--spacing-px) var(--spacing-xxs);\r\n border: var(--bw) solid #4e84a4;\r\n border-radius: var(--br);\r\n font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;\r\n`;\r\nconst StyledContainer = styled.div`\r\n white-space: pre-line;\r\n`;\r\nconst StyledImageSection = styled.div`\r\n display: grid;\r\n grid-template-columns: 615fr 703fr;\r\n gap: var(--spacing-sm);\r\n padding: var(--spacing-sm) 0;\r\n overflow: hidden;\r\n .panel-box {\r\n min-width: 0;\r\n position: relative;\r\n overflow: hidden;\r\n }\r\n`;\r\nconst StyledImageWithCaptionContainer = styled.div`\r\n min-width: 0;\r\n position: relative;\r\n overflow: hidden;\r\n .caption {\r\n position: absolute;\r\n right: 0;\r\n bottom: 0;\r\n padding: var(--spacing-px) var(--spacing-sm);\r\n background: var(--main-level-5);\r\n border-radius: var(--br-lg) 0 0 0;\r\n box-shadow: var(--bs-block);\r\n }\r\n > img {\r\n max-width: 100%;\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br-lg);\r\n }\r\n`;\r\nexport type ImageWithCaption = {\r\n caption?: React.ReactNode,\r\n containerProps?: React.HTMLAttributes,\r\n} & React.ImgHTMLAttributes;\r\nexport const ImageWithCaption = ({\r\n caption,\r\n containerProps,\r\n alt,\r\n ...rest\r\n}: ImageWithCaption) => {\r\n const { className } = containerProps ?? {};\r\n\r\n return \r\n {alt}\r\n
{caption}
\r\n
;\r\n};\r\n\r\nexport const FormattingHelpDrawer = () => {\r\n const [modalOpen, setDrawerOpen] = useState(false);\r\n const language = useLanguage();\r\n\r\n return <>\r\n {language['guide.format.label']} {\r\n setDrawerOpen(false);\r\n }}\r\n >{language['guide.format.close']}
}\r\n className=\"formattting-guide-overlay\"\r\n onClose={() => {\r\n setDrawerOpen(false);\r\n }}\r\n >\r\n \r\n

\r\n {language['guide.format.introduction']()}.\r\n

\r\n

{language['guide.format.section-1.label']}

\r\n {language['guide.format.section-1.content'](\r\n {'['},\r\n {']'},\r\n {'Ctrl-1'},\r\n {'⌘-1'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-2.label']}

\r\n {language['guide.format.section-2.content'](\r\n {'{'},\r\n {'}'},\r\n {'Ctrl-2'},\r\n {'⌘-2'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-3.label']}

\r\n {language['guide.format.section-3.content'](\r\n {'|'},\r\n {'Ctrl-3'},\r\n {'⌘-3'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-4.label']}

\r\n {language['guide.format.section-4.content'](\r\n {'||'},\r\n {'Ctrl-4'},\r\n {'⌘-4'},\r\n )}\r\n \r\n \r\n \r\n \r\n

{language['guide.format.section-5.label']}

\r\n {language['guide.format.section-5.content'](\r\n {'{{'},\r\n {'}}'},\r\n {'Ctrl-5'},\r\n {'⌘-5'},\r\n )}\r\n \r\n \r\n \r\n \r\n
\r\n \r\n {\r\n setDrawerOpen(true);\r\n }}\r\n >\r\n {language['guide.format.label']} \r\n \r\n ;\r\n};","import { FrameInfo } from 'src/model';\r\nimport { useLanguage } from 'src/service';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledFrameContainer = styled.div<{ $withPillar: boolean }>`\r\n display: grid;\r\n ${({ $withPillar }) => $withPillar ? 'grid-template-columns: max-content 1fr;' : 'grid-template-columns: 1fr;'}\r\n > label {\r\n cursor: pointer;\r\n padding: 0 var(--spacing-xxs);\r\n text-align: center;\r\n }\r\n`;\r\nconst StyledFramePillar = styled.div`\r\n display: inline-block;\r\n width: 10px;\r\n`;\r\nexport const FrameInfoBlock = ({\r\n nameKey,\r\n labelBackgroundColor,\r\n labelBackgroundColorList,\r\n className,\r\n}: Omit & { className?: string }) => {\r\n const language = useLanguage();\r\n\r\n return \r\n {labelBackgroundColorList\r\n ? \r\n {labelBackgroundColorList.map(color => )}\r\n \r\n : labelBackgroundColor\r\n ? \r\n : null}\r\n \r\n ;\r\n};\r\n","import { useLanguage, useSetting } from 'src/service';\r\nimport { SettingFilled } from '@ant-design/icons';\r\nimport styled, { css, keyframes } from 'styled-components';\r\nimport { Checkbox, Popover, Tooltip } from 'antd';\r\n\r\nconst rotate = keyframes`\r\n to {\r\n transform: rotate(360deg);\r\n }\r\n`;\r\nconst StyledSettingPanel = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr;\r\n gap: var(--spacing-sm);\r\n background-color: var(--main-level-3);\r\n padding: var(--spacing-sm);\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br-lg);\r\n color: var(--color);\r\n`;\r\nconst StyledSettingButtonContainer = styled.div<{ $softMode?: boolean }>`\r\n cursor: pointer;\r\n .setting-button-label {\r\n display: grid;\r\n label {\r\n cursor: pointer;\r\n line-height: 1;\r\n font-size: var(--fs-xs);\r\n margin-top: var(--spacing-xs);\r\n }\r\n }\r\n .anticon-setting {\r\n font-size: var(--fs-xl);\r\n justify-self: center;\r\n > svg {\r\n ${({ $softMode }) => $softMode ? '' : css`animation: ${rotate} 12s linear infinite;`}\r\n }\r\n }\r\n &:hover {\r\n color: var(--main-active);\r\n .anticon-setting {\r\n color: var(--sub-active);\r\n }\r\n }\r\n`;\r\nexport const SettingButton = () => {\r\n const language = useLanguage();\r\n const {\r\n setting,\r\n updateSetting,\r\n } = useSetting(({ setting, updateSetting }) => ({ setting, updateSetting }));\r\n const {\r\n allowHotkey,\r\n reduceMotionColor,\r\n showCreativeOption,\r\n showExtraDecorativeOption,\r\n } = setting;\r\n\r\n return \r\n \r\n
\r\n updateSetting({ reduceMotionColor: e.target.checked })}\r\n >{language['setting.option.soft-mode.label']}\r\n
\r\n
\r\n updateSetting({ showExtraDecorativeOption: e.target.checked })}\r\n >{language['setting.option.extra-decorative.label']}\r\n
\r\n
\r\n updateSetting({ showCreativeOption: e.target.checked })}\r\n >{language['setting.option.creative.label']}\r\n
\r\n
\r\n \r\n updateSetting({ allowHotkey: e.target.checked })}\r\n >{language['setting.option.hotkey.label']}\r\n \r\n
\r\n
\r\n {language['setting.alert']}\r\n
\r\n }\r\n >\r\n
\r\n \r\n \r\n
\r\n \r\n
;\r\n};","import { GithubFilled } from '@ant-design/icons';\r\nimport styled from 'styled-components';\r\nimport { Explanation } from '../explanation';\r\nimport { SettingButton } from '../setting';\r\nimport { useI18N, useLanguage } from 'src/service';\r\nimport { Radio } from 'antd';\r\nimport './app-header.scss';\r\n\r\nexport const Affiliation = () => {\r\n return
\r\n v{process.env.REACT_APP_VERSION ?? 'unknown'}\r\n
\r\n \r\n \r\n \r\n
\r\n
;\r\n};\r\n\r\nconst StyledAppSettingContainer = styled.div`\r\n align-content: center;\r\n align-self: center;\r\n border-left: var(--bw) dashed #b1b1b1;\r\n padding-left: var(--spacing);\r\n margin-left: var(--spacing);\r\n`;\r\n/** @summary If possible, please don't remove this credit box. Show these artists the appreciation they deserve for their hard works. */\r\nexport const AppHeader = () => {\r\n const {\r\n language,\r\n languageInfo,\r\n languageMetadataMap,\r\n changeLanguage,\r\n } = useI18N(({\r\n languageInfo,\r\n language,\r\n languageMetadataMap,\r\n changeLanguage,\r\n }) => ({\r\n languageInfo,\r\n language,\r\n languageMetadataMap,\r\n changeLanguage,\r\n }));\r\n\r\n return
\r\n \"app-logo\"\r\n
\r\n
\r\n

Yugioh Carder

\r\n {/** Temporary disable until Japanese is translated */}\r\n \r\n {Object.values(languageMetadataMap)\r\n .filter(({ active }) => active)\r\n .map(({ codeName, name }) => {\r\n return changeLanguage(e.target.value)}\r\n >\r\n {name}\r\n ;\r\n })}\r\n \r\n
\r\n
\r\n \r\n {language['contributor.gui.label']}: \r\n Lauqerm\r\n  \r\n

{language['contributor.disclaimer.label']}

\r\n
    \r\n
  • {language['contributor.disclaimer.line-1'](lauqerm.github.io/ygocarder)}
  • \r\n
  • {language['contributor.disclaimer.line-2']}
  • \r\n
  • {language['contributor.disclaimer.line-3']}
  • \r\n
  • {language['contributor.disclaimer.line-4']}
  • \r\n
  • {language['contributor.disclaimer.line-5'](\r\n Grezar,\r\n 9558able\r\n )}
  • \r\n
  • {language['contributor.disclaimer.line-6']}
  • \r\n
\r\n
}\r\n />\r\n \r\n \r\n {language['contributor.template-maker'](\r\n Grezar,\r\n 9558able,\r\n SlackerMagician,\r\n icycatelf,\r\n )}\r\n \r\n
\r\n
\r\n \r\n \r\n \r\n ;\r\n};\r\n\r\nexport const TaintedCanvasWarning = () => {\r\n const language = useLanguage();\r\n\r\n return \r\n

{language['alert.explaination.tainted.first-question']}

\r\n

{language['alert.explaination.tainted.first-answer']}

\r\n

{language['alert.explaination.tainted.second-question']}

\r\n

{language['alert.explaination.tainted.second-answer']}

\r\n

{language['alert.explaination.tainted.third-question']}

\r\n

{language['alert.explaination.tainted.third-answer']}

\r\n }\r\n />;\r\n};","import styled from 'styled-components';\r\n\r\nexport const StandaloneLabel = styled.div`\r\n font-weight: 500;\r\n border-color: transparent;\r\n background-color: transparent;\r\n color: var(--color-vendor);\r\n text-shadow: var(--ts);\r\n user-select: none;\r\n display: inline-block;\r\n height: 32px;\r\n width: var(--width-label);\r\n line-height: 30px;\r\n position: relative;\r\n min-width: var(--width-label);\r\n text-align: right;\r\n padding-right: var(--spacing-antd);\r\n`;\r\n\r\nexport const StyledDropdownOption = styled.div`\r\n display: flex;\r\n align-items: center;\r\n padding: var(--spacing-xs) var(--spacing);\r\n cursor: pointer;\r\n &:hover {\r\n background-color: var(--sub-active);\r\n }\r\n &.menu-active {\r\n background-color: var(--main-active);\r\n &:hover {\r\n background-color: var(--sub-active);\r\n }\r\n }\r\n`;\r\nexport const StyledDropdownContainer = styled.div`\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br-lg);\r\n background-color: var(--main-level-3);\r\n box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05); // Mimic antd\r\n padding: var(--spacing-xs) 0;\r\n color: var(--color);\r\n`;\r\nexport const StyledDropdown = {\r\n Container: StyledDropdownContainer,\r\n Option: StyledDropdownOption,\r\n};\r\n\r\nexport { ImageCropper } from './image-cropper';\r\nexport type { ImageCropperRef } from './image-cropper';\r\nexport { LinkMarkChooser } from './link-marker';\r\nexport { Loading } from './loading';\r\nexport * from './explanation';\r\nexport * from './formatting-guide';\r\nexport * from './frame-info-block';\r\nexport * from './icon-button';\r\nexport * from './setting';\r\nexport * from './app-header';","import {\r\n frameList,\r\n IconList,\r\n AttributeList,\r\n StickerList,\r\n getFoilList,\r\n CondenseTolerantLabelMap,\r\n NameFontDataMap,\r\n NO_ATTRIBUTE,\r\n NO_ICON,\r\n ArtFinishMap,\r\n FinishMap,\r\n FoilDictionary,\r\n} from '../../model';\r\nimport { FrameInfoBlock } from 'src/component';\r\nimport { CloseCircleOutlined } from '@ant-design/icons';\r\nimport { Tooltip } from 'antd';\r\n\r\nexport const FormatButtonList = [\r\n {\r\n label: 'OCG',\r\n value: 'ocg',\r\n props: {\r\n className: 'ocg-button',\r\n style: { fontWeight: 'bold' } as React.CSSProperties\r\n },\r\n },\r\n {\r\n label: 'TCG',\r\n value: 'tcg',\r\n props: {\r\n className: 'tcg-button',\r\n style: { fontWeight: 'bold' } as React.CSSProperties\r\n },\r\n },\r\n];\r\n\r\nexport const getFoilButtonList = (dictionary: FoilDictionary) => {\r\n return getFoilList(dictionary).map(({ color, name, label }) => ({\r\n label,\r\n value: name,\r\n props: {\r\n style: {\r\n color,\r\n fontWeight: 'bold',\r\n } as React.CSSProperties,\r\n }\r\n }));\r\n};\r\n\r\nexport const FinishButtonList = Object.values(FinishMap).map(({ value, label }) => ({\r\n label,\r\n value,\r\n}));\r\n\r\nexport const getNameFontOptionList = (dictionary: Record) => Object.values(NameFontDataMap).map(({ value, labelKey }) => ({\r\n label: dictionary[labelKey],\r\n value,\r\n}));\r\n\r\nexport const ArtFinishButtonList = [\r\n { value: 'normal', label: },\r\n ...Object.values(ArtFinishMap).map(({ value, label }) => ({\r\n label,\r\n value,\r\n })),\r\n];\r\n\r\nexport const getFrameButtonList = () => frameList.map(({ name, nameKey, labelBackgroundColor, labelBackgroundColorList, edition }) => ({\r\n label: ,\r\n value: name,\r\n edition,\r\n}));\r\n\r\nexport const getAttributeList = (format: string, dictionary: Record) => AttributeList.map(({ name, nameKey }) => ({\r\n label: name === NO_ATTRIBUTE\r\n ? \r\n : \r\n \r\n ,\r\n value: name,\r\n}));\r\n\r\nexport const getSTIconButtonList = (dictionary: Record) => IconList.map(({ value, nameKey }) => ({\r\n label: value === NO_ICON\r\n ? \r\n : \r\n {dictionary[nameKey]}\r\n ,\r\n value,\r\n}));\r\n\r\nexport const StarButtonList = [...Array(14)].map((_, index) => ({ label: index, value: index }));\r\nexport const IconTypeMap: Record = {\r\n 'auto': {\r\n value: 'auto',\r\n labelKey: 'input.icon-type.auto.label',\r\n fullLabelKey: 'input.icon-type.auto.label',\r\n icon: null,\r\n },\r\n 'st': {\r\n value: 'st',\r\n labelKey: 'input.icon-type.icon.label',\r\n fullLabelKey: 'input.icon-type.icon.label',\r\n icon: \"s/t-icon\",\r\n },\r\n 'level': {\r\n value: 'level',\r\n labelKey: 'input.icon-type.level.label',\r\n fullLabelKey: 'input.icon-type.level.label',\r\n icon: \"s/t-icon\",\r\n },\r\n 'negative-level': {\r\n value: 'negative-level',\r\n labelKey: 'input.icon-type.negative-level.label',\r\n fullLabelKey: 'input.icon-type.negative-level.label',\r\n icon: \"s/t-icon\",\r\n },\r\n 'rank': {\r\n value: 'rank',\r\n labelKey: 'input.icon-type.rank.label',\r\n fullLabelKey: 'input.icon-type.rank.label',\r\n icon: \"s/t-icon\",\r\n },\r\n};\r\nexport const IconTypeList = Object.values(IconTypeMap);\r\n\r\nexport const StickerButtonList = StickerList.map(name => ({\r\n label: name === 'no-sticker'\r\n ? \r\n : {name},\r\n value: name,\r\n}));\r\n\r\nexport const CondenseThresholdButtonList = Object\r\n .entries(CondenseTolerantLabelMap)\r\n .map(([key, { label, order }]) => {\r\n return {\r\n label,\r\n value: key,\r\n order\r\n };\r\n })\r\n .sort((l, r) => l.order - r.order);","// import { useCallback, useEffect, useState } from 'react';\r\n// import Moveable from 'react-moveable';\r\n// import { EllipsisOutlined } from '@ant-design/icons';\r\nimport { Explanation } from 'src/component';\r\nimport { useLanguage } from 'src/service';\r\nimport styled from 'styled-components';\r\n\r\nexport function insertAtCursor(target: HTMLTextAreaElement, myValue: string) {\r\n //IE support\r\n if ((document as any).selection) {\r\n target.focus();\r\n const sel = (document as any).selection.createRange();\r\n sel.text = myValue;\r\n\r\n return {\r\n value: target.value,\r\n position: 0,\r\n };\r\n }\r\n //MOZILLA and others\r\n else if (target.selectionStart || target.selectionStart === 0) {\r\n const startPos = target.selectionStart;\r\n const endPos = target.selectionEnd;\r\n target.value = target.value.substring(0, startPos)\r\n + myValue\r\n + target.value.substring(endPos, target.value.length);\r\n target.selectionStart = startPos + myValue.length;\r\n target.selectionEnd = startPos + myValue.length;\r\n target.focus();\r\n\r\n return {\r\n value: target.value,\r\n position: startPos + myValue.length,\r\n };\r\n } else {\r\n target.value += myValue;\r\n\r\n return {\r\n value: target.value,\r\n position: 0,\r\n };\r\n }\r\n}\r\n\r\nconst StyledCharPickerContainer = styled.div`\r\n z-index: 10;\r\n display: inline-grid;\r\n grid-template-columns: 1fr max-content;\r\n align-items: center;\r\n column-gap: var(--spacing-sm);\r\n .char-picker-guideline {\r\n\r\n }\r\n .char-picker {\r\n z-index: 1;\r\n display: grid;\r\n grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));\r\n .handler,\r\n .ant-btn {\r\n background-color: var(--main-level-1);\r\n color: var(--color-heavy);\r\n text-shadow: var(--ts);\r\n font-family: Segoe UI Symbol, sans-serif;\r\n border: 1px solid var(--sub-level-1);\r\n border-radius: 0;\r\n padding: 0 var(--spacing);\r\n + .ant-btn {\r\n border-left-width: 0;\r\n }\r\n &:hover {\r\n color: var(--main-active);\r\n }\r\n &:first-child {\r\n border-radius: var(--br) 0 0 var(--br);\r\n }\r\n &:last-child {\r\n border-radius: 0 var(--br) var(--br) 0;\r\n }\r\n }\r\n /** Currently char picker no longer movable */\r\n /* .handler {\r\n cursor: grabbing;\r\n background-color: var(--main-level-2);\r\n height: unset;\r\n font-size: var(--fs-xl);\r\n height: var(--fs-xl);\r\n line-height: 1;\r\n padding: 0;\r\n text-align: center;\r\n } */\r\n }\r\n .moveable-control-box {\r\n .moveable-control.moveable-origin,\r\n .moveable-line.moveable-direction {\r\n border-color: transparent;\r\n background: none;\r\n }\r\n }\r\n`;\r\n\r\n/** The dragging experience is not good. Currently turn it off for now and glue it into effect's textarea. */\r\nexport type CharPicker = {\r\n targetId: string,\r\n onPick?: (value: string, letter: string) => void,\r\n}\r\nexport const CharPicker = ({\r\n targetId = '',\r\n onPick = () => {},\r\n}: CharPicker) => {\r\n const language = useLanguage();\r\n // const [target, setTarget] = useState(null);\r\n const internalOnPick = (letter: string) => {\r\n const inputTarget = document.getElementById(targetId) as HTMLTextAreaElement;\r\n if (inputTarget) {\r\n const { value } = insertAtCursor(inputTarget, letter);\r\n\r\n onPick(value, letter);\r\n }\r\n };\r\n\r\n // useEffect(() => {\r\n // setTarget(document.getElementById('char-picker'));\r\n // }, []);\r\n\r\n // const onDrag = useCallback(({\r\n // target,\r\n // left, top,\r\n // transform,\r\n // }) => {\r\n // target!.style.left = `${left}px`;\r\n // target!.style.top = `${top}px`;\r\n // target!.style.transform = transform;\r\n // }, []);\r\n\r\n /** No tabIndex here because this is not an essential input, but rather a QoL component */\r\n return \r\n {
\r\n {/*
\r\n \r\n
*/}\r\n {[\r\n '∞',\r\n '☆',\r\n '●',\r\n '©',\r\n '™',\r\n 'Ɐ',\r\n 'Я',\r\n '※',\r\n ].map(entry => {\r\n return ;\r\n })}\r\n
}\r\n
\r\n \r\n {language['input.char-picker.guide.header']}\r\n
    \r\n
  • {language['input.char-picker.guide.instruction-1']}
  • \r\n
  • {language['input.char-picker.guide.instruction-2']}
  • \r\n
\r\n }\r\n />\r\n
\r\n {/* */}\r\n
;\r\n};","import { Button, InputNumber } from 'antd';\r\nimport { ForwardedRef, forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\r\nimport { ChromePicker } from 'react-color';\r\nimport { AnglePicker, ColorPoint, GradientPicker } from 'react-linear-gradient-picker';\r\nimport { getDefaultGradientPalette, parsePalette, stringifyPalette } from 'src/util';\r\nimport debounce from 'lodash.debounce';\r\nimport 'react-linear-gradient-picker/dist/index.css';\r\nimport './gradient-picker.scss';\r\nimport { useLanguage } from 'src/service';\r\n\r\ntype WrappedColorPicker = {\r\n color?: string,\r\n onSelect?: (color: string, opacity?: number) => void,\r\n onOffsetChange?: (id: number, offset: string) => void,\r\n onRemove?: (id: number) => void,\r\n opacity?: number,\r\n};\r\ntype WrappedColorPickerRef = {\r\n setColor: (stopColor: ColorPoint) => void,\r\n setCurrentOffset: (id: number, offset: string) => void,\r\n}\r\nconst WrappedColorPicker = forwardRef(({\r\n color,\r\n onSelect,\r\n onOffsetChange,\r\n onRemove,\r\n}: WrappedColorPicker, ref: ForwardedRef) => {\r\n const language = useLanguage();\r\n const [internalColor, setInternalColor] = useState(color);\r\n const [internalOffset, setInternalOffset] = useState(0);\r\n const [internalId, setInternalId] = useState(-1);\r\n const debouncedOnChange = useRef(debounce(setInternalOffset, 250)).current;\r\n\r\n useImperativeHandle(ref, () => ({\r\n setColor: ({ color, offset, id }) => {\r\n const { min, max, round } = Math;\r\n\r\n setInternalColor(color);\r\n setInternalOffset(max(0, min(100, round(parseFloat(offset) * 100))));\r\n setInternalId(id);\r\n },\r\n setCurrentOffset: (id, offset) => {\r\n const { min, max, round } = Math;\r\n\r\n if (id === internalId) setInternalOffset(max(0, min(100, round(parseFloat(offset) * 100))));\r\n }\r\n }));\r\n\r\n useEffect(() => {\r\n if (internalId > 0) onOffsetChange?.(internalId, `${internalOffset / 100}`);\r\n }, [internalId, internalOffset, onOffsetChange]);\r\n\r\n return
\r\n
\r\n
\r\n {language['input.name-style.gradient.color-stop.label']}: debouncedOnChange(typeof value === 'string' ? parseInt(value) : value ?? 0)}\r\n />\r\n
\r\n \r\n
\r\n setInternalColor(color.hex)}\r\n onChangeComplete={color => {\r\n setInternalColor(color.hex);\r\n onSelect?.(color.hex);\r\n }}\r\n />\r\n
;\r\n});\r\n\r\nconst MAX_STOP_POINT = 20;\r\nconst getPaletteInfo = (newColorList: ColorPoint[]) => {\r\n return {\r\n colorList: newColorList,\r\n raw: stringifyPalette(newColorList),\r\n };\r\n};\r\nexport type TextGradientPicker = {\r\n palette?: string,\r\n angle?: number,\r\n memoizedOnChange: (palette: ColorPoint[], angle: number) => void,\r\n};\r\nexport const TextGradientPicker = ({\r\n palette: externalPalette = stringifyPalette(getDefaultGradientPalette()),\r\n angle: externalAngle = 180,\r\n memoizedOnChange,\r\n}: TextGradientPicker) => {\r\n const language = useLanguage();\r\n const pickerRef = useRef(null);\r\n const [angle, setAngle] = useState(externalAngle);\r\n const [palette, setPalette] = useState(() => {\r\n const intialPalette = parsePalette(externalPalette);\r\n\r\n return {\r\n raw: externalPalette,\r\n colorList: intialPalette,\r\n currentControlId: intialPalette[0]?.id ?? -1,\r\n };\r\n });\r\n\r\n const changePalette = useCallback((id: number, offset: string) => setPalette(cur => {\r\n const nextColorList = cur.colorList.map(entry => entry.id === id ? { ...entry, offset } : entry);\r\n\r\n return { ...cur, ...getPaletteInfo(nextColorList) };\r\n }), []);\r\n\r\n useEffect(() => {\r\n setAngle(externalAngle);\r\n }, [externalAngle]);\r\n\r\n useEffect(() => {\r\n const newPalette = parsePalette(externalPalette);\r\n\r\n setPalette({\r\n raw: externalPalette,\r\n colorList: newPalette,\r\n currentControlId: newPalette[0]?.id ?? -1,\r\n });\r\n }, [externalPalette]);\r\n\r\n const setPickerOnMount = useRef(false);\r\n useEffect(() => {\r\n if (palette.colorList[0] && setPickerOnMount.current) {\r\n setPickerOnMount.current = true;\r\n pickerRef.current?.setColor(palette.colorList[0]);\r\n }\r\n }, [palette.colorList]);\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n const { colorList, currentControlId } = palette;\r\n if (relevant && currentControlId >= 0) {\r\n const targetColor = colorList.find(entry => entry.id === currentControlId);\r\n\r\n if (targetColor) pickerRef.current?.setCurrentOffset(currentControlId, targetColor.offset);\r\n }\r\n }, 100);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n }, [palette]);\r\n\r\n /** @todo REMEMBER to memorize the callback before passing into this component */\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n if (relevant) {\r\n memoizedOnChange(palette.colorList, angle);\r\n }\r\n }, 200);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n }, [palette, angle, memoizedOnChange]);\r\n\r\n return
\r\n
\r\n

\r\n {language['input.name-style.gradient.color-point.label']}\r\n

\r\n MAX_STOP_POINT}\r\n onClick={() => {\r\n setPalette(cur => {\r\n const nextColorList = [\r\n ...cur.colorList,\r\n { offset: '0.5', color: '#ffffff', id: cur.colorList.length + 1 },\r\n ].sort((l, r) => Number(l.offset) - Number(r.offset));\r\n\r\n return {\r\n ...cur,\r\n ...getPaletteInfo(nextColorList)\r\n };\r\n });\r\n }}\r\n >{language['input.name-style.gradient.add-point.label']} ({palette.colorList.length}/{MAX_STOP_POINT})\r\n
\r\n

{language['input.name-style.gradient.gradient-direction.label']}

\r\n \r\n
\r\n
\r\n
\r\n setPalette(cur => ({ ...cur, ...getPaletteInfo(colorList) })),\r\n onColorStopSelect: stopColor => {\r\n setPalette(cur => ({ ...cur, currentControlId: stopColor.id }));\r\n pickerRef.current?.setColor(stopColor);\r\n },\r\n }}>\r\n {/** Under the hood this children will be cloned with pre-populate props, so it seemingly work even though we do not pass anything here. */}\r\n {\r\n setPalette(cur => {\r\n const nextColorList = cur.colorList.filter(entry => entry.id !== id);\r\n const nextId = nextColorList?.[0].id ?? -1;\r\n if (nextId > 0) pickerRef.current?.setColor(palette.colorList[nextId]);\r\n\r\n return {\r\n ...getPaletteInfo(nextColorList),\r\n currentControlId: nextId,\r\n };\r\n });\r\n }}\r\n />\r\n \r\n
\r\n
;\r\n};","import { StyledDropdown } from 'src/component';\r\nimport styled from 'styled-components';\r\n\r\nexport const StyledPickerButton = styled.div<{ $active?: boolean, $softMode: boolean }>`\r\n background-color: var(--main-level-4);\r\n ${({ $active }) => $active ? 'border: var(--bw) solid var(--main-active);' : 'border: var(--bw) solid var(--sub-level-1);'}\r\n padding: var(--spacing-xxs) var(--spacing-xs);\r\n margin: calc(-1 * var(--spacing-xxs)) 0;\r\n border-radius: var(--br-lg);\r\n box-shadow: var(--bs-button);\r\n color: var(--color-heavy);\r\n cursor: pointer;\r\n ${({ $softMode, $active }) => {\r\n return $softMode\r\n ? `\r\n border: var(--bw) solid var(--main-level-4);\r\n ${$active ? 'outline: var(--bw) solid var(--main-active);' : ''}\r\n `\r\n : '';\r\n }}\r\n &:hover {\r\n background-color: var(--sub-level-4);\r\n }\r\n`;\r\n\r\nexport const StyledPatternContainer = styled(StyledDropdown.Container)`\r\n display: grid;\r\n grid-template-columns: repeat(2, 200px);\r\n gap: var(--spacing-sm);\r\n padding: var(--spacing-xs);\r\n .alert {\r\n grid-column: span 2;\r\n font-size: var(--fs-sm);\r\n text-align: center;\r\n }\r\n`;\r\nexport const StyledPatternOption = styled.div`\r\n line-height: 0;\r\n cursor: pointer;\r\n align-self: center;\r\n text-align: center;\r\n &:not(.menu-off) {\r\n min-height: 23.2px;\r\n &.menu-active {\r\n outline: var(--bw-lg) solid var(--main-active);\r\n &:hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n }\r\n :hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n }\r\n &.menu-off {\r\n &:hover {\r\n color: var(--main-link);\r\n .anticon {\r\n color: var(--main-link);\r\n }\r\n }\r\n }\r\n img {\r\n max-width: 100%;\r\n border: var(--bw) solid var(--sub-level-1);\r\n }\r\n`;\r\n\r\nexport const StyledPredefinedContainer = styled(StyledDropdown.Container)`\r\n display: grid;\r\n grid-template-columns: repeat(4, 120px);\r\n gap: var(--spacing-sm);\r\n padding: var(--spacing-xs);\r\n &:focus-visible {\r\n outline: none;\r\n box-shadow: 0 0 0 2px var(--focus) inset;\r\n }\r\n`;\r\nexport const StyledPredefinedOption = styled.div`\r\n line-height: 0;\r\n cursor: pointer;\r\n min-height: 26.13px;\r\n &.menu-active {\r\n outline: var(--bw-lg) solid var(--main-active);\r\n &:hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n }\r\n &.preset-item-focused {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n :hover {\r\n outline: var(--bw-lg) solid var(--sub-active);\r\n }\r\n img {\r\n max-width: 100%;\r\n }\r\n`;","import { InputNumber, Slider } from 'antd';\r\nimport { forwardRef, useEffect, useImperativeHandle, useState } from 'react';\r\nimport { CompactPicker } from 'react-color';\r\nimport PowerSlider from 'react-input-slider';\r\nimport { DefaultColorList, NameStyle } from 'src/model';\r\nimport { useLanguage } from 'src/service';\r\n\r\nexport type GridSliderInputRef = {\r\n setValue: (value: Partial<{\r\n x: number;\r\n y: number;\r\n width: number;\r\n color: string;\r\n }>) => void,\r\n};\r\nexport type GridSliderInput = {\r\n className: string,\r\n defaultValue: Partial,\r\n fieldMap: {\r\n x: keyof NameStyle,\r\n y: keyof NameStyle,\r\n width: keyof NameStyle,\r\n color: keyof NameStyle,\r\n },\r\n labelMap: Partial>,\r\n onChange: (value: {\r\n x: number;\r\n y: number;\r\n width: number;\r\n color: string;\r\n }) => void,\r\n}\r\nexport const GridSliderInput = forwardRef(({\r\n className,\r\n defaultValue,\r\n fieldMap,\r\n labelMap,\r\n onChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n x: xField,\r\n y: yField,\r\n color: colorField,\r\n width: widthField,\r\n } = fieldMap;\r\n const [value, setValue] = useState(() => {\r\n const xValue = defaultValue[xField] as number;\r\n const yValue = defaultValue[yField] as number;\r\n const colorValue = defaultValue[colorField] as string;\r\n const widthValue = defaultValue[widthField] as number;\r\n\r\n return {\r\n x: xValue ?? 0,\r\n y: yValue ?? 0,\r\n width: widthValue ?? 0,\r\n color: colorValue,\r\n };\r\n });\r\n const {\r\n x,\r\n y,\r\n color,\r\n width,\r\n } = value;\r\n const widthLabel = labelMap[widthField];\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n if (relevant) {\r\n onChange(value);\r\n }\r\n }, 500);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n /** No need to depend on handler */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: nextValue => {\r\n const keyList = Object.keys(nextValue) as (keyof typeof value)[];\r\n\r\n for (const key in keyList) {\r\n if (nextValue[key as keyof typeof value] !== value[key as keyof typeof value]) {\r\n setValue(cur => ({ ...cur, ...nextValue }));\r\n return;\r\n }\r\n }\r\n },\r\n }));\r\n\r\n return
\r\n

{language['input.name-style.slider.position.label']}

\r\n
\r\n setValue(cur => ({ ...cur, x, y }))} />\r\n
\r\n {language['input.name-style.slider.x-offset.label']}: setValue(cur => ({ ...cur, x: typeof value === 'number' ? value : parseInt(value ?? '0') }))}\r\n />\r\n
\r\n
\r\n {language['input.name-style.slider.y-offset.label']}: setValue(cur => ({ ...cur, y: typeof value === 'number' ? value : parseInt(value ?? '0') }))}\r\n />\r\n
\r\n
\r\n {widthLabel}: {\r\n if (typeof value === 'number') {\r\n setValue(cur => ({ ...cur, width: value }));\r\n }\r\n }}\r\n />\r\n
\r\n
\r\n

{language['input.name-style.slider.color.label']}

\r\n setValue(cur => ({ ...cur, color: color.hex }))}\r\n />\r\n
;\r\n});","import { forwardRef, useImperativeHandle, useRef, useState } from 'react';\r\nimport { StyledPredefinedContainer, StyledPredefinedOption } from './style-picker.styled';\r\nimport { NameStyle, PresetNameStyle, PresetNameStyleList } from 'src/model';\r\nimport { getNavigationProps, mergeClass } from 'src/util';\r\n\r\nexport type PredefinedOptionGridRef = {\r\n focus: () => void,\r\n};\r\nexport type PredefinedOptionGrid = {\r\n active: boolean,\r\n value: Partial,\r\n onClick: (value: {\r\n key: PresetNameStyle,\r\n label: string,\r\n image: string,\r\n value: Partial,\r\n }) => void,\r\n onCancel?: () => void,\r\n};\r\nexport const PredefinedOptionGrid = forwardRef(({\r\n active,\r\n value,\r\n onClick,\r\n onCancel,\r\n}, ref) => {\r\n const containerRef = useRef(null);\r\n const [focus, setFocus] = useState(0);\r\n\r\n useImperativeHandle(ref, () => ({\r\n focus: () => containerRef.current?.focus(),\r\n }));\r\n\r\n return {\r\n if (focus >= 0) onClick(PresetNameStyleList[focus]);\r\n },\r\n onCancel: () => {\r\n onCancel?.();\r\n }\r\n })}\r\n >\r\n {PresetNameStyleList.map((entry, index) => {\r\n const { key, image, label } = entry;\r\n\r\n return {\r\n e.stopPropagation();\r\n onClick(entry);\r\n }}\r\n >\r\n {/** Tooltip currently is not really helpful, and gives poor UX */}\r\n {/* */}\r\n \r\n {/* */}\r\n ;\r\n })}\r\n ;\r\n});","import { Checkbox, Popover } from 'antd';\r\nimport { useCallback, useEffect, useRef, useState, forwardRef, useImperativeHandle, ForwardedRef, useMemo } from 'react';\r\nimport { CompactPicker } from 'react-color';\r\nimport { CaretDownOutlined, CloseCircleOutlined } from '@ant-design/icons';\r\nimport {\r\n PresetNameStyleMap,\r\n NameStyle,\r\n NameStyleType,\r\n PatternList,\r\n FrameInfo,\r\n DefaultColorList,\r\n} from '../../../model';\r\nimport debounce from 'lodash.debounce';\r\nimport { getNavigationProps, mergeClass, stringifyPalette, useRefresh } from 'src/util';\r\nimport { TextGradientPicker } from './gradient-picker';\r\nimport { getNameFontOptionList } from '../const';\r\nimport { StyledDropdown } from 'src/component';\r\nimport {\r\n StyledPatternContainer,\r\n StyledPatternOption,\r\n StyledPickerButton,\r\n} from './style-picker.styled';\r\nimport { useLanguage, useSetting } from 'src/service';\r\nimport { GridSliderInput, GridSliderInputRef } from './grid-slider-input';\r\nimport { PredefinedOptionGrid, PredefinedOptionGridRef } from './predefined-option-grid';\r\nimport './style-picker.scss';\r\n\r\nexport type NameStylePickerRef = {\r\n setValue: (value: Partial) => void,\r\n};\r\nexport type NameStylePicker = {\r\n frameInfo?: FrameInfo,\r\n defaultType: NameStyleType,\r\n defaultValue: Partial,\r\n showExtraDecorativeOption: boolean,\r\n onChange: (type: NameStyleType, style: Partial) => void,\r\n};\r\nexport const NameStylePicker = forwardRef(({\r\n frameInfo,\r\n defaultType,\r\n defaultValue,\r\n showExtraDecorativeOption,\r\n onChange: undebouncedOnChange,\r\n}: NameStylePicker, ref: ForwardedRef) => {\r\n const language = useLanguage();\r\n const optionGridRef = useRef(null);\r\n const [focus, setFocus] = useState(-1);\r\n const [predefinedDropdownVisible, setPredefinedDropdownVisible] = useState(false);\r\n const [type, setType] = useState(defaultType);\r\n const [value, setValue] = useState(defaultValue);\r\n const [customStyleSignal, sendCustomStyleSignal] = useRefresh();\r\n const onChange = useRef(debounce(undebouncedOnChange, 250)).current;\r\n const memoizedOnGradientChange = useCallback((palette, gradientAngle) => {\r\n setValue(cur => ({ ...cur, gradientAngle, gradientColor: stringifyPalette(palette) }));\r\n customStyleSignal();\r\n }, [customStyleSignal]);\r\n const reduceColorMotion = useSetting(state => state.setting.reduceMotionColor);\r\n\r\n const fontList = useMemo(() => getNameFontOptionList(language), [language]);\r\n\r\n useEffect(() => {\r\n if (sendCustomStyleSignal !== 0) {\r\n setType('custom');\r\n onChange('custom', value);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [sendCustomStyleSignal]);\r\n\r\n const shadowPickeRef = useRef(null);\r\n const outlinePickeRef = useRef(null);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: nextValue => {\r\n setValue(currentValue => ({ ...currentValue, ...nextValue }));\r\n\r\n const {\r\n lineColor, lineWidth, lineOffsetX, lineOffsetY,\r\n shadowBlur, shadowColor, shadowOffsetX, shadowOffsetY,\r\n } = nextValue;\r\n shadowPickeRef.current?.setValue({\r\n x: shadowOffsetX, y: shadowOffsetY,\r\n width: shadowBlur, color: shadowColor,\r\n });\r\n outlinePickeRef.current?.setValue({\r\n x: lineOffsetX, y: lineOffsetY,\r\n width: lineWidth, color: lineColor,\r\n });\r\n },\r\n }));\r\n const {\r\n fillStyle,\r\n headTextFillStyle,\r\n hasOutline,\r\n hasShadow,\r\n hasGradient, gradientColor, gradientAngle,\r\n pattern,\r\n font,\r\n } = value;\r\n const { labelBackgroundColor, labelBackgroundImage } = frameInfo ?? {};\r\n const patternStyle = {\r\n background: labelBackgroundColor,\r\n backgroundImage: labelBackgroundImage,\r\n };\r\n const isStyleCustom = type === 'custom';\r\n const isStylePredefined = type === 'predefined';\r\n const optionInputContainerId = 'name-style-option-input-container';\r\n const applyAutoStyle = () => {\r\n setType('auto');\r\n if (type !== 'auto') onChange('auto', value);\r\n };\r\n const applyPredefinedStyle = () => {\r\n const presetValue = value.preset\r\n ? PresetNameStyleMap[value.preset]?.value\r\n : {};\r\n setType('predefined');\r\n setValue(cur => ({ ...cur, ...presetValue }));\r\n onChange('predefined', { ...value, ...presetValue });\r\n };\r\n const applyCustomStyle = () => {\r\n setType('custom');\r\n if (type !== 'custom') onChange('custom', value);\r\n };\r\n return
\r\n \r\n {language['input.name-style.label']}\r\n \r\n {\r\n if (focus === 1 && (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ')) {\r\n e.preventDefault();\r\n setFocus(1);\r\n setPredefinedDropdownVisible(true);\r\n /** Popover takes time to mount / become visible */\r\n setTimeout(() => {\r\n if (focus === 1) optionGridRef.current?.focus();\r\n }, 200);\r\n\r\n return false;\r\n }\r\n },\r\n onTrigger() {\r\n if (focus === 0) applyAutoStyle();\r\n if (focus === 1) applyPredefinedStyle();\r\n if (focus === 2) applyCustomStyle();\r\n },\r\n })}\r\n >\r\n applyAutoStyle()}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n {language['input.name-style.type.auto.label']}\r\n \r\n \r\n \r\n applyPredefinedStyle()}\r\n >\r\n \r\n {\r\n setPredefinedDropdownVisible(false);\r\n document.getElementById(optionInputContainerId)?.focus();\r\n }}\r\n onClick={({ key }) => {\r\n const presetValue = key\r\n ? PresetNameStyleMap[key]?.value\r\n : {};\r\n setType('predefined');\r\n setValue(cur => ({ ...cur, ...presetValue }));\r\n onChange('predefined', { ...value, ...presetValue });\r\n }}\r\n />\r\n
}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n \r\n {language['input.name-style.type.predefined.label']}\r\n \r\n \r\n \r\n \r\n \r\n applyCustomStyle()}\r\n >\r\n \r\n \r\n \r\n \r\n \r\n \r\n {language['input.name-style.type.custom.label']}\r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n

\r\n {language['input.name-style.color.text.label']}\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, fillStyle: color.hex }));\r\n customStyleSignal();\r\n }}\r\n />\r\n
\r\n
\r\n
\r\n

\r\n {language['input.name-style.color.ruby.label']}\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, headTextFillStyle: color.hex }));\r\n customStyleSignal();\r\n }}\r\n />\r\n
\r\n
\r\n
}\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.color.label']} \r\n \r\n \r\n {showExtraDecorativeOption && \r\n
\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, hasShadow: !cur.hasShadow }));\r\n customStyleSignal();\r\n }}>\r\n {language['input.name-style.shadow.toggle.label']}\r\n \r\n

\r\n {hasShadow && {\r\n setValue(cur => ({\r\n ...cur,\r\n shadowBlur: width,\r\n shadowColor: color,\r\n shadowOffsetX: x,\r\n shadowOffsetY: y,\r\n }));\r\n customStyleSignal();\r\n }}\r\n />}\r\n
\r\n }\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.shadow.label']} \r\n \r\n
}\r\n \r\n
\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, hasOutline: !cur.hasOutline }));\r\n customStyleSignal();\r\n }}>\r\n {language['input.name-style.outline.toggle.label']}\r\n \r\n

\r\n {hasOutline && {\r\n setValue(cur => ({\r\n ...cur,\r\n lineWidth: width,\r\n lineColor: color,\r\n lineOffsetX: x,\r\n lineOffsetY: y,\r\n }));\r\n customStyleSignal();\r\n }}\r\n />}\r\n
\r\n }\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.outline.label']} \r\n \r\n
\r\n {showExtraDecorativeOption && \r\n
\r\n

\r\n {\r\n setType('custom');\r\n setValue(cur => ({ ...cur, hasGradient: !cur.hasGradient }));\r\n customStyleSignal();\r\n }}>\r\n {language['input.name-style.gradient.toggle.label']}\r\n \r\n

\r\n {hasGradient &&
\r\n \r\n
}\r\n
\r\n }\r\n placement=\"bottom\"\r\n >\r\n \r\n {language['input.name-style.gradient.label']} \r\n \r\n
}\r\n {showExtraDecorativeOption && \r\n e.stopPropagation()}>\r\n
\r\n {language['input.name-style.pattern.alert']}\r\n
\r\n {PatternList.map(({ key, patternImage }) => {\r\n return {\r\n setValue(cur => ({ ...cur, pattern: key }));\r\n customStyleSignal();\r\n }}\r\n >\r\n {patternImage\r\n ? \r\n : <>\r\n {language['input.name-style.pattern.no-pattern.label']}\r\n }\r\n ;\r\n })}\r\n
\r\n }\r\n placement=\"bottomLeft\"\r\n >\r\n \r\n {language['input.name-style.pattern.label']}\r\n \r\n
}\r\n \r\n \r\n {fontList.map(({ value: fontValue, label }) => {\r\n return {\r\n setValue(cur => ({ ...cur, font: fontValue }));\r\n customStyleSignal();\r\n }}\r\n >\r\n {label}\r\n ;\r\n })}\r\n \r\n }\r\n placement=\"bottomLeft\"\r\n >\r\n \r\n {language['input.name-style.font.label']}\r\n \r\n \r\n \r\n
\r\n
\r\n ;\r\n});\r\n","import { useCallback, useState } from 'react';\r\n\r\nexport const useRefresh = (): [() => void, number] => {\r\n const [cnt, setCnt] = useState(0);\r\n const refresh = useCallback(() => {\r\n setCnt(cur => cur + 1);\r\n }, []);\r\n\r\n return [refresh, cnt];\r\n};","import { css } from 'styled-components';\r\n\r\nexport const InputTrainStyle = css`\r\n display: flex;\r\n .checkbox-train-input-group,\r\n .radio-train-input-group {\r\n display: flex;\r\n flex: 1 1 auto;\r\n\t\t&:focus-visible {\r\n\t\t\t.radio-train-focused,\r\n\t\t\t.checkbox-train-focused {\r\n\t\t\t\tbackground-color: var(--main-level-3);\r\n\t\t\t}\r\n\t\t}\r\n }\r\n .ant-radio-button-wrapper {\r\n user-select: none;\r\n }\r\n .ant-radio-button-wrapper:first-child,\r\n .ant-radio-button-wrapper:last-child {\r\n border-radius: 0;\r\n }\r\n .ant-radio-button-wrapper:not(.ant-radio-button-wrapper-checked):first-child {\r\n border-left-color: var(--sub-level-1);\r\n }\r\n`;\r\n\r\nexport const TrainGridStyle = css`\r\n .checkbox-train-input-group,\r\n .radio-train-input-group {\r\n\t\tdisplay: flex;\r\n\t\tflex-wrap: wrap;\r\n\t\tcolumn-gap: var(--spacing-xs);\r\n\t\trow-gap: var(--spacing-xs);\r\n\t\tbox-shadow: none;\r\n\t\tborder-radius: 0;\r\n\t\t&:focus-visible {\r\n\t\t\toutline: 3px solid var(--focus); // +1 width size to account for shadow\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper:first-child,\r\n\t\t.ant-radio-button-wrapper:last-child {\r\n\t\t\tborder-radius: 0;\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper {\r\n\t\t\tflex: 1;\r\n\t\t\twhite-space: nowrap;\r\n\t\t\tborder: none;\r\n\t\t\tbox-shadow: var(--bs-1);\r\n\t\t\tpadding: 0;\r\n\t\t\tmin-width: 90px;\r\n\t\t\theight: 28px;\r\n\t\t\tline-height: 28px;\r\n\t\t\ttext-align: center;\r\n\t\t\ttext-shadow: none;\r\n\t\t\tfont-size: var(--fs-sm);\r\n\t\t\t&:hover {\r\n\t\t\t\toutline: var(--bw) solid var(--main-active);\r\n\t\t\t\toutline-offset: var(--bw);\r\n\t\t\t}\r\n\t\t\t&::before {\r\n\t\t\t\tdisplay: none;\r\n\t\t\t}\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper-checked {\r\n\t\t\toutline: var(--bw) solid var(--main-active);\r\n\t\t\toutline-offset: var(--bw);\r\n\t\t}\r\n\t}\r\n`;","import styled from 'styled-components';\r\nimport { InputTrainStyle } from './input-train.styled';\r\nimport React, { forwardRef, useImperativeHandle, useRef, useState } from 'react';\r\nimport { getNavigationProps } from 'src/util';\r\nimport { Tooltip } from 'antd';\r\n\r\nconst StyledRadioTrainContainer = styled.div`\r\n ${InputTrainStyle}\r\n`;\r\nexport type RadioTrainRef = {\r\n focus: () => void,\r\n}\r\nexport type RadioTrain = {\r\n className?: string,\r\n strict?: boolean,\r\n value: string | number,\r\n optionList: { label: React.ReactNode, value: string | number, tooltipProps?: React.ComponentProps, props?: React.LabelHTMLAttributes }[],\r\n onChange: (value: string | number) => void,\r\n children?: React.ReactNode,\r\n suffix?: React.ReactNode,\r\n}\r\nexport const RadioTrain = forwardRef(({\r\n onChange,\r\n value: activeValue,\r\n optionList,\r\n children,\r\n suffix,\r\n className,\r\n strict = false,\r\n}, ref) => {\r\n const [focus, setFocus] = useState(-1);\r\n const internalRef = useRef(null);\r\n const optionLength = optionList.length;\r\n\r\n useImperativeHandle(ref, () => ({\r\n focus: () => internalRef.current?.focus(),\r\n }));\r\n\r\n return \r\n {children && }\r\n
{\r\n const target = optionList[focus];\r\n if (target) {\r\n onChange(target.value);\r\n }\r\n },\r\n })}\r\n >\r\n {optionList.map(({ value, props, label, tooltipProps }, index) => {\r\n const { className } = props ?? {};\r\n const isChecked = strict\r\n ? value === activeValue\r\n : `${value}` === `${activeValue}`;\r\n\r\n return \r\n \r\n ;\r\n })}\r\n
\r\n {suffix}\r\n ;\r\n});","import { useCard, useSetting } from 'src/service';\r\nimport { RadioTrain } from './radio-train';\r\nimport { useCallback, useMemo } from 'react';\r\nimport { getFrameButtonList } from '../const';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { tcgToOCGTermMap } from 'src/model';\r\nimport { TrainGridStyle } from './input-train.styled';\r\n\r\nconst StyledFrameTrain = styled(RadioTrain)`\r\n\t${TrainGridStyle}\r\n`;\r\n\r\nexport type FrameTrain = {\r\n onSTFrameChange: (value: string[]) => void,\r\n};\r\nexport const FrameTrain = ({\r\n onSTFrameChange,\r\n}: FrameTrain) => {\r\n const {\r\n setting,\r\n } = useSetting();\r\n const { showExtraDecorativeOption } = setting;\r\n const frameList = useMemo(() => getFrameButtonList()\r\n .filter(entry => {\r\n return showExtraDecorativeOption || entry.edition === 'normal';\r\n }),\r\n [showExtraDecorativeOption],\r\n );\r\n\r\n const {\r\n frame,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card,\r\n setCard,\r\n }) => ({\r\n frame: card.frame,\r\n setCard,\r\n })));\r\n const changeFrame = useCallback((frameValue: number | string) => {\r\n setCard(currentCard => {\r\n const {\r\n typeAbility,\r\n isPendulum,\r\n attribute,\r\n format,\r\n } = currentCard;\r\n const nextFrame = `${frameValue}`;\r\n const isST = nextFrame === 'spell' || nextFrame === 'trap';\r\n const termMap = format === 'tcg'\r\n ? {\r\n 'Spell Card': 'Spell Card',\r\n 'Trap Card': 'Trap Card',\r\n }\r\n : tcgToOCGTermMap;\r\n const newTypeAbility = nextFrame === 'spell'\r\n ? [termMap['Spell Card']]\r\n : nextFrame === 'trap' ? [termMap['Trap Card']] : typeAbility;\r\n if (isST) onSTFrameChange(newTypeAbility);\r\n\r\n return {\r\n ...currentCard,\r\n frame: nextFrame,\r\n isPendulum: nextFrame === 'link' ? false : isPendulum,\r\n attribute: isST\r\n ? `${nextFrame}`.toUpperCase()\r\n : attribute,\r\n typeAbility: newTypeAbility,\r\n };\r\n });\r\n }, [setCard, onSTFrameChange]);\r\n\r\n return ;\r\n};","import styled from 'styled-components';\r\nimport { InputTrainStyle } from './input-train.styled';\r\nimport { useState } from 'react';\r\nimport { getNavigationProps } from 'src/util';\r\n\r\nconst StyledCheckboxTrainContainer = styled.div`\r\n ${InputTrainStyle}\r\n`;\r\nexport type CheckboxTrain = {\r\n className?: string,\r\n value: string[],\r\n optionList: { label: React.ReactNode, value: string | number, props?: React.LabelHTMLAttributes }[],\r\n onChange: (value: (string | number)[]) => void,\r\n children?: React.ReactNode,\r\n}\r\nexport const CheckboxTrain = ({\r\n onChange,\r\n value: activeValue,\r\n optionList,\r\n children,\r\n className,\r\n}: CheckboxTrain) => {\r\n const [focus, setFocus] = useState(-1);\r\n const optionLength = optionList.length;\r\n\r\n return \r\n {children && }\r\n {\r\n const target = optionList[focus];\r\n if (target) {\r\n const isChecked = Array.isArray(activeValue) ? activeValue.includes(`${target.value}`) : false;\r\n onChange(isChecked\r\n ? activeValue.filter(currentValue => `${target.value}` !== currentValue)\r\n : [...activeValue, `${target.value}`]);\r\n }\r\n },\r\n })}\r\n >\r\n {optionList.map((entry, index) => {\r\n const { label, value, props } = entry;\r\n const isChecked = Array.isArray(activeValue) ? activeValue.includes(`${value}`) : false;\r\n\r\n return ;\r\n })}\r\n \r\n ;\r\n};","import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { ImageCropper, ImageCropperRef } from 'src/component';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { getArtCanvasCoordinate } from 'src/model';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledImageCropper = styled(ImageCropper)`\r\n display: grid;\r\n grid-template-columns: max-content max-content;\r\n align-items: start;\r\n gap: 0;\r\n .card-image-source-input {\r\n display: flex;\r\n flex-direction: column-reverse;\r\n .online-image-tip {\r\n text-align: center;\r\n }\r\n }\r\n .card-cropper {\r\n width: 375px;\r\n text-align: center;\r\n }\r\n`;\r\n\r\nexport type BackgroundInputGroupRef = {\r\n hasImage: () => boolean,\r\n setValue: (value: { background?: string, backgroundCrop?: Partial }) => void,\r\n};\r\nexport type BackgroundInputGroup = {\r\n children?: React.ReactNode,\r\n onCropChange?: (cropInfo: Partial, sourceType: 'internal' | 'external') => void,\r\n} & Pick;\r\nexport const BackgroundInputGroup = forwardRef(({\r\n backgroundColor,\r\n children,\r\n receivingCanvas,\r\n onSourceLoaded,\r\n onTainted,\r\n onCropChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n background, backgroundCrop, backgroundType,\r\n isPendulum,\r\n opacity,\r\n getUpdater,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n background, backgroundCrop, backgroundType,\r\n isPendulum,\r\n opacity,\r\n },\r\n getUpdater,\r\n setCard,\r\n }) => ({\r\n background, backgroundCrop, backgroundType,\r\n isPendulum,\r\n opacity,\r\n getUpdater,\r\n setCard,\r\n })));\r\n const imageCropperRef = useRef(null);\r\n\r\n const changeBackground = useMemo(() => getUpdater('background'), [getUpdater]);\r\n const changeBackgroundCrop = useCallback((cropInfo: Partial, sourceType: 'internal' | 'external') => {\r\n onCropChange?.(cropInfo, sourceType);\r\n if (cropInfo) setCard(curr => ({\r\n ...curr,\r\n backgroundCrop: cropInfo,\r\n }));\r\n }, [onCropChange, setCard]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n hasImage: () => imageCropperRef.current?.hasImage() ?? false,\r\n setValue: ({ background, backgroundCrop }) => {\r\n if (typeof background === 'string' && backgroundCrop) {\r\n imageCropperRef.current?.forceExternalSource(background, backgroundCrop);\r\n }\r\n }\r\n }));\r\n\r\n return \r\n {children}\r\n ;\r\n});","import { Checkbox, InputNumber, Popover, Slider, Tooltip } from 'antd';\r\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\r\nimport { CompactPicker } from 'react-color';\r\nimport { BackgroundType, getBackgroundTypeList, CardOpacity, DEFAULT_BASE_FILL_COLOR, OpacityList, getDefaultCardOpacity, DefaultColorList } from 'src/model';\r\nimport styled from 'styled-components';\r\nimport { BackgroundInputGroup, BackgroundInputGroupRef } from './background-input-group';\r\nimport { ImageCropper } from 'src/component';\r\nimport { RadioTrain } from '../input-train';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { BorderOuterOutlined } from '@ant-design/icons';\r\nimport './layout-picker.scss';\r\n\r\nconst StyledBoundlessOverlay = styled.span`\r\n white-space: pre-line;\r\n`;\r\nconst StyledLayoutPickerContainer = styled.div`\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: wrap;\r\n column-gap: var(--spacing-sm);\r\n row-gap: var(--spacing-sm);\r\n padding: 2px 0;\r\n align-items: center;\r\n .slider-label,\r\n .ant-slider,\r\n .slider-padding {\r\n border: var(--bw) solid var(--sub-level-1);\r\n background-color: var(--main-level-4);\r\n }\r\n .slider-label {\r\n display: inline-flex;\r\n column-gap: var(--spacing-xs);\r\n border-right: none;\r\n padding: var(--spacing-xxs) var(--spacing-xs);\r\n border-radius: var(--br) 0 0 var(--br);\r\n box-shadow: var(--bs-input);\r\n .ant-checkbox-wrapper {\r\n transform: translateY(-1px); // Alignment\r\n }\r\n }\r\n .ant-slider {\r\n margin: 0;\r\n border-left: none;\r\n border-right: none;\r\n height: 28px; // Alignment\r\n padding-top: 11px; // Alignment\r\n }\r\n .slider-padding {\r\n border-left: none;\r\n border-radius: 0 var(--br) var(--br) 0;\r\n }\r\n .ant-slider-rail,\r\n .ant-slider-track {\r\n border-radius: 0 var(--br) var(--br) 0;\r\n }\r\n .card-opacity-slider {\r\n flex: 0 1 auto;\r\n display: grid;\r\n grid-template-columns: max-content 60px 45px 12px;\r\n &.inactive {\r\n .slider-label,\r\n .ant-slider,\r\n .slider-padding {\r\n background-color: var(--main-level-3);\r\n }\r\n }\r\n }\r\n .ant-input-number.ant-input-number-sm {\r\n height: 28px; // Alignment\r\n width: unset;\r\n border-radius: 0;\r\n box-shadow: var(--bs-input);\r\n .ant-input-number-input {\r\n height: 26px; // Alignment\r\n }\r\n }\r\n .background-preview {\r\n display: inline-block;\r\n line-height: 0;\r\n width: 17px;\r\n height: 17px; // Alignment\r\n align-self: center;\r\n border: 1px solid #333333;\r\n cursor: pointer;\r\n text-align: center;\r\n user-select: none;\r\n &:hover {\r\n box-shadow: 0 0 2px 0 #222222;\r\n }\r\n .background-image-preview {\r\n max-width: 15px;\r\n max-height: 15px;\r\n }\r\n .no-background-icon {\r\n font-size: 15px; // Alignment\r\n }\r\n }\r\n`;\r\nconst StyledBaseFillPickerContainer = styled.div`\r\n --input-width: 315px;\r\n &.overlay-no-background-image {\r\n .card-image-cropper {\r\n grid-template-columns: 1fr;\r\n }\r\n .card-cropper {\r\n min-height: 0;\r\n line-height: 0;\r\n width: 0;\r\n visibility: hidden;\r\n position: absolute;\r\n }\r\n .card-image-source-input {\r\n padding-right: 0;\r\n margin-right: 0;\r\n border-right: none;\r\n }\r\n i {\r\n max-width: var(--input-width); // Alignment\r\n }\r\n }\r\n i {\r\n display: inline-block;\r\n font-size: var(--fs-sm);\r\n color: var(--color);\r\n font-weight: normal;\r\n }\r\n .background-picker {\r\n padding: var(--spacing-xs);\r\n /** No display none here, again we want to keep card cropper painted, just not visible */\r\n &.overlay-no-background {\r\n visibility: hidden;\r\n height: 0;\r\n width: 0;\r\n padding: 0;\r\n }\r\n .card-image-input {\r\n text-align: center;\r\n max-width: var(--input-width);\r\n }\r\n }\r\n .card-image-source-input {\r\n height: 100%;\r\n justify-content: start;\r\n padding-right: var(--spacing-xs);\r\n margin-right: var(--spacing-xs);\r\n border-right: var(--bw) solid var(--sub-level-4);\r\n .type-section h2 {\r\n margin-top: var(--spacing-xs);\r\n }\r\n .color-section h2 {\r\n padding-top: 0;\r\n padding-left: 0;\r\n }\r\n }\r\n .color-section {\r\n > h2 + div {\r\n > div:first-child {\r\n box-shadow: none !important; // Override inline style\r\n }\r\n > div:nth-child(2) {\r\n border: var(--bw) solid var(--main-level-1);\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport type LayoutPicker = {\r\n defaultValue: Partial,\r\n onChange: (opacity: CardOpacity) => void,\r\n} & Pick;\r\nexport type OpacityPickerRef = {\r\n setValue: (opacity: Partial & {\r\n background?: string,\r\n backgroundCrop?: Partial,\r\n backgroundType?: BackgroundType,\r\n }) => void,\r\n};\r\nexport const LayoutPicker = forwardRef(({\r\n receivingCanvas,\r\n defaultValue,\r\n onTainted,\r\n onChange,\r\n onSourceLoaded,\r\n onCropChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n hasBackground,\r\n backgroundType,\r\n isPendulum,\r\n background,\r\n setCard,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n isPendulum,\r\n hasBackground,\r\n backgroundType,\r\n background,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n hasBackground,\r\n backgroundType,\r\n isPendulum,\r\n background,\r\n setCard,\r\n getUpdater,\r\n })));\r\n const [backgroundInputVisible, setBackgroundInputVisible] = useState(true);\r\n const [backgroundInputHidden, setBackgroundInputHidden] = useState(true);\r\n const [opacity, setOpacity] = useState({ ...getDefaultCardOpacity(), ...defaultValue });\r\n const backgroundInputRef = useRef(null);\r\n\r\n const changeBackgroundType = useMemo(() => getUpdater('backgroundType'), [getUpdater]);\r\n const changeHasBackground = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return { ...currentCard, hasBackground: nextValue };\r\n }), [setCard]);\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n if (relevant) {\r\n onChange(opacity);\r\n }\r\n }, 500);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [opacity]);\r\n\r\n useEffect(() => {\r\n /** Force render, otherwise we will miss the image */\r\n setBackgroundInputVisible(false);\r\n /** Avoid consecutive render here, so the popover does not \"flashing\" when close */\r\n setTimeout(() => {\r\n setBackgroundInputHidden(false);\r\n }, 250);\r\n }, []);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ background, backgroundCrop, ...newValue }) => {\r\n if (typeof background === 'string' && backgroundCrop) {\r\n backgroundInputRef.current?.setValue({ background, backgroundCrop });\r\n }\r\n for (const key in newValue) {\r\n if (newValue[key as keyof CardOpacity] !== opacity[key as keyof CardOpacity]) {\r\n setOpacity(cur => ({ ...cur, ...newValue }));\r\n }\r\n }\r\n }\r\n }));\r\n\r\n const noBackground = (background ?? '').length === 0\r\n && (backgroundInputRef.current?.hasImage() !== true);\r\n return \r\n \r\n {language['input.opacity.boundless.tooltip']}\r\n }\r\n >\r\n setOpacity(cur => ({ ...cur, boundless: value.target.checked }))}\r\n checked={opacity.boundless}\r\n >\r\n {language['input.opacity.boundless.label']}\r\n \r\n \r\n {OpacityList.map(({ labelKey, type, subType, tooltipKey }) => {\r\n if (type === 'pendulum' && !isPendulum) return null;\r\n const activable = !!subType;\r\n const isActive = subType && opacity[subType];\r\n return
\r\n
\r\n {type === 'body' && \r\n \r\n

\r\n {\r\n changeHasBackground(e);\r\n }}\r\n >{language['input.background.toggle-label']}\r\n
\r\n {language['input.background.description']}\r\n

\r\n
\r\n \r\n
\r\n
\r\n

{language['input.background-color.label']}

\r\n {\r\n setOpacity(cur => ({ ...cur, baseFill: color.hex }));\r\n }}\r\n />\r\n
\r\n {!noBackground &&
\r\n

{language['input.background-type.label']}

\r\n \r\n
}\r\n
\r\n \r\n
\r\n \r\n
}\r\n placement=\"bottom\"\r\n >\r\n \r\n {hasBackground\r\n ? background\r\n ? \"Background\"\r\n : null\r\n : }\r\n
\r\n }\r\n {activable && \r\n subType && setOpacity(cur => ({ ...cur, [subType]: e.target.checked }))}\r\n />\r\n }\r\n {language[labelKey]}\r\n \r\n setOpacity(cur => ({ ...cur, [type]: typeof value === 'number' ? value : 100 }))}\r\n value={opacity[type] ?? 100}\r\n />\r\n setOpacity(cur => ({ ...cur, [type]: value }))}\r\n value={opacity[type] ?? 100}\r\n />\r\n
\r\n
;\r\n })}\r\n
;\r\n});","import { Input, Popover } from 'antd';\r\nimport { RadioTrain } from '../input-train';\r\nimport { StyledDropdown } from 'src/component';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useImperativeHandle, useMemo } from 'react';\r\nimport { CaretDownOutlined, AlignCenterOutlined, AlignLeftOutlined, AlignRightOutlined, CloseCircleOutlined } from '@ant-design/icons';\r\nimport { IconTypeList, IconTypeMap, StarButtonList, getSTIconButtonList } from '../const';\r\nimport { checkDarkSynchro, checkXyz } from 'src/util';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledIconDropdown = styled(StyledDropdown.Container)`\r\n img {\r\n max-height: 1.3em;\r\n }\r\n`;\r\nconst StyledCheckboxStarTrain = styled(RadioTrain)`\r\n .custom-star-input {\r\n margin-left: var(--spacing-sm);\r\n width: 6.5rem;\r\n }\r\n .checkbox-star-suffix {\r\n display: grid;\r\n grid-template-columns: max-content max-content;\r\n column-gap: var(--spacing-sm);\r\n }\r\n`;\r\n\r\nexport type CardIconInputGroupRef = {}\r\nexport type CardIconInputGroup = {\r\n isLink: boolean,\r\n isMonster: boolean,\r\n showCreativeOption: boolean,\r\n};\r\nexport const CardIconInputGroup = forwardRef(({\r\n isLink,\r\n isMonster,\r\n showCreativeOption,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n frame,\r\n subFamily,\r\n cardIcon,\r\n star,\r\n starAlignment,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n frame,\r\n subFamily,\r\n cardIcon,\r\n star,\r\n starAlignment,\r\n },\r\n getUpdater,\r\n }) => ({\r\n frame,\r\n subFamily,\r\n cardIcon,\r\n star,\r\n starAlignment,\r\n getUpdater,\r\n })));\r\n const isDarkSynchro = checkDarkSynchro({ frame });\r\n const isXyz = checkXyz({ frame });\r\n\r\n const changeCardIcon = useMemo(() => getUpdater('cardIcon'), [getUpdater]);\r\n const changeSubFamily = useMemo(() => getUpdater('subFamily'), [getUpdater]);\r\n const changeStar = useMemo(() => getUpdater('star'), [getUpdater]);\r\n const changeStarAlignment = useMemo(() => getUpdater('starAlignment'), [getUpdater]);\r\n\r\n useImperativeHandle(ref, () => ({}));\r\n\r\n const iconTypeData = cardIcon === 'auto'\r\n ? IconTypeMap[isMonster\r\n ? isXyz ? 'rank' : isDarkSynchro ? 'negative-level' : 'level'\r\n : 'st'\r\n ]\r\n : IconTypeMap[cardIcon];\r\n const iconDropdownText = language[iconTypeData.labelKey];\r\n const IconDropdownLabel = showCreativeOption\r\n ? <>{iconDropdownText} \r\n : iconDropdownText;\r\n const IconDropdown = \r\n \r\n {IconTypeList.map(({ fullLabelKey, value, icon }) => {\r\n return changeCardIcon(value)}\r\n >\r\n {icon ? <>{icon}  : null}{language[fullLabelKey]}\r\n ;\r\n })}\r\n \r\n }\r\n placement=\"bottomRight\"\r\n >\r\n \r\n {IconDropdownLabel}\r\n
\r\n ;\r\n const DropdownChildren = showCreativeOption\r\n ? IconDropdown\r\n : IconDropdownLabel;\r\n return !isLink\r\n ? iconTypeData.value === 'st'\r\n ? \r\n {DropdownChildren}\r\n \r\n : \r\n \r\n ,\r\n },\r\n {\r\n value: 'left',\r\n tooltipProps: { overlay: language['input.icon-type.alignment.left'] },\r\n label: ,\r\n },\r\n {\r\n value: 'center',\r\n tooltipProps: { overlay: language['input.icon-type.alignment.center'] },\r\n label: ,\r\n },\r\n {\r\n value: 'right',\r\n tooltipProps: { overlay: language['input.icon-type.alignment.right'] },\r\n label: ,\r\n },\r\n ]}\r\n />\r\n }\r\n >\r\n {DropdownChildren}\r\n \r\n : null;\r\n});","export const availableCommand = new Set(['1', '2', '3', '4', '5']);\r\nexport const resolveHotkey = (\r\n value: string,\r\n key: string,\r\n selectionStart: number,\r\n selectionEnd: number,\r\n allowNewLine: boolean,\r\n onResult: (joinedText: string, newCursorPlacement: number) => void,\r\n) => {\r\n const selectedText = value.substring(selectionStart, selectionEnd);\r\n const nextLetter = value[selectionEnd];\r\n const keepInline = nextLetter === '\\n' || !allowNewLine;\r\n let wrappedText = selectedText;\r\n let cursorOffset = 2;\r\n switch (key) {\r\n case '1': wrappedText = `[${selectedText}]${keepInline ? '' : '\\n'}`;\r\n cursorOffset = keepInline ? 2 : 3;\r\n break;\r\n case '2': wrappedText = `{${selectedText}}`; break;\r\n case '3': wrappedText = `{${selectedText}|}`; break;\r\n case '4': wrappedText = `{${selectedText}||}`; cursorOffset = 3; break;\r\n case '5': wrappedText = `{{${selectedText}}}`; cursorOffset = 4; break;\r\n }\r\n const joinedText = value.substring(0, selectionStart)\r\n + `${wrappedText}`\r\n + value.substring(selectionEnd, value.length);\r\n\r\n onResult(joinedText, selectionEnd + cursorOffset);\r\n};\r\n\r\nexport const placeCursorInInput = ({\r\n id,\r\n placement,\r\n}: {\r\n id: string;\r\n placement: number;\r\n}) => {\r\n if (id && placement >= 0) {\r\n const target = document.querySelector(`#${id}`) as HTMLInputElement | null;\r\n\r\n if (target && (target.selectionEnd ?? -1) >= 0) {\r\n target.selectionEnd = placement;\r\n }\r\n }\r\n};","import { availableCommand, placeCursorInInput, resolveHotkey } from './util';\r\nimport { Input } from 'antd';\r\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\r\nimport { TextAreaProps } from 'antd/lib/input';\r\n\r\nconst { TextArea } = Input;\r\nexport type CardTextAreaRef = {\r\n setValue: (nextValue: string) => void,\r\n getPickerRef: () => null | {\r\n id: string, \r\n setValue: (nextValue: string) => void;\r\n },\r\n};\r\nexport type CardTextArea = {\r\n allowHotkey?: boolean,\r\n defaultValue: string,\r\n onTakePicker?: (ref: {\r\n id: string, \r\n setValue: (nextValue: string) => void;\r\n }) => void,\r\n onChange: (e: { target: { value: string } }) => void,\r\n} & Partial;\r\nexport const CardTextArea = forwardRef(({\r\n id,\r\n allowHotkey,\r\n defaultValue,\r\n onTakePicker,\r\n onChange,\r\n onKeyDown,\r\n className,\r\n ...rest\r\n}, ref) => {\r\n const immediateValue = useRef(defaultValue);\r\n const [value, setValue] = useState(defaultValue);\r\n const [cursorData, setCursorData] = useState({ id: '', placement: -1 });\r\n const internalOnChange = useCallback((eventOrValue: string | { target: { value: string }}) => {\r\n const normalizedValue = typeof eventOrValue === 'string' ? eventOrValue : eventOrValue.target.value;\r\n immediateValue.current = normalizedValue;\r\n setValue(normalizedValue);\r\n }, []);\r\n\r\n useEffect(() => {\r\n placeCursorInInput(cursorData);\r\n }, [cursorData]);\r\n\r\n useEffect(() => {\r\n onChange({ target: { value } });\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value]);\r\n\r\n const externalSetValue = (nextValue: string) => {\r\n if (nextValue !== immediateValue.current) {\r\n internalOnChange(nextValue);\r\n }\r\n };\r\n useImperativeHandle(ref, () => ({\r\n setValue: externalSetValue,\r\n getPickerRef: () => id ? ({ id, setValue: externalSetValue }) : null,\r\n }));\r\n\r\n return id && onTakePicker?.({ id, setValue: externalSetValue })}\r\n allowClear\r\n spellCheck={false}\r\n className={`${id}-input ${className}`}\r\n value={value}\r\n onKeyDown={ev => {\r\n onKeyDown?.(ev);\r\n if (!allowHotkey) return;\r\n const { ctrlKey, key, metaKey } = ev;\r\n const selectionStart = ev.currentTarget.selectionStart ?? -1;\r\n const selectionEnd = ev.currentTarget.selectionEnd ?? -1;\r\n if ((ctrlKey || metaKey) && id && selectionEnd !== selectionStart && availableCommand.has(key)) {\r\n ev.preventDefault();\r\n resolveHotkey(\r\n ev.currentTarget.value, key,\r\n selectionStart, selectionEnd,\r\n true,\r\n (joinedText, placement) => {\r\n internalOnChange(joinedText);\r\n setCursorData({ id, placement });\r\n }\r\n );\r\n }\r\n }}\r\n onChange={internalOnChange}\r\n {...rest}\r\n />;\r\n});","import { availableCommand, placeCursorInInput, resolveHotkey } from './util';\r\nimport { Input } from 'antd';\r\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\r\nimport { InputProps } from 'antd/lib/input';\r\nimport { useSetting } from 'src/service';\r\n\r\nexport type CardTextInputRef = {\r\n setValue: (nextValue: string) => void,\r\n};\r\nexport type CardTextInput = {\r\n defaultValue: string,\r\n onTakePicker?: (ref: {\r\n id: string, \r\n setValue: (nextValue: string) => void;\r\n }) => void,\r\n onChange: (e: {target: { value: string }}) => void,\r\n} & Partial;\r\nexport const CardTextInput = forwardRef(({\r\n id,\r\n defaultValue,\r\n onTakePicker,\r\n onChange,\r\n onKeyDown,\r\n className,\r\n ...rest\r\n}, ref) => {\r\n const { setting } = useSetting();\r\n const { allowHotkey } = setting;\r\n const immediateValue = useRef(defaultValue);\r\n const [value, setValue] = useState(defaultValue);\r\n const [cursorData, setCursorData] = useState({ id: '', placement: -1 });\r\n const internalOnChange = useCallback((eventOrValue: string | { target: { value: string }}) => {\r\n const normalizedValue = typeof eventOrValue === 'string' ? eventOrValue : eventOrValue.target.value;\r\n immediateValue.current = normalizedValue;\r\n setValue(normalizedValue);\r\n }, []);\r\n\r\n useEffect(() => {\r\n placeCursorInInput(cursorData);\r\n }, [cursorData]);\r\n\r\n useEffect(() => {\r\n onChange({ target: { value } });\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [value]);\r\n\r\n const externalSetValue = (nextValue: string) => {\r\n if (nextValue !== value) {\r\n internalOnChange(nextValue);\r\n }\r\n };\r\n useImperativeHandle(ref, () => ({\r\n setValue: externalSetValue,\r\n }));\r\n\r\n return id && onTakePicker?.({ id, setValue: externalSetValue })}\r\n allowClear\r\n className={`${id}-input ${className}`}\r\n value={value}\r\n onKeyDown={ev => {\r\n onKeyDown?.(ev);\r\n if (!allowHotkey) return;\r\n const { ctrlKey, key, metaKey } = ev;\r\n const selectionStart = ev.currentTarget.selectionStart ?? -1;\r\n const selectionEnd = ev.currentTarget.selectionEnd ?? -1;\r\n if ((ctrlKey || metaKey) && id && selectionEnd !== selectionStart && availableCommand.has(key)) {\r\n ev.preventDefault();\r\n resolveHotkey(\r\n ev.currentTarget.value, key,\r\n selectionStart, selectionEnd,\r\n false,\r\n (joinedText, placement) => {\r\n internalOnChange(joinedText);\r\n setCursorData({ id, placement });\r\n }\r\n );\r\n }\r\n }}\r\n onChange={ev => internalOnChange(ev.target.value)}\r\n {...rest}\r\n />;\r\n});","import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { CardTextArea, CardTextAreaRef } from '../input-text';\r\nimport { useCard } from 'src/service';\r\n\r\nexport type EffectInputGroupRef = {\r\n setValue: (value: string) => void,\r\n};\r\nexport type EffectInputGroup = {} & Pick;\r\nexport const EffectInputGroup = forwardRef(({\r\n onTakePicker,\r\n}, ref) => {\r\n const getUpdater = useCard(state => state.getUpdater);\r\n const effectInputRef = useRef(null);\r\n\r\n const changeEffect = useMemo(() => getUpdater('effect', undefined, 'debounce'), [getUpdater]);\r\n\r\n useEffect(() => {\r\n const pickerRef = effectInputRef.current?.getPickerRef();\r\n\r\n if (pickerRef) onTakePicker?.(pickerRef);\r\n /** No need to depend on handler */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: (value) => {\r\n effectInputRef.current?.setValue(value);\r\n }\r\n }));\r\n\r\n return ;\r\n});","import { useCallback } from 'react';\r\nimport { Checkbox, Tooltip } from 'antd';\r\nimport { useCard, useLanguage } from '../../service';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\n\r\nconst StyledCheckboxGroup = styled.div`\r\n align-self: center;\r\n text-align: right;\r\n .ant-checkbox + span {\r\n user-select: none;\r\n }\r\n`;\r\n\r\nexport type CardCheckboxGroup = {};\r\nexport const CardCheckboxGroup = (_: CardCheckboxGroup) => {\r\n const language = useLanguage();\r\n const {\r\n isDuelTerminalCard,\r\n isFirstEdition,\r\n isSpeedCard,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card,\r\n setCard,\r\n }) => ({\r\n isSpeedCard: card.isSpeedCard,\r\n isDuelTerminalCard: card.isDuelTerminalCard,\r\n isFirstEdition: card.isFirstEdition,\r\n setCard,\r\n })));\r\n\r\n const onFirstEditionChange = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return { ...currentCard, isFirstEdition: nextValue };\r\n }), [setCard]);\r\n const onDuelTerminalCardChange = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n isDuelTerminalCard: nextValue,\r\n isSpeedCard: nextValue ? false : currentCard.isSpeedCard,\r\n };\r\n }), [setCard]);\r\n const onSpeedCardChange = useCallback((e: any) => setCard(currentCard => {\r\n const nextValue = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n isSpeedCard: e.target.checked,\r\n isDuelTerminalCard: nextValue ? false : currentCard.isDuelTerminalCard,\r\n };\r\n }), [setCard]);\r\n\r\n return \r\n \r\n {language['input.1st-edition.label']}\r\n \r\n \r\n \r\n {language['input.speed-duel.label']}\r\n \r\n \r\n \r\n \r\n {language['input.duel-terminal.label']}\r\n \r\n \r\n ;\r\n};","import { StyledDropdown } from 'src/component';\r\nimport styled from 'styled-components';\r\nimport { RadioTrain, TrainGridStyle } from './input-train';\r\n\r\nexport const StyledPendulumFrameContainer = styled(StyledDropdown.Container)`\r\n padding: var(--spacing-xs);\r\n .radio-train {\r\n display: flex;\r\n flex-wrap: wrap;\r\n max-width: 550px;\r\n .radio-train-input-group {\r\n gap: var(--spacing);\r\n }\r\n }\r\n .ant-checkbox-wrapper {\r\n color: var(--color-heavy);\r\n }\r\n .frame-auto-checkbox {\r\n margin-bottom: var(--spacing-xs);\r\n }\r\n ${TrainGridStyle}\r\n`;\r\n\r\nexport const StyledInputLabelWithButton = styled.div`\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\t.input-label {\r\n\t\tflex: 1;\r\n\t}\r\n`;\r\n\r\nexport const StyledNameSetIdInputContainer = styled.div`\r\n display: flex;\r\n align-items: center;\r\n margin-top: var(--spacing-sm);\r\n flex-wrap: wrap;\r\n row-gap: var(--spacing-sm);\r\n`;\r\n\r\nexport const StyledFormatRadioTrain = styled(RadioTrain)`\r\n &.radio-train {\r\n .ant-radio-button-wrapper-checked {\r\n &.ocg-button {\r\n background-color: var(--main-red-scale);\r\n border-color: var(--sub-red-scale);\r\n &:not([class*=\" ant-radio-button-wrapper-disabled\"]).ant-radio-button-wrapper:first-child {\r\n border-right-color: var(--sub-red-scale);\r\n }\r\n &:not(.ant-radio-button-wrapper-disabled):first-child {\r\n border-color: var(--sub-red-scale);\r\n }\r\n &:hover {\r\n background-color: var(--sub-red-scale);\r\n color: var(--color-heavy);\r\n }\r\n }\r\n &.tcg-button {\r\n background-color: var(--main-blue-scale);\r\n border-color: var(--sub-blue-scale);\r\n &:hover {\r\n background-color: var(--sub-blue-scale);\r\n color: var(--color-heavy);\r\n }\r\n }\r\n }\r\n .ocg-button {\r\n color: var(--color-heavy);\r\n &:hover {\r\n color: var(--sub-red-scale);\r\n }\r\n }\r\n .tcg-button {\r\n color: var(--color-heavy);\r\n &:hover {\r\n color: var(--sub-blue-scale);\r\n }\r\n }\r\n }\r\n`;","import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { CardTextInput, CardTextInputRef } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { IconButton } from 'src/component';\r\nimport { RadioTrain } from '../input-train';\r\nimport { CardCheckboxGroup } from '../input-checkbox-group';\r\nimport { randomPassword } from 'src/util';\r\nimport { SyncOutlined } from '@ant-design/icons';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { StickerButtonList } from '../const';\r\nimport styled from 'styled-components';\r\nimport { StyledInputLabelWithButton } from '../input-panel.styled';\r\n\r\nconst StyledFooterInputContainer = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n gap: var(--spacing-sm);\r\n .checkbox-input {\r\n align-self: center;\r\n .ant-checkbox + span {\r\n user-select: none;\r\n }\r\n }\r\n .sticker-input,\r\n .creator-input {\r\n grid-column: span 2;\r\n }\r\n .sticker-input .ant-radio-button-wrapper {\r\n padding-left: var(--spacing-sm);\r\n padding-right: var(--spacing-sm);\r\n }\r\n`;\r\n\r\nexport type FooterInputGroupRef = {\r\n setValue: (value: { password?: string, creator?: string, atk?: string, def?: string }) => void,\r\n};\r\nexport type FooterInputGroup = {\r\n isMonster: boolean,\r\n showCreativeOption: boolean,\r\n} & Pick;\r\nexport const FooterInputGroup = forwardRef(({\r\n isMonster,\r\n showCreativeOption,\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n sticker,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: { sticker },\r\n getUpdater,\r\n }) => ({\r\n sticker,\r\n getUpdater,\r\n })));\r\n const passwordInputRef = useRef(null);\r\n const creatorInputRef = useRef(null);\r\n const atkInputRef = useRef(null);\r\n const defInputRef = useRef(null);\r\n\r\n const changeATK = useMemo(() => getUpdater('atk', value => typeof value === 'string' ? value.trim() : value), [getUpdater]);\r\n const changeDEF = useMemo(() => getUpdater('def', value => typeof value === 'string' ? value.trim() : value), [getUpdater]);\r\n const changePassword = useMemo(() => getUpdater('password', undefined, 'debounce'), [getUpdater]);\r\n const onStickerChange = useMemo(() => getUpdater('sticker'), [getUpdater]);\r\n const changeCreator = useMemo(() => getUpdater('creator', undefined, 'debounce'), [getUpdater]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ password, creator, atk, def }) => {\r\n if (typeof atk === 'string') atkInputRef.current?.setValue(atk);\r\n if (typeof def === 'string') defInputRef.current?.setValue(def);\r\n if (typeof password === 'string') passwordInputRef.current?.setValue(password);\r\n if (typeof creator === 'string') creatorInputRef.current?.setValue(creator);\r\n }\r\n }));\r\n\r\n return \r\n {(isMonster || showCreativeOption) && <>\r\n \r\n \r\n }\r\n \r\n
{language['input.password.label']}
\r\n passwordInputRef.current?.setValue(randomPassword())}\r\n Icon={SyncOutlined}\r\n tooltipProps={{ overlay: language['button.randomize.label'] }}\r\n />\r\n }\r\n defaultValue={useCard.getState().card.password}\r\n onChange={changePassword}\r\n onTakePicker={onTakePicker}\r\n />\r\n \r\n \r\n \r\n {language['input.sticker.label']}\r\n \r\n
;\r\n});","import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { ImageCropper, ImageCropperRef, LinkMarkChooser } from 'src/component';\r\nimport { RadioTrain } from '../input-train';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { ArtFinishButtonList } from '../const';\r\nimport { getArtCanvasCoordinate } from 'src/model';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledImageRadioTrain = styled(RadioTrain)`\r\n .ant-input-group-addon {\r\n flex: 0;\r\n }\r\n .radio-train-input-group .ant-radio-button-wrapper {\r\n min-width: unset;\r\n }\r\n`;\r\n\r\nexport type ImageInputGroupRef = {\r\n setValue: (value: { art?: string, artCrop?: Partial }) => void,\r\n};\r\nexport type ImageInputGroup = {\r\n isLink: boolean,\r\n showExtraDecorativeOption: boolean,\r\n receivingCanvas: HTMLCanvasElement | null,\r\n onCropChange?: (cropInfo: Partial, sourceType: 'internal' | 'external') => void,\r\n onTainted: ImageCropper['onTainted'],\r\n onSourceLoaded: ImageCropper['onSourceLoaded'],\r\n};\r\nexport const ImageInputGroup = forwardRef(({\r\n isLink,\r\n showExtraDecorativeOption,\r\n receivingCanvas,\r\n onSourceLoaded,\r\n onTainted,\r\n onCropChange,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n opacity,\r\n artFinish,\r\n linkMap,\r\n isPendulum,\r\n art, artCrop,\r\n getUpdater,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n opacity,\r\n artFinish,\r\n linkMap,\r\n isPendulum,\r\n art, artCrop,\r\n },\r\n getUpdater,\r\n setCard,\r\n }) => ({\r\n opacity,\r\n artFinish,\r\n linkMap,\r\n isPendulum,\r\n art, artCrop,\r\n getUpdater,\r\n setCard,\r\n })));\r\n const imageCropperRef = useRef(null);\r\n\r\n const changeLinkMap = useMemo(() => getUpdater('linkMap'), [getUpdater]);\r\n const changePicture = useMemo(() => getUpdater('art'), [getUpdater]);\r\n const changeArtFinish = useMemo(() => getUpdater('artFinish'), [getUpdater]);\r\n const changeImageCrop = useCallback((cropInfo: Partial, sourceType: 'internal' | 'external') => {\r\n onCropChange?.(cropInfo, sourceType);\r\n if (cropInfo) setCard(curr => ({\r\n ...curr,\r\n artCrop: cropInfo,\r\n }));\r\n }, [onCropChange, setCard]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ art, artCrop }) => {\r\n if (typeof art === 'string' && artCrop) {\r\n imageCropperRef.current?.forceExternalSource(art, artCrop);\r\n }\r\n }\r\n }));\r\n\r\n return \r\n {language['input.art-finish.label']}\r\n \r\n : null\r\n }\r\n >\r\n {isLink\r\n ? \r\n :
}\r\n ;\r\n});","import { Tooltip } from 'antd';\r\nimport { IconButton } from 'src/component';\r\nimport { CardTextInput, CardTextInputRef } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { SyncOutlined } from '@ant-design/icons';\r\nimport { normalizedCardName, randomSetID } from 'src/util';\r\nimport { StyledInputLabelWithButton } from '../input-panel.styled';\r\nimport styled from 'styled-components';\r\n\r\nconst StyledNameInputContainer = styled.div`\r\n display: flex;\r\n flex-wrap: wrap;\r\n gap: var(--spacing-sm);\r\n width: 100%;\r\n .name-input {\r\n flex: 3;\r\n min-width: 400px;\r\n }\r\n .set-id-input {\r\n flex: 1;\r\n min-width: 250px;\r\n }\r\n`;\r\nconst StyledCopyButton = styled.span`\r\n cursor: pointer;\r\n`;\r\n\r\nexport type NameSetInputGroupRef = {\r\n setValue: (value: { name?: string, setId?: string }) => void,\r\n}\r\nexport type NameSetInputGroup = {} & Pick;\r\nexport const NameSetInputGroup = forwardRef(({\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n name,\r\n format,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n name,\r\n format,\r\n },\r\n getUpdater,\r\n }) => ({\r\n name,\r\n format,\r\n getUpdater,\r\n })));\r\n const nameInputRef = useRef(null);\r\n const setIdInputRef = useRef(null);\r\n\r\n const changeSetId = useMemo(() => getUpdater('setId'), [getUpdater]);\r\n const changeName = useMemo(() => getUpdater('name', undefined, 'debounce'), [getUpdater]);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ name, setId }) => {\r\n if (typeof name === 'string') nameInputRef.current?.setValue(name);\r\n if (typeof setId === 'string') setIdInputRef.current?.setValue(setId);\r\n }\r\n }));\r\n\r\n return \r\n \r\n {\r\n navigator.clipboard.writeText(normalizedCardName(name));\r\n }}>\r\n {language['input.name.label']}\r\n \r\n }\r\n onChange={changeName}\r\n onTakePicker={onTakePicker}\r\n />\r\n \r\n
\r\n {language['input.set-id.label']}\r\n
\r\n setIdInputRef.current?.setValue(randomSetID(format))}\r\n Icon={SyncOutlined}\r\n tooltipProps={{ overlay: language['button.randomize.label'] }}\r\n />\r\n }\r\n onChange={changeSetId}\r\n onTakePicker={onTakePicker}\r\n />\r\n
;\r\n});","import { Checkbox, Input, Popover } from 'antd';\r\nimport { StyledPendulumFrameContainer } from '../input-panel.styled';\r\nimport { RadioTrain } from '../input-train';\r\nimport { FrameInfoBlock } from 'src/component';\r\nimport { CardTextArea, CardTextAreaRef, CardTextInput } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';\r\nimport { FrameInfoMap } from 'src/model';\r\nimport { CaretDownOutlined } from '@ant-design/icons';\r\nimport { getFrameButtonList } from '../const';\r\nimport styled from 'styled-components';\r\nimport { getNavigationProps } from 'src/util';\r\n\r\ntype BottomFrameOptionGridRef = {\r\n focus: () => void,\r\n};\r\ntype BottomFrameOptionGrid = {\r\n pendulumFrame: string,\r\n frameList: ReturnType,\r\n onChange: (value: string | number) => void,\r\n onCancel: () => void,\r\n};\r\nconst BottomFrameOptionGrid = forwardRef(({\r\n frameList,\r\n pendulumFrame,\r\n onChange,\r\n onCancel,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const recentCustomPendulumFrame = useRef(pendulumFrame === 'auto' ? 'spell' : pendulumFrame);\r\n const inputRef = useRef(null);\r\n const [focus, setFocus] = useState(0);\r\n\r\n useImperativeHandle(ref, () => ({\r\n focus: () => inputRef.current?.focus(),\r\n }));\r\n\r\n return {\r\n if (focus >= 0) onChange(frameList[focus].value);\r\n },\r\n onCancel,\r\n })}\r\n >\r\n {\r\n onChange(e.target.checked ? 'auto' : recentCustomPendulumFrame.current);\r\n }}\r\n >{language['input.frame.auto']}\r\n \r\n ;\r\n});\r\n\r\nconst StyledPendulumFrameInputContainer = styled.div`\r\n display: inline-flex;\r\n cursor: pointer;\r\n box-shadow: var(--bs-input);\r\n vertical-align: bottom;\r\n box-shadow: var(--bs-button);\r\n border-radius: var(--br-lg);\r\n &:focus-visible {\r\n outline: 2px solid var(--focus);\r\n }\r\n .pendulum-frame-info-block {\r\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\r\n line-height: 2; // Alignment\r\n background-color: var(--main-level-4);\r\n min-width: 100px;\r\n overflow: hidden;\r\n border: var(--bw) solid var(--sub-level-1);\r\n .frame-info-block-label {\r\n padding: var(--spacing-px) var(--spacing-xs);\r\n }\r\n }\r\n .pendulum-frame-label {\r\n display: inline-block;\r\n background: var(--main-level-4);\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-right: none;\r\n padding: var(--spacing-px) var(--spacing-xs);\r\n border-radius: var(--br-lg) 0 0 var(--br-lg);\r\n line-height: 2; // Alignment\r\n &:last-child {\r\n border-radius: var(--br-lg);\r\n border-right: var(--bw) solid var(--sub-level-1);\r\n }\r\n }\r\n`;\r\nconst StyledPendulumInputContainer = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n column-gap: var(--spacing-sm);\r\n row-gap: var(--spacing-sm);\r\n .red-scale {\r\n color: var(--sub-red-scale);\r\n }\r\n .blue-scale {\r\n color: var(--sub-blue-scale);\r\n }\r\n .joined-row {\r\n position: 'relative';\r\n grid-column: span 2;\r\n .standalone-label {\r\n min-width: 0;\r\n width: unset;\r\n padding-left: var(--spacing-antd);\r\n }\r\n .pendulum-checkbox {\r\n /** Alignment **/\r\n width: var(--width-label);\r\n line-height: 32px;\r\n text-align: right;\r\n font-weight: 500;\r\n margin-right: 0;\r\n padding-right: var(--spacing);\r\n > span {\r\n padding-right: 0;\r\n }\r\n }\r\n .pendulum-checkbox-placeholder {\r\n display: inline-block;\r\n /** Alignment **/\r\n width: var(--width-label);\r\n }\r\n .pendulum-frame-input {\r\n margin-right: var(--spacing-lg);\r\n }\r\n .ant-checkbox-wrapper + .ant-checkbox-wrapper {\r\n margin-left: 0;\r\n }\r\n }\r\n`;\r\n\r\nexport type PendulumInputGroupRef = {\r\n setValue: (value: { pendulumEffect?: string }) => void,\r\n}\r\nexport type PendulumInputGroup = {\r\n showCreativeOption: boolean,\r\n showExtraDecorativeOption: boolean,\r\n} & Pick;\r\nexport const PendulumInputGroup = forwardRef(({\r\n showCreativeOption,\r\n showExtraDecorativeOption,\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n frame,\r\n isPendulum,\r\n pendulumFrame,\r\n pendulumScaleBlue,\r\n pendulumScaleRed,\r\n setCard,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n frame,\r\n isPendulum,\r\n pendulumFrame,\r\n pendulumScaleBlue,\r\n pendulumScaleRed,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n frame,\r\n isPendulum,\r\n pendulumFrame,\r\n pendulumScaleBlue,\r\n pendulumScaleRed,\r\n setCard,\r\n getUpdater,\r\n })));\r\n const containerRef = useRef(null);\r\n const bottomFrameOptionGridRef = useRef(null);\r\n const pendulumEffectInputRef = useRef(null);\r\n const [isMirrorScale, setMirrorScale] = useState(true);\r\n const [frameDropdownVisible, setFrameDropdownVisibleVisible] = useState(false);\r\n const recentCustomPendulumFrame = useRef(pendulumFrame === 'auto' ? 'spell' : pendulumFrame);\r\n const changeToPendulum = (e: any) => setCard(currentCard => {\r\n const willBecomePendulum = e.target.checked;\r\n /** It is rather not desirable to seemingly reduce opacity of pendulum frame, even though it looks closer to real card */\r\n // const currentOpacity = currentCard.opacity;\r\n // const nextOpacity = willBecomePendulum && (currentOpacity.pendulum ?? 100) !== 85\r\n // ? { ...currentOpacity, pendulum: 85 }\r\n // : currentOpacity;\r\n\r\n return {\r\n ...currentCard,\r\n // opacity: nextOpacity,\r\n isPendulum: willBecomePendulum,\r\n };\r\n });\r\n const changeBottomFrame = (value: string | number) => {\r\n const normalizedValue = `${value}`;\r\n\r\n if (normalizedValue !== 'auto') recentCustomPendulumFrame.current = normalizedValue;\r\n setCard(currentCard => {\r\n return { ...currentCard, pendulumFrame: normalizedValue };\r\n });\r\n };\r\n const onRedScaleChange = useMemo(() => getUpdater('pendulumScaleRed'), [getUpdater]);\r\n const onBlueScaleChange = useMemo(() => getUpdater('pendulumScaleBlue'), [getUpdater]);\r\n const changePendulumEffect = useMemo(() => getUpdater('pendulumEffect', undefined, 'debounce'), [getUpdater]);\r\n\r\n const frameList = useMemo(() => getFrameButtonList()\r\n .filter(entry => {\r\n return showExtraDecorativeOption || entry.edition === 'normal';\r\n }),\r\n [showExtraDecorativeOption],\r\n );\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ pendulumEffect }) => {\r\n if (pendulumEffect) pendulumEffectInputRef.current?.setValue(pendulumEffect);\r\n }\r\n }));\r\n\r\n const currentPendulumFrame = FrameInfoMap[pendulumFrame];\r\n return \r\n
\r\n {frame !== 'link'\r\n ? {language['input.pendulum.label']}\r\n :
}\r\n {showCreativeOption && \r\n {\r\n setFrameDropdownVisibleVisible(false);\r\n containerRef.current?.focus();\r\n }}\r\n onChange={changeBottomFrame}\r\n />\r\n
}\r\n >\r\n {\r\n if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {\r\n setFrameDropdownVisibleVisible(true);\r\n /** Popover takes time to mount / become visible */\r\n setTimeout(() => {\r\n bottomFrameOptionGridRef.current?.focus();\r\n }, 200);\r\n\r\n return false;\r\n }\r\n }}\r\n >\r\n {language['input.bottom-frame.label']} \r\n {currentPendulumFrame\r\n ? \r\n : }\r\n \r\n }\r\n {(isPendulum && showCreativeOption)\r\n && setMirrorScale(e.target.checked)} checked={isMirrorScale}>\r\n {language['input.mirror-scale.label']}\r\n }\r\n
\r\n {isPendulum && <>\r\n
\r\n \r\n {language['input.scale.label'](\r\n \r\n {language['input.scale.blue.label']}\r\n \r\n )}\r\n }\r\n value={pendulumScaleBlue}\r\n onChange={e => {\r\n onBlueScaleChange(e);\r\n if (isMirrorScale) onRedScaleChange(e);\r\n }} />\r\n
\r\n
\r\n \r\n {language['input.scale.label'](\r\n \r\n {language['input.scale.red.label']}\r\n \r\n )}\r\n }\r\n value={pendulumScaleRed}\r\n onChange={e => {\r\n if (isMirrorScale) onBlueScaleChange(e);\r\n onRedScaleChange(e);\r\n }}\r\n />\r\n
\r\n
\r\n {/** Explicit label does not looks too good */}\r\n {/* Pendulum Effect */}\r\n \r\n
\r\n }\r\n ;\r\n});","import { Checkbox, Tooltip } from 'antd';\r\nimport { RadioTrain } from '../input-train';\r\nimport { Explanation, FormattingHelpDrawer } from 'src/component';\r\nimport { CardTextInput, CardTextInputRef } from '../input-text';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from 'react';\r\nimport { CondenseType } from 'src/model';\r\nimport { CondenseThresholdButtonList, IconTypeMap } from '../const';\r\nimport styled from 'styled-components';\r\nimport { checkMonster } from 'src/util';\r\n\r\nconst StyledPostPendulumInputContainer = styled.div`\r\n display: grid;\r\n grid-template-columns: 1fr max-content;\r\n grid-template-areas:\r\n \"type-input input-helper\"\r\n \"condense-input help-button\";\r\n gap: var(--spacing-sm);\r\n align-items: center;\r\n .formatting-help-button {\r\n grid-area: help-button;\r\n &:focus {\r\n box-shadow: 0 0 0 2px var(--focus);\r\n }\r\n }\r\n .input-kanji-helper {\r\n grid-area: input-helper;\r\n }\r\n .type-ability-input {\r\n grid-area: type-input;\r\n }\r\n .condense-input {\r\n grid-area: condense-input;\r\n\t\t.standalone-addon.ant-input-group-addon {\r\n\t\t\twidth: unset;\r\n\t\t}\r\n\t\t.ant-radio-button-wrapper {\r\n\t\t\tflex: 1 1 90px;\r\n\t\t}\r\n\t}\r\n &.variant-tcg {\r\n .type-ability-input {\r\n grid-column: span 2;\r\n }\r\n }\r\n`;\r\n\r\nexport type PostPendulumInputGroupRef = {\r\n setValue: (value: { typeAbility?: string[] }) => void,\r\n}\r\nexport type PostPendulumInputGroup = {} & Pick;\r\nexport const PostPendulumInputGroup = forwardRef(({\r\n onTakePicker,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n frame,\r\n cardIcon,\r\n format,\r\n furiganaHelper,\r\n condenseTolerant,\r\n setCard,\r\n getUpdater,\r\n } = useCard(useShallow(({\r\n card: {\r\n frame,\r\n cardIcon,\r\n format,\r\n furiganaHelper,\r\n effectStyle,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n frame,\r\n cardIcon,\r\n format,\r\n furiganaHelper,\r\n condenseTolerant: effectStyle?.condenseTolerant,\r\n setCard,\r\n getUpdater,\r\n })));\r\n const typeAbilitySeparator = format === 'ocg' ? '/' : '/';\r\n const typeAbilityInputRef = useRef(null);\r\n const changeTypeAbility = useMemo(() => {\r\n return getUpdater(\r\n 'typeAbility',\r\n value => {\r\n return typeof value !== 'string' ? [] : value.split(//|\\//)\r\n .map(entry => `${entry}`.trim())\r\n .filter(entry => typeof entry === 'string' && entry.length > 0);\r\n },\r\n 'debounce',\r\n );\r\n }, [getUpdater]);\r\n const toggleFuriganaHelper = useCallback((e: any) => setCard(currentCard => {\r\n return { ...currentCard, furiganaHelper: e.target.checked };\r\n }), [setCard]);\r\n const onCondenseTolerantChange = (value: CondenseType) => {\r\n setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n effectStyle: {\r\n ...currentCard.effectStyle,\r\n condenseTolerant: value,\r\n }\r\n };\r\n });\r\n };\r\n\r\n useImperativeHandle(ref, () => ({\r\n setValue: ({ typeAbility }) => {\r\n if (typeAbility) typeAbilityInputRef.current?.setValue(typeAbility.join(typeAbilitySeparator));\r\n }\r\n }));\r\n\r\n const typeLabel = cardIcon === 'auto'\r\n ? checkMonster({ frame })\r\n ? 'input.type.monster.label'\r\n : 'input.type.st.label'\r\n : IconTypeMap[cardIcon].value === 'st'\r\n ? 'input.type.st.label'\r\n : 'input.type.monster.label';\r\n const isOCG = format === 'ocg';\r\n return \r\n \r\n {isOCG && \r\n \r\n {language['input.furigana-helper.label']}\r\n \r\n }\r\n onCondenseTolerantChange(value as CondenseType)}\r\n optionList={CondenseThresholdButtonList}\r\n >\r\n \r\n {language['input.condense.label']} \r\n \r\n \r\n \r\n ;\r\n});","import { Checkbox, Input, Popover } from 'antd';\r\nimport { CompactPicker } from 'react-color';\r\nimport { useCard, useLanguage } from 'src/service';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { DefaultColorList } from 'src/model';\r\nimport { useEffect, useState } from 'react';\r\nimport { HexColorRegex, hexToRGBA } from 'src/util';\r\n\r\n/** Spacing in this component mimic react-color's */\r\nconst StyledInlineColorPickerContainer = styled.div`\r\n color: var(--color);\r\n text-shadow: var(--ts);\r\n font-weight: 500;\r\n padding: 5px;\r\n display: grid;\r\n grid-template-columns: max-content 1fr;\r\n gap: 3px;\r\n .color-list {\r\n display: flex;\r\n flex-wrap: nowrap;\r\n gap: 3px;\r\n }\r\n .color-block {\r\n height: 17px;\r\n width: 17px;\r\n cursor: pointer;\r\n position: relative;\r\n outline: none;\r\n border: var(--bw) solid var(--sub-level-4);\r\n &.static-block {\r\n cursor: default;\r\n height: 9px;\r\n width: 9px;\r\n margin: 4px 0;\r\n border: none;\r\n }\r\n }\r\n .active-dot {\r\n position: absolute;\r\n inset: var(--spacing-xs);\r\n background: rgb(0, 0, 0);\r\n border-radius: 50%;\r\n opacity: 1;\r\n }\r\n .color-input {\r\n display: grid;\r\n grid-template-columns: max-content 1fr;\r\n gap: 3px;\r\n border-left: var(--bw-lg) solid var(--sub-level-4);\r\n padding-left: 3px;\r\n input {\r\n width: 58px;\r\n font-size: var(--fs-sm);\r\n line-height: 1;\r\n border: none;\r\n padding: 0 5px;\r\n }\r\n }\r\n`;\r\nconst InlineColorList = [\r\n { hex: '#FFFFFF', rgb: [255, 255, 255] },\r\n { hex: '#000000', rgb: [0, 0, 0] },\r\n { hex: '#FF0000', rgb: [255, 0, 0] },\r\n { hex: '#FFFF00', rgb: [255, 255, 0] },\r\n { hex: '#00FF00', rgb: [0, 255, 0] },\r\n { hex: '#00FFFF', rgb: [0, 255, 255] },\r\n { hex: '#0000FF', rgb: [0, 0, 255] },\r\n { hex: '#FF00FF', rgb: [255, 0, 255] },\r\n];\r\ntype InlineColorPicker = {\r\n value?: string,\r\n onChange?: (hexValue: string) => void,\r\n}\r\nconst InlineColorPicker = ({\r\n value = '',\r\n onChange,\r\n}: InlineColorPicker) => {\r\n const [currentText, setCurrentText] = useState(value);\r\n const [internalValue, setInternalValue] = useState(() => {\r\n return {\r\n hex: HexColorRegex.test(value) ? value : '#000000',\r\n rgb: hexToRGBA(value, false),\r\n };\r\n });\r\n\r\n useEffect(() => {\r\n const normalizedText = currentText.startsWith('#') ? currentText : `#${currentText}`;\r\n\r\n if (HexColorRegex.test(normalizedText)) {\r\n setCurrentText(normalizedText);\r\n setInternalValue({\r\n hex: normalizedText,\r\n rgb: hexToRGBA(normalizedText, false),\r\n });\r\n onChange?.(normalizedText);\r\n }\r\n /** No need to depend on callback */\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [currentText]);\r\n\r\n useEffect(() => {\r\n setCurrentText(value);\r\n setInternalValue({\r\n hex: HexColorRegex.test(value) ? value : '#000000',\r\n rgb: hexToRGBA(value, false),\r\n });\r\n }, [value]);\r\n\r\n return \r\n
\r\n {InlineColorList.map(({ hex, rgb }) => {\r\n /** Contrast formula from google \\ :v / */\r\n const dotColor = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000 >= 128\r\n ? '#000000'\r\n : '#FFFFFF';\r\n\r\n return
onChange?.(hex)}>\r\n {internalValue.hex.toUpperCase() === hex && }\r\n
;\r\n })}\r\n
\r\n
\r\n
\r\n {\r\n setCurrentText(e.target.value);\r\n }}\r\n />\r\n
\r\n ;\r\n};\r\n\r\nconst StyledTextStyleContainer = styled.div`\r\n display: inline-grid;\r\n grid-template-columns: 1fr 1fr 1fr 1fr;\r\n column-gap: var(--spacing-xxs);\r\n padding: var(--spacing-px);\r\n margin-right: var(--spacing-sm);\r\n border: var(--bw) solid var(--sub-level-1);\r\n border-radius: var(--br);\r\n background-color: var(--main-level-4);\r\n cursor: pointer;\r\n &:hover {\r\n border-color: var(--main-active);\r\n }\r\n .text-style-preview-section {\r\n width: 8px;\r\n height: 28px; // Alignment\r\n }\r\n`;\r\nconst StyledTextStylePicker = styled.div`\r\n position: relative;\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n gap: var(--spacing-px);\r\n &.custom-style-picker {\r\n background-color: var(--sub-level-4); // Mimic border color\r\n }\r\n .style-section {\r\n z-index: 1;\r\n position: relative;\r\n background-color: var(--main-level-3);\r\n }\r\n .style-picker-section {\r\n overflow: hidden;\r\n .shadow-checkbox .ant-checkbox {\r\n transform: translateY(1px);\r\n }\r\n > .ant-checkbox-wrapper {\r\n padding: var(--spacing-xs);\r\n }\r\n }\r\n .custom-style-expand {\r\n display: grid;\r\n grid-template-columns: 1fr max-content;\r\n column-gap: var(--spacing-xs);\r\n .ant-checkbox-wrapper > span {\r\n padding-right: 0;\r\n }\r\n }\r\n .radio-train {\r\n padding: var(--spacing-xs);\r\n padding-bottom: 0;\r\n .standalone-addon {\r\n flex: 1 1 auto;\r\n text-align: left;\r\n }\r\n .radio-train-input-group {\r\n flex: 0 0 auto;\r\n }\r\n .ant-radio-button-wrapper {\r\n height: 26px;\r\n line-height: 24px;\r\n }\r\n }\r\n`;\r\nconst TextStyleInfoMap = {\r\n effectTextStyle: {\r\n keyName: 'effectTextStyle' as const,\r\n labelKey: 'input.text-style.section.effect.label',\r\n },\r\n pendulumTextStyle: {\r\n keyName: 'pendulumTextStyle' as const,\r\n labelKey: 'input.text-style.section.pendulum.label',\r\n },\r\n statTextStyle: {\r\n keyName: 'statTextStyle' as const,\r\n labelKey: 'input.text-style.section.stat.label',\r\n },\r\n typeTextStyle: {\r\n keyName: 'typeTextStyle' as const,\r\n labelKey: 'input.text-style.section.type.label',\r\n },\r\n};\r\nexport const TextStylePicker = () => {\r\n const language = useLanguage();\r\n const {\r\n statTextStyle,\r\n typeTextStyle,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n statTextStyle,\r\n typeTextStyle,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n },\r\n setCard,\r\n getUpdater,\r\n }) => ({\r\n statTextStyle,\r\n typeTextStyle,\r\n effectTextStyle,\r\n pendulumTextStyle,\r\n setCard,\r\n })));\r\n\r\n const styleList = [\r\n { info: TextStyleInfoMap.effectTextStyle, value: effectTextStyle },\r\n { info: TextStyleInfoMap.pendulumTextStyle, value: pendulumTextStyle },\r\n { info: TextStyleInfoMap.statTextStyle, value: statTextStyle },\r\n { info: TextStyleInfoMap.typeTextStyle, value: typeTextStyle },\r\n ];\r\n return \r\n \r\n {styleList.map(({ info, value }) => {\r\n const { keyName, labelKey } = info;\r\n const [custom, fillStyle, hasShadow, shadow] = value;\r\n\r\n return
\r\n

\r\n \r\n {language[labelKey]}\r\n \r\n {\r\n setCard(currentCard => {\r\n const applyStyle = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n [keyName]: [applyStyle, ...value.slice(1)],\r\n };\r\n });\r\n }}\r\n >{language['input.text-style.custom.label']}\r\n

\r\n {custom &&
\r\n

\r\n {\r\n setCard(currentCard => {\r\n const applyShadow = e.target.checked;\r\n\r\n return {\r\n ...currentCard,\r\n [keyName]: [...value.slice(0, 2), applyShadow, value[3]],\r\n };\r\n });\r\n }}\r\n >\r\n {language['input.text-style.shadow.label']}\r\n \r\n

\r\n {hasShadow && setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n [keyName]: [...value.slice(0, 3), shadowValue],\r\n };\r\n })}\r\n />}\r\n

{language['input.text-style.color.label']}

\r\n {\r\n setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n [keyName]: [value[0], color.hex, ...value.slice(2, 4)],\r\n };\r\n });\r\n }}\r\n />\r\n
}\r\n
;\r\n })}\r\n
\r\n
}\r\n >\r\n \r\n {styleList.map(({ info, value }) => {\r\n const { keyName } = info;\r\n const [custom, fillStyle, hasShadow, shadow] = value;\r\n\r\n return
;\r\n })}\r\n \r\n ;\r\n};","import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\r\nimport {\r\n Card,\r\n CardOpacity,\r\n NameStyle,\r\n NameStyleType,\r\n FrameInfoMap,\r\n} from '../../model';\r\nimport {\r\n Affiliation,\r\n AppHeader,\r\n StandaloneLabel,\r\n} from '../../component';\r\nimport {\r\n checkLink,\r\n checkMonster,\r\n} from '../../util';\r\nimport {\r\n getFoilButtonList,\r\n getAttributeList,\r\n FinishButtonList,\r\n FormatButtonList,\r\n} from './const';\r\nimport { CharPicker } from './char-picker';\r\nimport { NameStylePicker, NameStylePickerRef } from './name-style-picker';\r\nimport { CheckboxTrain, FrameTrain, RadioTrain } from './input-train';\r\nimport { Explanation } from 'src/component/explanation';\r\nimport { changeCardFormat, useCard, useLanguage, useSetting } from '../../service';\r\nimport { LayoutPicker, OpacityPickerRef } from './layout-picker';\r\nimport {\r\n CardIconInputGroup,\r\n EffectInputGroup,\r\n EffectInputGroupRef,\r\n FooterInputGroup,\r\n FooterInputGroupRef,\r\n ImageInputGroup,\r\n ImageInputGroupRef,\r\n NameSetInputGroup,\r\n NameSetInputGroupRef,\r\n PendulumInputGroup,\r\n PendulumInputGroupRef,\r\n PostPendulumInputGroup,\r\n PostPendulumInputGroupRef,\r\n} from './input-group';\r\nimport {\r\n TextStylePicker,\r\n} from './text-style-picker';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport {\r\n StyledFormatRadioTrain,\r\n StyledNameSetIdInputContainer,\r\n} from './input-panel.styled';\r\nimport './input-panel.scss';\r\n\r\nexport type CardInputPanelRef = {\r\n forceCardData: (card: Card) => void,\r\n}\r\nexport type CardInputPanel = {\r\n artworkCanvas: ImageInputGroup['receivingCanvas'],\r\n backgroundCanvas: ImageInputGroup['receivingCanvas'],\r\n} & Pick;\r\nexport const CardInputPanel = React.forwardRef(({\r\n artworkCanvas,\r\n backgroundCanvas,\r\n onCropChange,\r\n onTainted,\r\n onSourceLoaded,\r\n}: CardInputPanel, forwardedRef) => {\r\n const language = useLanguage();\r\n const {\r\n format,\r\n frame, foil, finish, opacity,\r\n nameStyleType, nameStyle,\r\n isPendulum,\r\n attribute,\r\n getUpdater,\r\n setCard,\r\n } = useCard(useShallow(({\r\n card: {\r\n format,\r\n frame, foil, finish, opacity,\r\n nameStyleType, nameStyle,\r\n isPendulum,\r\n attribute,\r\n },\r\n getUpdater,\r\n setCard,\r\n }) => ({\r\n format,\r\n frame, foil, finish, opacity,\r\n nameStyleType, nameStyle,\r\n isPendulum,\r\n attribute,\r\n getUpdater,\r\n setCard,\r\n })));\r\n const { setting } = useSetting();\r\n const { showCreativeOption, showExtraDecorativeOption } = setting;\r\n\r\n const stylePickerRef = useRef(null);\r\n\r\n const isLink = checkLink({ frame });\r\n const isMonster = checkMonster({ frame });\r\n const [stylePickerResetCount, setStylePickerResetCount] = useState(0);\r\n const foilButtonList = useMemo(() => getFoilButtonList({\r\n normal: language['input.foil.normal.label'],\r\n gold: language['input.foil.gold.label'],\r\n platinum: language['input.foil.platinum.label'],\r\n }), [language]);\r\n\r\n const imageInputGroupRef = useRef(null);\r\n const layoutPickerRef = useRef(null);\r\n const nameSetIdInputGroupRef = useRef(null);\r\n const pendulumInputGroupRef = useRef(null);\r\n const effectInputGroupRef = useRef(null);\r\n const postPendulumInputGroupRef = useRef(null);\r\n const footerInputGroupRef = useRef(null);\r\n\r\n const [pickerTarget, setPickerTarget] = useState<{\r\n id: string,\r\n setValue: (nextValue: string) => void,\r\n }>({\r\n id: '',\r\n setValue: () => {},\r\n });\r\n\r\n const changeFormat = (formatValue: string | number) => {\r\n setCard(currentCard => {\r\n const nextFormat = `${formatValue}`;\r\n const formatSwappedCard = changeCardFormat(currentCard, nextFormat);\r\n\r\n const { name, setId, effect, typeAbility, password, creator, pendulumEffect } = formatSwappedCard;\r\n nameSetIdInputGroupRef.current?.setValue({ name, setId });\r\n effectInputGroupRef.current?.setValue(effect);\r\n pendulumInputGroupRef.current?.setValue({ pendulumEffect });\r\n postPendulumInputGroupRef.current?.setValue({ typeAbility });\r\n footerInputGroupRef.current?.setValue({ creator, password });\r\n\r\n return formatSwappedCard;\r\n });\r\n };\r\n const changeFoil = useMemo(() => getUpdater('foil'), [getUpdater]);\r\n const onFinishChange = useMemo(() => getUpdater('finish'), [getUpdater]);\r\n const changeOpacity = useCallback((opacity: CardOpacity) => setCard(curr => ({ ...curr, opacity })), [setCard]);\r\n const changeAttribute = useMemo(() => getUpdater('attribute'), [getUpdater]);\r\n const changeNameStyle = useCallback((type: NameStyleType, value: Partial) => {\r\n setCard(currentCard => {\r\n return {\r\n ...currentCard,\r\n nameStyleType: type,\r\n nameStyle: value,\r\n };\r\n });\r\n }, [setCard]);\r\n\r\n const attributeList = useMemo(() => getAttributeList(format, language), [format, language]);\r\n\r\n useEffect(() => {\r\n stylePickerRef.current?.setValue({ font: nameStyle.font });\r\n }, [nameStyle]);\r\n\r\n useEffect(() => {\r\n layoutPickerRef.current?.setValue(opacity);\r\n }, [opacity]);\r\n\r\n useImperativeHandle(forwardedRef, () => ({\r\n forceCardData: card => {\r\n setStylePickerResetCount(cnt => cnt + 1);\r\n const {\r\n name,\r\n art, artCrop,\r\n background, backgroundCrop,\r\n opacity,\r\n setId,\r\n pendulumEffect,\r\n typeAbility,\r\n effect,\r\n atk, def,\r\n creator, password,\r\n } = card;\r\n\r\n imageInputGroupRef.current?.setValue({ art, artCrop });\r\n layoutPickerRef.current?.setValue({ ...opacity, background, backgroundCrop });\r\n nameSetIdInputGroupRef.current?.setValue({ name, setId });\r\n pendulumInputGroupRef.current?.setValue({ pendulumEffect });\r\n effectInputGroupRef.current?.setValue(effect);\r\n postPendulumInputGroupRef.current?.setValue({ typeAbility });\r\n footerInputGroupRef.current?.setValue({ atk, def, creator, password });\r\n }\r\n }));\r\n\r\n return \r\n \r\n
\r\n \r\n\r\n
\r\n \r\n {language['input.format.label']}\r\n \r\n \r\n {language['input.foil.label']}\r\n \r\n {showExtraDecorativeOption && \r\n {language['input.finish.label']}\r\n }\r\n
\r\n\r\n {showCreativeOption &&
\r\n \r\n \r\n
}\r\n\r\n postPendulumInputGroupRef.current?.setValue({ typeAbility })} />\r\n\r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n \r\n {language['input.attribute.label']}\r\n \r\n\r\n {(isPendulum || frame !== 'link' || showCreativeOption)\r\n && }\r\n\r\n \r\n\r\n
\r\n
\r\n \r\n {language['input.effect.label']}\r\n \r\n {showCreativeOption ? :
}\r\n \r\n
\r\n \r\n
\r\n\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
;\r\n});","import { Button, Dropdown, Menu, notification, Tooltip } from 'antd';\r\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\r\nimport { MasterSeriesCanvas } from 'src/model';\r\nimport { useCardExport, useLanguage, useMasterSeriDrawer, useSetting } from 'src/service';\r\nimport { MenuOutlined } from '@ant-design/icons';\r\nimport styled from 'styled-components';\r\nimport { useShallow } from 'zustand/react/shallow';\r\nimport { forceRefocus } from 'src/util';\r\n\r\nconst StyledDownloadDropdownLabel = styled(Menu.Item)`\r\n color: var(--color);\r\n padding: 1px 12px 5px 12px; // Alignment\r\n font-size: var(--fs-sm);\r\n border-bottom: var(--bw) solid var(--sub-level-4);\r\n cursor: default;\r\n &.ant-dropdown-menu-item.ant-dropdown-menu-item-disabled:hover {\r\n cursor: default;\r\n background: var(--main-level-3);\r\n }\r\n`;\r\nconst StyledDownloadDropdownOption = styled(Menu.Item)`\r\n &.active-resolution {\r\n background-color: var(--sub-active);\r\n }\r\n`;\r\nconst StyledDownloadButton = styled(Button)`\r\n padding: 0;\r\n .button-label {\r\n padding: 4px 15px;\r\n height: 100%; // Alignment\r\n align-content: center;\r\n border-radius: var(--br-lg);\r\n line-height: 1.5;\r\n }\r\n .button-option {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n height: 100%;\r\n display: flex;\r\n align-items: center;\r\n padding: var(--spacing);\r\n border-left: var(--bw) solid var(--sub-secondary);\r\n border-radius: 0 var(--br-lg) var(--br-lg) 0;\r\n .anticon {\r\n font-size: var(--fs-2xl);\r\n margin-left: 0;\r\n }\r\n &:hover {\r\n background: #399af9;\r\n }\r\n }\r\n`;\r\nexport type DownloadButtonRef = {\r\n download: () => void,\r\n}\r\nexport type DownloadButton = {\r\n isTainted: boolean,\r\n isInitializing: boolean,\r\n imageChangeCount: number,\r\n canvasMap: MasterSeriesCanvas,\r\n onDownloadError: () => void,\r\n};\r\nexport const DownloadButton = forwardRef(({\r\n isTainted,\r\n isInitializing,\r\n imageChangeCount,\r\n canvasMap,\r\n onDownloadError,\r\n}, ref) => {\r\n const language = useLanguage();\r\n const {\r\n allowHotkey,\r\n resolution,\r\n updateSetting,\r\n } = useSetting(useShallow(({\r\n setting: { allowHotkey, resolution },\r\n updateSetting,\r\n }) => ({\r\n allowHotkey,\r\n resolution,\r\n updateSetting,\r\n })));\r\n const { onExport } = useMasterSeriDrawer(\r\n true,\r\n canvasMap,\r\n {\r\n imageChangeCount,\r\n isInitializing,\r\n },\r\n );\r\n const {\r\n drawCanvasRef,\r\n } = canvasMap;\r\n const exportRef = useRef({\r\n currentPipeline: Promise.resolve(),\r\n pipelineRunning: false,\r\n });\r\n const [isDownloading, setDownloading] = useState(false);\r\n const onDownloadComplete = useCallback(() => {\r\n setDownloading(false);\r\n }, []);\r\n const { onSave } = useCardExport({\r\n isTainted,\r\n isInitializing,\r\n drawCanvasRef,\r\n exportRef,\r\n onExport,\r\n onDownloadError,\r\n onDownloadComplete,\r\n });\r\n\r\n const download = (size?: [number, number]) => {\r\n if (isDownloading) return;\r\n if (isTainted) {\r\n notification.error({\r\n message: 'Your card is tainted, you must save manually',\r\n description: 'Right click the card → Choose \"Save image as...\"',\r\n });\r\n return;\r\n }\r\n setDownloading(true);\r\n onSave(size);\r\n return;\r\n };\r\n useImperativeHandle(ref, () => ({\r\n download,\r\n }));\r\n\r\n if (isTainted) return null;\r\n return
\r\n
\r\n download()}>\r\n Ctrl-S / ⌘-S : null}>\r\n
\r\n {isDownloading\r\n ? language['button.download.ongoing.label']\r\n : language['button.download.label']}\r\n
\r\n
\r\n e.domEvent.stopPropagation()}>\r\n {language['button.download.resolution.label']}\r\n {[\r\n { width: 549, height: 800 },\r\n { width: 813, height: 1185 },\r\n ].map(({ width, height }) => {\r\n return {\r\n updateSetting({\r\n resolution: [width, height],\r\n });\r\n forceRefocus();\r\n }}\r\n >\r\n {width} × {height}\r\n ;\r\n })}\r\n }\r\n >\r\n
e.stopPropagation()}>\r\n \r\n
\r\n \r\n
\r\n
;\r\n});","import { useCallback, useEffect, useRef } from 'react';\r\nimport { compressCardData, insertUrlParam, normalizedCardName } from 'src/util';\r\nimport { useCard } from './use-card';\r\nimport { CardOpacity } from 'src/model';\r\nimport { useSetting } from './use-setting';\r\n\r\nexport type UseCardExport = {\r\n isTainted: boolean,\r\n isInitializing: boolean,\r\n drawCanvasRef: React.RefObject,\r\n exportRef: React.MutableRefObject<{\r\n currentPipeline: Promise;\r\n pipelineRunning: boolean;\r\n }>,\r\n onExport: (exportProps: {\r\n isPendulum: boolean,\r\n opacity: Partial,\r\n isRelevant: () => boolean,\r\n }) => Promise,\r\n onDownloadError: () => void,\r\n onDownloadComplete: () => void,\r\n};\r\nexport const useCardExport = ({\r\n isTainted,\r\n isInitializing,\r\n drawCanvasRef,\r\n exportRef,\r\n onExport,\r\n onDownloadError,\r\n onDownloadComplete,\r\n}: UseCardExport) => {\r\n const {\r\n card: currentCard,\r\n } = useCard();\r\n const resolution = useSetting(state => state.setting.resolution);\r\n const {\r\n opacity,\r\n name,\r\n isPendulum,\r\n } = currentCard;\r\n const pendingSave = useRef(false);\r\n\r\n const download = useCallback((size: [number, number] = resolution) => {\r\n const drawCanvas = drawCanvasRef.current;\r\n /** Clone node so we can resize it as will */\r\n const cloneCanvas = drawCanvas?.cloneNode() as HTMLCanvasElement | null;\r\n const drawCanvasContext = drawCanvas?.getContext('2d');\r\n const cloneCanvasContext = cloneCanvas?.getContext('2d');\r\n if (drawCanvas && drawCanvasContext\r\n && cloneCanvas && cloneCanvasContext\r\n && !isTainted\r\n ) {\r\n try {\r\n if (size) {\r\n cloneCanvas.width = size[0];\r\n cloneCanvas.height = size[1];\r\n }\r\n /** Resize here */\r\n cloneCanvasContext.drawImage(\r\n drawCanvas,\r\n 0, 0, drawCanvas.width, drawCanvas.height,\r\n 0, 0, cloneCanvas.width, cloneCanvas.height,\r\n );\r\n\r\n const normalizedName = normalizedCardName(name);\r\n var link = document.createElement('a');\r\n link.download = normalizedName\r\n ? `${normalizedName}.png`\r\n : 'card.png';\r\n link.href = cloneCanvas.toDataURL('image/png');\r\n link.click();\r\n } catch (e) {\r\n onDownloadError();\r\n }\r\n }\r\n document.querySelector('#export-canvas-guard')?.classList.remove('guard-on');\r\n onDownloadComplete();\r\n }, [drawCanvasRef, isTainted, name, resolution, onDownloadComplete, onDownloadError]);\r\n const onSave = (size?: [number, number]) => {\r\n document.querySelector('#export-canvas-guard')?.classList.add('guard-on');\r\n const queuingSize = size ? [...size] as [number, number] : undefined;\r\n /** Prevent split-second download. By using hotkey user is able to perform extremely fast save process before the pipeline start running, thus getting the previous card data instead of the most recent one. */\r\n setTimeout(() => {\r\n if (exportRef.current.pipelineRunning === false) {\r\n download(queuingSize);\r\n } else pendingSave.current = true;\r\n }, 200);\r\n };\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n setTimeout(() => {\r\n const normalizedName = normalizedCardName(name);\r\n\r\n if (relevant) {\r\n document.title = normalizedName\r\n ? `${normalizedName} - Yu-Gi-Oh Carder`\r\n : 'Yu-Gi-Oh Carder';\r\n }\r\n }, 500);\r\n\r\n return () => {\r\n relevant = false;\r\n };\r\n }, [name]);\r\n\r\n useEffect(() => {\r\n let relevant = true;\r\n let confirmReload = (ev: Event) => {\r\n ev.preventDefault();\r\n return 'Leave right now may make you lose unsaved progress, proceed?';\r\n };\r\n if (isInitializing === false) {\r\n localStorage.setItem('card-data', JSON.stringify(currentCard));\r\n localStorage.setItem('card-version', process.env.REACT_APP_VERSION ?? 'unknown');\r\n\r\n /**\r\n * Run export pipeline:\r\n * - Immediately mark the pipeline as running, then run wait for the current pipeline (1).\r\n * - If the (1) pipeline is no longer relevant, end effect.\r\n * - Otherwise (the current pipeline is the newest), start export pipeline, this export pipeline is now the current pipeline (2).\r\n * - If the (2) pipeline is no longer relevant, end effect.\r\n * - Otherwise finish the pipeline and write result, also mark the pipeline as no longer running.\r\n */\r\n (async () => {\r\n const canvasRef = drawCanvasRef.current;\r\n if (canvasRef) {\r\n window.addEventListener('beforeunload', confirmReload);\r\n document.getElementById('export-canvas')?.classList.remove('js-export-available');\r\n document.getElementById('export-canvas-guard')?.setAttribute('style', '');\r\n document.getElementById('save-button-waiting')?.setAttribute('style', 'display: block');\r\n\r\n exportRef.current.pipelineRunning = true;\r\n /** Artifical delay, turn on to test export timing */\r\n // await new Promise(resolve => setTimeout(() => resolve(true), 3000));\r\n await exportRef.current.currentPipeline;\r\n\r\n if (relevant) {\r\n exportRef.current.currentPipeline = onExport({ isPendulum, opacity, isRelevant: () => relevant });\r\n\r\n await exportRef.current.currentPipeline;\r\n if (relevant) {\r\n const condensedCard = compressCardData(currentCard);\r\n if (typeof condensedCard === 'string') insertUrlParam('data', condensedCard);\r\n\r\n document.getElementById('export-canvas')?.classList.add('js-export-available');\r\n document.getElementById('export-canvas-guard')?.setAttribute('style', 'display: none');\r\n document.getElementById('save-button-waiting')?.setAttribute('style', 'display: none');\r\n window.removeEventListener('beforeunload', confirmReload);\r\n exportRef.current.pipelineRunning = false;\r\n\r\n if (pendingSave.current) {\r\n pendingSave.current = false;\r\n download();\r\n }\r\n }\r\n }\r\n }\r\n })();\r\n }\r\n\r\n return () => {\r\n window.removeEventListener('beforeunload', confirmReload);\r\n relevant = false;\r\n };\r\n });\r\n\r\n return {\r\n onSave,\r\n };\r\n};","import styled from 'styled-components';\r\n\r\nexport const StyledDataButtonPanelContainer = styled.div`\r\n display: flex;\r\n column-gap: var(--spacing);\r\n border-radius: var(--br-lg);\r\n font-size: var(--fs-4xl);\r\n line-height: 1.5;\r\n margin: auto;\r\n max-width: var(--card-width);\r\n min-height: 59px;\r\n outline: none !important; // Avoid default state styling\r\n padding: var(--spacing);\r\n padding-right: 0;\r\n text-align: center;\r\n text-shadow: 0 1px 2px black;\r\n .anticon {\r\n cursor: pointer;\r\n }\r\n button {\r\n color: white;\r\n border-radius: var(--br-lg);\r\n outline: none !important; // Avoid default state styling\r\n cursor: pointer;\r\n }\r\n .save-button {\r\n flex: 1;\r\n font-size: var(--fs-xl);\r\n border: var(--bw) solid var(--sub-secondary);\r\n font-weight: 500;\r\n box-shadow: var(--bs-button);\r\n height: 39px; // Alignment\r\n line-height: 1;\r\n &:focus, &:active {\r\n color: white;\r\n }\r\n }\r\n #save-button-waiting {\r\n cursor: wait;\r\n position: absolute;\r\n width: 100%;\r\n height: 100%;\r\n top: 0;\r\n left: 0;\r\n z-index: 1;\r\n }\r\n #save-button-ready {\r\n cursor: pointer;\r\n &:hover {\r\n background-color: var(--sub-info);\r\n box-shadow: none;\r\n }\r\n }\r\n .save-button-container {\r\n display: flex;\r\n flex: 1;\r\n font-size: var(--fs);\r\n line-height: 1.35;\r\n position: relative;\r\n }\r\n .imexport {\r\n flex: 0 0 210px;\r\n display: grid;\r\n grid-template-columns: 1fr 1fr;\r\n column-gap: var(--spacing);\r\n button {\r\n font-size: var(--fs);\r\n background-color: var(--main-tertiary);\r\n border: var(--bw) solid var(--sub-tertiary);\r\n box-shadow: var(--bs-button);\r\n &:hover {\r\n background-color: var(--sub-tertiary);\r\n box-shadow: none;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport const StyledCardCanvasGroupContainer = styled.div`\r\n width: var(--card-width);\r\n height: var(--card-height);\r\n margin-bottom: var(--spacing);\r\n transform: translateX(var(--translate-ratio)) translateY(var(--translate-ratio)) scale(var(--resize-ratio))\r\n translateZ(0);\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n canvas {\r\n position: absolute;\r\n left: 0;\r\n z-index: 1;\r\n pointer-events: none;\r\n }\r\n &:hover {\r\n .reset-button,\r\n .lightbox-button {\r\n display: block;\r\n }\r\n #export-canvas.js-export-available {\r\n display: inline-block !important; // Override js-controlled inline style\r\n cursor: default;\r\n }\r\n #export-canvas-guard {\r\n display: flex;\r\n cursor: wait;\r\n transition: all 2s;\r\n }\r\n }\r\n #export-canvas {\r\n display: none;\r\n z-index: 100;\r\n pointer-events: all;\r\n }\r\n #export-canvas-guard {\r\n position: absolute;\r\n left: 0;\r\n display: none;\r\n align-items: center;\r\n justify-content: center;\r\n z-index: 101;\r\n // background-color: #ffffff08;\r\n width: var(--card-width);\r\n height: var(--card-height);\r\n .anticon {\r\n font-size: var(--fs-4xl);\r\n }\r\n .canvas-guard-alert {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n color: white;\r\n padding: var(--spacing-xs) var(--spacing);\r\n border-radius: 0 0 0 var(--br-lg);\r\n background-color: var(--main-active);\r\n box-shadow:\r\n 0 3px 6px rgba(0, 0, 0, 0.16),\r\n 0 3px 6px rgba(0, 0, 0, 0.23);\r\n }\r\n &.guard-on {\r\n display: flex !important; // Override js-controlled inline style\r\n }\r\n }\r\n .crop-canvas {\r\n position: relative;\r\n width: 416px;\r\n height: 416px;\r\n z-index: 0;\r\n visibility: hidden;\r\n }\r\n`;\r\n\r\nexport const StyledAppLoading = styled.div`\r\n\tposition: fixed;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-image: linear-gradient(45deg, #333, #333);\r\n\tz-index: 4000;\r\n\tcolor: white;\r\n\ttext-shadow:\r\n\t\t0 1px #333,\r\n\t\t0 2px #111;\r\n\tfont-size: var(--fs-3xl);\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: center;\r\n`;\r\n\r\nexport const StyledByMe = styled.div`\r\n\tposition: fixed;\r\n\tright: var(--spacing);\r\n\tbottom: 0;\r\n\tfont-size: var(--fs-xs);\r\n\topacity: 0.5;\r\n\tpadding: var(--spacing-px) var(--spacing-xs);\r\n\tcolor: var(--color-dim);\r\n img {\r\n height: 10px;\r\n margin-left: 1px;\r\n }\r\n`;\r\n\r\nexport const ErrorAlert = styled.span`\r\n color: var(--main-danger);\r\n`;\r\n\r\nexport const OverlayButton = styled.div`\r\n --overlay-size: 51px;\r\n position: absolute;\r\n z-index: 101;\r\n background: var(--main-primary);\r\n border-color: var(--main-active);\r\n color: var(--color-heavy);\r\n padding: var(--spacing);\r\n line-height: 1;\r\n font-size: var(--fs-3xl);\r\n text-align: center;\r\n width: var(--overlay-size);\r\n height: var(--overlay-size);\r\n border-radius: var(--br-lg);\r\n cursor: pointer;\r\n box-shadow: var(--bs-1);\r\n display: none;\r\n &:hover {\r\n background: var(--sub-primary);\r\n }\r\n`;\r\n\r\nexport const LightboxButton = styled(OverlayButton)`\r\n top: var(--spacing-xs);\r\n right: var(--spacing-xs);\r\n`;\r\n\r\nexport const ResetButton = styled(OverlayButton)`\r\n top: var(--spacing-xs);\r\n right: calc(var(--overlay-size) + 2 * var(--spacing-xs));\r\n`;","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport 'antd/dist/antd.css';\r\nimport './app.scss';\r\nimport './style/index.scss';\r\nimport './responsive.scss';\r\nimport './reduce-color-motion.scss';\r\nimport {\r\n CanvasConst,\r\n getDefaultCard,\r\n} from './model';\r\nimport {\r\n compressCardData,\r\n forceRefocus,\r\n isMobileDevice,\r\n} from './util';\r\nimport { CardInputPanel, CardInputPanelRef, DownloadButton, DownloadButtonRef } from './page';\r\nimport WebFont from 'webfontloader';\r\nimport {\r\n changeCardFormat,\r\n getLanguage,\r\n retrieveSavedCard,\r\n decodeCardWithCompatibility,\r\n useCard,\r\n useI18N,\r\n useOCGFont,\r\n useSetting,\r\n} from './service';\r\nimport { Modal, notification, Tooltip } from 'antd';\r\nimport { TaintedCanvasWarning } from './component';\r\nimport { clearCanvas } from './draw';\r\nimport { ZoomInOutlined, ClearOutlined } from '@ant-design/icons';\r\nimport {\r\n ErrorAlert,\r\n LightboxButton,\r\n ResetButton,\r\n StyledAppLoading,\r\n StyledByMe,\r\n StyledCardCanvasGroupContainer,\r\n StyledDataButtonPanelContainer,\r\n} from './app.styled';\r\nimport { configure, HotKeys } from 'react-hotkeys';\r\nimport { useShallow } from 'zustand/react/shallow';\r\n\r\n/** React hotkey setup */\r\nconfigure({\r\n ignoreTags: [],\r\n});\r\nconst AppGlobalHotkeyMap = {\r\n EXPORT: ['ctrl+d', 'command+d'],\r\n IMPORT: ['ctrl+e', 'command+e'],\r\n MERGE: ['ctrl+g', 'command+g'],\r\n VIEW: ['ctrl+b', 'command+b'],\r\n DOWNLOAD: ['ctrl+s', 'command+s'],\r\n};\r\n\r\nconst { height: CanvasHeight, width: CanvasWidth } = CanvasConst;\r\nfunction App() {\r\n const {\r\n allowHotkey,\r\n softMode,\r\n } = useSetting(useShallow(({ setting: { allowHotkey, reduceMotionColor } }) => ({\r\n softMode: reduceMotionColor,\r\n allowHotkey,\r\n })));\r\n const {\r\n isInitiating: isLanguageInitiating,\r\n isLoading: isLanguageLoading,\r\n language,\r\n isMetadataReady,\r\n languageInfo,\r\n initiate: initiateI18N,\r\n loadDefaultLanguage,\r\n } = useI18N(useShallow(({\r\n isInitiating,\r\n isLoading,\r\n language,\r\n isMetadataReady,\r\n languageInfo,\r\n initiate,\r\n loadDefaultLanguage,\r\n }) => ({\r\n isInitiating,\r\n isLoading,\r\n language,\r\n isMetadataReady,\r\n languageInfo,\r\n initiate,\r\n loadDefaultLanguage,\r\n })));\r\n const [isInitializing, setInitializing] = useState(true);\r\n const [error, setError] = useState('');\r\n const [sourceType, setSourceType] = useState<'internal' | 'external'>('external');\r\n const [canvasKey, setCanvasKey] = useState(0);\r\n const [lightboxVisible, setLightboxVisible] = useState(false);\r\n\r\n const cardInputRef = useRef(null);\r\n const artworkCanvasRef = useRef(null);\r\n const backgroundCanvasRef = useRef(null);\r\n const drawCanvasRef = useRef(null);\r\n const frameCanvasRef = useRef(null);\r\n const cardIconCanvasRef = useRef(null);\r\n const pendulumScaleCanvasRef = useRef(null);\r\n const pendulumEffectCanvasRef = useRef(null);\r\n const typeCanvasRef = useRef(null);\r\n const effectCanvasRef = useRef(null);\r\n const nameCanvasRef = useRef(null);\r\n const statCanvasRef = useRef(null);\r\n const setIdCanvasRef = useRef(null);\r\n const passwordCanvasRef = useRef(null);\r\n const creatorCanvasRef = useRef(null);\r\n const stickerCanvasRef = useRef(null);\r\n const finishCanvasRef = useRef(null);\r\n const lightboxCanvasRef = useRef(null);\r\n const [canvasMap] = useState({\r\n artworkCanvasRef,\r\n backgroundCanvasRef,\r\n drawCanvasRef,\r\n frameCanvasRef,\r\n cardIconCanvasRef,\r\n pendulumScaleCanvasRef,\r\n pendulumEffectCanvasRef,\r\n typeCanvasRef,\r\n effectCanvasRef,\r\n nameCanvasRef,\r\n statCanvasRef,\r\n setIdCanvasRef,\r\n passwordCanvasRef,\r\n creatorCanvasRef,\r\n stickerCanvasRef,\r\n finishCanvasRef,\r\n lightboxCanvasRef,\r\n });\r\n\r\n const downloadButtonRef = useRef(null);\r\n\r\n const [imageChangeCount, setImageChangeCount] = useState(0);\r\n\r\n useEffect(() => {\r\n initiateI18N();\r\n }, [initiateI18N]);\r\n useEffect(() => {\r\n if (isMetadataReady) loadDefaultLanguage();\r\n }, [isMetadataReady, loadDefaultLanguage]);\r\n /** Dynamic style, we force inline style into body because app component's style cannot affect overlay component. */\r\n useEffect(() => {\r\n const applyList = [\r\n 'font-family',\r\n 'letter-spacing',\r\n '--width-label',\r\n ];\r\n\r\n applyList.forEach(styleName => {\r\n document.body.style.setProperty(styleName, languageInfo.style?.[styleName] ?? '' as any);\r\n });\r\n }, [languageInfo]);\r\n\r\n useEffect(() => {\r\n const ctx = drawCanvasRef.current?.getContext('2d');\r\n const setCard = useCard.getState().setCard;\r\n if (ctx) {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.imageSmoothingQuality = 'high';\r\n clearCanvas(ctx);\r\n }\r\n\r\n if (isLanguageInitiating === false) WebFont.load({\r\n custom: {\r\n families: [\r\n 'Matrix-Bold',\r\n 'MatrixBoldSmallCaps',\r\n 'MatrixBook',\r\n 'MatrixRegularSmallCaps',\r\n 'RoGSanSrfStd-Bd',\r\n 'YuGiOhITCStoneSerifBSc',\r\n 'matrix',\r\n 'palatino-linotype-bold',\r\n 'stone-serif-bold',\r\n 'stone-serif-regular',\r\n ],\r\n urls: ['asset/font.css'],\r\n },\r\n active: () => {\r\n const retrievedCard = retrieveSavedCard();\r\n\r\n setCard(retrievedCard);\r\n setInitializing(false);\r\n },\r\n fontinactive(familyName, fvd) {\r\n console.error('TCG fontinactive', familyName, fvd);\r\n notification.error({\r\n message: getLanguage()['error.load.font.tcg'](familyName),\r\n });\r\n },\r\n inactive: () => {\r\n setError(getLanguage()['error.load.font.all-tcg']);\r\n setInitializing(false);\r\n },\r\n });\r\n }, [isLanguageInitiating]);\r\n\r\n const {\r\n styleContent: ocgStyleFile,\r\n } = useOCGFont({\r\n isLanguageInitiating,\r\n onBeforeLoad: () => {\r\n setInitializing(true);\r\n const ctx = drawCanvasRef.current?.getContext('2d');\r\n if (ctx) {\r\n ctx.setTransform(1, 0, 0, 1, 0, 0);\r\n ctx.imageSmoothingQuality = 'high';\r\n clearCanvas(ctx);\r\n }\r\n },\r\n onActive: () => {\r\n setInitializing(false);\r\n },\r\n onInactive: () => {\r\n setError(getLanguage()['error.load.font.all-ocg']);\r\n setInitializing(false);\r\n },\r\n onFontInactive: (familyName, fvd) => {\r\n console.error('OCG fontinactive', familyName, fvd);\r\n notification.error({\r\n message: getLanguage()['error.load.font.ocg'](familyName),\r\n });\r\n }\r\n });\r\n\r\n const [isTainted, setTainted] = useState(false);\r\n\r\n useEffect(() => {\r\n const documentClassList = document.body.classList;\r\n\r\n if (softMode) documentClassList.add('reduced-color-motion');\r\n else documentClassList.remove('reduced-color-motion');\r\n }, [softMode]);\r\n\r\n const displayLightbox = useCallback((status?: boolean, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n setLightboxVisible(cur => typeof status === 'boolean' ? status : !cur);\r\n }, [allowHotkey]);\r\n\r\n const importData = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n const cardData = window.prompt(language['prompt.import.message']);\r\n const setCard = useCard.getState().setCard;\r\n\r\n if (cardData) {\r\n const decodedCard = decodeCardWithCompatibility(cardData);\r\n\r\n setCard(decodedCard);\r\n setImageChangeCount(cnt => cnt + 1);\r\n cardInputRef.current?.forceCardData(decodedCard);\r\n /** Allow navigate input panel right away */\r\n forceRefocus();\r\n }\r\n }, [allowHotkey, language]);\r\n\r\n const mergeData = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n const cardData = window.prompt(language['prompt.import.message']);\r\n const setCard = useCard.getState().setCard;\r\n\r\n if (cardData) {\r\n const decodedCard = decodeCardWithCompatibility(cardData, useCard.getState().card);\r\n\r\n setCard(decodedCard);\r\n setImageChangeCount(cnt => cnt + 1);\r\n cardInputRef.current?.forceCardData(decodedCard);\r\n /** Allow navigate input panel right away */\r\n forceRefocus();\r\n }\r\n }, [allowHotkey, language]);\r\n\r\n const exportData = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n if (sourceType === 'internal') window.alert(language['prompt.export.offline-warning.message']);\r\n const exportableCard = useCard.getState().card;\r\n\r\n window.prompt(\r\n language['prompt.export.message'],\r\n `${compressCardData(exportableCard)}`,\r\n );\r\n }, [allowHotkey, language, sourceType]);\r\n\r\n const downloadFromHotkey = useCallback((event?: { preventDefault: () => void }, fromHotkey = false) => {\r\n if (fromHotkey && !allowHotkey) return;\r\n\r\n event?.preventDefault();\r\n downloadButtonRef.current?.download();\r\n }, [allowHotkey]);\r\n\r\n const hotkeyHandlerMap = useMemo(() => {\r\n return {\r\n IMPORT: (event?: { preventDefault: () => void }) => importData(event, true),\r\n MERGE: (event?: { preventDefault: () => void }) => mergeData(event, true),\r\n EXPORT: (event?: { preventDefault: () => void }) => exportData(event, true),\r\n VIEW: () => displayLightbox(true, true),\r\n DOWNLOAD: (event?: { preventDefault: () => void }) => downloadFromHotkey(event, true),\r\n };\r\n }, [downloadFromHotkey, exportData, importData, mergeData, displayLightbox]);\r\n\r\n const alertDownloadError = useCallback(() => {\r\n setTainted(true);\r\n alert(language['prompt.download.tainted.message']);\r\n }, [language]);\r\n\r\n const rerenderAllImage = useCallback(() => {\r\n setCanvasKey(cnt => cnt + 1);\r\n setImageChangeCount(cnt => cnt + 1);\r\n setTainted(false);\r\n }, []);\r\n\r\n const rerenderCardImage: NonNullable = useCallback((_, sourceType) => {\r\n setImageChangeCount(cnt => cnt + 1);\r\n setSourceType(sourceType);\r\n }, []);\r\n\r\n const markTaintedImage = useCallback(() => {\r\n setImageChangeCount(cnt => cnt + 1);\r\n setTainted(true);\r\n }, []);\r\n\r\n const isLoading = isLanguageLoading || isInitializing;\r\n return (\r\n \r\n
{ }}\r\n className={`language-${languageInfo.codeName}`}\r\n style={{\r\n backgroundImage: `url(\"${process.env.PUBLIC_URL}/asset/image/texture/debut-dark.png\"), linear-gradient(180deg, #00000022, #00000044)`,\r\n height: isMobileDevice() ? '-webkit-fill-available' : '100vh',\r\n ...({\r\n '--card-height': `${CanvasConst.height}px`,\r\n '--card-width': `${CanvasConst.width}px`,\r\n }),\r\n }}\r\n >\r\n {ocgStyleFile && }\r\n \r\n {isLoading && \r\n {error.length > 0\r\n ? \r\n {error}\r\n \r\n : languageInfo.initialMessage ?? ''}\r\n }\r\n {/*
*/}\r\n
\r\n \r\n
\r\n Ctrl-D / ⌘-D : null}>\r\n \r\n \r\n \r\n
Ctrl-E / ⌘-E
\r\n
Ctrl-G / ⌘-G{language['prompt.import.merge.tooltip']}
\r\n
: null}>\r\n \r\n \r\n
\r\n \r\n {isTainted &&
\r\n \r\n {language['alert.download.tainted-first-line']}
\r\n {language['alert.download.tainted-second-line']}
\r\n
}\r\n \r\n
\r\n \r\n \r\n {\r\n const consent = window.confirm(language['prompt.reset.message']);\r\n\r\n if (consent) {\r\n const { setCard, card } = useCard.getState();\r\n const defaultCard = getDefaultCard();\r\n const contextualDefaultCardData = card.format === 'tcg'\r\n ? defaultCard\r\n : changeCardFormat(defaultCard, 'ocg');\r\n\r\n setCard(contextualDefaultCardData);\r\n setImageChangeCount(cnt => cnt + 1);\r\n cardInputRef.current?.forceCardData(contextualDefaultCardData);\r\n }\r\n }}>\r\n \r\n \r\n \r\n \r\n {language['button.full-size.label']}\r\n {allowHotkey ? <>
Ctrl-B / ⌘-B : null}\r\n
}>\r\n displayLightbox()}>\r\n \r\n \r\n \r\n \r\n {/** Overlay guarding seems very janky, cursor should suffix for now */}\r\n
e.preventDefault()}>\r\n {/*
Generating...
*/}\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n
\r\n {isLoading === false && }\r\n
\r\n {/** Pixel perfect for card image */}\r\n setLightboxVisible(false)}\r\n footer={null}\r\n >\r\n \r\n \r\n \r\n Made by Lauqerm \"avatar\"\r\n \r\n
\r\n \r\n );\r\n}\r\n\r\nexport default App;\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport WebFont from 'webfontloader';\r\nimport { useCard } from './use-card';\r\nimport { useShallow } from 'zustand/react/shallow';\r\n\r\nexport type UseOCGFont = {\r\n isLanguageInitiating: boolean,\r\n onBeforeLoad: () => void,\r\n onActive: () => void,\r\n onInactive: () => void,\r\n onFontInactive: (familyName: string, fvd: string) => void,\r\n}\r\nexport const useOCGFont = ({\r\n isLanguageInitiating,\r\n onActive,\r\n onBeforeLoad,\r\n onFontInactive,\r\n onInactive,\r\n}: UseOCGFont) => {\r\n const {\r\n font,\r\n format,\r\n } = useCard(useShallow(state => ({\r\n format: state.card.format,\r\n font: state.card.nameStyle.font,\r\n })));\r\n const [styleContent, setStyleContent] = useState('');\r\n\r\n const ocgReady = useRef(false);\r\n const loadAttempt = useRef(0);\r\n useEffect(() => {\r\n if (\r\n (format === 'ocg' || font === 'OCG')\r\n && ocgReady.current === false\r\n && loadAttempt.current <= 3\r\n && isLanguageInitiating === false\r\n ) {\r\n loadAttempt.current += 1;\r\n setStyleContent(`${process.env.PUBLIC_URL}/asset/ocg-font.css`);\r\n onBeforeLoad();\r\n\r\n WebFont.load({\r\n custom: {\r\n families: [\r\n 'DFHSGothic-W3-WIN-RKSJ-H',\r\n 'DFKakuTaiHiStd-W4',\r\n 'FOT-Rodin Pro M',\r\n 'Yu-Gi-Oh! DF Leisho 3',\r\n ],\r\n urls: ['asset/ocg-font.css'],\r\n },\r\n active: () => {\r\n ocgReady.current = true;\r\n onActive();\r\n },\r\n inactive: () => {\r\n ocgReady.current = true;\r\n onInactive();\r\n },\r\n fontinactive: onFontInactive,\r\n });\r\n }\r\n }, [format, font, isLanguageInitiating, onActive, onBeforeLoad, onFontInactive, onInactive]);\r\n\r\n return {\r\n styleContent,\r\n };\r\n};","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\r\nimport ReactDOM from 'react-dom';\r\nimport './index.css';\r\nimport App from './app';\r\nimport reportWebVitals from './reportWebVitals';\r\n\r\nReactDOM.render(\r\n \r\n \r\n ,\r\n document.getElementById('root'),\r\n);\r\n\r\n// If you want to start measuring performance in your app, pass a function\r\n// to log results (for example: reportWebVitals(console.log))\r\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\r\nreportWebVitals();\r\n"],"sourceRoot":""} \ No newline at end of file