PageSourceSearch

https://tools.fthux.com/_nuxt/DyGDY7Wc.js

js fthux.com collected 2026-09-24 14:14:28 UTC 32,736 bytes, 9 lines download raw bytes

1import{D as et,d as U,f as Y,M as lt,F as nt,h as Q,w as rt,E as wt,b as Lt,i as V,t as ct,j as dt,k as R,l as j,m as ut,R as it,I as At,o as D,p as vt}from"./Up0cWS5N.js";import{C as ft}from"./Bf7ENlU8.js";import"./DzfUrCz9.js";class Mt{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++){const s=t[i];e[i]=[s,this.get(s)]}return e}evict(t=!1){if(t||this.size>0){const e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;e!==null;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let s=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(s={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=n:this.last.next=n,this.last=n}return s}set(t,e,i=!1,s=this.resetTtl){let n=this.items[t];return i||n!==void 0?(n.value=e,i===!1&&s&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(n)):(this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=n:this.last.next=n,this.last=n),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function _t(r=1e3,t=0,e=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof e!="boolean")throw new TypeError("Invalid resetTtl value");return new Mt(r,t,e)}function yt(r){return!!r.tagStyles&&Object.keys(r.tagStyles).length>0}function Wt(r){return r.includes("<")}function Et(r,t){return r.clone().assign(t)}function Pt(r,t){const e=[],i=t.tagStyles;if(!yt(t)||!Wt(r))return e.push({text:r,style:t}),e;const s=[t],n=[];let o="",a=0;for(;a<r.length;){const h=r[a];if(h==="<"){const l=r.indexOf(">",a);if(l===-1){o+=h,a++;continue}const c=r.slice(a+1,l);if(c.startsWith("/")){const d=c.slice(1).trim();if(n.length>0&&n[n.length-1]===d){o.length>0&&(e.push({text:o,style:s[s.length-1]}),o=""),s.pop(),n.pop(),a=l+1;continue}else{o+=r.slice(a,l+1),a=l+1;continue}}else{const d=c.trim();if(i[d]){o.length>0&&(e.push({text:o,style:s[s.length-1]}),o="");const m=s[s.length-1],y=Et(m,i[d]);s.push(y),n.push(d),a=l+1;continue}else{o+=r.slice(a,l+1),a=l+1;continue}}}else o+=h,a++}return o.length>0&&e.push({text:o,style:s[s.length-1]}),e}const It=[10,13],Ht=new Set(It),Ot=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Rt=new Set(Ot),jt=/(\r\n|\r|\n)/,Nt=/(?:\r\n|\r|\n)/;function ot(r){return typeof r!="string"?!1:Ht.has(r.charCodeAt(0))}function I(r,t){return typeof r!="string"?!1:Rt.has(r.charCodeAt(0))}function kt(r){return r==="normal"||r==="pre-line"}function Ft(r){return r==="normal"}function O(r){if(typeof r!="string")return"";let t=r.length-1;for(;t>=0&&I(r[t]);)t--;return t<r.length-1?r.slice(0,t+1):r}function Ct(r){const t=[],e=[];if(typeof r!="string")return t;for(let i=0;i<r.length;i++){const s=r[i],n=r[i+1];if(I(s)||ot(s)){e.length>0&&(t.push(e.join("")),e.length=0),s==="\r"&&n===`
2`?(t.push(`\r
3`),i++):t.push(s);continue}e.push(s)}return e.length>0&&t.push(e.join("")),t}function Tt(r,t,e,i){const s=e(r),n=[];for(let o=0;o<s.length;o++){let a=s[o],h=a,l=1;for(;s[o+l];){const c=s[o+l];if(!i(h,c,r,o,t))a+=c,h=c,l++;else break}o+=l-1,n.push(a)}return n}const Gt=/\r\n|\r|\n/g;function $t(r,t,e,i,s,n,o,a){const h=Pt(r,t);if(Ft(t.whiteSpace))for(let B=0;B<h.length;B++){const A=h[B];h[B]={text:A.text.replace(Gt," "),style:A.style}}const c=[];let d=[];for(const B of h){const A=B.text.split(jt);for(let E=0;E<A.length;E++){const v=A[E];v===`\r
4`||v==="\r"||v===`
5`?(c.push(d),d=[]):v.length>0&&d.push({text:v,style:B.style})}}(d.length>0||c.length===0)&&c.push(d);const m=e?Dt(c,t,i,s,o,a):c,y=[],C=[],F=[],w=[],u=[];let g=0;const W=t._fontString,x=n(W);x.fontSize===0&&(x.fontSize=t.fontSize,x.ascent=t.fontSize);let f="",_=!!t.dropShadow;for(const B of m){let A=0,E=x.ascent,v=x.descent,M="";for(const H of B){const $=H.style._fontString,q=n($);$!==f&&(i.font=$,f=$);const X=s(H.text,H.style.letterSpacing,i);A+=X,E=Math.max(E,q.ascent),v=Math.max(v,q.descent),M+=H.text,!_&&H.style.dropShadow&&(_=!0)}B.length===0&&(E=x.ascent,v=x.descent),y.push(A),C.push(E),F.push(v),u.push(M);const P=t.lineHeight||E+v;w.push(P+t.leading),g=Math.max(g,A)}const T=t._stroke?.width||0,G=(e&&t.align!=="left"&&t.align!=="justify"?Math.max(g,t.wordWrapWidth):g)+T+(t.dropShadow?t.dropShadow.distance:0);let k=0;for(let B=0;B<w.length;B++)k+=w[B];k=Math.max(k,w[0]+T);const L=k+(t.dropShadow?t.dropShadow.distance:0),b=t.lineHeight||x.fontSize;return{width:G,height:L,lines:u,lineWidths:y,lineHeight:b+t.leading,maxLineWidth:g,fontProperties:x,runsByLine:m,lineAscents:C,lineDescents:F,lineHeights:w,hasDropShadow:_}}function Dt(r,t,e,i,s,n){const{letterSpacing:o,whiteSpace:a,wordWrapWidth:h,breakWords:l}=t,c=kt(a),d=h+o,m={};let y="";const C=(w,u)=>{const g=`${w}|${u.styleKey}`;let W=m[g];if(W===void 0){const x=u._fontString;x!==y&&(e.font=x,y=x),W=i(w,u.letterSpacing,e)+u.letterSpacing,m[g]=W}return W},F=[];for(const w of r){const u=Kt(w),g=F.length,W=k=>{let L=0,b=k;do{const{token:B,style:A}=u[b];L+=C(B,A),b++}while(b<u.length&&u[b].continuesFromPrevious);return L},x=k=>{const L=[];let b=k;do L.push({token:u[b].token,style:u[b].style}),b++;while(b<u.length&&u[b].continuesFromPrevious);return L};let f=[],_=0,T=!c,S=null;const z=()=>{S&&S.text.length>0&&f.push(S),S=null},G=()=>{if(z(),f.length>0){const k=f[f.length-1];k.text=O(k.text),k.text.length===0&&f.pop()}F.push(f),f=[],_=0,T=!1};for(let k=0;k<u.length;k++){const{token:L,style:b,continuesFromPrevious:B}=u[k],A=C(L,b);
5if(c){const M=I(L),P=S?.text[S.text.length-1]??f[f.length-1]?.text.slice(-1)??"",H=P?I(P):!1;if(M&&H)continue}const E=!B,v=E?W(k):A;if(v>d&&E)if(_>0&&G(),l){const M=x(k);for(let P=0;P<M.length;P++){const H=M[P].token,$=M[P].style,q=Tt(H,l,n,s);for(const X of q){const ht=C(X,$);ht+_>d&&G(),!S||S.style!==$?(z(),S={text:X,style:$}):S.text+=X,_+=ht}}k+=M.length-1}else{const M=x(k);z(),F.push(M.map(P=>({text:P.token,style:P.style}))),T=!1,k+=M.length-1}else if(v+_>d&&E){if(I(L)){T=!1;continue}G(),S={text:L,style:b},_=A}else if(B&&!l)!S||S.style!==b?(z(),S={text:L,style:b}):S.text+=L,_+=A;else{const M=I(L);if(_===0&&M&&!T)continue;!S||S.style!==b?(z(),S={text:L,style:b}):S.text+=L,_+=A}}if(z(),f.length>0){const k=f[f.length-1];k.text=O(k.text),k.text.length===0&&f.pop()}(f.length>0||F.length===g)&&F.push(f)}return F}function Kt(r){const t=[];let e=!1;for(const i of r){const s=Ct(i.text);let n=!0;for(const o of s){const a=I(o)||ot(o),h=n&&e&&!a;t.push({token:o,style:i.style,continuesFromPrevious:h}),e=!a,n=!1}}return t}const Vt={willReadFrequently:!0};function pt(r,t,e,i,s){let n=e[r];return typeof n!="number"&&(n=s(r,t,i)+t,e[r]=n),n}function Yt(r,t,e,i,s,n,o){const a=e.getContext("2d",Vt);a.font=t._fontString;let h=0,l="";const c=[],d=Object.create(null),{letterSpacing:m,whiteSpace:y}=t,C=kt(y),F=Ft(y);let w=!C;const u=t.wordWrapWidth+m,g=Ct(r);for(let x=0;x<g.length;x++){let f=g[x];if(ot(f)){if(!F){c.push(O(l)),w=!C,l="",h=0;continue}f=" "}if(C){const T=I(f),S=I(l[l.length-1]);if(T&&S)continue}const _=pt(f,m,d,a,i);if(_>u)if(l!==""&&(c.push(O(l)),l="",h=0),s(f,t.breakWords)){const T=Tt(f,t.breakWords,o,n);for(const S of T){const z=pt(S,m,d,a,i);z+h>u&&(c.push(O(l)),w=!1,l="",h=0),l+=S,h+=z}}else l.length>0&&(c.push(O(l)),l="",h=0),c.push(O(f)),w=!1,l="",h=0;else _+h>u&&(w=!1,c.push(O(l)),l="",h=0),(l.length>0||!I(f)||w)&&(l+=f,h+=_)}const W=O(l);return W.length>0&&c.push(W),c.join(`
6`)}const gt={willReadFrequently:!0},N=class p{static get experimentalLetterSpacingSupported(){let t=p._experimentalLetterSpacingSupported;if(t===void 0){const e=et.get().getCanvasRenderingContext2D().prototype;t=p._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,h,l,c){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",e,i=p._canvas,s=e.wordWrap){const n=`${t}-${e.styleKey}-wordWrap-${s}`;if(p._measurementCache.has(n))return p._measurementCache.get(n);if(yt(e)&&Wt(t)){const f=$t(t,e,s,p._context,p._measureText,p.measureFont,p.canBreakChars,p.wordWrapSplit),_=new p(t,e,f.width,f.height,f.lines,f.lineWidths,f.lineHeight,f.maxLineWidth,f.fontProperties,{runsByLine:f.runsByLine,lineAscents:f.lineAscents,lineDescents:f.lineDescents,lineHeights:f.lineHeights,hasDropShadow:f.hasDropShadow});return p._measurementCache.set(n,_),_}const a=e._fontString,h=p.measureFont(a);h.fontSize===0&&(h.fontSize=e.fontSize,h.ascent=e.fontSize,h.descent=0);const l=p._context;l.font=a;const d=(s?p._wordWrap(t,e,i):t).split(Nt),m=new Array(d.length);let y=0;for(let f=0;f<d.length;f++){const _=p._measureText(d[f],e.letterSpacing,l);m[f]=_,y=Math.max(y,_)}const C=e._stroke?.width??0,F=e.lineHeight||h.fontSize,w=p._getAlignWidth(y,e,s),u=p._adjustWidthForStyle(w,e),g=Math.max(F,h.fontSize+C)+(d.length-1)*(F+e.leading),W=p._adjustHeightForStyle(g,e),x=new p(t,e,u,W,d,m,F+e.leading,y,h);return p._measurementCache.set(n,x),x}static _adjustWidthForStyle(t,e){const i=e._stroke?.width||0;let s=t+i;return e.dropShadow&&(s+=e.dropShadow.distance),s}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _getAlignWidth(t,e,i){return i&&e.align!=="left"&&e.align!=="justify"?Math.max(t,e.wordWrapWidth):t}static _measureText(t,e,i){let s=!1;p.experimentalLetterSpacingSupported&&(p.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}
6px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));const n=i.measureText(t);let o=n.width;const a=-(n.actualBoundingBoxLeft??0);let l=(n.actualBoundingBoxRight??0)-a;if(o>0)if(s)o-=e,l-=e;else{const c=(p.graphemeSegmenter(t).length-1)*e;o+=c,l+=c}return Math.max(o,l)}static _wordWrap(t,e,i=p._canvas){return Yt(t,e,i,p._measureText,p.canBreakWords,p.canBreakChars,p.wordWrapSplit)}static isBreakingSpace(t,e){return I(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return p.graphemeSegmenter(t)}static measureFont(t){if(p._fonts[t])return p._fonts[t];const e=p._context;e.font=t;const i=e.measureText(p.METRICS_STRING+p.BASELINE_SYMBOL),s=i.actualBoundingBoxAscent??0,n=i.actualBoundingBoxDescent??0,o={ascent:s,descent:n,fontSize:s+n};return p._fonts[t]=o,o}static clearMetrics(t=""){t?delete p._fonts[t]:p._fonts={}}static get _canvas(){if(!p.__canvas){let t;try{const e=new OffscreenCanvas(0,0);if(e.getContext("2d",gt)?.measureText)return p.__canvas=e,e;t=et.get().createCanvas()}catch{t=et.get().createCanvas()}t.width=t.height=10,p.__canvas=t}return p.__canvas}static get _context(){return p.__context||(p.__context=p._canvas.getContext("2d",gt)),p.__context}};N.METRICS_STRING="|ÉqÅ";N.BASELINE_SYMBOL="M";N.BASELINE_MULTIPLIER=1.4;N.HEIGHT_MULTIPLIER=2;N.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){const r=new Intl.Segmenter;return t=>{const e=r.segment(t),i=[];let s=0;for(const n of e)i[s++]=n.segment;return i}}return r=>[...r]})();N.experimentalLetterSpacing=!1;N._fonts={};N._measurementCache=_t(1e3);let Z=N;const Xt=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function st(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!Xt.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}function St(r,t,e,i=0,s=0,n=0){if(r.texture===U.WHITE&&!r.fill)return Y.shared.setValue(r.color).setAlpha(r.alpha??1).toHexa();if(r.fill){if(r.fill instanceof nt){const o=r.fill,a=t.createPattern(o.texture.source.resource,"repeat"),h=o.transform.copyTo(lt.shared);return h.scale(o.texture.source.pixelWidth,o.texture.source.pixelHeight),a.setTransform(h),a}else if(r.fill instanceof Q){const o=r.fill,a=o.type==="linear";o.textureSpace;let h=1,l=1,c;if(a){const{start:d,end:m}=o;c=t.createLinearGradient(d.x*h+s,d.y*l+n,m.x*h+s,m.y*l+n),Math.abs(m.x-d.x)<Math.abs((m.y-d.y)*.1)}else{const{center:d,innerRadius:m,outerCenter:y,outerRadius:C}=o;c=t.createRadialGradient(d.x*h+s,d.y*l+n,m*h,y.x*h+s,y.y*l+n,C*h)}return o.colorStops.forEach(d=>{c.addColorStop(d.offset,Y.shared.setValue(d.color).toHex())}),c}}else{const o=t.createPattern(r.texture.source.resource,"repeat"),a=r.matrix.copyTo(lt.shared);return a.scale(r.texture.source.pixelWidth,r.texture.source.pixelHeight),o.setTransform(a),o}return rt("FillStyle not recognised",r),"red"}const at=class K extends wt{constructor(t={}){super(),this.uid=Lt("textStyle"),this._tick=0,this._cachedFontString=null,Ut(t),t instanceof K&&(t=t._toObject());const s={...K.defaultTextStyle,...t};for(const n in s){const o=n;this[o]=s[n]}this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...K.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...K.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...V.defaultFillStyle,...t},()=>{this._fill=ct({...this._originalFill},V.defaultFillStyle)})),this._fill=ct(t===0?"black":t,V.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...V.defaultStrokeStyle,...t},()=>{this._stroke=dt({...this._originalStroke},V.defaultStrokeStyle)}
6)),this._stroke=dt(t,V.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const t=K.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(t){for(const e in t){const i=e;this[i]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=st(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new K(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){const i=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(i),this._originalFill?.texture&&this._originalFill.texture.destroy(i),this._stroke?.texture&&this._stroke.texture.destroy(i),this._originalStroke?.texture&&this._originalStroke.texture.destroy(i)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,n)=>(i[s]===n||(i[s]=n,e?.(s,n),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(Y.isColorLike(t)||t instanceof Q||t instanceof nt)}};at.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};at.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let tt=at;function Ut(r){const t=r;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=tt.defaultDropShadow;r.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){R(j,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(Y.isColorLike(e))i.color=e;else if(e instanceof Q||e instanceof nt)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");r.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(R(j,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&rt("The number of fill colors must match the number of fill gradient stops.");const e=new Q({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),i=t.fillGradientStops.slice(),s=t.fill.map(n=>Y.shared.setValue(n).toNumber());i.forEach((n,o)=>{e.addColorStop(n,s[o])}),r.fill={fill:e}}}class bt extends wt{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return R(j,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return R(j,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return R(j,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return R(j,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return R(j,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}
6destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(const e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}const Bt=class zt extends bt{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const e={...zt.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;const i=e.style.clone();e.overrideFill&&(i._fill.color=16777215,i._fill.alpha=1,i._fill.texture=U.WHITE,i._fill.fill=null),this.applyFillAsTint=e.overrideFill;const s=i.fontSize;i.fontSize=this.baseMeasurementFontSize;const n=st(i);e.overrideSize?i._stroke&&(i._stroke.width*=this.baseRenderedFontSize/s):i.fontSize=this.baseRenderedFontSize=s,this._style=i,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,e.textureStyle&&(this._textureStyle=e.textureStyle instanceof ut?e.textureStyle:new ut(e.textureStyle)),this.fontMetrics=Z.measureFont(n),this.lineHeight=i.lineHeight||this.fontMetrics.fontSize||i.fontSize}ensureCharacters(t){const e=Z.graphemeSegmenter(t).filter(w=>!this._currentChars.includes(w)).filter((w,u,g)=>g.indexOf(w)===u);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:s,context:n}=i.canvasAndContext,o=i.texture.source;const a=this._style;let h=this._currentX,l=this._currentY,c=this._currentMaxCharHeight;const d=this.baseRenderedFontSize/this.baseMeasurementFontSize,m=this._padding*d;let y=!1;const C=s.width/this.resolution,F=s.height/this.resolution;for(let w=0;w<e.length;w++){const u=e[w],g=Z.measureText(u,a,s,!1);g.lineHeight=g.height;const W=g.width*d,x=Math.ceil((a.fontStyle==="italic"?2:1)*W),f=g.height*d,_=x+m*2,T=f+m*2;if(y=!1,u!==`
7`&&u!=="\r"&&u!=="	"&&u!==" "&&(y=!0,c=Math.ceil(Math.max(T,c))),h+_>C&&(l+=c,c=T,h=0,l+c>F)){o.update();const z=this._nextPage();s=z.canvasAndContext.canvas,n=z.canvasAndContext.context,o=z.texture.source,h=0,l=0,c=0}const S=W/d-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[u]={id:u.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:S,kerning:{}},y){this._drawGlyph(n,g,h+m,l+m,d,a);const z=o.width*d,G=o.height*d,k=new it(h/z*o.width,l/G*o.height,_/z*o.width,T/G*o.height);this.chars[u].texture=new U({source:o,frame:k}),h+=Math.ceil(_)}}o.update(),this._currentX=h,this._currentY=l,this._currentMaxCharHeight=c,this._skipKerning&&this._applyKerning(e,n)}get pageTextures(){return R(j,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){const i=this._measureCache;for(let s=0;s<t.length;s++){const n=t[s];for(let o=0;o<this._currentChars.length;o++){const a=this._currentChars[o];let h=i[n];h||(h=i[n]=e.measureText(n).width);let l=i[a];l||(l=i[a]=e.measureText(a).width);let c=e.measureText(n+a).width,d=c-(h+l);d&&(this.chars[n].kerning[a]=d),c=e.measureText(n+a).width,d=c-(h+l),d&&(this.chars[a].kerning[n]=d)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=ft.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new U({source:new At({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(s.source.style=this._textureStyle);const n={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,i){e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=st(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const s=e._stroke,n=s?.width??0;if(s&&(t.lineWidth=n,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=St(s,t)),e._fill&&(t.fillStyle=St(e._fill,t)),e.dropShadow){const o=e.dropShadow,a=Y.shared.setValue(o.color).toArray(),h=o.blur*i,l=o.distance*i;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${o.alpha})`,t.shadowBlur=h,t.shadowOffsetX=Math.cos(o.angle)*l,t.shadowOffsetY=Math.sin(o.angle)*l}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,n,o){const a=e.text,h=e.fontProperties,c=(o._stroke?.width??0)*n,d=i+c/2,m=s-c/2,y=h.descent*n,C=e.lineHeight*n;let F=!1;o.stroke&&c&&(F=!0,t.strokeText(a,d,m+C-y));const{shadowBlur:w,shadowOffsetX:u,shadowOffsetY:g}=t;o._fill&&(F&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),t.fillText(a,d,m+C-y)),F&&(t.shadowBlur=w,t.shadowOffsetX=u,t.shadowOffsetY=g)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:i}=this.pages[t];ft.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};Bt.defaultOptions={textureSize:512,style:new tt,mipmap:!0};let xt=Bt;function qt(r,t,e,i){const s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let n=s.lines[0],o=null,a=!0;const h={width:0,start:0,index:0,positions:[],chars:[]},l=e.baseMeasurementFontSize/t.fontSize,c=t.letterSpacing*l,d=t.wordWrapWidth*l,m=t.lineHeight?t.lineHeight*l:e.lineHeight,y=t.wordWrap&&t.breakWords,C=u=>{const g=n.width;for(let W=0;W<h.index;W++){const x=u.positions[W];n.chars.push(u.chars[W]),n.charPositions.push(x+g)}n.width+=u.width,a=!1,h.width=0,h.index=0,h.chars.length=0},F=()=>{let u=n.chars.length-1;if(i){let g=n.chars[u];for(;g===" ";)n.width-=e.chars[g].xAdvance,g=n.chars[--u]}s.width=Math.max(s.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(n),s.height+=m},w=u=>u-c>d;for(let u=0;u<r.length+1;u++){let g;const W=u===r.length;W||(g=r[u]);const x=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
8`||W){if(!a&&t.wordWrap&&w(n.width+h.width)?(F(),C(h),W||n.charPositions.push(0)):(h.start=n.width,C(h),W||n.charPositions.push(0)),g==="\r"||g===`
9`)F();else if(!W){const S=x.xAdvance+(x.kerning[o]||0)+c;n.width+=S,n.spaceWidth=S,n.spacesIndex.push(n.charPositions.length),n.chars.push(g)}}else{const T=x.kerning[o]||0,S=x.xAdvance+T+c;y&&w(n.width+h.width+S)&&(C(h),F()),h.positions[h.index++]=h.width+T,h.chars.push(g),h.width+=S}o=g}return F(),t.align==="center"?Jt(s):t.align==="right"?Zt(s):t.align==="justify"&&Qt(s),s}function Jt(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function Zt(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function Qt(r){const t=r.width;for(let e=0;e<r.lines.length;e++){const i=r.lines[e];let s=0,n=i.spacesIndex[s++],o=0;const a=i.spacesIndex.length,l=(t-i.width)/a;for(let c=0;c<i.charPositions.length;c++)c===n&&(n=i.spacesIndex[s++],o+=l),i.charPositions[c]+=o}}function te(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");
9const n=s[0].charCodeAt(0),o=s[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,h=o;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}let J=0;class ee{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null},this.measureCache=_t(1e3)}getFont(t,e){let i=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke?(i+=e._fill.fill.styleKey,s=!1):(e._stroke||e.dropShadow)&&(i=`${e.styleKey}-bitmap`,s=!1),!D.has(i)){const o=Object.create(e);o._lineHeight=0;const a=new xt({style:o,overrideFill:s,overrideSize:!0,...this.defaultOptions});J++,J>50&&rt("BitmapText",`You have dynamically created ${J} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{J--,D.remove(i)}),D.set(i,a)}const n=D.get(i);return n.ensureCharacters?.(t),n}getLayout(t,e,i=!0){const s=this.getFont(t,e),n=`${t}-${e.styleKey}-${i}`;if(this.measureCache.has(n))return this.measureCache.get(n);const o=Z.graphemeSegmenter(t),a=qt(o,e,s,i);return this.measureCache.set(n,a),a}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},R(j,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const i=e?.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};const s=e.style,n=s instanceof tt?s:new tt(s),o=e.dynamicFill??this._canUseTintForStyle(n),a=new xt({style:n,overrideFill:o,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1,textureStyle:e.textureStyle}),h=te(e.chars);return a.ensureCharacters(h.join("")),D.set(`${i}-bitmap`,a),a.once("destroy",()=>D.remove(`${i}-bitmap`)),a}uninstall(t){const e=`${t}-bitmap`,i=D.get(e);i&&i.destroy()}_canUseTintForStyle(t){return!t._stroke&&(!t.dropShadow||t.dropShadow.color===0)&&!t._fill.fill&&t._fill.color===16777215}}const mt=new ee;class re extends bt{constructor(t,e){super();const{textures:i,data:s}=t;Object.keys(s.pages).forEach(n=>{const o=s.pages[parseInt(n,10)],a=i[o.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(n=>{const o=s.chars[n],{frame:a,source:h,rotate:l}=i[o.page],c=vt.transformRectCoords(o,a,l,new it),d=new U({frame:c,orig:new it(0,0,o.width,o.height),source:h,rotate:l});this.chars[n]={id:n.codePointAt(0),xOffset:o.xOffset,yOffset:o.yOffset,xAdvance:o.xAdvance,kerning:o.kerning??{},texture:d}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){mt.install(t)}static uninstall(t){mt.uninstall(t)}}export{re as BitmapFont};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.