{"ast":null,"code":"import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { Asset } from 'expo-asset';\nimport { CodedError } from 'expo-modules-core';\nimport ExpoFontLoader from \"./ExpoFontLoader\";\nimport { FontDisplay } from \"./Font.types\";\nfunction uriFromFontSource(asset) {\n  if (typeof asset === 'string') {\n    return asset || null;\n  } else if (typeof asset === 'object') {\n    return asset.uri || asset.localUri || asset.default || null;\n  } else if (typeof asset === 'number') {\n    return uriFromFontSource(Asset.fromModule(asset));\n  }\n  return null;\n}\nfunction displayFromFontSource(asset) {\n  return asset.display || FontDisplay.AUTO;\n}\nexport function fontFamilyNeedsScoping(name) {\n  return false;\n}\nexport function getAssetForSource(source) {\n  var uri = uriFromFontSource(source);\n  var display = displayFromFontSource(source);\n  if (!uri || typeof uri !== 'string') {\n    throwInvalidSourceError(uri);\n  }\n  return {\n    uri: uri,\n    display: display\n  };\n}\nfunction throwInvalidSourceError(source) {\n  var type = typeof source;\n  if (type === 'object') type = JSON.stringify(source, null, 2);\n  throw new CodedError(`ERR_FONT_SOURCE`, `Expected font asset of type \\`string | FontResource | Asset\\` instead got: ${type}`);\n}\nexport function loadSingleFontAsync(_x, _x2) {\n  return _loadSingleFontAsync.apply(this, arguments);\n}\nfunction _loadSingleFontAsync() {\n  _loadSingleFontAsync = _asyncToGenerator(function* (name, input) {\n    if (typeof input !== 'object' || typeof input.uri !== 'string' || input.downloadAsync) {\n      throwInvalidSourceError(input);\n    }\n    yield ExpoFontLoader.loadAsync(name, input);\n  });\n  return _loadSingleFontAsync.apply(this, arguments);\n}\nexport function getNativeFontName(name) {\n  return name;\n}","map":{"version":3,"sources":["../src/FontLoader.web.ts"],"names":[],"mappings":";AAAA,SAAS,KAAK,QAAQ,YAAY;AAClC,SAAS,UAAU,QAAQ,mBAAmB;AAE9C,OAAO,cAAc;AACrB,SAAmC,WAAW;AAE9C,SAAS,iBAAiB,CAAC,KAAU,EAAA;EACnC,IAAI,OAAO,KAAK,KAAK,QAA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AA2B,EAAA;IAE3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAK,KAAa,CAAC,aAAa,EAAE;MAC9F,uBAAuB,CAAC,KAAK,CAAC;IAC/B;IAED,MAAM,cAAc,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC;EAC7C,CAAC;EAAA,OAAA,oBAAA,CAAA,KAAA,OAAA,SAAA;AAAA;AAED,OAAM,SAAU,iBAAiB,CAAC,IAAY,EAAA;EAC5C,OAAO,IAAI;AACb","sourcesContent":["import { Asset } from 'expo-asset';\nimport { CodedError } from 'expo-modules-core';\n\nimport ExpoFontLoader from './ExpoFontLoader';\nimport { FontResource, FontSource, FontDisplay } from './Font.types';\n\nfunction uriFromFontSource(asset: any): string | null {\n  if (typeof asset === 'string') {\n    return asset || null;\n  } else if (typeof asset === 'object') {\n    return asset.uri || asset.localUri || asset.default || null;\n  } else if (typeof asset === 'number') {\n    return uriFromFontSource(Asset.fromModule(asset));\n  }\n  return null;\n}\n\nfunction displayFromFontSource(asset: any): FontDisplay | undefined {\n  return asset.display || FontDisplay.AUTO;\n}\n\nexport function fontFamilyNeedsScoping(name: string): boolean {\n  return false;\n}\n\nexport function getAssetForSource(source: FontSource): Asset | FontResource {\n  const uri = uriFromFontSource(source);\n  const display = displayFromFontSource(source);\n\n  if (!uri || typeof uri !== 'string') {\n    throwInvalidSourceError(uri);\n  }\n\n  return {\n    uri: uri!,\n    display,\n  };\n}\n\nfunction throwInvalidSourceError(source: any): never {\n  let type: string = typeof source;\n  if (type === 'object') type = JSON.stringify(source, null, 2);\n  throw new CodedError(\n    `ERR_FONT_SOURCE`,\n    `Expected font asset of type \\`string | FontResource | Asset\\` instead got: ${type}`\n  );\n}\n\nexport async function loadSingleFontAsync(\n  name: string,\n  input: Asset | FontResource\n): Promise<void> {\n  if (typeof input !== 'object' || typeof input.uri !== 'string' || (input as any).downloadAsync) {\n    throwInvalidSourceError(input);\n  }\n\n  await ExpoFontLoader.loadAsync(name, input);\n}\n\nexport function getNativeFontName(name: string): string {\n  return name;\n}\n"],"sourceRoot":""},"metadata":{},"sourceType":"module"}