var t,e;t=void 0,e=function(){var t=Phaser.Renderer.WebGL.Utils,e={renderWebGL:function(e,i,s,r){if(0!==i.width&&0!==i.height){s.addToRenderList(i);var n=i.frame,a=n.width,h=n.height,o=t.getTintAppendFloatAlpha,l=e.pipelines.set(i.pipeline,i),u=l.setTexture2D(n.glTexture,i);e.pipelines.preBatch(i),l.batchTexture(i,n.glTexture,a,h,i.x,i.y,a/i.style.resolution,h/i.style.resolution,i.scaleX,i.scaleY,i.rotation,i.flipX,i.flipY,i.scrollFactorX,i.scrollFactorY,i.displayOriginX,i.displayOriginY,0,0,a,h,o(i.tintTopLeft,s.alpha*i._alphaTL),o(i.tintTopRight,s.alpha*i._alphaTR),o(i.tintBottomLeft,s.alpha*i._alphaBL),o(i.tintBottomRight,s.alpha*i._alphaBR),i.tintFill,0,0,s,r,!1,u),e.pipelines.postBatch(i)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const i=Phaser.Display.Canvas.CanvasPool;var s=!1;!function(t){if(!s){void 0===t&&(t=60);var e=Phaser.VERSION.split("."),i=parseInt(e[0]);if(3===i){var r=parseInt(e[1]);r * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ const u=Phaser.Display.Canvas.CanvasPool;var d=function(t){var e=u.create(this),i=e.getContext("2d",{willReadFrequently:!0});t.syncFont(e,i);var s=i.measureText(t.testString);if("actualBoundingBoxAscent"in s){var r=s.actualBoundingBoxAscent,n=s.actualBoundingBoxDescent,a={ascent:r,descent:n,fontSize:r+n};return u.remove(e),a}var h=Math.ceil(s.width*t.baselineX),o=h,l=2*o;if(o=o*t.baselineY|0,e.width=h,e.height=l,i.fillStyle="#f00",i.fillRect(0,0,h,l),i.font=t._font,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(t.testString,0,o),a={ascent:0,descent:0,fontSize:0},!i.getImageData(0,0,h,l))return a.ascent=o,a.descent=o+6,a.fontSize=a.ascent+a.descent,u.remove(e),a;var d,g,c=i.getImageData(0,0,h,l).data,p=c.length,f=4*h,v=0,x=!1;for(d=0;do;d--){for(g=0;g0&&this.wrapMode!==f&&0===this.wrapWidth}setStyle(t,e,i){if(void 0===e&&(e=!0),void 0===i&&(i=!1),t&&t.hasOwnProperty("wordWrap")){var s=t.wordWrap;s.hasOwnProperty("width")&&(t.wrap={mode:"word",width:s.width})}if(t&&t.hasOwnProperty("wrap")){var r=t.wrap;if(r.hasOwnProperty("mode")){var n=r.mode;"string"==typeof n&&(r.mode=w[n])}else r.hasOwnProperty("width")&&(r.mode=1)}t&&t.rtl&&i&&!t.hasOwnProperty("halign")&&(t.halign="right"),t&&t.hasOwnProperty("fontSize")&&"number"==typeof t.fontSize&&(t.fontSize=t.fontSize.toString()+"px");var a=this.propertyMap;for(var h in a){var l=a[h],u=l[0],g=i?l[1]:this[h],c=l[2];if("wrapCallback"===h||"wrapCallbackScope"===h)this[h]=E(t,u,g);else{var p=S(t,u,g);c&&(p=c(p)),this[h]=p}}var f=E(t,"font",null);this._font=null===f?this.fontStyle+" "+this.fontSize+" "+this.fontFamily:f;var v=E(t,"fill",null);null!==v&&(this.color=o(v));var x=E(t,"metrics",!1);return x?this.metrics={ascent:E(x,"ascent",0),descent:E(x,"descent",0),fontSize:E(x,"fontSize",0)}:!e&&this.metrics||(this.metrics=d(this)),e?this.parent.updateText():this.parent}syncFont(t,e){e.font=this._font}syncStyle(t,e){e.textBaseline="alphabetic",e.fillStyle=this.color,e.strokeStyle=this.stroke,e.lineWidth=this.strokeThickness,e.lineCap="round",e.lineJoin="round"}syncShadow(t,e){e?(t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY,t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur):(t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowColor=0,t.shadowBlur=0)}update(t){return t&&(this._font=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim(),this.metrics=d(this)),this.parent.updateText(t)}buildFont(){var t=`${this.fontStyle} ${this.fontSize} ${this.fontFamily}`.trim();return t!==this._font&&(this._font=t),this}setFont(t){return"string"==typeof t?(this.fontFamily=t,this.fontSize="",this.fontStyle=""):(this.fontFamily=E(t,"fontFamily","Courier"),this.fontSize=E(t,"fontSize","16px"),this.fontStyle=E(t,"fontStyle","")),this.update(!0)}setFontFamily(t){return this.fontFamily=t,this.update(!0)}setFontStyle(t){return this.fontStyle=t,this.update(!0)}setFontSize(t){return"number"==typeof t&&(t=t.toString()+"px"),this.fontSize=t,this.update(!0)}setTestString(t){return this.testString=t,this.update(!0)}setFixedSize(t,e){return this.fixedWidth=t,this.fixedHeight=e,t&&(this.parent.width=t),e&&(this.parent.height=e),this.update(this.isWrapFitMode)}setResolution(t){return this.resolution=t,this.update(!1)}setXOffset(t){return this.xOffset=t,this.update(!1)}setBackgroundColor(t,e,i){return void 0===i&&(i=!0),this.backgroundColor=o(t,this.parent.canvas,this.parent.context),this.backgroundColor2=o(e,this.parent.canvas,this.parent.context),this.backgroundHorizontalGradient=i,this.update(!1)}setBackgroundStrokeColor(t,e){return this.backgroundStrokeColor=o(t,this.parent.canvas,this.parent.context),this.backgroundStrokeLineWidth=e,this.update(!1)}setBackgroundCornerRadius(t,e){return this.backgroundCornerRadius=t,this.backgroundCornerIteration=e,this.update(!1)}setFill(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setColor(t){return this.color=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStroke(t,e){return void 0===t?this.strokeThickness=0:(void 0===e&&(e=this.strokeThickness),this.stroke=o(t,this.parent.canvas,this.parent.context),this.strokeThickness=e),this.update(!0)}setShadow(t,e,i,s,r,n){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="#000"),void 0===s&&(s=0),void 0===r&&(r=!1),void 0===n&&(n=!0),this.shadowOffsetX=t,this.shadowOffsetY=e,this.shadowColor=o(i,this.parent.canvas,this.parent.context),this.shadowBlur=s,this.shadowStroke=r,this.shadowFill=n,this.update(!1)}setShadowOffset(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.shadowOffsetX=t,this.shadowOffsetY=e,this.update(!1)}setShadowColor(t){return void 0===t&&(t="#000"),this.shadowColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setShadowBlur(t){return void 0===t&&(t=0),this.shadowBlur=t,this.update(!1)}setShadowStroke(t){return this.shadowStroke=t,this.update(!1)}setShadowFill(t){return this.shadowFill=t,this.update(!1)}setUnderline(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.underlineThickness=e,this.underlineOffset=i,this.update(!1)}setUnderlineColor(t){return void 0===t&&(t="#000"),this.underlineColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setUnderlineThickness(t){return void 0===t&&(t=0),this.underlineThickness=t,this.update(!1)}setUnderlineOffset(t){return void 0===t&&(t=0),this.underlineOffset=t,this.update(!1)}setStrikethrough(t,e,i){return void 0===t&&(t="#000"),void 0===e&&(e=0),void 0===i&&(i=0),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.strikethroughThickness=e,this.strikethroughOffset=i,this.update(!1)}setStrikethroughColor(t){return void 0===t&&(t="#000"),this.strikethroughColor=o(t,this.parent.canvas,this.parent.context),this.update(!1)}setStrikethroughThickness(t){return void 0===t&&(t=0),this.strikethroughThickness=t,this.update(!1)}setStrikethroughOffset(t){return void 0===t&&(t=0),this.strikethroughOffset=t,this.update(!1)}setWrapMode(t){return"string"==typeof t&&(t=w[t.toLowerCase()]||0),this.wrapMode=t,this.update(!0)}setWrapWidth(t){return this.wrapWidth=t,this.update(!1)}setAlign(t,e){return void 0===t&&(t="left"),void 0===e&&(e="top"),this.halign=t,this.valign=e,this.update(!1)}setHAlign(t){return void 0===t&&(t="left"),this.halign=t,this.update(!1)}setVAlign(t){return void 0===t&&(t="top"),this.valign=t,this.update(!1)}setMaxLines(t){return void 0===t&&(t=0),this.maxLines=t,this.update(!1)}getTextMetrics(){var t=this.metrics;return{ascent:t.ascent,descent:t.descent,fontSize:t.fontSize}}setTextMetrics(t,e){return this.metrics.ascent=t.ascent,this.metrics.descent=t.descent,this.metrics.fontSize=t.fontSize,e&&("string"==typeof e?(this.fontFamily=e,this.fontSize="",this.fontStyle=""):(this.fontFamily=E(e,"fontFamily",this.fontFamily),this.fontSize=E(e,"fontSize",this.fontSize),this.fontStyle=E(e,"fontStyle",this.fontStyle))),this.parent.updateText(!0)}get lineHeight(){return this.metrics.fontSize+this.parent.lineSpacing}toJSON(){var t={},e=this.propertyMap;for(var i in e)t[i]=this[i];return t.metrics=this.getTextMetrics(),t}destroy(){this.parent=void 0}}const m=Phaser.Utils.Objects.GetValue;class T{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=m(t,"x",0),i=m(t,"y",0));var s=this.cornerRadius;s.tl=R(m(t,"tl",void 0),e,i),s.tr=R(m(t,"tr",void 0),e,i),s.bl=R(m(t,"bl",void 0),e,i),s.br=R(m(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){_(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){_(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){_(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){_(this.cornerRadius.br,t)}}var R=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),k(t),t},_=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=m(e,"x",0),t.y=m(e,"y",0)),k(t)},k=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)};const P=Phaser.Math.DegToRad;var C=function(t){return!t.hasOwnProperty("convex")||t.convex},b=function(t){return t.x>0&&t.y>0},L=function(t,e,i,s,r,n,a,h,o){if(h&&a>n?a-=360:!h&&a=c?1:s/c,v=r>=p?1:r/p,x=g.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),h=x.tl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,l,o,l,180,270,!1,a):L(t,0,0,o,l,90,0,!0,a),u=0,d=l):(t.lineTo(0,0),u=0,d=0),h=x.tr,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,l,o,l,270,360,!1,a):L(t,s,0,o,l,180,90,!0,a)):t.lineTo(s,0),h=x.br,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,s-o,r-l,o,l,0,90,!1,a):L(t,s,r,o,l,270,180,!0,a)):t.lineTo(s,r),h=x.bl,b(h)?(o=h.x*f,l=h.y*v,C(h)?L(t,o,r-l,o,l,90,180,!1,a):L(t,0,r,o,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(u,d),t.closePath(),t.restore()}(e,i,s,r,n,a,g),null!=h)&&(null!=u&&((c=d?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,h),c.addColorStop(1,u),h=c),e.fillStyle=h,e.fill());null!=o&&l>0&&(e.strokeStyle=o,e.lineWidth=l,e.stroke())},A={draw(t,e,i,s){var r=this.penManager;this.hitAreaManager.clear();var n=this.context;n.save();var a=this.defaultStyle;this.clear(),function(t,e,i,s,r,n,a,h){if(null!=e||null!=i){var o=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var u=s/2;o=Math.max(1,o-s),l=Math.max(1,l-s),M(t.canvas,t.context,u,u,o,l,r,e,i,s,n,a,h)}}(this,a.backgroundColor,a.backgroundStrokeColor,a.backgroundStrokeLineWidth,a.backgroundCornerRadius,a.backgroundColor2,a.backgroundHorizontalGradient,a.backgroundCornerIteration);var h=this.parent,o=h.padding,l=h.width-o.left-o.right,u=h.height-o.top-o.bottom,d=this.linesHeight,g=l>0&&u>0,c=h.style.fixedHeight>0,p=d>u,f=a.maxLines,v=f<=0&&"top"===a.valign&&g&&c&&p,x=v;x&&(n.save(),n.beginPath(),n.rect(o.left,o.top,l,u),n.clip()),t+=this.startXOffset,e+=this.startYOffset;var y,w,S,E,O,m,T=a.halign,R=a.valign,_=r.lines,k=_.length;if(v&&k>0){var P=-h.scrollY,C=P+u;S=function(t,e){for(var i=0,s=t.length-1,r=t.length;i<=s;){var n=i+s>>1;t[n].endOffset>e?(r=n,s=n-1):i=n+1}return r}(_,P),E=function(t,e){for(var i=0,s=t.length-1,r=t.length;i<=s;){var n=i+s>>1;t[n].startOffset>=e?(r=n,s=n-1):i=n+1}return r}(_,C),S<0&&(S=0),E>k&&(E=k),E0&&k>f?(w=f,E=(S="center"===R?Math.floor((k-w)/2):"bottom"===R?k-w:0)+w):(S=0,E=k);var b=this.rtl,L=b?this.parent.width:void 0;if(v)m=e;else{var A=this.getLinesHeight(S,E);m="center"===R?Math.max((s-A)/2,0):"bottom"===R?Math.max(s-A-2,0):0,m+=e}for(var F=S;F0){var o=this.defaultStyle.metrics,l=i-o.ascent,u=o.fontSize;this.drawRectangle(e,l,t.width,u,h.bgcolor,h)}if(h.underlineThickness>0&&t.width>0){var d=i+h.underlineOffset-h.underlineThickness/2;this.drawLine(e,d,t.width,h.underlineThickness,h.underlineColor,h)}if(t.isTextPen&&(h.buildFont(),h.syncFont(n,a),h.syncStyle(n,a),this.drawText(e,i,t.text,h)),t.isImagePen&&this.drawImage(e,i,t.prop.img,t.prop.color,h),h.strikethroughThickness>0&&t.width>0&&(d=i+h.strikethroughOffset-h.strikethroughThickness/2,this.drawLine(e,d,t.width,h.strikethroughThickness,h.strikethroughColor,h)),a.restore(),t.hasAreaMarker&&t.width>0){var g,c=t.prop.area;if(c)g={key:c};else{var p=t.prop.url;g={key:`url:${p}`,url:p}}this.hitAreaManager.add(e,i-this.startYOffset,t.width,r||this.defaultStyle.lineHeight,g)}},clear(){var t=this.canvas;this.context.clearRect(0,0,t.width,t.height)},drawRectangle(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;a.fillStyle=r,a.fillRect(t,e,i,s)},drawLine(t,e,i,s,r,n){this.autoRound&&(t=Math.round(t),e=Math.round(e));var a=this.context;n.syncShadow(a,n.shadowStroke);var h=a.lineCap;a.lineCap="butt",a.strokeStyle=r,a.lineWidth=s,a.beginPath(),a.moveTo(t,e),a.lineTo(t+i,e),a.stroke(),a.lineCap=h},drawText(t,e,i,s){this.autoRound&&(t=Math.round(t),e=Math.round(e));var r=this.context,n=s.letterSpacing;if(0===n)s.stroke&&"none"!==s.stroke&&s.strokeThickness>0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(i,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(i,t,e));else for(var a=i.split(""),h=0,o=a.length;h0&&(s.syncShadow(r,s.shadowStroke),r.strokeText(l,t,e)),s.color&&"none"!==s.color&&(s.syncShadow(r,s.shadowFill),r.fillText(l,t,e)),t+=r.measureText(l).width+n}},drawImage(t,e,i,s,r){e-=this.startYOffset,this.parent.imageManager.draw(i,this.context,t,e,s,this.autoRound)}};const F=Phaser.Utils.Objects.GetValue,I=g,N=c;class H{constructor(t){this.prop={},this.resetFromJSON(t)}resetFromJSON(t){this.text=F(t,"text",""),this.x=F(t,"x",0),this.y=F(t,"y",0),this.width=F(t,"width",0),this.ascent=F(t,"ascent",0),this.descent=F(t,"descent",0);var e=F(t,"height",null);null==e&&(e=this.ascent+this.descent),this.height=e;var i=F(t,"prop",null);null===i&&(i={}),this.prop=i,this.newLineMode=F(t,"newLineMode",0),this.startIndex=F(t,"startIndex",0)}get plainText(){var t=this.text;return this.newLineMode===N&&(t+="\n"),t}get wrapText(){var t=this.text;return this.newLineMode!==I&&(t+="\n"),t}get rawTextLength(){var t=this.text.length;return this.newLineMode===N&&(t+=1),t}get endIndex(){return this.startIndex+this.rawTextLength}get lastX(){return this.x+this.width}get isTextPen(){return""!==this.text}get isImagePen(){return!!this.prop.img}get hasAreaMarker(){return!!this.prop.area||!!this.prop.url}}class W{constructor(t){this.pens=t||[],this.maxAscent=0,this.maxDescent=0,this.lineHeight=0,this.startOffset=0,this.endOffset=0}reset(){return this.pens.length=0,this.maxAscent=0,this.maxDescent=0,this.lineHeight=0,this.startOffset=0,this.endOffset=0,this}addPen(t){return this.pens.push(t),t.ascent>this.maxAscent&&(this.maxAscent=t.ascent),t.descent>this.maxDescent&&(this.maxDescent=t.descent),this}get length(){return this.pens.length}get lastPen(){return this.pens[this.pens.length-1]}}var Y=function(t,e){var i=Array.isArray(t);if(void 0===e?e=i?[]:{}:function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(e),i){e.length=t.length;for(var s=0,r=t.length;s=this.lines.length)return this.getLineEndIndex(t);var e=this.lines[t],i=e&&e.pens?e.pens:e;return i&&i[0]?i[0].startIndex:0}getLineEndIndex(t){t>=this.lines.length&&(t=this.lines.length-1);var e,i,s=!1;for(e=t;e>=0;e--){var r;if(s=null!=(r=(i=this.lines[e])&&i.pens?i.pens:i)&&r.length>0)break}return s?(r=i&&i.pens?i.pens:i)[r.length-1].endIndex:0}getLineWidth(t){var e=this.lines[t];if(!e)return 0;var i=e&&e.pens?e.pens:e,s=i[i.length-1];return null==s?0:s.lastX}getMaxLineWidth(){if(void 0!==this.maxLinesWidth)return this.maxLinesWidth;for(var t,e=0,i=0,s=this.lines.length;ie&&(e=t);return this.maxLinesWidth=e,e}getLineWidths(){for(var t=[],e=0,i=this.lines.length;e=t&&o<=e||(a=a.substring(t-h,e-h)),this.tagToTextScope?d+=this.tagToText.call(this.tagToTextScope,a,l,u):d+=this.tagToText(a,l,u),u=l,!(o>=e)));g++);return d}get length(){return this.lines.length}set length(t){this.clear()}}var U={};class X{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const j=Phaser.Geom.Rectangle;var K=new X;class V{constructor(){this.hitAreas=[]}destroy(){this.clear()}clear(){for(var t=0,e=this.hitAreas.length;ts&&xt(v)){""!==S?h.push(a.getLine(S,E,ut)):0===O&&n>0&&h.push(a.getLine("",0,ut)),h.push(...ft(v,e,ct,s,r,0,a));var T=h.pop();S=T.text,E=T.width,a.freeLine(T)," "===S&&(S="",E=0)}else(y=E+x)>l?(h.push(a.getLine(S,E,ut)),S=v,E=x,l=s):(S+=v,E=y);O===m-1&&h.push(a.getLine(S,E,u))}}return h},vt=function(t,e){var i;switch(e){case gt:i=[];for(var s=0,r=(t=t.split(" ")).length;s0){var u=this.defaultStyle.metrics.ascent,d=l-u;d<0&&(d=0),h={ascent:u,descent:d,height:u+d}}return s>0&&r!==wt&&s0&&t>e&&(t=e),t}get linesWidth(){return Math.ceil(this.penManager.getMaxLineWidth())}get linesHeight(){var t=this.displayLinesCount;return this.getLinesHeight(0,t)}getLineHeight(t){var e=t?t.lineHeight:0;if(e>0)return e;var i=this.defaultStyle.metrics;return i.ascent+i.descent}getLinesHeight(t,e){var i=this.penManager.lines,s=i.length;if(void 0===t&&(t=0),(void 0===e||e>s)&&(e=s),e<=t)return 0;for(var r=0,n=t;n1&&(r+=this.defaultStyle.lineSpacing*(a-1)),r}get imageManager(){return this.parent.imageManager}get rtl(){return this.parent.style.rtl}newPenManager(){return new D({pensPool:this.pensPool,linesPool:this.linesPool,tagToText:this.parser.propToTagText,tagToTextScope:this.parser})}get tmpPenManager(){return null===this._tmpPenManager&&(this._tmpPenManager=this.newPenManager()),this._tmpPenManager}getPlainText(t,e,i){var s;if(null==t)s=this.penManager.plainText;else{var r=this.parser.splitText(t,1);s="";for(var n=0,a=r.length;n0?-t:0}get scrollY(){return this._scrollY}set scrollY(t){this._scrollY!==t&&(this._scrollY=t,this.updateText(!1))}setScrollY(t,e){return void 0===e&&(e=!1),e&&(t=Yt(t,this.bottomScrollY,this.topScrollY)),this.scrollY=t,this}addScrollY(t,e){return this.setScrollY(this.scrollY+t,e)}get t(){var t=this.bottomScrollY;return 0===t?0:this._scrollY/t}set t(t){this.setT(t)}setT(t,e){void 0===e&&(e=!1),e&&(t=Yt(t,0,1));var i=this.bottomScrollY*t;return this.setScrollY(i,!1)}addT(t,e){return this.setT(this.t+t,e)}scrollToTop(){return this.setScrollY(this.topScrollY)}scrollToBottom(){return this.setScrollY(this.bottomScrollY)}initRTL(){this.style.rtl&&(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Mt(this.canvas,this.scene.sys.canvas),this.originX=1)}setRTL(t){void 0===t&&(t=!0);var e=this.style;if(e.rtl===t)return this;if(e.rtl=t,t?(this.canvas.dir="rtl",this.context.direction="rtl",this.canvas.style.display="none",Mt(this.canvas,this.scene.sys.canvas)):(this.canvas.dir="ltr",this.context.direction="ltr"),"left"===e.halign?e.halign="right":"right"===e.halign&&(e.halign="left"),this._imageManager){var i=this._imageManager.images;for(var s in i)i[s].originX=1-i[s].originX}return this}setText(t){return(t=function(t){return null==t?t="":Array.isArray(t)?t=t.join("\n"):"number"==typeof t&&(t=t.toString()),t}(t))===this._text||(this._text=t,this.updateText()),this}setPadding(t,e,i,s){if("object"==typeof t){var r=t,n=It(r,"x",null);null!==n?(t=n,i=n):(t=It(r,"left",0),i=It(r,"right",t));var a=It(r,"y",null);null!==a?(e=a,s=a):(e=It(r,"top",0),s=It(r,"bottom",e))}else void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=t),void 0===s&&(s=e);return this.padding.left=t,this.padding.top=e,this.padding.right=i,this.padding.bottom=s,this.updateText(!1)}updateText(t){void 0===t&&(t=!0);var e=this.canvasText,i=this.style;t&&e.updatePenManager(this._text,i.wrapMode,i.wrapWidth,i.lineHeight);var s,r,n=this.padding,a=Math.ceil(e.linesWidth);0===i.fixedWidth?(this.width=a+n.left+n.right,s=a):(this.width=i.fixedWidth,(s=this.width-n.left-n.right)