Socket
Socket
Sign inDemoInstall

@pixi/text

Package Overview
Dependencies
Maintainers
3
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixi/text - npm Package Compare versions

Comparing version 6.1.3 to 6.2.0

6

dist/browser/text.min.js
/*!
* @pixi/text - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/text - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/text is licensed under the MIT License.

*/
this.PIXI=this.PIXI||{};var _pixi_text=function(t,e,i,n,r,o){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var a;(a=t.TEXT_GRADIENT||(t.TEXT_GRADIENT={}))[a.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",a[a.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL";var h={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:t.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},l=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],c=function(){function t(t){this.styleID=0,this.reset(),d(this,t,t)}return t.prototype.clone=function(){var e={};return d(e,this,h),new t(e)},t.prototype.reset=function(){d(this,h,h)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=f(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=f(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=f(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var n=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&l.indexOf(n)<0&&(n='"'+n+'"'),e[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function u(t){return"number"==typeof t?o.hex2string(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function f(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=u(t[e]);return t}return u(t)}function d(t,e,i){for(var n in i)Array.isArray(e[n])?t[n]=e[n].slice():t[n]=e[n]}var p=function(){function t(t,e,i,n,r,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,n,r){void 0===r&&(r=t._canvas),n=null==n?i.wordWrap:n;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=r.getContext("2d");a.font=o;for(var h=(n?t.wordWrap(e,i,r):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),c=0,u=0;u<h.length;u++){var f=a.measureText(h[u]).width+(h[u].length-1)*i.letterSpacing;l[u]=f,c=Math.max(c,f)}var d=c+i.strokeThickness;i.dropShadow&&(d+=i.dropShadowDistance);var p=i.lineHeight||s.fontSize+i.strokeThickness,g=Math.max(p,s.fontSize+i.strokeThickness)+(h.length-1)*(p+i.leading);return i.dropShadow&&(g+=i.dropShadowDistance),new t(e,i,d,g,h,l,p+i.leading,c,s)},t.wordWrap=function(e,i,n){void 0===n&&(n=t._canvas);for(var r=n.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,c=i.whiteSpace,u=t.collapseSpaces(c),f=t.collapseNewlines(c),d=!u,p=i.wordWrapWidth+l,g=t.tokenize(e),y=0;y<g.length;y++){var _=g[y];if(t.isNewline(_)){if(!f){a+=t.addLine(s),d=!u,s="",o=0;continue}_=" "}if(u){var b=t.isBreakingSpace(_),S=t.isBreakingSpace(s[s.length-1]);if(b&&S)continue}var m=t.getFromCache(_,l,h,r);if(m>p)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(_,i.breakWords))for(var w=t.wordWrapSplit(_),v=0;v<w.length;v++){for(var x=w[v],I=1;w[v+I];){var T=w[v+I],k=x[x.length-1];if(t.canBreakChars(k,T,_,v,i.breakWords))break;x+=T,I++}v+=x.length-1;var O=t.getFromCache(x,l,h,r);O+o>p&&(a+=t.addLine(s),d=!1,s="",o=0),s+=x,o+=O}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var L=y===g.length-1;a+=t.addLine(_,!L),d=!1,s="",o=0}else m+o>p&&(d=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(_)||d)&&(s+=_,o+=m)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,n){var r=i[t];if("number"!=typeof r){var o=t.length*e;r=n.measureText(t).width+o,i[t]=r}return r},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var n=e[i];if(!t.isBreakingSpace(n))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],n="";if("string"!=typeof e)return i;for(var r=0;r<e.length;r++){var o=e[r],s=e[r+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==n&&(i.push(n),n=""),i.push(o)):n+=o}return""!==n&&i.push(n),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,n,r){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},n=t._canvas,r=t._context;r.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(r.measureText(o).width),a=Math.ceil(r.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,n.width=s,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,s,h),r.font=e,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(o,0,a);var l=r.getImageData(0,0,s,h).data,c=l.length,u=4*s,f=0,d=0,p=!1;for(f=0;f<a;++f){for(var g=0;g<u;g+=4)if(255!==l[d+g]){p=!0;break}if(p)break;d+=u}for(i.ascent=a-f,d=c-u,p=!1,f=h;f>a;--f){for(g=0;g<u;g+=4)if(255!==l[d+g]){p=!0;break}if(p)break;d-=u}return i.descent=f-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),g=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();g.width=g.height=10,p._canvas=g,p._context=g.getContext("2d"),p._fonts={},p.METRICS_STRING="|ÉqÅ",p.BASELINE_SYMBOL="M",p.BASELINE_MULTIPLIER=1.4,p.HEIGHT_MULTIPLIER=2,p._newlines=[10,13],p._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var y={texture:!0,children:!1,baseTexture:!0},_=function(e){function a(t,o,s){var a=this,h=!1;s||(s=document.createElement("canvas"),h=!0),s.width=3,s.height=3;var l=i.Texture.from(s);return l.orig=new r.Rectangle,l.trim=new r.Rectangle,(a=e.call(this,l)||this)._ownCanvas=h,a.canvas=s,a.context=a.canvas.getContext("2d"),a._resolution=n.settings.RESOLUTION,a._autoResolution=!0,a._text=null,a._style=null,a._styleListener=null,a._font="",a.text=t,a.style=o,a.localStyleID=-1,a}return function(t,e){function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(a,e),a.prototype.updateText=function(t){var e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),this.dirty||!t){this._font=this._style.toFontString();var i,n,r=this.context,s=p.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),h=s.width,l=s.height,c=s.lines,u=s.lineHeight,f=s.lineWidths,d=s.maxLineWidth,g=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,h)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,l)+2*e.padding)*this._resolution),r.scale(this._resolution,this._resolution),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.font=this._font,r.lineWidth=e.strokeThickness,r.textBaseline=e.textBaseline,r.lineJoin=e.lineJoin,r.miterLimit=e.miterLimit;for(var y=e.dropShadow?2:1,_=0;_<y;++_){var b=e.dropShadow&&0===_,S=b?Math.ceil(Math.max(1,l)+2*e.padding):0,m=S*this._resolution;if(b){r.fillStyle="black",r.strokeStyle="black";var w=e.dropShadowColor,v=o.hex2rgb("number"==typeof w?w:o.string2hex(w));r.shadowColor="rgba("+255*v[0]+","+255*v[1]+","+255*v[2]+","+e.dropShadowAlpha+")",r.shadowBlur=e.dropShadowBlur,r.shadowOffsetX=Math.cos(e.dropShadowAngle)*e.dropShadowDistance,r.shadowOffsetY=Math.sin(e.dropShadowAngle)*e.dropShadowDistance+m}else r.fillStyle=this._generateFillStyle(e,c,s),r.strokeStyle=e.stroke,r.shadowColor="black",r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0;var x=(u-g.fontSize)/2;(!a.nextLineHeightBehavior||u-g.fontSize<0)&&(x=0);for(var I=0;I<c.length;I++)i=e.strokeThickness/2,n=e.strokeThickness/2+I*u+g.ascent+x,"right"===e.align?i+=d-f[I]:"center"===e.align&&(i+=(d-f[I])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(c[I],i+e.padding,n+e.padding-S,!0),e.fill&&this.drawLetterSpacing(c[I],i+e.padding,n+e.padding-S)}this.updateTexture()}},a.prototype.drawLetterSpacing=function(t,e,i,n){void 0===n&&(n=!1);var r=this._style.letterSpacing;if(0!==r)for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var c=s[l];n?this.context.strokeText(c,o,i):this.context.fillText(c,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+r,a=h}else n?this.context.strokeText(t,e,i):this.context.fillText(t,e,i)},a.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=o.trimCanvas(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,n=this._style,r=n.trim?0:n.padding,s=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-r,i.trim.y=-r,i.orig.width=i._frame.width-2*r,i.orig.height=i._frame.height-2*r,this._onTextureUpdate(),s.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},a.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),e.prototype._render.call(this,t)},a.prototype.getLocalBounds=function(t){return this.updateText(!0),e.prototype.getLocalBounds.call(this,t)},a.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},a.prototype._generateFillStyle=function(e,i,n){var r,o=e.fill;if(!Array.isArray(o))return o;if(1===o.length)return o[0];var s=e.dropShadow?e.dropShadowDistance:0,a=e.padding||0,h=this.canvas.width/this._resolution-s-2*a,l=this.canvas.height/this._resolution-s-2*a,c=o.slice(),u=e.fillGradientStops.slice();if(!u.length)for(var f=c.length+1,d=1;d<f;++d)u.push(d/f);if(c.unshift(o[0]),u.unshift(0),c.push(o[o.length-1]),u.push(1),e.fillGradientType===t.TEXT_GRADIENT.LINEAR_VERTICAL){r=this.context.createLinearGradient(h/2,a,h/2,l+a);var p=n.fontProperties.fontSize+e.strokeThickness;for(d=0;d<i.length;d++){var g=n.lineHeight*(d-1)+p,y=n.lineHeight*d,_=y;d>0&&g>y&&(_=(y+g)/2);var b=y+p,S=n.lineHeight*(d+1),m=b;d+1<i.length&&S<b&&(m=(b+S)/2);for(var w=(m-_)/l,v=0;v<c.length;v++){var x=0;x="number"==typeof u[v]?u[v]:v/c.length;var I=Math.min(1,Math.max(0,_/l+x*w));I=Number(I.toFixed(5)),r.addColorStop(I,c[v])}}}else{r=this.context.createLinearGradient(a,l/2,h+a,l/2);var T=c.length+1,k=1;for(d=0;d<c.length;d++){var O=void 0;O="number"==typeof u[d]?u[d]:k/T,r.addColorStop(O,c[d]),k++}}return r},a.prototype.destroy=function(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},y,t),e.prototype.destroy.call(this,t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(a.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=o.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=o.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof c?t:new c(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),a.nextLineHeightBehavior=!1,a}(e.Sprite);return t.Text=_,t.TextMetrics=p,t.TextStyle=c,t}({},PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_text);
this.PIXI=this.PIXI||{};var _pixi_text=function(t,e,i,n,r,o){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};var a;(a=t.TEXT_GRADIENT||(t.TEXT_GRADIENT={}))[a.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",a[a.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL";var h={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:t.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},l=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],c=function(){function t(t){this.styleID=0,this.reset(),d(this,t,t)}return t.prototype.clone=function(){var e={};return d(e,this,h),new t(e)},t.prototype.reset=function(){d(this,h,h)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=f(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=f(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=f(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var n=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&l.indexOf(n)<0&&(n='"'+n+'"'),e[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function u(t){return"number"==typeof t?o.hex2string(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function f(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=u(t[e]);return t}return u(t)}function d(t,e,i){for(var n in i)Array.isArray(e[n])?t[n]=e[n].slice():t[n]=e[n]}var p=function(){function t(t,e,i,n,r,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,n,r){void 0===r&&(r=t._canvas),n=null==n?i.wordWrap:n;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=r.getContext("2d");a.font=o;for(var h=(n?t.wordWrap(e,i,r):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),c=0,u=0;u<h.length;u++){var f=a.measureText(h[u]).width+(h[u].length-1)*i.letterSpacing;l[u]=f,c=Math.max(c,f)}var d=c+i.strokeThickness;i.dropShadow&&(d+=i.dropShadowDistance);var p=i.lineHeight||s.fontSize+i.strokeThickness,g=Math.max(p,s.fontSize+i.strokeThickness)+(h.length-1)*(p+i.leading);return i.dropShadow&&(g+=i.dropShadowDistance),new t(e,i,d,g,h,l,p+i.leading,c,s)},t.wordWrap=function(e,i,n){void 0===n&&(n=t._canvas);for(var r=n.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,c=i.whiteSpace,u=t.collapseSpaces(c),f=t.collapseNewlines(c),d=!u,p=i.wordWrapWidth+l,g=t.tokenize(e),y=0;y<g.length;y++){var _=g[y];if(t.isNewline(_)){if(!f){a+=t.addLine(s),d=!u,s="",o=0;continue}_=" "}if(u){var b=t.isBreakingSpace(_),S=t.isBreakingSpace(s[s.length-1]);if(b&&S)continue}var m=t.getFromCache(_,l,h,r);if(m>p)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(_,i.breakWords))for(var w=t.wordWrapSplit(_),v=0;v<w.length;v++){for(var x=w[v],I=1;w[v+I];){var T=w[v+I],k=x[x.length-1];if(t.canBreakChars(k,T,_,v,i.breakWords))break;x+=T,I++}v+=x.length-1;var O=t.getFromCache(x,l,h,r);O+o>p&&(a+=t.addLine(s),d=!1,s="",o=0),s+=x,o+=O}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var L=y===g.length-1;a+=t.addLine(_,!L),d=!1,s="",o=0}else m+o>p&&(d=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(_)||d)&&(s+=_,o+=m)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,n){var r=i[t];if("number"!=typeof r){var o=t.length*e;r=n.measureText(t).width+o,i[t]=r}return r},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var n=e[i];if(!t.isBreakingSpace(n))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],n="";if("string"!=typeof e)return i;for(var r=0;r<e.length;r++){var o=e[r],s=e[r+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==n&&(i.push(n),n=""),i.push(o)):n+=o}return""!==n&&i.push(n),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,n,r){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},n=t._canvas,r=t._context;r.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(r.measureText(o).width),a=Math.ceil(r.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,n.width=s,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,s,h),r.font=e,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(o,0,a);var l=r.getImageData(0,0,s,h).data,c=l.length,u=4*s,f=0,d=0,p=!1;for(f=0;f<a;++f){for(var g=0;g<u;g+=4)if(255!==l[d+g]){p=!0;break}if(p)break;d+=u}for(i.ascent=a-f,d=c-u,p=!1,f=h;f>a;--f){for(g=0;g<u;g+=4)if(255!==l[d+g]){p=!0;break}if(p)break;d-=u}return i.descent=f-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),g=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();g.width=g.height=10,p._canvas=g,p._context=g.getContext("2d"),p._fonts={},p.METRICS_STRING="|ÉqÅ",p.BASELINE_SYMBOL="M",p.BASELINE_MULTIPLIER=1.4,p.HEIGHT_MULTIPLIER=2,p._newlines=[10,13],p._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var y={texture:!0,children:!1,baseTexture:!0},_="letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype,b=function(e){function a(t,o,s){var a=this,h=!1;s||(s=document.createElement("canvas"),h=!0),s.width=3,s.height=3;var l=i.Texture.from(s);return l.orig=new r.Rectangle,l.trim=new r.Rectangle,(a=e.call(this,l)||this)._ownCanvas=h,a.canvas=s,a.context=a.canvas.getContext("2d"),a._resolution=n.settings.RESOLUTION,a._autoResolution=!0,a._text=null,a._style=null,a._styleListener=null,a._font="",a.text=t,a.style=o,a.localStyleID=-1,a}return function(t,e){function i(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(a,e),a.prototype.updateText=function(t){var e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),this.dirty||!t){this._font=this._style.toFontString();var i,n,r=this.context,s=p.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),h=s.width,l=s.height,c=s.lines,u=s.lineHeight,f=s.lineWidths,d=s.maxLineWidth,g=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,h)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,l)+2*e.padding)*this._resolution),r.scale(this._resolution,this._resolution),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.font=this._font,r.lineWidth=e.strokeThickness,r.textBaseline=e.textBaseline,r.lineJoin=e.lineJoin,r.miterLimit=e.miterLimit;for(var y=e.dropShadow?2:1,_=0;_<y;++_){var b=e.dropShadow&&0===_,S=b?Math.ceil(Math.max(1,l)+2*e.padding):0,m=S*this._resolution;if(b){r.fillStyle="black",r.strokeStyle="black";var w=e.dropShadowColor,v=o.hex2rgb("number"==typeof w?w:o.string2hex(w));r.shadowColor="rgba("+255*v[0]+","+255*v[1]+","+255*v[2]+","+e.dropShadowAlpha+")",r.shadowBlur=e.dropShadowBlur,r.shadowOffsetX=Math.cos(e.dropShadowAngle)*e.dropShadowDistance,r.shadowOffsetY=Math.sin(e.dropShadowAngle)*e.dropShadowDistance+m}else r.fillStyle=this._generateFillStyle(e,c,s),r.strokeStyle=e.stroke,r.shadowColor="black",r.shadowBlur=0,r.shadowOffsetX=0,r.shadowOffsetY=0;var x=(u-g.fontSize)/2;(!a.nextLineHeightBehavior||u-g.fontSize<0)&&(x=0);for(var I=0;I<c.length;I++)i=e.strokeThickness/2,n=e.strokeThickness/2+I*u+g.ascent+x,"right"===e.align?i+=d-f[I]:"center"===e.align&&(i+=(d-f[I])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(c[I],i+e.padding,n+e.padding-S,!0),e.fill&&this.drawLetterSpacing(c[I],i+e.padding,n+e.padding-S)}this.updateTexture()}},a.prototype.drawLetterSpacing=function(t,e,i,n){void 0===n&&(n=!1);var r=this._style.letterSpacing;if(0===r||_)return _&&(this.context.letterSpacing=r,this.context.textLetterSpacing=r),void(n?this.context.strokeText(t,e,i):this.context.fillText(t,e,i));for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var c=s[l];n?this.context.strokeText(c,o,i):this.context.fillText(c,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+r,a=h}},a.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=o.trimCanvas(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,n=this._style,r=n.trim?0:n.padding,s=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-r,i.trim.y=-r,i.orig.width=i._frame.width-2*r,i.orig.height=i._frame.height-2*r,this._onTextureUpdate(),s.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},a.prototype._render=function(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),e.prototype._render.call(this,t)},a.prototype.getLocalBounds=function(t){return this.updateText(!0),e.prototype.getLocalBounds.call(this,t)},a.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},a.prototype._generateFillStyle=function(e,i,n){var r,o=e.fill;if(!Array.isArray(o))return o;if(1===o.length)return o[0];var s=e.dropShadow?e.dropShadowDistance:0,a=e.padding||0,h=this.canvas.width/this._resolution-s-2*a,l=this.canvas.height/this._resolution-s-2*a,c=o.slice(),u=e.fillGradientStops.slice();if(!u.length)for(var f=c.length+1,d=1;d<f;++d)u.push(d/f);if(c.unshift(o[0]),u.unshift(0),c.push(o[o.length-1]),u.push(1),e.fillGradientType===t.TEXT_GRADIENT.LINEAR_VERTICAL){r=this.context.createLinearGradient(h/2,a,h/2,l+a);var p=n.fontProperties.fontSize+e.strokeThickness;for(d=0;d<i.length;d++){var g=n.lineHeight*(d-1)+p,y=n.lineHeight*d,_=y;d>0&&g>y&&(_=(y+g)/2);var b=y+p,S=n.lineHeight*(d+1),m=b;d+1<i.length&&S<b&&(m=(b+S)/2);for(var w=(m-_)/l,v=0;v<c.length;v++){var x=0;x="number"==typeof u[v]?u[v]:v/c.length;var I=Math.min(1,Math.max(0,_/l+x*w));I=Number(I.toFixed(5)),r.addColorStop(I,c[v])}}}else{r=this.context.createLinearGradient(a,l/2,h+a,l/2);var T=c.length+1,k=1;for(d=0;d<c.length;d++){var O=void 0;O="number"==typeof u[d]?u[d]:k/T,r.addColorStop(O,c[d]),k++}}return r},a.prototype.destroy=function(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},y,t),e.prototype.destroy.call(this,t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(a.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=o.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=o.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof c?t:new c(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),a.nextLineHeightBehavior=!1,a}(e.Sprite);return t.Text=b,t.TextMetrics=p,t.TextStyle=c,t}({},PIXI,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(this.PIXI,_pixi_text);
//# sourceMappingURL=text.min.js.map
/*!
* @pixi/text - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/text - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/text is licensed under the MIT License.

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var sprite=require("@pixi/sprite"),core=require("@pixi/core"),settings=require("@pixi/settings"),math=require("@pixi/math"),utils=require("@pixi/utils"),extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function __extends(t,e){function i(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(exports.TEXT_GRADIENT||(exports.TEXT_GRADIENT={}));var defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:exports.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},genericFontFamilies=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],TextStyle=function(){function t(t){this.styleID=0,this.reset(),deepCopyProperties(this,t,t)}return t.prototype.clone=function(){var e={};return deepCopyProperties(e,this,defaultStyle),new t(e)},t.prototype.reset=function(){deepCopyProperties(this,defaultStyle,defaultStyle)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=getColor(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=getColor(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){areArraysEqual(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=getColor(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&genericFontFamilies.indexOf(r)<0&&(r='"'+r+'"'),e[i]=r}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function getSingleColor(t){return"number"==typeof t?utils.hex2string(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function getColor(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=getSingleColor(t[e]);return t}return getSingleColor(t)}function areArraysEqual(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}function deepCopyProperties(t,e,i){for(var r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}var TextMetrics=function(){function t(t,e,i,r,n,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,r,n){void 0===n&&(n=t._canvas),r=null==r?i.wordWrap:r;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=n.getContext("2d");a.font=o;for(var h=(r?t.wordWrap(e,i,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),c=0,u=0;u<h.length;u++){var f=a.measureText(h[u]).width+(h[u].length-1)*i.letterSpacing;l[u]=f,c=Math.max(c,f)}var p=c+i.strokeThickness;i.dropShadow&&(p+=i.dropShadowDistance);var d=i.lineHeight||s.fontSize+i.strokeThickness,g=Math.max(d,s.fontSize+i.strokeThickness)+(h.length-1)*(d+i.leading);return i.dropShadow&&(g+=i.dropShadowDistance),new t(e,i,p,g,h,l,d+i.leading,c,s)},t.wordWrap=function(e,i,r){void 0===r&&(r=t._canvas);for(var n=r.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,c=i.whiteSpace,u=t.collapseSpaces(c),f=t.collapseNewlines(c),p=!u,d=i.wordWrapWidth+l,g=t.tokenize(e),y=0;y<g.length;y++){var _=g[y];if(t.isNewline(_)){if(!f){a+=t.addLine(s),p=!u,s="",o=0;continue}_=" "}if(u){var S=t.isBreakingSpace(_),b=t.isBreakingSpace(s[s.length-1]);if(S&&b)continue}var x=t.getFromCache(_,l,h,n);if(x>d)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(_,i.breakWords))for(var m=t.wordWrapSplit(_),w=0;w<m.length;w++){for(var v=m[w],T=1;m[w+T];){var I=m[w+T],k=v[v.length-1];if(t.canBreakChars(k,I,_,w,i.breakWords))break;v+=I,T++}w+=v.length-1;var O=t.getFromCache(v,l,h,n);O+o>d&&(a+=t.addLine(s),p=!1,s="",o=0),s+=v,o+=O}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var L=y===g.length-1;a+=t.addLine(_,!L),p=!1,s="",o=0}else x+o>d&&(p=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(_)||p)&&(s+=_,o+=x)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,r){var n=i[t];if("number"!=typeof n){var o=t.length*e;n=r.measureText(t).width+o,i[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],r="";if("string"!=typeof e)return i;for(var n=0;n<e.length;n++){var o=e[n],s=e[n+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==r&&(i.push(r),r=""),i.push(o)):r+=o}return""!==r&&i.push(r),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,r,n){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},r=t._canvas,n=t._context;n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(n.measureText(o).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,r.width=s,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,s,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,a);var l=n.getImageData(0,0,s,h).data,c=l.length,u=4*s,f=0,p=0,d=!1;for(f=0;f<a;++f){for(var g=0;g<u;g+=4)if(255!==l[p+g]){d=!0;break}if(d)break;p+=u}for(i.ascent=a-f,p=c-u,d=!1,f=h;f>a;--f){for(g=0;g<u;g+=4)if(255!==l[p+g]){d=!0;break}if(d)break;p-=u}return i.descent=f-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),canvas=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();canvas.width=canvas.height=10,TextMetrics._canvas=canvas,TextMetrics._context=canvas.getContext("2d"),TextMetrics._fonts={},TextMetrics.METRICS_STRING="|ÉqÅ",TextMetrics.BASELINE_SYMBOL="M",TextMetrics.BASELINE_MULTIPLIER=1.4,TextMetrics.HEIGHT_MULTIPLIER=2,TextMetrics._newlines=[10,13],TextMetrics._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Text=function(t){function e(e,i,r){var n=this,o=!1;r||(r=document.createElement("canvas"),o=!0),r.width=3,r.height=3;var s=core.Texture.from(r);return s.orig=new math.Rectangle,s.trim=new math.Rectangle,(n=t.call(this,s)||this)._ownCanvas=o,n.canvas=r,n.context=n.canvas.getContext("2d"),n._resolution=settings.settings.RESOLUTION,n._autoResolution=!0,n._text=null,n._style=null,n._styleListener=null,n._font="",n.text=e,n.style=i,n.localStyleID=-1,n}return __extends(e,t),e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),this.dirty||!t){this._font=this._style.toFontString();var r,n,o=this.context,s=TextMetrics.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=s.width,h=s.height,l=s.lines,c=s.lineHeight,u=s.lineWidths,f=s.maxLineWidth,p=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+2*i.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,h)+2*i.padding)*this._resolution),o.scale(this._resolution,this._resolution),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.font=this._font,o.lineWidth=i.strokeThickness,o.textBaseline=i.textBaseline,o.lineJoin=i.lineJoin,o.miterLimit=i.miterLimit;for(var d=i.dropShadow?2:1,g=0;g<d;++g){var y=i.dropShadow&&0===g,_=y?Math.ceil(Math.max(1,h)+2*i.padding):0,S=_*this._resolution;if(y){o.fillStyle="black",o.strokeStyle="black";var b=i.dropShadowColor,x=utils.hex2rgb("number"==typeof b?b:utils.string2hex(b));o.shadowColor="rgba("+255*x[0]+","+255*x[1]+","+255*x[2]+","+i.dropShadowAlpha+")",o.shadowBlur=i.dropShadowBlur,o.shadowOffsetX=Math.cos(i.dropShadowAngle)*i.dropShadowDistance,o.shadowOffsetY=Math.sin(i.dropShadowAngle)*i.dropShadowDistance+S}else o.fillStyle=this._generateFillStyle(i,l,s),o.strokeStyle=i.stroke,o.shadowColor="black",o.shadowBlur=0,o.shadowOffsetX=0,o.shadowOffsetY=0;var m=(c-p.fontSize)/2;(!e.nextLineHeightBehavior||c-p.fontSize<0)&&(m=0);for(var w=0;w<l.length;w++)r=i.strokeThickness/2,n=i.strokeThickness/2+w*c+p.ascent+m,"right"===i.align?r+=f-u[w]:"center"===i.align&&(r+=(f-u[w])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(l[w],r+i.padding,n+i.padding-_,!0),i.fill&&this.drawLetterSpacing(l[w],r+i.padding,n+i.padding-_)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,e,i,r){void 0===r&&(r=!1);var n=this._style.letterSpacing;if(0!==n)for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var c=s[l];r?this.context.strokeText(c,o,i):this.context.fillText(c,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+n,a=h}else r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i)},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=utils.trimCanvas(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,r=this._style,n=r.trim?0:r.padding,o=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-n,i.trim.y=-n,i.orig.width=i._frame.width-2*n,i.orig.height=i._frame.height-2*n,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},e.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},e.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},e.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,e,i){var r,n=t.fill;if(!Array.isArray(n))return n;if(1===n.length)return n[0];var o=t.dropShadow?t.dropShadowDistance:0,s=t.padding||0,a=this.canvas.width/this._resolution-o-2*s,h=this.canvas.height/this._resolution-o-2*s,l=n.slice(),c=t.fillGradientStops.slice();if(!c.length)for(var u=l.length+1,f=1;f<u;++f)c.push(f/u);if(l.unshift(n[0]),c.unshift(0),l.push(n[n.length-1]),c.push(1),t.fillGradientType===exports.TEXT_GRADIENT.LINEAR_VERTICAL){r=this.context.createLinearGradient(a/2,s,a/2,h+s);var p=i.fontProperties.fontSize+t.strokeThickness;for(f=0;f<e.length;f++){var d=i.lineHeight*(f-1)+p,g=i.lineHeight*f,y=g;f>0&&d>g&&(y=(g+d)/2);var _=g+p,S=i.lineHeight*(f+1),b=_;f+1<e.length&&S<_&&(b=(_+S)/2);for(var x=(b-y)/h,m=0;m<l.length;m++){var w=0;w="number"==typeof c[m]?c[m]:m/l.length;var v=Math.min(1,Math.max(0,y/h+w*x));v=Number(v.toFixed(5)),r.addColorStop(v,l[m])}}}else{r=this.context.createLinearGradient(s,h/2,a+s,h/2);var T=l.length+1,I=1;for(f=0;f<l.length;f++){var k=void 0;k="number"==typeof c[f]?c[f]:I/T,r.addColorStop(k,l[f]),I++}}return r},e.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},defaultDestroyOptions,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=utils.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=utils.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof TextStyle?t:new TextStyle(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e}(sprite.Sprite);exports.Text=Text,exports.TextMetrics=TextMetrics,exports.TextStyle=TextStyle;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var sprite=require("@pixi/sprite"),core=require("@pixi/core"),settings=require("@pixi/settings"),math=require("@pixi/math"),utils=require("@pixi/utils"),extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function __extends(t,e){function i(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(exports.TEXT_GRADIENT||(exports.TEXT_GRADIENT={}));var defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:exports.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},genericFontFamilies=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],TextStyle=function(){function t(t){this.styleID=0,this.reset(),deepCopyProperties(this,t,t)}return t.prototype.clone=function(){var e={};return deepCopyProperties(e,this,defaultStyle),new t(e)},t.prototype.reset=function(){deepCopyProperties(this,defaultStyle,defaultStyle)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=getColor(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=getColor(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){areArraysEqual(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=getColor(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&genericFontFamilies.indexOf(r)<0&&(r='"'+r+'"'),e[i]=r}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function getSingleColor(t){return"number"==typeof t?utils.hex2string(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function getColor(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=getSingleColor(t[e]);return t}return getSingleColor(t)}function areArraysEqual(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}function deepCopyProperties(t,e,i){for(var r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}var TextMetrics=function(){function t(t,e,i,r,n,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,r,n){void 0===n&&(n=t._canvas),r=null==r?i.wordWrap:r;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=n.getContext("2d");a.font=o;for(var h=(r?t.wordWrap(e,i,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),c=0,u=0;u<h.length;u++){var f=a.measureText(h[u]).width+(h[u].length-1)*i.letterSpacing;l[u]=f,c=Math.max(c,f)}var p=c+i.strokeThickness;i.dropShadow&&(p+=i.dropShadowDistance);var d=i.lineHeight||s.fontSize+i.strokeThickness,g=Math.max(d,s.fontSize+i.strokeThickness)+(h.length-1)*(d+i.leading);return i.dropShadow&&(g+=i.dropShadowDistance),new t(e,i,p,g,h,l,d+i.leading,c,s)},t.wordWrap=function(e,i,r){void 0===r&&(r=t._canvas);for(var n=r.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,c=i.whiteSpace,u=t.collapseSpaces(c),f=t.collapseNewlines(c),p=!u,d=i.wordWrapWidth+l,g=t.tokenize(e),y=0;y<g.length;y++){var _=g[y];if(t.isNewline(_)){if(!f){a+=t.addLine(s),p=!u,s="",o=0;continue}_=" "}if(u){var S=t.isBreakingSpace(_),b=t.isBreakingSpace(s[s.length-1]);if(S&&b)continue}var x=t.getFromCache(_,l,h,n);if(x>d)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(_,i.breakWords))for(var m=t.wordWrapSplit(_),w=0;w<m.length;w++){for(var v=m[w],T=1;m[w+T];){var I=m[w+T],k=v[v.length-1];if(t.canBreakChars(k,I,_,w,i.breakWords))break;v+=I,T++}w+=v.length-1;var L=t.getFromCache(v,l,h,n);L+o>d&&(a+=t.addLine(s),p=!1,s="",o=0),s+=v,o+=L}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var O=y===g.length-1;a+=t.addLine(_,!O),p=!1,s="",o=0}else x+o>d&&(p=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(_)||p)&&(s+=_,o+=x)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,r){var n=i[t];if("number"!=typeof n){var o=t.length*e;n=r.measureText(t).width+o,i[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],r="";if("string"!=typeof e)return i;for(var n=0;n<e.length;n++){var o=e[n],s=e[n+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==r&&(i.push(r),r=""),i.push(o)):r+=o}return""!==r&&i.push(r),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,r,n){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},r=t._canvas,n=t._context;n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(n.measureText(o).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,r.width=s,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,s,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,a);var l=n.getImageData(0,0,s,h).data,c=l.length,u=4*s,f=0,p=0,d=!1;for(f=0;f<a;++f){for(var g=0;g<u;g+=4)if(255!==l[p+g]){d=!0;break}if(d)break;p+=u}for(i.ascent=a-f,p=c-u,d=!1,f=h;f>a;--f){for(g=0;g<u;g+=4)if(255!==l[p+g]){d=!0;break}if(d)break;p-=u}return i.descent=f-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),canvas=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();canvas.width=canvas.height=10,TextMetrics._canvas=canvas,TextMetrics._context=canvas.getContext("2d"),TextMetrics._fonts={},TextMetrics.METRICS_STRING="|ÉqÅ",TextMetrics.BASELINE_SYMBOL="M",TextMetrics.BASELINE_MULTIPLIER=1.4,TextMetrics.HEIGHT_MULTIPLIER=2,TextMetrics._newlines=[10,13],TextMetrics._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},supportLetterSpacing="letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype,Text=function(t){function e(e,i,r){var n=this,o=!1;r||(r=document.createElement("canvas"),o=!0),r.width=3,r.height=3;var s=core.Texture.from(r);return s.orig=new math.Rectangle,s.trim=new math.Rectangle,(n=t.call(this,s)||this)._ownCanvas=o,n.canvas=r,n.context=n.canvas.getContext("2d"),n._resolution=settings.settings.RESOLUTION,n._autoResolution=!0,n._text=null,n._style=null,n._styleListener=null,n._font="",n.text=e,n.style=i,n.localStyleID=-1,n}return __extends(e,t),e.prototype.updateText=function(t){var i=this._style;if(this.localStyleID!==i.styleID&&(this.dirty=!0,this.localStyleID=i.styleID),this.dirty||!t){this._font=this._style.toFontString();var r,n,o=this.context,s=TextMetrics.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),a=s.width,h=s.height,l=s.lines,c=s.lineHeight,u=s.lineWidths,f=s.maxLineWidth,p=s.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,a)+2*i.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,h)+2*i.padding)*this._resolution),o.scale(this._resolution,this._resolution),o.clearRect(0,0,this.canvas.width,this.canvas.height),o.font=this._font,o.lineWidth=i.strokeThickness,o.textBaseline=i.textBaseline,o.lineJoin=i.lineJoin,o.miterLimit=i.miterLimit;for(var d=i.dropShadow?2:1,g=0;g<d;++g){var y=i.dropShadow&&0===g,_=y?Math.ceil(Math.max(1,h)+2*i.padding):0,S=_*this._resolution;if(y){o.fillStyle="black",o.strokeStyle="black";var b=i.dropShadowColor,x=utils.hex2rgb("number"==typeof b?b:utils.string2hex(b));o.shadowColor="rgba("+255*x[0]+","+255*x[1]+","+255*x[2]+","+i.dropShadowAlpha+")",o.shadowBlur=i.dropShadowBlur,o.shadowOffsetX=Math.cos(i.dropShadowAngle)*i.dropShadowDistance,o.shadowOffsetY=Math.sin(i.dropShadowAngle)*i.dropShadowDistance+S}else o.fillStyle=this._generateFillStyle(i,l,s),o.strokeStyle=i.stroke,o.shadowColor="black",o.shadowBlur=0,o.shadowOffsetX=0,o.shadowOffsetY=0;var m=(c-p.fontSize)/2;(!e.nextLineHeightBehavior||c-p.fontSize<0)&&(m=0);for(var w=0;w<l.length;w++)r=i.strokeThickness/2,n=i.strokeThickness/2+w*c+p.ascent+m,"right"===i.align?r+=f-u[w]:"center"===i.align&&(r+=(f-u[w])/2),i.stroke&&i.strokeThickness&&this.drawLetterSpacing(l[w],r+i.padding,n+i.padding-_,!0),i.fill&&this.drawLetterSpacing(l[w],r+i.padding,n+i.padding-_)}this.updateTexture()}},e.prototype.drawLetterSpacing=function(t,e,i,r){void 0===r&&(r=!1);var n=this._style.letterSpacing;if(0===n||supportLetterSpacing)return supportLetterSpacing&&(this.context.letterSpacing=n,this.context.textLetterSpacing=n),void(r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i));for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var c=s[l];r?this.context.strokeText(c,o,i):this.context.fillText(c,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+n,a=h}},e.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=utils.trimCanvas(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,r=this._style,n=r.trim?0:r.padding,o=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-n,i.trim.y=-n,i.orig.width=i._frame.width-2*n,i.orig.height=i._frame.height-2*n,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},e.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},e.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},e.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},e.prototype._generateFillStyle=function(t,e,i){var r,n=t.fill;if(!Array.isArray(n))return n;if(1===n.length)return n[0];var o=t.dropShadow?t.dropShadowDistance:0,s=t.padding||0,a=this.canvas.width/this._resolution-o-2*s,h=this.canvas.height/this._resolution-o-2*s,l=n.slice(),c=t.fillGradientStops.slice();if(!c.length)for(var u=l.length+1,f=1;f<u;++f)c.push(f/u);if(l.unshift(n[0]),c.unshift(0),l.push(n[n.length-1]),c.push(1),t.fillGradientType===exports.TEXT_GRADIENT.LINEAR_VERTICAL){r=this.context.createLinearGradient(a/2,s,a/2,h+s);var p=i.fontProperties.fontSize+t.strokeThickness;for(f=0;f<e.length;f++){var d=i.lineHeight*(f-1)+p,g=i.lineHeight*f,y=g;f>0&&d>g&&(y=(g+d)/2);var _=g+p,S=i.lineHeight*(f+1),b=_;f+1<e.length&&S<_&&(b=(_+S)/2);for(var x=(b-y)/h,m=0;m<l.length;m++){var w=0;w="number"==typeof c[m]?c[m]:m/l.length;var v=Math.min(1,Math.max(0,y/h+w*x));v=Number(v.toFixed(5)),r.addColorStop(v,l[m])}}}else{r=this.context.createLinearGradient(s,h/2,a+s,h/2);var T=l.length+1,I=1;for(f=0;f<l.length;f++){var k=void 0;k="number"==typeof c[f]?c[f]:I/T,r.addColorStop(k,l[f]),I++}}return r},e.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},defaultDestroyOptions,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(e.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=utils.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=utils.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof TextStyle?t:new TextStyle(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),e.nextLineHeightBehavior=!1,e}(sprite.Sprite);exports.Text=Text,exports.TextMetrics=TextMetrics,exports.TextStyle=TextStyle;
//# sourceMappingURL=text.min.js.map
/*!
* @pixi/text - v6.1.3
* Compiled Mon, 13 Sep 2021 15:29:31 UTC
* @pixi/text - v6.2.0
* Compiled Mon, 01 Nov 2021 16:52:10 UTC
*

@@ -8,3 +8,3 @@ * @pixi/text is licensed under the MIT License.

*/
import{Sprite as t}from"@pixi/sprite";import{Texture as e}from"@pixi/core";import{settings as i}from"@pixi/settings";import{Rectangle as r}from"@pixi/math";import{hex2string as n,hex2rgb as o,string2hex as s,trimCanvas as a,sign as h}from"@pixi/utils";var l,f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(l||(l={}));var c={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:l.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},u=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],d=function(){function t(t){this.styleID=0,this.reset(),y(this,t,t)}return t.prototype.clone=function(){var e={};return y(e,this,c),new t(e)},t.prototype.reset=function(){y(this,c,c)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=g(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=g(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=g(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&u.indexOf(r)<0&&(r='"'+r+'"'),e[i]=r}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function p(t){return"number"==typeof t?n(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function g(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=p(t[e]);return t}return p(t)}function y(t,e,i){for(var r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}var _=function(){function t(t,e,i,r,n,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,r,n){void 0===n&&(n=t._canvas),r=null==r?i.wordWrap:r;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=n.getContext("2d");a.font=o;for(var h=(r?t.wordWrap(e,i,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),f=0,c=0;c<h.length;c++){var u=a.measureText(h[c]).width+(h[c].length-1)*i.letterSpacing;l[c]=u,f=Math.max(f,u)}var d=f+i.strokeThickness;i.dropShadow&&(d+=i.dropShadowDistance);var p=i.lineHeight||s.fontSize+i.strokeThickness,g=Math.max(p,s.fontSize+i.strokeThickness)+(h.length-1)*(p+i.leading);return i.dropShadow&&(g+=i.dropShadowDistance),new t(e,i,d,g,h,l,p+i.leading,f,s)},t.wordWrap=function(e,i,r){void 0===r&&(r=t._canvas);for(var n=r.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,f=i.whiteSpace,c=t.collapseSpaces(f),u=t.collapseNewlines(f),d=!c,p=i.wordWrapWidth+l,g=t.tokenize(e),y=0;y<g.length;y++){var _=g[y];if(t.isNewline(_)){if(!u){a+=t.addLine(s),d=!c,s="",o=0;continue}_=" "}if(c){var b=t.isBreakingSpace(_),S=t.isBreakingSpace(s[s.length-1]);if(b&&S)continue}var m=t.getFromCache(_,l,h,n);if(m>p)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(_,i.breakWords))for(var w=t.wordWrapSplit(_),v=0;v<w.length;v++){for(var x=w[v],I=1;w[v+I];){var k=w[v+I],T=x[x.length-1];if(t.canBreakChars(T,k,_,v,i.breakWords))break;x+=k,I++}v+=x.length-1;var O=t.getFromCache(x,l,h,n);O+o>p&&(a+=t.addLine(s),d=!1,s="",o=0),s+=x,o+=O}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var L=y===g.length-1;a+=t.addLine(_,!L),d=!1,s="",o=0}else m+o>p&&(d=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(_)||d)&&(s+=_,o+=m)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,r){var n=i[t];if("number"!=typeof n){var o=t.length*e;n=r.measureText(t).width+o,i[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],r="";if("string"!=typeof e)return i;for(var n=0;n<e.length;n++){var o=e[n],s=e[n+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==r&&(i.push(r),r=""),i.push(o)):r+=o}return""!==r&&i.push(r),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,r,n){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},r=t._canvas,n=t._context;n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(n.measureText(o).width),a=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,r.width=s,r.height=h,n.fillStyle="#f00",n.fillRect(0,0,s,h),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,a);var l=n.getImageData(0,0,s,h).data,f=l.length,c=4*s,u=0,d=0,p=!1;for(u=0;u<a;++u){for(var g=0;g<c;g+=4)if(255!==l[d+g]){p=!0;break}if(p)break;d+=c}for(i.ascent=a-u,d=f-c,p=!1,u=h;u>a;--u){for(g=0;g<c;g+=4)if(255!==l[d+g]){p=!0;break}if(p)break;d-=c}return i.descent=u-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),b=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();b.width=b.height=10,_._canvas=b,_._context=b.getContext("2d"),_._fonts={},_.METRICS_STRING="|ÉqÅ",_.BASELINE_SYMBOL="M",_.BASELINE_MULTIPLIER=1.4,_.HEIGHT_MULTIPLIER=2,_._newlines=[10,13],_._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var S={texture:!0,children:!1,baseTexture:!0},m=function(t){function n(n,o,s){var a=this,h=!1;s||(s=document.createElement("canvas"),h=!0),s.width=3,s.height=3;var l=e.from(s);return l.orig=new r,l.trim=new r,(a=t.call(this,l)||this)._ownCanvas=h,a.canvas=s,a.context=a.canvas.getContext("2d"),a._resolution=i.RESOLUTION,a._autoResolution=!0,a._text=null,a._style=null,a._styleListener=null,a._font="",a.text=n,a.style=o,a.localStyleID=-1,a}return function(t,e){function i(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(n,t),n.prototype.updateText=function(t){var e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),this.dirty||!t){this._font=this._style.toFontString();var i,r,a=this.context,h=_.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),l=h.width,f=h.height,c=h.lines,u=h.lineHeight,d=h.lineWidths,p=h.maxLineWidth,g=h.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,l)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,f)+2*e.padding)*this._resolution),a.scale(this._resolution,this._resolution),a.clearRect(0,0,this.canvas.width,this.canvas.height),a.font=this._font,a.lineWidth=e.strokeThickness,a.textBaseline=e.textBaseline,a.lineJoin=e.lineJoin,a.miterLimit=e.miterLimit;for(var y=e.dropShadow?2:1,b=0;b<y;++b){var S=e.dropShadow&&0===b,m=S?Math.ceil(Math.max(1,f)+2*e.padding):0,w=m*this._resolution;if(S){a.fillStyle="black",a.strokeStyle="black";var v=e.dropShadowColor,x=o("number"==typeof v?v:s(v));a.shadowColor="rgba("+255*x[0]+","+255*x[1]+","+255*x[2]+","+e.dropShadowAlpha+")",a.shadowBlur=e.dropShadowBlur,a.shadowOffsetX=Math.cos(e.dropShadowAngle)*e.dropShadowDistance,a.shadowOffsetY=Math.sin(e.dropShadowAngle)*e.dropShadowDistance+w}else a.fillStyle=this._generateFillStyle(e,c,h),a.strokeStyle=e.stroke,a.shadowColor="black",a.shadowBlur=0,a.shadowOffsetX=0,a.shadowOffsetY=0;var I=(u-g.fontSize)/2;(!n.nextLineHeightBehavior||u-g.fontSize<0)&&(I=0);for(var k=0;k<c.length;k++)i=e.strokeThickness/2,r=e.strokeThickness/2+k*u+g.ascent+I,"right"===e.align?i+=p-d[k]:"center"===e.align&&(i+=(p-d[k])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(c[k],i+e.padding,r+e.padding-m,!0),e.fill&&this.drawLetterSpacing(c[k],i+e.padding,r+e.padding-m)}this.updateTexture()}},n.prototype.drawLetterSpacing=function(t,e,i,r){void 0===r&&(r=!1);var n=this._style.letterSpacing;if(0!==n)for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var f=s[l];r?this.context.strokeText(f,o,i):this.context.fillText(f,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+n,a=h}else r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i)},n.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=a(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,r=this._style,n=r.trim?0:r.padding,o=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-n,i.trim.y=-n,i.orig.width=i._frame.width-2*n,i.orig.height=i._frame.height-2*n,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},n.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},n.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},n.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},n.prototype._generateFillStyle=function(t,e,i){var r,n=t.fill;if(!Array.isArray(n))return n;if(1===n.length)return n[0];var o=t.dropShadow?t.dropShadowDistance:0,s=t.padding||0,a=this.canvas.width/this._resolution-o-2*s,h=this.canvas.height/this._resolution-o-2*s,f=n.slice(),c=t.fillGradientStops.slice();if(!c.length)for(var u=f.length+1,d=1;d<u;++d)c.push(d/u);if(f.unshift(n[0]),c.unshift(0),f.push(n[n.length-1]),c.push(1),t.fillGradientType===l.LINEAR_VERTICAL){r=this.context.createLinearGradient(a/2,s,a/2,h+s);var p=i.fontProperties.fontSize+t.strokeThickness;for(d=0;d<e.length;d++){var g=i.lineHeight*(d-1)+p,y=i.lineHeight*d,_=y;d>0&&g>y&&(_=(y+g)/2);var b=y+p,S=i.lineHeight*(d+1),m=b;d+1<e.length&&S<b&&(m=(b+S)/2);for(var w=(m-_)/h,v=0;v<f.length;v++){var x=0;x="number"==typeof c[v]?c[v]:v/f.length;var I=Math.min(1,Math.max(0,_/h+x*w));I=Number(I.toFixed(5)),r.addColorStop(I,f[v])}}}else{r=this.context.createLinearGradient(s,h/2,a+s,h/2);var k=f.length+1,T=1;for(d=0;d<f.length;d++){var O=void 0;O="number"==typeof c[d]?c[d]:T/k,r.addColorStop(O,f[d]),T++}}return r},n.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},S,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(n.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=h(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=h(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof d?t:new d(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),n.nextLineHeightBehavior=!1,n}(t);export{l as TEXT_GRADIENT,m as Text,_ as TextMetrics,d as TextStyle};
import{Sprite as t}from"@pixi/sprite";import{Texture as e}from"@pixi/core";import{settings as i}from"@pixi/settings";import{Rectangle as n}from"@pixi/math";import{hex2string as r,hex2rgb as o,string2hex as s,trimCanvas as a,sign as h}from"@pixi/utils";var l,c=function(t,e){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(l||(l={}));var f={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:l.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},u=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],p=function(){function t(t){this.styleID=0,this.reset(),y(this,t,t)}return t.prototype.clone=function(){var e={};return y(e,this,f),new t(e)},t.prototype.reset=function(){y(this,f,f)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=g(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=g(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontVariant",{get:function(){return this._fontVariant},set:function(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineHeight",{get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leading",{get:function(){return this._leading},set:function(t){this._leading!==t&&(this._leading=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineJoin",{get:function(){return this._lineJoin},set:function(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"miterLimit",{get:function(){return this._miterLimit},set:function(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding!==t&&(this._padding=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stroke",{get:function(){return this._stroke},set:function(t){var e=g(t);this._stroke!==e&&(this._stroke=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"strokeThickness",{get:function(){return this._strokeThickness},set:function(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textBaseline",{get:function(){return this._textBaseline},set:function(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trim",{get:function(){return this._trim},set:function(t){this._trim!==t&&(this._trim=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"whiteSpace",{get:function(){return this._whiteSpace},set:function(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"wordWrapWidth",{get:function(){return this._wordWrapWidth},set:function(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)},enumerable:!1,configurable:!0}),t.prototype.toFontString=function(){var t="number"==typeof this.fontSize?this.fontSize+"px":this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(var i=e.length-1;i>=0;i--){var n=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&u.indexOf(n)<0&&(n='"'+n+'"'),e[i]=n}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function d(t){return"number"==typeof t?r(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function g(t){if(Array.isArray(t)){for(var e=0;e<t.length;++e)t[e]=d(t[e]);return t}return d(t)}function y(t,e,i){for(var n in i)Array.isArray(e[n])?t[n]=e[n].slice():t[n]=e[n]}var _=function(){function t(t,e,i,n,r,o,s,a,h){this.text=t,this.style=e,this.width=i,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=s,this.maxLineWidth=a,this.fontProperties=h}return t.measureText=function(e,i,n,r){void 0===r&&(r=t._canvas),n=null==n?i.wordWrap:n;var o=i.toFontString(),s=t.measureFont(o);0===s.fontSize&&(s.fontSize=i.fontSize,s.ascent=i.fontSize);var a=r.getContext("2d");a.font=o;for(var h=(n?t.wordWrap(e,i,r):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length),c=0,f=0;f<h.length;f++){var u=a.measureText(h[f]).width+(h[f].length-1)*i.letterSpacing;l[f]=u,c=Math.max(c,u)}var p=c+i.strokeThickness;i.dropShadow&&(p+=i.dropShadowDistance);var d=i.lineHeight||s.fontSize+i.strokeThickness,g=Math.max(d,s.fontSize+i.strokeThickness)+(h.length-1)*(d+i.leading);return i.dropShadow&&(g+=i.dropShadowDistance),new t(e,i,p,g,h,l,d+i.leading,c,s)},t.wordWrap=function(e,i,n){void 0===n&&(n=t._canvas);for(var r=n.getContext("2d"),o=0,s="",a="",h=Object.create(null),l=i.letterSpacing,c=i.whiteSpace,f=t.collapseSpaces(c),u=t.collapseNewlines(c),p=!f,d=i.wordWrapWidth+l,g=t.tokenize(e),y=0;y<g.length;y++){var _=g[y];if(t.isNewline(_)){if(!u){a+=t.addLine(s),p=!f,s="",o=0;continue}_=" "}if(f){var b=t.isBreakingSpace(_),S=t.isBreakingSpace(s[s.length-1]);if(b&&S)continue}var m=t.getFromCache(_,l,h,r);if(m>d)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(_,i.breakWords))for(var w=t.wordWrapSplit(_),v=0;v<w.length;v++){for(var x=w[v],I=1;w[v+I];){var k=w[v+I],T=x[x.length-1];if(t.canBreakChars(T,k,_,v,i.breakWords))break;x+=k,I++}v+=x.length-1;var L=t.getFromCache(x,l,h,r);L+o>d&&(a+=t.addLine(s),p=!1,s="",o=0),s+=x,o+=L}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var O=y===g.length-1;a+=t.addLine(_,!O),p=!1,s="",o=0}else m+o>d&&(p=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(_)||p)&&(s+=_,o+=m)}return a+=t.addLine(s,!1)},t.addLine=function(e,i){return void 0===i&&(i=!0),e=t.trimRight(e),e=i?e+"\n":e},t.getFromCache=function(t,e,i,n){var r=i[t];if("number"!=typeof r){var o=t.length*e;r=n.measureText(t).width+o,i[t]=r}return r},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var i=e.length-1;i>=0;i--){var n=e[i];if(!t.isBreakingSpace(n))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,i){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var i=[],n="";if("string"!=typeof e)return i;for(var r=0;r<e.length;r++){var o=e[r],s=e[r+1];t.isBreakingSpace(o,s)||t.isNewline(o)?(""!==n&&(i.push(n),n=""),i.push(o)):n+=o}return""!==n&&i.push(n),i},t.canBreakWords=function(t,e){return e},t.canBreakChars=function(t,e,i,n,r){return!0},t.wordWrapSplit=function(t){return t.split("")},t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var i={ascent:0,descent:0,fontSize:0},n=t._canvas,r=t._context;r.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,s=Math.ceil(r.measureText(o).width),a=Math.ceil(r.measureText(t.BASELINE_SYMBOL).width),h=Math.ceil(t.HEIGHT_MULTIPLIER*a);a=a*t.BASELINE_MULTIPLIER|0,n.width=s,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,s,h),r.font=e,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(o,0,a);var l=r.getImageData(0,0,s,h).data,c=l.length,f=4*s,u=0,p=0,d=!1;for(u=0;u<a;++u){for(var g=0;g<f;g+=4)if(255!==l[p+g]){d=!0;break}if(d)break;p+=f}for(i.ascent=a-u,p=c-f,d=!1,u=h;u>a;--u){for(g=0;g<f;g+=4)if(255!==l[p+g]){d=!0;break}if(d)break;p-=f}return i.descent=u-a,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i},t.clearMetrics=function(e){void 0===e&&(e=""),e?delete t._fonts[e]:t._fonts={}},t}(),b=function(){try{var t=new OffscreenCanvas(0,0),e=t.getContext("2d");return e&&e.measureText?t:document.createElement("canvas")}catch(t){return document.createElement("canvas")}}();b.width=b.height=10,_._canvas=b,_._context=b.getContext("2d"),_._fonts={},_.METRICS_STRING="|ÉqÅ",_.BASELINE_SYMBOL="M",_.BASELINE_MULTIPLIER=1.4,_.HEIGHT_MULTIPLIER=2,_._newlines=[10,13],_._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var S={texture:!0,children:!1,baseTexture:!0},m="letterSpacing"in CanvasRenderingContext2D.prototype||"textLetterSpacing"in CanvasRenderingContext2D.prototype,w=function(t){function r(r,o,s){var a=this,h=!1;s||(s=document.createElement("canvas"),h=!0),s.width=3,s.height=3;var l=e.from(s);return l.orig=new n,l.trim=new n,(a=t.call(this,l)||this)._ownCanvas=h,a.canvas=s,a.context=a.canvas.getContext("2d"),a._resolution=i.RESOLUTION,a._autoResolution=!0,a._text=null,a._style=null,a._styleListener=null,a._font="",a.text=r,a.style=o,a.localStyleID=-1,a}return function(t,e){function i(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(r,t),r.prototype.updateText=function(t){var e=this._style;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),this.dirty||!t){this._font=this._style.toFontString();var i,n,a=this.context,h=_.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),l=h.width,c=h.height,f=h.lines,u=h.lineHeight,p=h.lineWidths,d=h.maxLineWidth,g=h.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,l)+2*e.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,c)+2*e.padding)*this._resolution),a.scale(this._resolution,this._resolution),a.clearRect(0,0,this.canvas.width,this.canvas.height),a.font=this._font,a.lineWidth=e.strokeThickness,a.textBaseline=e.textBaseline,a.lineJoin=e.lineJoin,a.miterLimit=e.miterLimit;for(var y=e.dropShadow?2:1,b=0;b<y;++b){var S=e.dropShadow&&0===b,m=S?Math.ceil(Math.max(1,c)+2*e.padding):0,w=m*this._resolution;if(S){a.fillStyle="black",a.strokeStyle="black";var v=e.dropShadowColor,x=o("number"==typeof v?v:s(v));a.shadowColor="rgba("+255*x[0]+","+255*x[1]+","+255*x[2]+","+e.dropShadowAlpha+")",a.shadowBlur=e.dropShadowBlur,a.shadowOffsetX=Math.cos(e.dropShadowAngle)*e.dropShadowDistance,a.shadowOffsetY=Math.sin(e.dropShadowAngle)*e.dropShadowDistance+w}else a.fillStyle=this._generateFillStyle(e,f,h),a.strokeStyle=e.stroke,a.shadowColor="black",a.shadowBlur=0,a.shadowOffsetX=0,a.shadowOffsetY=0;var I=(u-g.fontSize)/2;(!r.nextLineHeightBehavior||u-g.fontSize<0)&&(I=0);for(var k=0;k<f.length;k++)i=e.strokeThickness/2,n=e.strokeThickness/2+k*u+g.ascent+I,"right"===e.align?i+=d-p[k]:"center"===e.align&&(i+=(d-p[k])/2),e.stroke&&e.strokeThickness&&this.drawLetterSpacing(f[k],i+e.padding,n+e.padding-m,!0),e.fill&&this.drawLetterSpacing(f[k],i+e.padding,n+e.padding-m)}this.updateTexture()}},r.prototype.drawLetterSpacing=function(t,e,i,n){void 0===n&&(n=!1);var r=this._style.letterSpacing;if(0===r||m)return m&&(this.context.letterSpacing=r,this.context.textLetterSpacing=r),void(n?this.context.strokeText(t,e,i):this.context.fillText(t,e,i));for(var o=e,s=Array.from?Array.from(t):t.split(""),a=this.context.measureText(t).width,h=0,l=0;l<s.length;++l){var c=s[l];n?this.context.strokeText(c,o,i):this.context.fillText(c,o,i),o+=a-(h=this.context.measureText(t.substring(l+1)).width)+r,a=h}},r.prototype.updateTexture=function(){var t=this.canvas;if(this._style.trim){var e=a(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}var i=this._texture,n=this._style,r=n.trim?0:n.padding,o=i.baseTexture;i.trim.width=i._frame.width=t.width/this._resolution,i.trim.height=i._frame.height=t.height/this._resolution,i.trim.x=-r,i.trim.y=-r,i.orig.width=i._frame.width-2*r,i.orig.height=i._frame.height-2*r,this._onTextureUpdate(),o.setRealSize(t.width,t.height,this._resolution),i.updateUvs(),this._recursivePostUpdateTransform(),this.dirty=!1},r.prototype._render=function(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),t.prototype._render.call(this,e)},r.prototype.getLocalBounds=function(e){return this.updateText(!0),t.prototype.getLocalBounds.call(this,e)},r.prototype._calculateBounds=function(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)},r.prototype._generateFillStyle=function(t,e,i){var n,r=t.fill;if(!Array.isArray(r))return r;if(1===r.length)return r[0];var o=t.dropShadow?t.dropShadowDistance:0,s=t.padding||0,a=this.canvas.width/this._resolution-o-2*s,h=this.canvas.height/this._resolution-o-2*s,c=r.slice(),f=t.fillGradientStops.slice();if(!f.length)for(var u=c.length+1,p=1;p<u;++p)f.push(p/u);if(c.unshift(r[0]),f.unshift(0),c.push(r[r.length-1]),f.push(1),t.fillGradientType===l.LINEAR_VERTICAL){n=this.context.createLinearGradient(a/2,s,a/2,h+s);var d=i.fontProperties.fontSize+t.strokeThickness;for(p=0;p<e.length;p++){var g=i.lineHeight*(p-1)+d,y=i.lineHeight*p,_=y;p>0&&g>y&&(_=(y+g)/2);var b=y+d,S=i.lineHeight*(p+1),m=b;p+1<e.length&&S<b&&(m=(b+S)/2);for(var w=(m-_)/h,v=0;v<c.length;v++){var x=0;x="number"==typeof f[v]?f[v]:v/c.length;var I=Math.min(1,Math.max(0,_/h+x*w));I=Number(I.toFixed(5)),n.addColorStop(I,c[v])}}}else{n=this.context.createLinearGradient(s,h/2,a+s,h/2);var k=c.length+1,T=1;for(p=0;p<c.length;p++){var L=void 0;L="number"==typeof f[p]?f[p]:T/k,n.addColorStop(L,c[p]),T++}}return n},r.prototype.destroy=function(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},S,e),t.prototype.destroy.call(this,e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width},set:function(t){this.updateText(!0);var e=h(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height},set:function(t){this.updateText(!0);var e=h(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"style",{get:function(){return this._style},set:function(t){t=t||{},this._style=t instanceof p?t:new p(t),this.localStyleID=-1,this.dirty=!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"text",{get:function(){return this._text},set:function(t){t=String(null==t?"":t),this._text!==t&&(this._text=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)},enumerable:!1,configurable:!0}),r.nextLineHeightBehavior=!1,r}(t);export{l as TEXT_GRADIENT,w as Text,_ as TextMetrics,p as TextStyle};
//# sourceMappingURL=text.min.js.map

@@ -44,2 +44,7 @@ import type { IDestroyOptions } from '@pixi/display';

declare interface ModernContext2D extends CanvasRenderingContext2D {
textLetterSpacing?: number;
letterSpacing?: number;
}
/**

@@ -66,4 +71,2 @@ * A Text Object will create a line or multiple lines of text.

*
* @class
* @extends PIXI.Sprite
* @memberof PIXI

@@ -77,24 +80,54 @@ */

* In the next major release, we'll enable this by default.
*
* @static
* @memberof PIXI.Text
* @member {boolean} nextLineHeightBehavior
* @default false
*/
static nextLineHeightBehavior: boolean;
/** The canvas element that everything is drawn to. */
canvas: HTMLCanvasElement;
context: CanvasRenderingContext2D;
/** The canvas 2d context that everything is drawn with. */
context: ModernContext2D;
localStyleID: number;
dirty: boolean;
/**
* The resolution / device pixel ratio of the canvas.
*
* This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
*
* @default PIXI.settings.RESOLUTION
*/
_resolution: number;
_autoResolution: boolean;
/**
* Private tracker for the current text.
*
* @private
*/
protected _text: string;
/**
* Private tracker for the current font.
*
* @private
*/
protected _font: string;
/**
* Private tracker for the current style.
*
* @private
*/
protected _style: TextStyle;
/**
* Private listener to track style changes.
*
* @private
*/
protected _styleListener: () => void;
/**
* Keep track if this Text object created it's own canvas
* element (`true`) or uses the constructor argument (`false`).
* Used to workaround a GC issues with Safari < 13 when
* destroying Text. See `destroy` for more info.
*/
private _ownCanvas;
/**
* @param {string} text - The string that you would like the text to display
* @param text - The string that you would like the text to display
* @param {object|PIXI.TextStyle} [style] - The style parameters
* @param {HTMLCanvasElement} [canvas] - The canvas element for drawing text
* @param canvas - The canvas element for drawing text
*/

@@ -104,2 +137,3 @@ constructor(text: string, style?: Partial<ITextStyle> | TextStyle, canvas?: HTMLCanvasElement);

* Renders text to its canvas, and updates its texture.
*
* By default this is used internally to ensure the texture is correct before rendering,

@@ -109,3 +143,3 @@ * but it can be used called externally, for example from this class to 'pre-generate' the texture from a piece of text,

*
* @param {boolean} respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.
* @param respectDirty - Whether to abort updating the text if the Text isn't dirty and the function is called.
*/

@@ -115,15 +149,11 @@ updateText(respectDirty: boolean): void;

* Render the text with letter-spacing.
* @param {string} text - The text to draw
* @param {number} x - Horizontal position to draw the text
* @param {number} y - Vertical position to draw the text
* @param {boolean} [isStroke=false] - Is this drawing for the outside stroke of the
*
* @param text - The text to draw
* @param x - Horizontal position to draw the text
* @param y - Vertical position to draw the text
* @param isStroke - Is this drawing for the outside stroke of the
* text? If not, it's for the inside fill
* @private
*/
private drawLetterSpacing;
/**
* Updates texture size based on canvas size
*
* @private
*/
/** Updates texture size based on canvas size. */
private updateTexture;

@@ -133,4 +163,3 @@ /**

*
* @protected
* @param {PIXI.Renderer} renderer - The renderer
* @param renderer - The renderer
*/

@@ -141,10 +170,7 @@ protected _render(renderer: Renderer): void;

*
* @param {PIXI.Rectangle} rect - The output rectangle.
* @return {PIXI.Rectangle} The bounds.
* @param rect - The output rectangle.
* @return The bounds.
*/
getLocalBounds(rect: Rectangle): Rectangle;
/**
* calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account.
* @protected
*/
/** Calculates the bounds of the Text as a rectangle. The bounds calculation takes the worldTransform into account. */
protected _calculateBounds(): void;

@@ -154,6 +180,5 @@ /**

*
* @private
* @param {object} style - The style.
* @param {string[]} lines - The lines of text.
* @return {string|number|CanvasGradient} The fill style
* @param style - The style.
* @param lines - The lines of text.
* @return The fill style
*/

@@ -163,6 +188,7 @@ private _generateFillStyle;

* Destroys this text object.
*
* Note* Unlike a Sprite, a Text object will automatically destroy its baseTexture and texture as
* the majority of the time the texture will not be shared with any other Sprites.
*
* @param {object|boolean} [options] - Options parameter. A boolean will act as if all options
* @param options - Options parameter. A boolean will act as if all options
* have been set to that value

@@ -175,29 +201,16 @@ * @param {boolean} [options.children=false] - if set to true, all the children will have their

destroy(options?: IDestroyOptions | boolean): void;
/**
* The width of the Text, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
/** The width of the Text, setting this will actually modify the scale to achieve the value set. */
get width(): number;
set width(value: number);
/**
* The height of the Text, setting this will actually modify the scale to achieve the value set
*
* @member {number}
*/
/** The height of the Text, setting this will actually modify the scale to achieve the value set. */
get height(): number;
set height(value: number);
/**
* Set the style of the text. Set up an event listener to listen for changes on the style
* object and mark the text as dirty.
* Set the style of the text.
*
* @member {object|PIXI.TextStyle}
* Set up an event listener to listen for changes on the style object and mark the text as dirty.
*/
get style(): TextStyle | Partial<ITextStyle>;
set style(style: TextStyle | Partial<ITextStyle>);
/**
* Set the copy for the text object. To split a line you can use '\n'.
*
* @member {string}
*/
/** Set the copy for the text object. To split a line you can use '\n'. */
get text(): string;

@@ -207,4 +220,5 @@ set text(text: string);

* The resolution / device pixel ratio of the canvas.
*
* This is set to automatically match the renderer resolution by default, but can be overridden by setting manually.
* @member {number}
*
* @default 1

@@ -241,14 +255,26 @@ */

*
* @class
* @memberof PIXI
*/
declare class TextMetrics_2 {
/** The text that was measured. */
text: string;
/** The style that was measured. */
style: TextStyle;
/** The measured width of the text. */
width: number;
/** The measured height of the text. */
height: number;
/** An array of lines of the text broken by new lines and wrapping is specified in style. */
lines: string[];
/** An array of the line widths for each line matched to `lines`. */
lineWidths: number[];
/** The measured line height for this style. */
lineHeight: number;
/** The maximum line width for all measured lines. */
maxLineWidth: number;
/**
* The font properties object from TextMetrics.measureFont.
*
* @type {PIXI.IFontMetrics}
*/
fontProperties: IFontMetrics;

@@ -267,11 +293,11 @@ static METRICS_STRING: string;

/**
* @param {string} text - the text that was measured
* @param {PIXI.TextStyle} style - the style that was measured
* @param {number} width - the measured width of the text
* @param {number} height - the measured height of the text
* @param {string[]} lines - an array of the lines of text broken by new lines and wrapping if specified in style
* @param {number[]} lineWidths - an array of the line widths for each line matched to `lines`
* @param {number} lineHeight - the measured line height for this style
* @param {number} maxLineWidth - the maximum line width for all measured lines
* @param {Object} fontProperties - the font properties object from TextMetrics.measureFont
* @param text - the text that was measured
* @param style - the style that was measured
* @param width - the measured width of the text
* @param height - the measured height of the text
* @param lines - an array of the lines of text broken by new lines and wrapping if specified in style
* @param lineWidths - an array of the line widths for each line matched to `lines`
* @param lineHeight - the measured line height for this style
* @param maxLineWidth - the maximum line width for all measured lines
* @param {PIXI.IFontMetrics} fontProperties - the font properties object from TextMetrics.measureFont
*/

@@ -282,7 +308,7 @@ constructor(text: string, style: TextStyle, width: number, height: number, lines: string[], lineWidths: number[], lineHeight: number, maxLineWidth: number, fontProperties: IFontMetrics);

*
* @param {string} text - the text to measure.
* @param {PIXI.TextStyle} style - the text style to use for measuring
* @param {boolean} [wordWrap] - optional override for if word-wrap should be applied to the text.
* @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.
* @return {PIXI.TextMetrics} measured width and height of the text.
* @param text - The text to measure.
* @param style - The text style to use for measuring
* @param wordWrap - Override for if word-wrap should be applied to the text.
* @param canvas - optional specification of the canvas to use for measuring.
* @return Measured width and height of the text.
*/

@@ -294,17 +320,14 @@ static measureText(text: string, style: TextStyle, wordWrap?: boolean, canvas?: HTMLCanvasElement | OffscreenCanvas): TextMetrics_2;

*
* @private
* @param {string} text - String to apply word wrapping to
* @param {PIXI.TextStyle} style - the style to use when wrapping
* @param {HTMLCanvasElement} [canvas] - optional specification of the canvas to use for measuring.
* @return {string} New string with new lines applied where required
* @param text - String to apply word wrapping to
* @param style - the style to use when wrapping
* @param canvas - optional specification of the canvas to use for measuring.
* @return New string with new lines applied where required
*/
private static wordWrap;
/**
* Convienience function for logging each line added during the wordWrap
* method
* Convienience function for logging each line added during the wordWrap method.
*
* @private
* @param {string} line - The line of text to add
* @param {boolean} newLine - Add new line character to end
* @return {string} A formatted line
* @param line - The line of text to add
* @param newLine - Add new line character to end
* @return A formatted line
*/

@@ -315,32 +338,28 @@ private static addLine;

*
* @private
* @param {string} key - The key
* @param {number} letterSpacing - The letter spacing
* @param {object} cache - The cache
* @param {CanvasRenderingContext2D} context - The canvas context
* @return {number} The from cache.
* @param key - The key
* @param letterSpacing - The letter spacing
* @param cache - The cache
* @param context - The canvas context
* @return The from cache.
*/
private static getFromCache;
/**
* Determines whether we should collapse breaking spaces
* Determines whether we should collapse breaking spaces.
*
* @private
* @param {string} whiteSpace - The TextStyle property whiteSpace
* @return {boolean} should collapse
* @param whiteSpace - The TextStyle property whiteSpace
* @return Should collapse
*/
private static collapseSpaces;
/**
* Determines whether we should collapse newLine chars
* Determines whether we should collapse newLine chars.
*
* @private
* @param {string} whiteSpace - The white space
* @return {boolean} should collapse
* @param whiteSpace - The white space
* @return should collapse
*/
private static collapseNewlines;
/**
* trims breaking whitespaces from string
* Trims breaking whitespaces from string.
*
* @private
* @param {string} text - The text
* @return {string} trimmed string
* @param text - The text
* @return Trimmed string
*/

@@ -351,5 +370,4 @@ private static trimRight;

*
* @private
* @param {string} char - The character
* @return {boolean} True if newline, False otherwise.
* @param char - The character
* @return True if newline, False otherwise.
*/

@@ -364,5 +382,5 @@ private static isNewline;

*
* @param {string} char - The character
* @param {string} [nextChar] - The next character
* @return {boolean} True if whitespace, False otherwise.
* @param char - The character
* @param [nextChar] - The next character
* @return True if whitespace, False otherwise.
*/

@@ -373,5 +391,4 @@ static isBreakingSpace(char: string, _nextChar?: string): boolean;

*
* @private
* @param {string} text - The text
* @return {string[]} A tokenized array
* @param text - The text
* @return A tokenized array
*/

@@ -386,5 +403,5 @@ private static tokenize;

*
* @param {string} token - The token
* @param {boolean} breakWords - The style attr break words
* @return {boolean} whether to break word or not
* @param token - The token
* @param breakWords - The style attr break words
* @return Whether to break word or not
*/

@@ -400,8 +417,8 @@ static canBreakWords(_token: string, breakWords: boolean): boolean;

*
* @param {string} char - The character
* @param {string} nextChar - The next character
* @param {string} token - The token/word the characters are from
* @param {number} index - The index in the token of the char
* @param {boolean} breakWords - The style attr break words
* @return {boolean} whether to break word or not
* @param char - The character
* @param nextChar - The next character
* @param token - The token/word the characters are from
* @param index - The index in the token of the char
* @param breakWords - The style attr break words
* @return whether to break word or not
*/

@@ -420,4 +437,4 @@ static canBreakChars(_char: string, _nextChar: string, _token: string, _index: number, _breakWords: boolean): boolean;

*
* @param {string} token - The token to split
* @return {string[]} The characters of the token
* @param token - The token to split
* @return The characters of the token
*/

@@ -428,5 +445,4 @@ static wordWrapSplit(token: string): string[];

*
* @static
* @param {string} font - String representing the style of the font
* @return {PIXI.IFontMetrics} Font properties object
* @param font - String representing the style of the font
* @return Font properties object
*/

@@ -437,3 +453,2 @@ static measureFont(font: string): IFontMetrics;

*
* @static
* @param {string} [font] - font name. If font name not set then clear cache for all fonts.

@@ -452,3 +467,2 @@ */

*
* @class
* @memberof PIXI

@@ -540,8 +554,6 @@ */

*
* @return {PIXI.TextStyle} New cloned TextStyle object
* @return New cloned TextStyle object
*/
clone(): TextStyle;
/**
* Resets all properties to the defaults specified in TextStyle.prototype._default
*/
/** Resets all properties to the defaults specified in TextStyle.prototype._default */
reset(): void;

@@ -555,49 +567,21 @@ /**

set align(align: TextStyleAlign);
/**
* Indicates if lines can be wrapped within words, it needs wordWrap to be set to true
*
* @member {boolean}
*/
/** Indicates if lines can be wrapped within words, it needs wordWrap to be set to true. */
get breakWords(): boolean;
set breakWords(breakWords: boolean);
/**
* Set a drop shadow for the text
*
* @member {boolean}
*/
/** Set a drop shadow for the text. */
get dropShadow(): boolean;
set dropShadow(dropShadow: boolean);
/**
* Set alpha for the drop shadow
*
* @member {number}
*/
/** Set alpha for the drop shadow. */
get dropShadowAlpha(): number;
set dropShadowAlpha(dropShadowAlpha: number);
/**
* Set a angle of the drop shadow
*
* @member {number}
*/
/** Set a angle of the drop shadow. */
get dropShadowAngle(): number;
set dropShadowAngle(dropShadowAngle: number);
/**
* Set a shadow blur radius
*
* @member {number}
*/
/** Set a shadow blur radius. */
get dropShadowBlur(): number;
set dropShadowBlur(dropShadowBlur: number);
/**
* A fill style to be used on the dropshadow e.g 'red', '#00FF00'
*
* @member {string|number}
*/
/** A fill style to be used on the dropshadow e.g 'red', '#00FF00'. */
get dropShadowColor(): number | string;
set dropShadowColor(dropShadowColor: number | string);
/**
* Set a distance of the drop shadow
*
* @member {number}
*/
/** Set a distance of the drop shadow. */
get dropShadowDistance(): number;

@@ -607,2 +591,3 @@ set dropShadowDistance(dropShadowDistance: number);

* A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.
*
* Can be an array to create a gradient eg ['#000000','#FFFFFF']

@@ -617,5 +602,4 @@ * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}

* If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.
* See {@link PIXI.TEXT_GRADIENT}
*
* @member {number}
* @see PIXI.TEXT_GRADIENT
*/

@@ -627,12 +611,6 @@ get fillGradientType(): TEXT_GRADIENT;

* (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.
*
* @member {number[]}
*/
get fillGradientStops(): number[];
set fillGradientStops(fillGradientStops: number[]);
/**
* The font family
*
* @member {string|string[]}
*/
/** The font family. */
get fontFamily(): string | string[];

@@ -643,4 +621,2 @@ set fontFamily(fontFamily: string | string[]);

* (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')
*
* @member {number|string}
*/

@@ -673,21 +649,9 @@ get fontSize(): number | string;

set fontWeight(fontWeight: TextStyleFontWeight);
/**
* The amount of spacing between letters, default is 0
*
* @member {number}
*/
/** The amount of spacing between letters, default is 0. */
get letterSpacing(): number;
set letterSpacing(letterSpacing: number);
/**
* The line height, a number that represents the vertical space that a letter uses
*
* @member {number}
*/
/** The line height, a number that represents the vertical space that a letter uses. */
get lineHeight(): number;
set lineHeight(lineHeight: number);
/**
* The space between lines
*
* @member {number}
*/
/** The space between lines. */
get leading(): number;

@@ -704,6 +668,5 @@ set leading(leading: number);

/**
* The miter limit to use when using the 'miter' lineJoin mode
* The miter limit to use when using the 'miter' lineJoin mode.
*
* This can reduce or increase the spikiness of rendered text.
*
* @member {number}
*/

@@ -715,4 +678,2 @@ get miterLimit(): number;

* by adding padding to all sides of the text.
*
* @member {number}
*/

@@ -724,4 +685,2 @@ get padding(): number;

* e.g 'blue', '#FCFF00'
*
* @member {string|number}
*/

@@ -732,5 +691,4 @@ get stroke(): string | number;

* A number that represents the thickness of the stroke.
* Default is 0 (no stroke)
*
* @member {number}
* @default 0
*/

@@ -746,7 +704,3 @@ get strokeThickness(): number;

set textBaseline(textBaseline: TextStyleTextBaseline);
/**
* Trim transparent borders
*
* @member {boolean}
*/
/** Trim transparent borders. */
get trim(): boolean;

@@ -768,14 +722,6 @@ set trim(trim: boolean);

set whiteSpace(whiteSpace: TextStyleWhiteSpace);
/**
* Indicates if word wrap should be used
*
* @member {boolean}
*/
/** Indicates if word wrap should be used. */
get wordWrap(): boolean;
set wordWrap(wordWrap: boolean);
/**
* The width at which text will wrap, it needs wordWrap to be set to true
*
* @member {number}
*/
/** The width at which text will wrap, it needs wordWrap to be set to true. */
get wordWrapWidth(): number;

@@ -786,3 +732,3 @@ set wordWrapWidth(wordWrapWidth: number);

*
* @return {string} Font style string, for passing to `TextMetrics.measureFont()`
* @return Font style string, for passing to `TextMetrics.measureFont()`
*/

@@ -789,0 +735,0 @@ toFontString(): string;

{
"name": "@pixi/text",
"version": "6.1.3",
"version": "6.2.0",
"main": "dist/cjs/text.js",

@@ -28,14 +28,9 @@ "module": "dist/esm/text.js",

"peerDependencies": {
"@pixi/core": "6.1.3",
"@pixi/math": "6.1.3",
"@pixi/settings": "6.1.3",
"@pixi/sprite": "6.1.3",
"@pixi/utils": "6.1.3"
"@pixi/core": "6.2.0",
"@pixi/math": "6.2.0",
"@pixi/settings": "6.2.0",
"@pixi/sprite": "6.2.0",
"@pixi/utils": "6.2.0"
},
"devDependencies": {
"@pixi/canvas-display": "6.1.3",
"@pixi/canvas-renderer": "6.1.3",
"@pixi/canvas-sprite": "6.1.3"
},
"gitHead": "2342b551124751206078602eb0e4408df230923e"
"gitHead": "793f21c0d0f2d2a423bd4339f40a569e1ea68711"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc