Files
granblue-party/dist/assets/Spark-L19kjwZP.js
2026-04-13 07:15:44 +00:00

3 lines
31 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{n as tt,L as et,U as j,m as Q}from"./index-DDNMzpZj.js";import{p as gt}from"./collection-tracker-03Pk0lTl.js";import{p as wt}from"./mixins-CpCP8hE3.js";import{C as _t}from"./Checkbox-Dc2UYqO9.js";function vt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var F={exports:{}};var yt=F.exports,Z;function xt(){return Z||(Z=1,(function(s,t){(r=>{let n=(()=>{let l=0;return{escape:function(e){return e.replace(/([.*+?^${}()|[\]/\\])/g,"\\$1")},isDataUrl:function(e){return e.search(/^(data:)/)!==-1},canvasToBlob:function(e){return e.toBlob?new Promise(function(o){e.toBlob(o)}):(o=>new Promise(function(d){var a=rt(o.toDataURL().split(",")[1]),m=a.length,C=new Uint8Array(m);for(let L=0;L<m;L++)C[L]=a.charCodeAt(L);d(new Blob([C],{type:"image/png"}))}))(e)},resolveUrl:function(e,o){var d=document.implementation.createHTMLDocument(),a=d.createElement("base"),m=(d.head.appendChild(a),d.createElement("a"));return d.body.appendChild(m),a.href=o,m.href=e,m.href},getAndEncode:function(e){let o=_.impl.urlCache.find(function(d){return d.url===e});return o||(o={url:e,promise:null},_.impl.urlCache.push(o)),o.promise===null&&(_.impl.options.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime()),o.promise=new Promise(function(d){let a=new XMLHttpRequest;function m(p){console.error(p),d("")}function C(){var p=_.impl.options.imagePlaceholder;p?d(p):m("Status:"+a.status+" while fetching resource: "+e)}if(a.timeout=_.impl.options.httpTimeout,a.onerror=C,a.ontimeout=C,a.onloadend=function(){if(a.readyState===XMLHttpRequest.DONE){var p=a.status;if(p===0&&e.toLowerCase().startsWith("file://")||200<=p&&p<=300&&a.response!==null){p=a.response,p instanceof Blob||m("Expected response to be a Blob, but got: "+typeof p);let b=new FileReader;b.onloadend=function(){var g=b.result;d(g)};try{b.readAsDataURL(p)}catch(g){m("Failed to read the response as Data URL: "+g.toString())}}else C()}},0<_.impl.options.useCredentialsFilters.length&&(_.impl.options.useCredentials=0<_.impl.options.useCredentialsFilters.filter(p=>0<=e.search(p)).length),_.impl.options.useCredentials&&(a.withCredentials=!0),_.impl.options.corsImg&&e.indexOf("http")===0&&e.indexOf(window.location.origin)===-1){var L=(_.impl.options.corsImg.method||"GET").toUpperCase()==="POST"?"POST":"GET";a.open(L,(_.impl.options.corsImg.url||"").replace("#{cors}",e),!0);let p=!1,b=_.impl.options.corsImg.headers||{},g=(Object.keys(b).forEach(function(c){b[c].indexOf("application/json")!==-1&&(p=!0),a.setRequestHeader(c,b[c])}),(c=>{try{return JSON.parse(JSON.stringify(c))}catch(x){m("corsImg.data is missing or invalid:"+x.toString())}})(_.impl.options.corsImg.data||""));Object.keys(g).forEach(function(c){typeof g[c]=="string"&&(g[c]=g[c].replace("#{cors}",e))}),a.responseType="blob",a.send(p?JSON.stringify(g):g)}else a.open("GET",e,!0),a.responseType="blob",a.send()})),o.promise},uid:function(){return"u"+("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)+l++},asArray:function(e){var o=[],d=e.length;for(let a=0;a<d;a++)o.push(e[a]);return o},escapeXhtml:function(e){return e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(e){return e!=="data:,"?new Promise(function(o,d){let a=document.createElementNS("http://www.w3.org/2000/svg","svg"),m=new Image;_.impl.options.useCredentials&&(m.crossOrigin="use-credentials"),m.onload=function(){document.body.removeChild(a),window&&window.requestAnimationFrame?window.requestAnimationFrame(function(){o(m)}):o(m)},m.onerror=C=>{document.body.removeChild(a),d(C)},a.appendChild(m),m.src=e,document.body.appendChild(a)}):Promise.resolve()},width:function(e){var o=u(e,"width");if(!isNaN(o))return o;var o=u(e,"border-left-width"),d=u(e,"border-right-width");return e.scrollWidth+o+d},height:function(e){var o=u(e,"height");if(!isNaN(o))return o;var o=u(e,"border-top-width"),d=u(e,"border-bottom-width");return e.scrollHeight+o+d},getWindow:i,isElement:w,isElementHostForOpenShadowRoot:function(e){return w(e)&&e.shadowRoot!==null},isShadowRoot:f,isInShadowRoot:h,isHTMLElement:function(e){return e instanceof i(e).HTMLElement},isHTMLCanvasElement:function(e){return e instanceof i(e).HTMLCanvasElement},isHTMLInputElement:function(e){return e instanceof i(e).HTMLInputElement},isHTMLImageElement:function(e){return e instanceof i(e).HTMLImageElement},isHTMLLinkElement:function(e){return e instanceof i(e).HTMLLinkElement},isHTMLScriptElement:function(e){return e instanceof i(e).HTMLScriptElement},isHTMLStyleElement:function(e){return e instanceof i(e).HTMLStyleElement},isHTMLTextAreaElement:function(e){return e instanceof i(e).HTMLTextAreaElement},isShadowSlotElement:function(e){return h(e)&&e instanceof i(e).HTMLSlotElement},isSVGElement:function(e){return e instanceof i(e).SVGElement},isSVGRectElement:function(e){return e instanceof i(e).SVGRectElement},isDimensionMissing:function(e){return isNaN(e)||e<=0}};function i(e){return e=e?e.ownerDocument:void 0,(e?e.defaultView:void 0)||window||r}function f(e){return e instanceof i(e).ShadowRoot}function h(e){return e!=null&&e.getRootNode!==void 0&&f(e.getRootNode())}function w(e){return e instanceof i(e).Element}function u(e,o){if(e.nodeType===B){let d=q(e).getPropertyValue(o);if(d.slice(-2)==="px")return d=d.slice(0,-2),parseFloat(d)}return NaN}})(),y=(()=>{let l=/url\(\s*(["']?)((?:\\.|[^\\)])+)\1\s*\)/gm;return{inlineAll:function(u,e,o){return i(u)?Promise.resolve(u).then(f).then(function(d){let a=Promise.resolve(u);return d.forEach(function(m){a=a.then(function(C){return w(C,m,e,o)})}),a}):Promise.resolve(u)},shouldProcess:i,impl:{readUrls:f,inline:w,urlAsRegex:h}};function i(u){return u.search(l)!==-1}function f(u){for(var e,o=[];(e=l.exec(u))!==null;)o.push(e[2]);return o.filter(function(d){return!n.isDataUrl(d)})}function h(u){return new RegExp(`url\\((["']?)(${n.escape(u)})\\1\\)`,"gm")}function w(u,e,o,d){return Promise.resolve(e).then(function(a){return o?n.resolveUrl(a,o):a}).then(d||n.getAndEncode).then(function(a){var m=h(e);return u.replace(m,`url($1${a}$1)`)})}})(),T={resolveAll:function(){return z().then(function(l){return Promise.all(l.map(function(i){return i.resolve()}))}).then(function(l){return l.join(`
`)})},impl:{readAll:z}};function z(){return Promise.resolve(n.asArray(document.styleSheets)).then(function(i){let f=[];return i.forEach(function(h){var w=Object.getPrototypeOf(h);if(Object.prototype.hasOwnProperty.call(w,"cssRules"))try{n.asArray(h.cssRules||[]).forEach(f.push.bind(f))}catch(u){console.error("domtoimage: Error while reading CSS rules from: "+h.href,u.toString())}}),f}).then(function(i){return i.filter(function(f){return f.type===CSSRule.FONT_FACE_RULE}).filter(function(f){return y.shouldProcess(f.style.getPropertyValue("src"))})}).then(function(i){return i.map(l)});function l(i){return{resolve:function(){var f=(i.parentStyleSheet||{}).href;return y.inlineAll(i.cssText,f)},src:function(){return i.style.getPropertyValue("src")}}}}let X={inlineAll:function l(i){if(!n.isElement(i))return Promise.resolve(i);return f(i).then(function(){return n.isHTMLImageElement(i)?Y(i).inline():Promise.all(n.asArray(i.childNodes).map(function(h){return l(h)}))});function f(h){let w=["background","background-image"],u=w.map(function(e){let o=h.style.getPropertyValue(e),d=h.style.getPropertyPriority(e);return o?y.inlineAll(o).then(function(a){h.style.setProperty(e,a,d)}):Promise.resolve()});return Promise.all(u).then(function(){return h})}},impl:{newImage:Y}};function Y(l){return{inline:function(i){return n.isDataUrl(l.src)?Promise.resolve():Promise.resolve(l.src).then(i||n.getAndEncode).then(function(f){return new Promise(function(h){l.onload=h,l.onerror=h,l.src=f})})}}}let D={copyDefaultStyles:!0,imagePlaceholder:void 0,cacheBust:!1,useCredentials:!1,useCredentialsFilters:[],httpTimeout:3e4,styleCaching:"strict",corsImg:void 0},_={toSvg:J,toPng:function(l,i){return O(l,i).then(function(f){return f.toDataURL()})},toJpeg:function(l,i){return O(l,i).then(function(f){return f.toDataURL("image/jpeg",(i?i.quality:void 0)||1)})},toBlob:function(l,i){return O(l,i).then(n.canvasToBlob)},toPixelData:function(l,i){return O(l,i).then(function(f){return f.getContext("2d").getImageData(0,0,n.width(l),n.height(l)).data})},toCanvas:O,impl:{fontFaces:T,images:X,util:n,inliner:y,urlCache:[],options:{},copyOptions:function(l){l.copyDefaultStyles===void 0?_.impl.options.copyDefaultStyles=D.copyDefaultStyles:_.impl.options.copyDefaultStyles=l.copyDefaultStyles,_.impl.options.imagePlaceholder=(l.imagePlaceholder===void 0?D:l).imagePlaceholder,_.impl.options.cacheBust=(l.cacheBust===void 0?D:l).cacheBust,_.impl.options.corsImg=(l.corsImg===void 0?D:l).corsImg,_.impl.options.useCredentials=(l.useCredentials===void 0?D:l).useCredentials,_.impl.options.useCredentialsFilters=(l.useCredentialsFilters===void 0?D:l).useCredentialsFilters,_.impl.options.httpTimeout=(l.httpTimeout===void 0?D:l).httpTimeout,_.impl.options.styleCaching=(l.styleCaching===void 0?D:l).styleCaching}}},B=(s.exports=_,(Node===void 0?void 0:Node.ELEMENT_NODE)||1),q=(r===void 0?void 0:r.getComputedStyle)||(window===void 0?void 0:window.getComputedStyle)||globalThis.getComputedStyle,rt=(r===void 0?void 0:r.atob)||(window===void 0?void 0:window.atob)||globalThis.atob;function J(l,i){_.impl.util.getWindow(l);let f=(i=i||{},_.impl.copyOptions(i),[]);return Promise.resolve(l).then(function(h){if(h.nodeType===B)return h;var w=h,u=document.createElement("span");return w.replaceWith(u),u.append(h),f.push({child:w,wrapper:u}),u}).then(function(h){return(function w(u,e,o,d){let a=e.filter;if(u===P||n.isHTMLScriptElement(u)||n.isHTMLStyleElement(u)||n.isHTMLLinkElement(u)||o!==null&&a&&!a(u))return Promise.resolve();return Promise.resolve(u).then(m).then(C).then(function(c){return b(c,p(u))}).then(L).then(function(c){return g(c,u)});function m(c){return n.isHTMLCanvasElement(c)?n.makeImage(c.toDataURL()):c.cloneNode(!1)}function C(c){return e.adjustClonedNode&&e.adjustClonedNode(u,c,!1),Promise.resolve(c)}function L(c){return e.adjustClonedNode&&e.adjustClonedNode(u,c,!0),Promise.resolve(c)}function p(c){return n.isElementHostForOpenShadowRoot(c)?c.shadowRoot:c}function b(c,x){let R=$(x),N=Promise.resolve();if(R.length!==0){let k=q(H(x));n.asArray(R).forEach(function(M){N=N.then(function(){return w(M,e,k).then(function(I){I&&c.appendChild(I)})})})}return N.then(function(){return c});function H(k){return n.isShadowRoot(k)?k.host:k}function $(k){if(n.isShadowSlotElement(k)){let M=k.assignedNodes();if(M&&0<M.length)return M}return k.childNodes}}function g(c,x){return!n.isElement(c)||n.isShadowSlotElement(x)?Promise.resolve(c):Promise.resolve().then(N).then(H).then($).then(k).then(R).then(function(){return c});function R(){n.isHTMLImageElement(c)&&(c.removeAttribute("loading"),x.srcset||x.sizes)&&(c.removeAttribute("srcset"),c.removeAttribute("sizes"),c.src=x.currentSrc||x.src)}function N(){function M(S,v){v.font=S.font,v.fontFamily=S.fontFamily,v.fontFeatureSettings=S.fontFeatureSettings,v.fontKerning=S.fontKerning,v.fontSize=S.fontSize,v.fontStretch=S.fontStretch,v.fontStyle=S.fontStyle,v.fontVariant=S.fontVariant,v.fontVariantCaps=S.fontVariantCaps,v.fontVariantEastAsian=S.fontVariantEastAsian,v.fontVariantLigatures=S.fontVariantLigatures,v.fontVariantNumeric=S.fontVariantNumeric,v.fontVariationSettings=S.fontVariationSettings,v.fontWeight=S.fontWeight}function I(S,v){let A=q(S);A.cssText?(v.style.cssText=A.cssText,M(A,v.style)):(ot(e,S,A,o,v),o===null&&(["inset-block","inset-block-start","inset-block-end"].forEach(V=>v.style.removeProperty(V)),["left","right","top","bottom"].forEach(V=>{v.style.getPropertyValue(V)&&v.style.setProperty(V,"0px")})))}I(x,c)}function H(){let M=n.uid();function I(S){let v=q(x,S),A=v.getPropertyValue("content");if(A!==""&&A!=="none"){let lt=function(){let ct=`.${M}:`+S,ut=(v.cssText?dt:ht)();return document.createTextNode(ct+`{${ut}}`);function dt(){return`${v.cssText} content: ${A};`}function ht(){return n.asArray(v).map(ft).join("; ")+";";function ft(W){let pt=v.getPropertyValue(W),mt=v.getPropertyPriority(W)?" !important":"";return W+": "+pt+mt}}},V=c.getAttribute("class")||"",K=(c.setAttribute("class",V+" "+M),document.createElement("style"));K.appendChild(lt()),c.appendChild(K)}}[":before",":after"].forEach(function(S){I(S)})}function $(){n.isHTMLTextAreaElement(x)&&(c.innerHTML=x.value),n.isHTMLInputElement(x)&&c.setAttribute("value",x.value)}function k(){n.isSVGElement(c)&&(c.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.isSVGRectElement(c))&&["width","height"].forEach(function(M){let I=c.getAttribute(M);I&&c.style.setProperty(M,I)})}}})(h,i,null)}).then(i.disableEmbedFonts?Promise.resolve(l):st).then(i.disableInlineImages?Promise.resolve(l):it).then(function(h){i.bgcolor&&(h.style.backgroundColor=i.bgcolor),i.width&&(h.style.width=i.width+"px"),i.height&&(h.style.height=i.height+"px"),i.style&&Object.keys(i.style).forEach(function(u){h.style[u]=i.style[u]});let w=null;return typeof i.onclone=="function"&&(w=i.onclone(h)),Promise.resolve(w).then(function(){return h})}).then(function(h){let w=i.width||n.width(l),u=i.height||n.height(l);return Promise.resolve(h).then(function(e){return e.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),new XMLSerializer().serializeToString(e)}).then(n.escapeXhtml).then(function(e){var o=(n.isDimensionMissing(w)?' width="100%"':` width="${w}"`)+(n.isDimensionMissing(u)?' height="100%"':` height="${u}"`);return`<svg xmlns="http://www.w3.org/2000/svg"${(n.isDimensionMissing(w)?"":` width="${w}"`)+(n.isDimensionMissing(u)?"":` height="${u}"`)}><foreignObject${o}>${e}</foreignObject></svg>`}).then(function(e){return"data:image/svg+xml;charset=utf-8,"+e})}).then(function(h){for(;0<f.length;){var w=f.pop();w.wrapper.replaceWith(w.child)}return h}).then(function(h){return _.impl.urlCache=[],P&&(document.body.removeChild(P),P=null),G&&clearTimeout(G),G=setTimeout(()=>{G=null,U={}},2e4),h})}function O(l,i){return J(l,i=i||{}).then(n.makeImage).then(function(f){var h=typeof i.scale!="number"?1:i.scale,w=((e,o)=>{let d=i.width||n.width(e),a=i.height||n.height(e);return n.isDimensionMissing(d)&&(d=n.isDimensionMissing(a)?300:2*a),n.isDimensionMissing(a)&&(a=d/2),(e=document.createElement("canvas")).width=d*o,e.height=a*o,i.bgcolor&&((o=e.getContext("2d")).fillStyle=i.bgcolor,o.fillRect(0,0,e.width,e.height)),e})(l,h),u=w.getContext("2d");return u.msImageSmoothingEnabled=!1,u.imageSmoothingEnabled=!1,f&&(u.scale(h,h),u.drawImage(f,0,0)),w})}let P=null;function st(l){return T.resolveAll().then(function(i){var f;return i!==""&&(f=document.createElement("style"),l.appendChild(f),f.appendChild(document.createTextNode(i))),l})}function it(l){return X.inlineAll(l).then(function(){return l})}function ot(l,i,f,h,w){let u=_.impl.options.copyDefaultStyles?((o,d)=>{var a,m=(p=>(o.styleCaching!=="relaxed"?p:p.filter((b,g,c)=>g===0||g===c.length-1)).join(">"))(d=(p=>{var b=[];do if(p.nodeType===B){var g=p.tagName;if(b.push(g),at.includes(g))break}while(p=p.parentNode);return b})(d));{if(U[m])return U[m];d=((p,b)=>{let g=p.body;do{var c=b.pop(),c=p.createElement(c);g.appendChild(c),g=c}while(0<b.length);return g.textContent="",g})((a=(()=>{if(P)return P.contentWindow;b=document.characterSet||"UTF-8",p=(p=document.doctype)?(`<!DOCTYPE ${H(p.name)} ${H(p.publicId)} `+H(p.systemId)).trim()+">":"",(P=document.createElement("iframe")).id="domtoimage-sandbox-"+n.uid(),P.style.top="-9999px",P.style.visibility="hidden",P.style.position="fixed",document.body.appendChild(P);var p,b,g=P,c="domtoimage-sandbox";try{return g.contentWindow.document.write(p+`<html><head><meta charset='${b}'><title>${c}</title></head><body></body></html>`),g.contentWindow}catch{}var x=document.createElement("meta");x.setAttribute("charset",b);try{var R=document.implementation.createHTMLDocument(c),N=(R.head.appendChild(x),p+R.documentElement.outerHTML);return g.setAttribute("srcdoc",N),g.contentWindow}catch{}return g.contentDocument.head.appendChild(x),g.contentDocument.title=c,g.contentWindow;function H($){var k;return $?((k=document.createElement("div")).innerText=$,k.innerHTML):""}})()).document,d),a=((p,b)=>{let g={},c=p.getComputedStyle(b);return n.asArray(c).forEach(function(x){g[x]=x==="width"||x==="height"?"auto":c.getPropertyValue(x)}),g})(a,d);var C=d;do{var L=C.parentElement;L!==null&&L.removeChild(C),C=L}while(C&&C.tagName!=="BODY");return U[m]=a}})(l,i):{},e=w.style;n.asArray(f).forEach(function(o){var d,a,m,C;l.filterStyles&&!l.filterStyles(i,o)||(a=f.getPropertyValue(o),m=u[o],d=h?h.getPropertyValue(o):void 0,e.getPropertyValue(o))||(a!==m||h&&a!==d)&&(m=f.getPropertyPriority(o),d=e,a=a,m=m,C=0<=["background-clip"].indexOf(o=o),m?(d.setProperty(o,a,m),C&&d.setProperty("-webkit-"+o,a,m)):(d.setProperty(o,a),C&&d.setProperty("-webkit-"+o,a)))})}let G=null,U={},at=["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DETAILS","DIALOG","DD","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","SVG","TABLE","UL","math","svg","BODY","HEAD","HTML"]})(yt)})(F)),F.exports}var Ct=xt();const bt=vt(Ct),St={namespaced:!0,state(){return{characters:[],summons:[]}},actions:{fetchCharacters({state:s,dispatch:t}){if(s.characters.length===0)return this.axios.get("/spark/characters").then(r=>s.characters=r.data).catch(r=>t("addAxiosErrorMessage",r,{root:!0}))},fetchSummons({state:s,dispatch:t}){if(s.summons.length===0)return this.axios.get("/spark/summons").then(r=>s.summons=r.data).catch(r=>t("addAxiosErrorMessage",r,{root:!0}))}}},kt=wt("spark",St),nt="/assets/ceruleanspark-wtDMxBUx.png",Et={props:{unit:{type:Object,required:!0},width:{type:Number,default:105},height:{type:Number,default:60},isSpark:{type:Boolean,default:!1}},methods:{getName(s){return this.isLangEnglish?s.n:s.nj}},computed:{isLangEnglish(){return this.$store.getters.getLang===et.EN}}};var Tt=function(){var t=this,r=t._self._c;return r("div",{staticClass:"flex flex-col relative",style:"width: "+t.width+"px;"},[r("a",{staticClass:"text-xs text-primary h-5 px-1 text-center truncate",attrs:{target:"_blank",href:"https://gbf.wiki/"+t.unit.n,title:t.getName(t.unit)}},[t._v(t._s(t.getName(t.unit)))]),r("img",{staticClass:"cursor-pointer",style:"min-width: "+t.width+"px;",attrs:{height:t.height,width:t.width,title:t.getName(t.unit),src:"/img/unit_small/"+t.unit.id+"000.jpg"},on:{click:function(n){return t.$emit("left-click-unit")},contextmenu:function(n){return n.preventDefault(),t.$emit("right-click-unit")}}}),t.isSpark===!0?r("img",{staticClass:"absolute bottom-0 right-0 pointer-events-none",attrs:{height:"39",width:"38",src:nt}}):t._e()])},Mt=[],Pt=tt(Et,Tt,Mt,!1,null,null);const Lt=Pt.exports,It="/assets/crystal-vfYmHQy5.jpg",Dt="/assets/goldmoon-D3Rz1DRX.jpg",$t="/assets/sunlightstone-BvZntHf2.jpg",At="/assets/silvermoon-CXkLd0tc.jpg",E=new j.LocalStorageMgt("Spark"),Rt={components:{Checkbox:_t,SparkUnit:Lt},mixins:[gt,kt],head:{title:"Granblue.Party - Spark Maker",desc:"Granblue Fantasy Spark Maker",image:"https://www.granblue.party/img/card_spark.jpg",keywords:"spark, gacha, draws, characters, summons, weapons"},data(){return{search_text:"",include_sr:!1,loading:!0,show_help:!1,show_spark:!0,drawn_characters:[],drawn_SRs:[],drawn_GM:[],drawn_summons:[],spark_targets:[],unique_index:0,draws:300,screenshot:!1}},methods:{loadData(){let s=[this.$store.dispatch("spark/fetchCharacters"),this.$store.dispatch("spark/fetchSummons")];return this.isUserLogged&&s.push(this.$store.dispatch("collection/fetchCollection",this.$store.getters.getUserId)),Promise.all(s)},newSpark(){this.drawn_characters=[],this.drawn_SRs=[],this.drawn_GM=[],this.drawn_summons=[],this.spark_targets=[],this.unique_index=0},clearText(){this.search_text="",this.$nextTick().then(()=>{this.$refs.searchfield.focus()})},selectCharacter(s){s=j.copy(s),s.uniqueId=this.unique_index,this.unique_index++,s.r==2?(this.drawn_characters.some(t=>t.id==s.id)||this.drawn_GM.some(t=>t.id==s.id)?this.drawn_GM.push(s):this.ownedCharactersMap[s.id]&&this.ownedCharactersMap[s.id].owned===!0?this.drawn_GM.push(s):this.drawn_characters.push(s),this.spark_targets.push(s)):this.drawn_SRs.push(s),this.clearText()},selectGM(s){s=j.copy(s),s.uniqueId=this.unique_index,this.unique_index++,s.r==2?(this.drawn_GM.push(s),this.spark_targets.push(s)):this.drawn_SRs.push(s),this.clearText()},selectSummon(s){s=j.copy(s),s.uniqueId=this.unique_index,this.unique_index++,this.drawn_summons.push(s),this.spark_targets.push(s),this.clearText()},removeElement(s,t){const r=s.splice(t,1);if(r.length===1){const n=this.spark_targets.findIndex(y=>y.uniqueId===r[0].uniqueId);n>=0&&this.spark_targets.splice(n,1)}},isSpark(s){return this.show_spark===!0&&this.spark_targets[this.spark_targets.length-1].uniqueId===s.uniqueId},getName(s){return this.isLangEnglish?s.n:s.nj},screenSpark(){this.screenshot=!0;let s=document.getElementById("spark");bt.toPng(s).then(t=>{this.screenshot=!1;var r=document.createElement("a");r.download="spark.png",r.href=t,r.click()})},saveToCollection(){if(this.ownedCharactersMap!==null){const t={c:[],s:[]};this.drawn_characters.forEach(r=>{const n=this.ownedCharactersMap[r.id];n&&n.owned!==!0&&t.c.push([r.id,n.sb,!0,0,!1])}),this.drawn_SRs.forEach(r=>{const n=this.ownedCharactersMap[r.id];n&&n.owned!==!0&&t.c.push([r.id,n.sb,!0,0,!1])}),this.drawn_summons.forEach(r=>{const n=this.ownedSummonsMap[r.id];if(n){const y=t.s.findIndex(T=>T[0]===r.id);if(y>=0)t.s[y][1]<n.sm&&t.s[y][1]++;else{let T=n.sc;n.owned==null||n.owned===!1?T=0:T<n.sm&&T++,t.s.push([r.id,T,!0])}}}),t.c.length>0||t.s.length>0?this.axios.post("/tracker/save",t).then(r=>this.$store.dispatch("addMessage",{message:"Units successfully added to the Collection"})).catch(r=>this.$store.dispatch("addAxiosErrorMessage",r)):this.$store.dispatch("addMessage",{message:"No units to add."})}}},computed:{...Q("spark",["characters","summons"]),...Q("collection",{collection_charas:"characters",collection_summons:"summons"}),isUserLogged(){return this.$store.getters.getUserId!==null},isLangEnglish(){return this.$store.getters.getLang===et.EN},searchCharacters(){if(this.search_text.length<2)return{};const s=this.search_text.toLowerCase();return this.characters.filter(t=>(this.include_sr||t.r==2)&&(t.n.toLowerCase().includes(s)||t.nj.includes(this.search_text)||t.w.toLowerCase().includes(s)))},searchSummons(){if(this.search_text.length<2)return{};const s=this.search_text.toLowerCase();return this.summons.filter(t=>t.n.toLowerCase().includes(s)||t.nj.includes(this.search_text))},ssrRatio(){if(this.draws<1)return 0;let s=this.drawn_characters.length+this.drawn_GM.length+this.drawn_summons.length;return s>0&&this.show_spark===!0&&s--,(s/this.draws*100).toFixed(2)},ownedCharactersMap(){let s={};return this.collection_charas.forEach(t=>t.reduce((r,n)=>(r[n.id]=n,r),s)),s},ownedSummonsMap(){let s={};return this.collection_summons.forEach(t=>t.reduce((r,n)=>(r[n.id]=n,r),s)),s}},serverPrefetch(){return this.loadData()},async mounted(){await this.loadData().then(t=>{this.loading=!1,this.$nextTick().then(()=>{this.$refs.searchfield.focus()})}),E.getValue(this,"include_sr"),E.getValue(this,"show_spark"),E.getValue(this,"drawn_characters"),E.getValue(this,"drawn_SRs"),E.getValue(this,"drawn_GM"),E.getValue(this,"drawn_summons"),E.getValue(this,"unique_index");const s=t=>{t.hasOwnProperty("uniqueId")||(t.uniqueId=this.unique_index,this.unique_index++),this.spark_targets.push(t)};this.drawn_characters.forEach(t=>s(t)),this.drawn_GM.forEach(t=>s(t)),this.drawn_summons.forEach(t=>s(t)),this.spark_targets.sort((t,r)=>t.uniqueId>r.uniqueId)},watch:{"$store.getters.getUserId"(s){s===null&&this.$store.commit("collection/resetCollection"),this.loading=!0,this.loadData().then(t=>this.loading=!1)},include_sr(){E.setValue("include_sr",this)},show_spark(){E.setValue("show_spark",this)},drawn_characters(){E.setValue("drawn_characters",this)},drawn_SRs(){E.setValue("drawn_SRs",this)},drawn_GM(){E.setValue("drawn_GM",this)},drawn_summons(){E.setValue("drawn_summons",this)},unique_index(){E.setValue("unique_index",this)}}};var Nt=function(){var t=this,r=t._self._c;return r("div",{staticClass:"flex flex-col"},[r("h1",{staticClass:"self-center mb-8"},[t._v("Spark Maker")]),r("div",{staticClass:"flex flex-row flex-wrap self-center items-center gap-2 mb-4"},[r("button",{staticClass:"btn",class:t.show_help?"btn-blue":"btn-white",on:{click:function(n){t.show_help=!t.show_help}}},[r("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","info-circle"]}}),t._v(" Usage ")],1),r("checkbox",{model:{value:t.include_sr,callback:function(n){t.include_sr=n},expression:"include_sr"}},[t._v("Include Rs and SRs")]),r("checkbox",{model:{value:t.show_spark,callback:function(n){t.show_spark=n},expression:"show_spark"}},[t._v("Show Spark target")]),r("button",{staticClass:"btn btn-blue",on:{click:function(n){return t.screenSpark()}}},[r("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","save"]}}),t._v(" Save as PNG ")],1),t.isUserLogged?r("button",{staticClass:"btn btn-blue",on:{click:function(n){return t.saveToCollection()}}},[r("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","save"]}}),t._v(" Add Units to my Collection ")],1):t._e(),r("button",{staticClass:"btn btn-red",on:{click:function(n){return t.newSpark()}}},[r("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","trash"]}}),t._v(" New Spark ")],1)],1),t.show_help?r("div",{staticClass:"self-center bg-secondary rounded p-4 mb-2"},[r("h2",[t._v("Search")]),t._m(0),r("h2",[t._v("Click")]),t._m(1),t._m(2),t._m(3),r("h2",[t._v("Add to my Collection")]),t._m(4)]):t._e(),t.loading===!0?r("div",[t._v(" Loading... ")]):r("div",{staticClass:"flex flex-row flex-wrap md:flex-nowrap"},[r("div",{staticClass:"flex flex-col shrink pb-4 mr-2 w-96"},[r("div",{staticClass:"flex flex-row gap-x-2 mb-4"},[r("input",{directives:[{name:"model",rawName:"v-model",value:t.search_text,expression:"search_text"}],ref:"searchfield",staticClass:"input",attrs:{type:"text",size:"8",placeholder:"Search",autofocus:""},domProps:{value:t.search_text},on:{input:function(n){n.target.composing||(t.search_text=n.target.value)}}}),r("button",{staticClass:"btn btn-red",on:{click:function(n){return t.clearText()}}},[r("fa-icon",{staticClass:"text-xl",attrs:{icon:["fas","times"]}}),t._v(" Clear ")],1)]),r("span",{staticClass:"flex flex-col overflow-y-auto bg-secondary p-4",class:t.screenshot?"":"h-full"},[t.searchCharacters.length>0?r("h2",[t._v("Characters")]):t._e(),r("span",{staticClass:"flex flex-row flex-wrap"},t._l(t.searchCharacters,function(n){return r("spark-unit",{key:n.id,attrs:{unit:n},on:{"left-click-unit":function(y){return t.selectCharacter(n)},"right-click-unit":function(y){return t.selectGM(n)}}})}),1),t.searchSummons.length>0?r("h2",[t._v("Summons")]):t._e(),r("span",{staticClass:"flex flex-row flex-wrap"},t._l(t.searchSummons,function(n){return r("spark-unit",{key:n.id,attrs:{unit:n},on:{"left-click-unit":function(y){return t.selectSummon(n)}}})}),1)])]),r("div",{staticClass:"flex flex-col grow bg-primary",attrs:{id:"spark"}},[r("div",{staticClass:"flex flex-row flex-wrap"},[r("div",{staticClass:"flex pb-2 w-full",class:t.include_sr?"md:w-1/4":"md:w-1/3"},[r("div",{staticClass:"flex flex-col items-center bg-secondary rounded py-4 mr-2 px-2 w-full"},[r("img",{staticClass:"pb-2",attrs:{src:It,width:"65",height:"65"}}),r("div",{staticClass:"flex flex-row flex-wrap justify-center"},t._l(t.drawn_characters,function(n,y){return r("spark-unit",{key:y,attrs:{unit:n,width:126,height:72,isSpark:t.isSpark(n)},on:{"left-click-unit":function(T){return t.removeElement(t.drawn_characters,y)}}})}),1)])]),r("div",{staticClass:"flex pb-2 w-full",class:t.include_sr?"md:w-1/4":"md:w-1/3"},[r("div",{staticClass:"flex flex-col items-center bg-secondary rounded py-4 mr-2 px-2 w-full"},[r("img",{staticClass:"pb-2",attrs:{src:Dt,width:"65",height:"65"}}),r("div",{staticClass:"flex flex-row flex-wrap justify-center"},t._l(t.drawn_GM,function(n,y){return r("spark-unit",{key:y,attrs:{unit:n,width:126,height:72,isSpark:t.isSpark(n)},on:{"left-click-unit":function(T){return t.removeElement(t.drawn_GM,y)}}})}),1)])]),r("div",{staticClass:"flex pb-2 w-full",class:t.include_sr?"md:w-1/4":"md:w-1/3"},[r("div",{staticClass:"flex flex-col items-center bg-secondary rounded py-4 px-2 w-full",class:t.include_sr?"mr-2":""},[r("img",{staticClass:"pb-2",attrs:{src:$t,width:"65",height:"65"}}),r("div",{staticClass:"flex flex-row flex-wrap justify-center"},t._l(t.drawn_summons,function(n,y){return r("spark-unit",{key:y,attrs:{unit:n,width:126,height:72,isSpark:t.isSpark(n)},on:{"left-click-unit":function(T){return t.removeElement(t.drawn_summons,y)}}})}),1)])]),t.include_sr?r("div",{staticClass:"flex pb-2 w-full",class:t.include_sr?"md:w-1/4":"md:w-1/3"},[r("div",{staticClass:"flex flex-col items-center bg-secondary rounded py-4 px-2 w-full"},[r("img",{staticClass:"pb-2",attrs:{src:At,width:"65",height:"65"}}),r("div",{staticClass:"flex flex-row flex-wrap justify-center"},t._l(t.drawn_SRs,function(n,y){return r("spark-unit",{key:y,attrs:{unit:n,width:126,height:72},on:{"left-click-unit":function(T){return t.removeElement(t.drawn_SRs,y)}}})}),1)])]):t._e()]),r("div",{staticClass:"flex flex-row flex-wrap justify-between"},[r("span",[t.screenshot?t._e():r("label",{staticClass:"ml-2"},[t._v("Draws "),r("input",{directives:[{name:"model",rawName:"v-model",value:t.draws,expression:"draws"}],staticClass:"input input-sm",staticStyle:{width:"7ch"},attrs:{type:"number",min:"1"},domProps:{value:t.draws},on:{input:function(n){n.target.composing||(t.draws=n.target.value)}}})]),r("span",{staticClass:"ml-2"},[t._v("SSR ratio: "+t._s(t.ssrRatio)+"%")]),t.show_spark===!0&&t.spark_targets.length>0?r("span",{staticClass:"ml-2"},[t._v("Sparked: "+t._s(t.getName(t.spark_targets[t.spark_targets.length-1])))]):t._e()]),t.screenshot?r("span",{staticClass:"pr-2 ml-2"},[t._v("https://www.granblue.party/spark")]):t._e()])])])])},Ht=[function(){var s=this,t=s._self._c;return t("p",{staticClass:"pb-4"},[s._v(" You can search units by English, Japanese or Weapon name."),t("br"),s._v(" You need to type at least 2 characters to display the result of your query. ")])},function(){var s=this,t=s._self._c;return t("p",{staticClass:"pb-4"},[s._v(" Left-click on a unit in the search section to add it to your spark."),t("br"),s._v(" Right-click on a unit to add it as a Gold Moon."),t("br"),s._v(" To remove a unit from your spark, left-click on its image in the spark section. ")])},function(){var s=this,t=s._self._c;return t("h2",[s._v("Spark target "),t("img",{staticClass:"h-6",attrs:{src:nt}})])},function(){var s=this,t=s._self._c;return t("p",{staticClass:"pb-4"},[s._v(" The last element you add is your spark target."),t("br"),s._v(" The spark target does not count in the SSR ratio. ")])},function(){var s=this,t=s._self._c;return t("p",{staticClass:"pb-4"},[s._v(" If you are logged in with your account, you can add the result of your Spark to your Collection."),t("br"),s._v(" Characters will be added with a base amount of stars (no blue stars unlocked)."),t("br"),s._v(" New summons will be added with no stars, and existing ones will gain one star (if possible)."),t("br"),s._v(" Be careful not to add the same Spark multiple times, or you might add extra unwanted stars to your summons. ")])}],Vt=tt(Rt,Nt,Ht,!1,null,null);const Ft=Vt.exports;export{Ft as default};