var VMPrintStandardFonts=(()=>{var l=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var A=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var v=(i,e)=>{for(var t in e)l(i,t,{get:e[t],enumerable:!0})},w=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of S(e))!b.call(i,n)&&n!==t&&l(i,n,{get:()=>e[n],enumerable:!(r=T(e,n))||r.enumerable});return i};var R=i=>w(l({},"__esModule",{value:!0}),i);var o=(i,e,t)=>A(i,typeof e!="symbol"?e+"":e,t);var _={};v(_,{STANDARD_FONT_ALIASES:()=>d,STANDARD_FONT_REGISTRY:()=>s,STANDARD_FONT_SRC_PREFIX:()=>a,StandardFontManager:()=>m,default:()=>p});var a="standard-font://",f=[{id:0,name:"Helvetica Regular",family:"Helvetica",weight:400,style:"normal"},{id:1,name:"Helvetica Bold",family:"Helvetica",weight:700,style:"normal"},{id:2,name:"Helvetica Oblique",family:"Helvetica",weight:400,style:"italic"},{id:3,name:"Helvetica Bold Oblique",family:"Helvetica",weight:700,style:"italic"},{id:4,name:"Times Roman",family:"Times",weight:400,style:"normal"},{id:5,name:"Times Bold",family:"Times",weight:700,style:"normal"},{id:6,name:"Times Italic",family:"Times",weight:400,style:"italic"},{id:7,name:"Times Bold Italic",family:"Times",weight:700,style:"italic"},{id:8,name:"Courier Regular",family:"Courier",weight:400,style:"normal"},{id:9,name:"Courier Bold",family:"Courier",weight:700,style:"normal"},{id:10,name:"Courier Oblique",family:"Courier",weight:400,style:"italic"},{id:11,name:"Courier Bold Oblique",family:"Courier",weight:700,style:"italic"},{id:12,name:"Symbol Regular",family:"Symbol",weight:400,style:"normal"},{id:13,name:"ZapfDingbats Regular",family:"ZapfDingbats",weight:400,style:"normal"}],F=i=>`${a}${i.toString(16).padStart(2,"0")}`,s=f.map(i=>({name:i.name,family:i.family,weight:i.weight,style:i.style,src:F(i.id),enabled:!0,fallback:!1})),u=f.reduce((i,e)=>(i[F(e.id)]=e.id,i),{}),c=i=>String(i||"").trim().toLowerCase().replace(/["']/g,"").replace(/\s+/g," "),d={helvetica:"Helvetica","helvetica-bold":"Helvetica","helvetica-oblique":"Helvetica","helvetica-boldoblique":"Helvetica",arial:"Helvetica","sans-serif":"Helvetica","sans serif":"Helvetica",times:"Times","times roman":"Times","times-roman":"Times","times new roman":"Times",timesnewroman:"Times","times-bold":"Times","times-italic":"Times","times-bolditalic":"Times",serif:"Times",courier:"Courier","courier new":"Courier",couriernew:"Courier","courier-bold":"Courier","courier-oblique":"Courier","courier-boldoblique":"Courier",monospace:"Courier",symbol:"Symbol",zapfdingbats:"ZapfDingbats","zapf dingbats":"ZapfDingbats",arimo:"Helvetica",tinos:"Times",cousine:"Courier",carlito:"Helvetica",caladea:"Times","noto sans":"Helvetica","courier prime":"Courier"};var h=i=>String(i||"").trim(),m=class{constructor(e={}){o(this,"seedFonts");o(this,"familyAliases");o(this,"srcToId");let t=this.engineApi();this.seedFonts=t.cloneFontRegistry(e.fonts||s),this.familyAliases={...e.aliases||d},this.srcToId={...u}}getFontRegistrySnapshot(){return this.engineApi().cloneFontRegistry(this.seedFonts)}resolveFamilyAlias(e){let t=c(e);return t&&this.familyAliases[t]||e}getAllFonts(e){return e.filter(t=>t.enabled)}getEnabledFallbackFonts(e){return[]}getFontsByFamily(e,t){let r=this.resolveFamilyAlias(e);return t.filter(n=>n.family===r&&n.enabled)}getFallbackFamilies(e){return[]}registerFont(e,t){t.push(e)}async loadFontBuffer(e){let t=this.resolveStandardFontId(e);if(t===void 0)throw new Error(`[StandardFontManager] Unknown standard font source "${e}".`);return this.engineApi().createStandardFontSentinelBuffer(t)}resolveStandardFontId(e){let t=h(e);if(!t)return;let r=this.srcToId[t];if(r!==void 0)return r;if(!t.startsWith(a))return;let n=t.slice(a.length).trim();if(!n)return;let g=/^[0-9a-f]+$/i.test(n)?Number.parseInt(n,16):Number.parseInt(n,10);if(!Number.isInteger(g))return;let y=this.engineApi().getStandardFontMetadataById(g);if(y)return y.id}engineApi(){let e=window.VMPrintEngine;if(!e)throw new Error("[StandardFontManager] window.VMPrintEngine is missing. Load vmprint-engine.js first.");return e}};var p=m;return R(_);})();
