{"version":3,"sources":["../../src/server/font-utils.ts"],"names":["getFontDefinitionFromNetwork","getFontDefinitionFromManifest","calculateOverrideValues","calculateSizeAdjustValues","getFontOverrideCss","capsizeFontsMetrics","require","https","CHROME_UA","IE_UA","isGoogleFont","url","startsWith","GOOGLE_FONT_PROVIDER","getFontForUA","UA","Promise","resolve","reject","rawData","get","headers","res","on","chunk","toString","e","result","Log","warn","manifest","find","font","content","parseGoogleFontName","css","regex","matches","matchAll","fontNames","Set","fontFamily","replace","add","formatName","str","word","index","toLowerCase","toUpperCase","formatOverrideValue","val","Math","abs","toFixed","fontName","fontKey","fontMetrics","category","ascent","descent","lineGap","unitsPerEm","fallbackFont","DEFAULT_SERIF_FONT","DEFAULT_SANS_SERIF_FONT","name","xWidthAvg","mainFontAvgWidth","fallbackFontName","fallbackFontMetrics","fallbackFontAvgWidth","sizeAdjust","calculateOverrideCSS","trim","calculateSizeAdjustCSS","useSizeAdjust","calcFn","fontCss","reduce","cssStr","console","log"],"mappings":";;;;;;;;;;;;;;;;;;IAkDsBA,4BAA4B;eAA5BA;;IAuBNC,6BAA6B;eAA7BA;;IAuCAC,uBAAuB;eAAvBA;;IAkBAC,yBAAyB;eAAzBA;;IA8DAC,kBAAkB;eAAlBA;;;6DAhMK;2BAKd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACP,MAAMC,sBAAsBC,QAAQ;AACpC,MAAMC,QAAQD,QAAQ;AAEtB,MAAME,YACJ;AACF,MAAMC,QAAQ;AASd,SAASC,aAAaC,GAAW;IAC/B,OAAOA,IAAIC,UAAU,CAACC,+BAAoB;AAC5C;AAEA,SAASC,aAAaH,GAAW,EAAEI,EAAU;IAC3C,OAAO,IAAIC,QAAQ,CAACC,SAASC;QAC3B,IAAIC,UAAe;QACnBZ,MACGa,GAAG,CACFT,KACA;YACEU,SAAS;gBACP,cAAcN;YAChB;QACF,GACA,CAACO;YACCA,IAAIC,EAAE,CAAC,QAAQ,CAACC;gBACdL,WAAWK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