{"version":3,"sources":["jsdelivr-header.js","/npm/@react-native-firebase/app-check@23.7.0/lib/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCYE,UACA,MACA,SACA,SACA,WACA,YACA,QACA,4BACK,+CAEL,sBACA,eACA,oBACK,iDACE,aAAgB,sBAClB,wCAAyC,+CACvC,yBAA4B,8DAC9B,mBAAoB,kCAEpB,YAAa,YAEpB,MAAM,UAAY,WAEZ,iBAAmB,4BAElB,MAAM,eACX,WAAA,CAAY,GACV,IAAK,SAAS,GACZ,MAAM,IAAI,MAAM,uDAElB,IAAK,WAAW,EAAuB,UACrC,MAAM,IAAI,MAAM,wDAElB,KAAK,uBAAyB,CAChC,CAEA,cAAM,GACJ,OAAO,KAAK,uBAAuB,UACrC,EAGF,MAAM,QAAU,CACd,+BAGF,MAAM,+BAA+B,eACnC,WAAA,IAAe,GACb,SAAS,GAET,KAAK,QAAQ,YAAY,KAAK,gBAAgB,2BAA2B,IACvE,KAAK,QAAQ,KAAK,KAAK,gBAAgB,0BAA2B,EAAM,IAG1E,KAAK,eAAiB,CACxB,CAEA,+BAAA,GAIE,OAFA,+BAA4B,EAErB,yBACT,CAEA,sCAAA,GACE,OAAO,IAAI,mCACb,CAEA,kBAAA,CAAmB,GACjB,GAAI,QAAS,CACX,IAAK,SAAS,GACZ,MAAM,IAAI,MAAM,8CAElB,GAAI,YAAY,EAAQ,UACtB,MAAM,IAAI,MAAM,+CAElB,OAAO,KAAK,OAAO,mBAAmB,EACxC,CAiBA,GAfK,UAAU,EAAQ,6BACrB,EAAQ,0BAA4B,KAAK,aAAa,8BAInD,UAAU,EAAQ,6BACrB,EAAQ,0BAA4B,KAAK,aAAa,qCAInD,UAAU,EAAQ,6BACrB,EAAQ,2BAA4B,GAEtC,KAAK,OAAO,2BAA2B,EAAQ,gCAEtB,IAArB,EAAQ,eAA+D,IAArC,EAAQ,SAAS,gBACrD,MAAM,IAAI,MAAM,sEAElB,GAAoB,YAAhB,SAA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uBAIZ,sBAAsB,CACnC,gBACA,gBACA,oBACA,kCACA,aAAc,CAAC,0BACf,oBAAoB,EACpB,6BAA6B,EAC7B,YAAa,+BAGN,KAAK,mBAKP,MAAM,SAAW,kBAGxB,qBAAqB,iBAAkB","file":"/npm/@react-native-firebase/app-check@23.7.0/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@react-native-firebase/app-check@23.7.0/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\n * Copyright (c) 2016-present Invertase Limited & Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this library except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n  isBoolean,\n  isIOS,\n  isString,\n  isObject,\n  isFunction,\n  isUndefined,\n  isOther,\n  parseListenerOrObserver,\n} from '@react-native-firebase/app/lib/common';\nimport {\n  createModuleNamespace,\n  FirebaseModule,\n  getFirebaseRoot,\n} from '@react-native-firebase/app/lib/internal';\nimport { Platform } from 'react-native';\nimport ReactNativeFirebaseAppCheckProvider from './ReactNativeFirebaseAppCheckProvider';\nimport { setReactNativeModule } from '@react-native-firebase/app/lib/internal/nativeModule';\nimport fallBackModule from './web/RNFBAppCheckModule';\n\nimport version from './version';\n\nconst namespace = 'appCheck';\n\nconst nativeModuleName = 'RNFBAppCheckModule';\n\nexport class CustomProvider {\n  constructor(_customProviderOptions) {\n    if (!isObject(_customProviderOptions)) {\n      throw new Error('Invalid configuration: no provider options defined.');\n    }\n    if (!isFunction(_customProviderOptions.getToken)) {\n      throw new Error('Invalid configuration: no getToken function defined.');\n    }\n    this._customProviderOptions = _customProviderOptions;\n  }\n\n  async getToken() {\n    return this._customProviderOptions.getToken();\n  }\n}\n\nconst statics = {\n  CustomProvider,\n};\n\nclass FirebaseAppCheckModule extends FirebaseModule {\n  constructor(...args) {\n    super(...args);\n\n    this.emitter.addListener(this.eventNameForApp('appCheck_token_changed'), event => {\n      this.emitter.emit(this.eventNameForApp('onAppCheckTokenChanged'), event);\n    });\n\n    this._listenerCount = 0;\n  }\n\n  getIsTokenRefreshEnabledDefault() {\n    // no default to start\n    isTokenAutoRefreshEnabled = undefined;\n\n    return isTokenAutoRefreshEnabled;\n  }\n\n  newReactNativeFirebaseAppCheckProvider() {\n    return new ReactNativeFirebaseAppCheckProvider();\n  }\n\n  initializeAppCheck(options) {\n    if (isOther) {\n      if (!isObject(options)) {\n        throw new Error('Invalid configuration: no options defined.');\n      }\n      if (isUndefined(options.provider)) {\n        throw new Error('Invalid configuration: no provider defined.');\n      }\n      return this.native.initializeAppCheck(options);\n    }\n    // determine token refresh setting, if not specified\n    if (!isBoolean(options.isTokenAutoRefreshEnabled)) {\n      options.isTokenAutoRefreshEnabled = this.firebaseJson.app_check_token_auto_refresh;\n    }\n\n    // If that was not defined, attempt to use app-wide data collection setting per docs:\n    if (!isBoolean(options.isTokenAutoRefreshEnabled)) {\n      options.isTokenAutoRefreshEnabled = this.firebaseJson.app_data_collection_default_enabled;\n    }\n\n    // If that also was not defined, the default is documented as true.\n    if (!isBoolean(options.isTokenAutoRefreshEnabled)) {\n      options.isTokenAutoRefreshEnabled = true;\n    }\n    this.native.setTokenAutoRefreshEnabled(options.isTokenAutoRefreshEnabled);\n\n    if (options.provider === undefined || options.provider.providerOptions === undefined) {\n      throw new Error('Invalid configuration: no provider or no provider options defined.');\n    }\n    if (Platform.OS === 'android') {\n      if (!isString(options.provider.providerOptions.android.provider)) {\n        throw new Error(\n          'Invalid configuration: no android provider configured while on android platform.',\n        );\n      }\n      return this.native.configureProvider(\n        options.provider.providerOptions.android.provider,\n        options.provider.providerOptions.android.debugToken,\n      );\n    }\n    if (Platform.OS === 'ios' || Platform.OS === 'macos') {\n      if (!isString(options.provider.providerOptions.apple.provider)) {\n        throw new Error(\n          'Invalid configuration: no apple provider configured while on apple platform.',\n        );\n      }\n      return this.native.configureProvider(\n        options.provider.providerOptions.apple.provider,\n        options.provider.providerOptions.apple.debugToken,\n      );\n    }\n    throw new Error('Unsupported platform: ' + Platform.OS);\n  }\n\n  activate(siteKeyOrProvider, isTokenAutoRefreshEnabled) {\n    if (isOther) {\n      throw new Error('firebase.appCheck().activate(*) is not supported on other platforms');\n    }\n    if (!isString(siteKeyOrProvider)) {\n      throw new Error('siteKeyOrProvider must be a string value to match firebase-js-sdk API');\n    }\n\n    // We wrap our new flexible interface, with compatible defaults\n    rnfbProvider = new ReactNativeFirebaseAppCheckProvider();\n    rnfbProvider.configure({\n      android: {\n        provider: 'playIntegrity',\n      },\n      apple: {\n        provider: 'deviceCheck',\n      },\n      web: {\n        provider: 'reCaptchaV3',\n        siteKey: 'none',\n      },\n    });\n\n    return this.initializeAppCheck({ provider: rnfbProvider, isTokenAutoRefreshEnabled });\n  }\n\n  // TODO this is an async call\n  setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled) {\n    this.native.setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled);\n  }\n\n  getToken(forceRefresh) {\n    if (!forceRefresh) {\n      return this.native.getToken(false);\n    } else {\n      return this.native.getToken(true);\n    }\n  }\n\n  getLimitedUseToken() {\n    return this.native.getLimitedUseToken();\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  onTokenChanged(onNextOrObserver, onError, onCompletion) {\n    // iOS does not provide any native listening feature\n    if (isIOS) {\n      // eslint-disable-next-line no-console\n      console.warn('onTokenChanged is not implemented on IOS, only for Android');\n      return () => {};\n    }\n    const nextFn = parseListenerOrObserver(onNextOrObserver);\n    // let errorFn = function () { };\n    // if (onNextOrObserver.error != null) {\n    //   errorFn = onNextOrObserver.error.bind(onNextOrObserver);\n    // }\n    // else if (onError) {\n    //   errorFn = onError;\n    // }\n    const subscription = this.emitter.addListener(\n      this.eventNameForApp('onAppCheckTokenChanged'),\n      nextFn,\n    );\n    if (this._listenerCount === 0) this.native.addAppCheckListener();\n\n    this._listenerCount++;\n    return () => {\n      subscription.remove();\n      this._listenerCount--;\n      if (this._listenerCount === 0) this.native.removeAppCheckListener();\n    };\n  }\n}\n\n// import { SDK_VERSION } from '@react-native-firebase/app-check';\nexport const SDK_VERSION = version;\n\n// import appCheck from '@react-native-firebase/app-check';\n// appCheck().X(...);\nexport default createModuleNamespace({\n  statics,\n  version,\n  namespace,\n  nativeModuleName,\n  nativeEvents: ['appCheck_token_changed'],\n  hasMultiAppSupport: true,\n  hasCustomUrlOrRegionSupport: false,\n  ModuleClass: FirebaseAppCheckModule,\n});\n\nexport * from './modular';\n\n// import appCheck, { firebase } from '@react-native-firebase/app-check';\n// appCheck().X(...);\n// firebase.appCheck().X(...);\nexport const firebase = getFirebaseRoot();\n\n// Register the interop module for non-native platforms.\nsetReactNativeModule(nativeModuleName, fallBackModule);\n"]}