{"ast":null,"code":"import _regeneratorRuntime from \"@babel/runtime/regenerator\";\nimport { CodedError } from 'expo-modules-core';\nimport ExpoFontLoader from \"./ExpoFontLoader\";\nimport { FontDisplay } from \"./Font\";\n\nfunction uriFromFontSource(asset) {\n  if (typeof asset === 'string') {\n    return asset || null;\n  } else if (typeof asset === 'object') {\n    return asset.uri || asset.localUri || null;\n  }\n\n  return null;\n}\n\nfunction displayFromFontSource(asset) {\n  return asset.display || FontDisplay.AUTO;\n}\n\nexport function fontFamilyNeedsScoping(name) {\n  return false;\n}\nexport function getAssetForSource(source) {\n  var uri = uriFromFontSource(source);\n  var display = displayFromFontSource(source);\n\n  if (!uri || typeof uri !== 'string') {\n    throwInvalidSourceError(uri);\n  }\n\n  return {\n    uri: uri,\n    display: display\n  };\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` (number is not supported on web) instead got: \" + type);\n}\n\nexport function loadSingleFontAsync(name, input) {\n  return _regeneratorRuntime.async(function loadSingleFontAsync$(_context) {\n    while (1) {\n      switch (_context.prev = _context.next) {\n        case 0:\n          if (typeof input !== 'object' || typeof input.uri !== 'string' || input.downloadAsync) {\n            throwInvalidSourceError(input);\n          }\n\n          _context.next = 3;\n          return _regeneratorRuntime.awrap(ExpoFontLoader.loadAsync(name, input));\n\n        case 3:\n        case \"end\":\n          return _context.stop();\n      }\n    }\n  }, null, null, null, Promise);\n}\nexport function getNativeFontName(name) {\n  return name;\n}","map":{"version":3,"sources":["../src/FontLoader.web.ts"],"names":[],"mappings":";AACA,SAAS,UAAT,QAA2B,mBAA3B;AAEA,OAAO,cAAP;AACA,SAAS,WAAT;;AAGA,SAAS,iBAAT,CAA2B,KAA3B,EAAqC;AACnC,MAAI,OAAO,KAAP,KAAiB,QAArB,EAA+B;AAC7B,WAAO,KAAK,IAAI,IAAhB;AACD,GAFD,MA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A;AAAA;AAWP,OAAM,SAAU,iBAAV,CAA4B,IAA5B,EAAwC;AAC5C,SAAO,IAAP;AACD","sourcesContent":["import { Asset } from 'expo-asset';\nimport { CodedError } from 'expo-modules-core';\n\nimport ExpoFontLoader from './ExpoFontLoader';\nimport { FontDisplay } from './Font';\nimport { FontResource, FontSource } 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 || null;\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\\` (number is not supported on web) 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"}