/*! * @pixi/text-bitmap - v6.5.10 * Compiled Thu, 06 Jul 2023 15:25:11 UTC * * @pixi/text-bitmap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license */ import{Rectangle as e,Point as t,ObservablePoint as r}from"@pixi/math";import{settings as i}from"@pixi/settings";import{MeshGeometry as n,MeshMaterial as a,Mesh as o}from"@pixi/mesh";import{hex2rgb as s,string2hex as h,getResolutionOfUrl as l,removeItems as u}from"@pixi/utils";import{BaseTexture as f,Texture as c,Program as p,ExtensionType as d}from"@pixi/core";import{TEXT_GRADIENT as g,TextStyle as m,TextMetrics as v}from"@pixi/text";import{ALPHA_MODES as x,MIPMAP_MODES as y,BLEND_MODES as _}from"@pixi/constants";import{Container as b}from"@pixi/display";import{LoaderResource as w}from"@pixi/loaders";var T=function(e,t){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},T(e,t)};var A=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},S=function(){function e(){}return e.test=function(e){return"string"==typeof e&&0===e.indexOf("info face=")},e.parse=function(e){var t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var i in t){var n=t[i].match(/^[a-z]+/gm)[0],a=t[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),o={};for(var s in a){var h=a[s].split("="),l=h[0],u=h[1].replace(/"/gm,""),f=parseFloat(u),c=isNaN(f)?u:f;o[l]=c}r[n].push(o)}var p=new A;return r.info.forEach((function(e){return p.info.push({face:e.face,size:parseInt(e.size,10)})})),r.common.forEach((function(e){return p.common.push({lineHeight:parseInt(e.lineHeight,10)})})),r.page.forEach((function(e){return p.page.push({id:parseInt(e.id,10),file:e.file})})),r.char.forEach((function(e){return p.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})})),r.kerning.forEach((function(e){return p.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})})),r.distanceField.forEach((function(e){return p.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})})),p},e}(),P=function(){function e(){}return e.test=function(e){return e instanceof XMLDocument&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},e.parse=function(e){for(var t=new A,r=e.getElementsByTagName("info"),i=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),s=e.getElementsByTagName("distanceField"),h=0;h")>-1){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return P.test(t)}return!1},e.parse=function(e){var t=(new globalThis.DOMParser).parseFromString(e,"text/xml");return P.parse(t)},e}(),C=[S,P,M];function F(e){for(var t=0;t=u-N*h){if(0===T)throw new Error("[BitmapFont] textureHeight "+u+"px is too small (fontFamily: '"+d.fontFamily+"', fontSize: "+d.fontSize+"px, char: '"+C+"')");--M,y=null,_=null,b=null,T=0,w=0,S=0}else if(S=Math.max(N+F.fontProperties.descent,S),z*h+w>=g){if(0===w)throw new Error("[BitmapFont] textureWidth "+l+"px is too small (fontFamily: '"+d.fontFamily+"', fontSize: "+d.fontSize+"px, char: '"+C+"')");--M,T+=S*h,T=Math.ceil(T),w=0,S=0}else{E(y,_,F,w,T,h,d);var D=I(F.text);x.char.push({id:D,page:P.length-1,x:w/h,y:T/h,width:z,height:N,xoffset:0,yoffset:0,xadvance:Math.ceil(k-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0))}),w+=(z+2*s)*h,w=Math.ceil(w)}}if(!(null==n?void 0:n.skipKerning)){M=0;for(var H=p.length;M0&&h.x>m&&(++S,u(l,1+T-S,1+C-T),C=T,T=-1,f.push(A),d.push(l.length>0?l[l.length-1].prevSpaces:0),b=Math.max(b,A),w++,h.x=0,h.y+=r.lineHeight,x=null,M=0)}}else f.push(y),d.push(-1),b=Math.max(b,y),++w,++S,h.x=0,h.y+=r.lineHeight,x=null,M=0}var B=g[g.length-1];"\r"!==B&&"\n"!==B&&(/(?:\s)/.test(B)&&(y=A),f.push(y),b=Math.max(b,y),d.push(-1));var L=[];for(C=0;C<=w;C++){var R=0;"right"===this._align?R=b-f[C]:"center"===this._align?R=(b-f[C])/2:"justify"===this._align&&(R=d[C]<0?0:(b-f[C])/d[C]),L.push(R)}var j=l.length,W={},U=[],Y=this._activePagesMeshData;v.push.apply(v,Y);for(C=0;C 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),Z=_.NORMAL_NPM);var q=new o(G,V);q.blendMode=Z,ue={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:q,vertices:null,uvs:null,indices:null}}ue.index=0,ue.indexCount=0,ue.vertexCount=0,ue.uvsCount=0,ue.total=0;var $=this._textureCache;$[X]=$[X]||new c(ie.baseTexture),ue.mesh.texture=$[X],ue.mesh.tint=this._tint,U.push(ue),W[X]=ue}W[X].total++}for(C=0;C6*J)||ue.vertices.length<2*o.BATCHABLE_SIZE)ue.vertices=new Float32Array(8*J),ue.uvs=new Float32Array(8*J),ue.indices=new Uint16Array(6*J);else for(var K=ue.total,Q=ue.vertices,ee=4*K*2;ee