@onairos/react-native 3.6.4 → 3.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/lib/commonjs/api/index.js +1 -1
  2. package/lib/commonjs/components/BodyText.js +1 -1
  3. package/lib/commonjs/components/BrandMark.js +1 -1
  4. package/lib/commonjs/components/CodeInput.js +1 -1
  5. package/lib/commonjs/components/EmailInput.js +1 -1
  6. package/lib/commonjs/components/GoogleButton.js +1 -1
  7. package/lib/commonjs/components/HeadingGroup.js +1 -1
  8. package/lib/commonjs/components/LLMDataInputModal.js +1 -1
  9. package/lib/commonjs/components/ModalHeader.js +1 -1
  10. package/lib/commonjs/components/ModalSheet.js +1 -1
  11. package/lib/commonjs/components/Onairos.js +1 -1
  12. package/lib/commonjs/components/OnairosButton.js +1 -1
  13. package/lib/commonjs/components/OnairosSignInButton.js +1 -1
  14. package/lib/commonjs/components/Overlay.js +1 -1
  15. package/lib/commonjs/components/PersonaImage.js +1 -1
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +1 -1
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +1 -1
  18. package/lib/commonjs/components/PinCreationScreen.js +1 -1
  19. package/lib/commonjs/components/PinInput.js +1 -1
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1 -1
  21. package/lib/commonjs/components/PlatformList.js +1 -1
  22. package/lib/commonjs/components/PlatformToggle.js +1 -1
  23. package/lib/commonjs/components/PrimaryButton.js +1 -1
  24. package/lib/commonjs/components/SignInMatchAnimation.js +1 -1
  25. package/lib/commonjs/components/SignInStep.js +1 -1
  26. package/lib/commonjs/components/UniversalOnboarding.js +1 -1
  27. package/lib/commonjs/components/VerificationStep.js +1 -1
  28. package/lib/commonjs/components/WelcomeScreen.js +1 -1
  29. package/lib/commonjs/components/icons/Basicproficon.js +1 -1
  30. package/lib/commonjs/components/icons/Basicprofile.js +1 -1
  31. package/lib/commonjs/components/icons/Checkbox.js +1 -1
  32. package/lib/commonjs/components/icons/Checkmark.js +1 -1
  33. package/lib/commonjs/components/icons/Contentanalysis.js +1 -1
  34. package/lib/commonjs/components/icons/Contenticon.js +1 -1
  35. package/lib/commonjs/components/icons/EnochE.js +1 -1
  36. package/lib/commonjs/components/icons/Personalityicon.js +1 -1
  37. package/lib/commonjs/components/icons/Personalityprofile.js +1 -1
  38. package/lib/commonjs/components/icons/Personalitytraits.js +1 -1
  39. package/lib/commonjs/components/icons/Userpreferences.js +1 -1
  40. package/lib/commonjs/components/icons/index.js +1 -1
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1 -1
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +1 -1
  43. package/lib/commonjs/components/onboarding/PinInput.js +1 -1
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +1 -1
  45. package/lib/commonjs/config/api.js +1 -1
  46. package/lib/commonjs/constants/index.js +1 -1
  47. package/lib/commonjs/context/AuthContext.js +1 -1
  48. package/lib/commonjs/hooks/useConnectedAccounts.js +1 -1
  49. package/lib/commonjs/hooks/useConnections.js +1 -1
  50. package/lib/commonjs/hooks/useCredentials.js +1 -1
  51. package/lib/commonjs/hooks/useUserConnections.js +1 -1
  52. package/lib/commonjs/index.js +1 -1
  53. package/lib/commonjs/services/apiClient.js +1 -1
  54. package/lib/commonjs/services/apiKeyService.js +924 -9
  55. package/lib/commonjs/services/authService.js +627 -10
  56. package/lib/commonjs/services/biometricPinService.js +1 -1
  57. package/lib/commonjs/services/chatGPTConversationExtractor.js +1 -1
  58. package/lib/commonjs/services/chatGPTConversationService.js +1 -1
  59. package/lib/commonjs/services/claudeConversationExtractor.js +1 -1
  60. package/lib/commonjs/services/claudeConversationService.js +1 -1
  61. package/lib/commonjs/services/connectedAccountsService.js +1 -1
  62. package/lib/commonjs/services/googleAuthService.js +1 -1
  63. package/lib/commonjs/services/hingeDataExtractor.js +1 -1
  64. package/lib/commonjs/services/hingeDataService.js +1 -1
  65. package/lib/commonjs/services/imageCompressionService.js +1 -1
  66. package/lib/commonjs/services/instagramDataExtractor.js +1 -1
  67. package/lib/commonjs/services/instagramDataService.js +1 -1
  68. package/lib/commonjs/services/jwtStorageService.js +1 -1
  69. package/lib/commonjs/services/linkedinDOMExtractor.js +1 -1
  70. package/lib/commonjs/services/linkedinProfileService.js +1 -1
  71. package/lib/commonjs/services/linkedinScrapingService.js +1 -1
  72. package/lib/commonjs/services/llmDataStorage.js +1 -1
  73. package/lib/commonjs/services/mobileTrainingService.js +1 -1
  74. package/lib/commonjs/services/oauthService.js +391 -11
  75. package/lib/commonjs/services/pinEncryptionService.js +1 -1
  76. package/lib/commonjs/services/pinStorageUtils.js +1 -1
  77. package/lib/commonjs/services/platformAuthService.js +1 -1
  78. package/lib/commonjs/services/sephoraDataExtractor.js +1 -1
  79. package/lib/commonjs/services/sephoraDataService.js +1 -1
  80. package/lib/commonjs/services/storageService.js +1 -1
  81. package/lib/commonjs/services/telegramDataExtractor.js +1 -1
  82. package/lib/commonjs/services/telegramDataService.js +1 -1
  83. package/lib/commonjs/services/trainingApiHelpers.js +1 -1
  84. package/lib/commonjs/services/userConnectionsService.js +1 -1
  85. package/lib/commonjs/services/youtubeMigrationService.js +1 -1
  86. package/lib/commonjs/theme/index.js +1 -1
  87. package/lib/commonjs/types/index.js +1 -1
  88. package/lib/commonjs/types.js +1 -1
  89. package/lib/commonjs/utils/Portal.js +1 -1
  90. package/lib/commonjs/utils/api.js +1 -1
  91. package/lib/commonjs/utils/assetRegistry.js +1 -1
  92. package/lib/commonjs/utils/auth.js +1 -1
  93. package/lib/commonjs/utils/connectorTests.js +1 -1
  94. package/lib/commonjs/utils/crypto.js +1 -1
  95. package/lib/commonjs/utils/debugHelper.js +1 -1
  96. package/lib/commonjs/utils/encryption.js +1 -1
  97. package/lib/commonjs/utils/eventUtils.js +1 -1
  98. package/lib/commonjs/utils/haptics.js +1 -1
  99. package/lib/commonjs/utils/imagePreloader.js +1 -1
  100. package/lib/commonjs/utils/networkDiagnostics.js +1 -1
  101. package/lib/commonjs/utils/onairosApi.js +1 -1
  102. package/lib/commonjs/utils/programmaticFlow.js +1 -1
  103. package/lib/commonjs/utils/retryHelper.js +1 -1
  104. package/lib/commonjs/utils/secureStorage.js +1 -1
  105. package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -1
  106. package/lib/commonjs/utils/webviewScripts/claude.js +1 -1
  107. package/lib/commonjs/utils/webviewScripts/hinge.js +1 -1
  108. package/lib/commonjs/utils/webviewScripts/index.js +1 -1
  109. package/lib/commonjs/utils/webviewScripts/instagram.js +1 -1
  110. package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -1
  111. package/lib/commonjs/utils/webviewScripts/sephora.js +1 -1
  112. package/lib/commonjs/utils/webviewScripts/telegram.js +1 -1
  113. package/lib/module/api/index.js +1 -1
  114. package/lib/module/components/BodyText.js +1 -1
  115. package/lib/module/components/BrandMark.js +1 -1
  116. package/lib/module/components/CodeInput.js +1 -1
  117. package/lib/module/components/EmailInput.js +1 -1
  118. package/lib/module/components/GoogleButton.js +1 -1
  119. package/lib/module/components/HeadingGroup.js +1 -1
  120. package/lib/module/components/LLMDataInputModal.js +1 -1
  121. package/lib/module/components/ModalHeader.js +1 -1
  122. package/lib/module/components/ModalSheet.js +1 -1
  123. package/lib/module/components/Onairos.js +1 -1
  124. package/lib/module/components/OnairosButton.js +1 -1
  125. package/lib/module/components/OnairosSignInButton.js +1 -1
  126. package/lib/module/components/Overlay.js +1 -1
  127. package/lib/module/components/PersonaImage.js +1 -1
  128. package/lib/module/components/PersonaLoadingScreen.js +1 -1
  129. package/lib/module/components/PersonalizationConsentScreen.js +1 -1
  130. package/lib/module/components/PinCreationScreen.js +1 -1
  131. package/lib/module/components/PinInput.js +1 -1
  132. package/lib/module/components/PlatformConnectorsStep.js +1 -1
  133. package/lib/module/components/PlatformList.js +1 -1
  134. package/lib/module/components/PlatformToggle.js +1 -1
  135. package/lib/module/components/PrimaryButton.js +1 -1
  136. package/lib/module/components/SignInMatchAnimation.js +1 -1
  137. package/lib/module/components/SignInStep.js +1 -1
  138. package/lib/module/components/UniversalOnboarding.js +1 -1
  139. package/lib/module/components/VerificationStep.js +1 -1
  140. package/lib/module/components/WelcomeScreen.js +1 -1
  141. package/lib/module/components/icons/Basicproficon.js +1 -1
  142. package/lib/module/components/icons/Basicprofile.js +1 -1
  143. package/lib/module/components/icons/Checkbox.js +1 -1
  144. package/lib/module/components/icons/Checkmark.js +1 -1
  145. package/lib/module/components/icons/Contentanalysis.js +1 -1
  146. package/lib/module/components/icons/Contenticon.js +1 -1
  147. package/lib/module/components/icons/EnochE.js +1 -1
  148. package/lib/module/components/icons/Personalityicon.js +1 -1
  149. package/lib/module/components/icons/Personalityprofile.js +1 -1
  150. package/lib/module/components/icons/Personalitytraits.js +1 -1
  151. package/lib/module/components/icons/Userpreferences.js +1 -1
  152. package/lib/module/components/onboarding/OAuthWebView.js +1 -1
  153. package/lib/module/components/onboarding/OnboardingHeader.js +1 -1
  154. package/lib/module/components/onboarding/PinInput.js +1 -1
  155. package/lib/module/components/onboarding/PlatformConnector.js +1 -1
  156. package/lib/module/config/api.js +1 -1
  157. package/lib/module/constants/index.js +1 -1
  158. package/lib/module/context/AuthContext.js +1 -1
  159. package/lib/module/hooks/useConnectedAccounts.js +1 -1
  160. package/lib/module/hooks/useConnections.js +1 -1
  161. package/lib/module/hooks/useCredentials.js +1 -1
  162. package/lib/module/hooks/useUserConnections.js +1 -1
  163. package/lib/module/index.js +1 -1
  164. package/lib/module/services/apiClient.js +1 -1
  165. package/lib/module/services/apiKeyService.js +898 -1
  166. package/lib/module/services/authService.js +602 -1
  167. package/lib/module/services/biometricPinService.js +1 -1
  168. package/lib/module/services/chatGPTConversationExtractor.js +1 -1
  169. package/lib/module/services/chatGPTConversationService.js +1 -1
  170. package/lib/module/services/claudeConversationExtractor.js +1 -1
  171. package/lib/module/services/claudeConversationService.js +1 -1
  172. package/lib/module/services/connectedAccountsService.js +1 -1
  173. package/lib/module/services/googleAuthService.js +1 -1
  174. package/lib/module/services/hingeDataExtractor.js +1 -1
  175. package/lib/module/services/hingeDataService.js +1 -1
  176. package/lib/module/services/imageCompressionService.js +1 -1
  177. package/lib/module/services/instagramDataExtractor.js +1 -1
  178. package/lib/module/services/instagramDataService.js +1 -1
  179. package/lib/module/services/jwtStorageService.js +1 -1
  180. package/lib/module/services/linkedinDOMExtractor.js +1 -1
  181. package/lib/module/services/linkedinProfileService.js +1 -1
  182. package/lib/module/services/linkedinScrapingService.js +1 -1
  183. package/lib/module/services/llmDataStorage.js +1 -1
  184. package/lib/module/services/mobileTrainingService.js +1 -1
  185. package/lib/module/services/oauthService.js +381 -1
  186. package/lib/module/services/pinEncryptionService.js +1 -1
  187. package/lib/module/services/pinStorageUtils.js +1 -1
  188. package/lib/module/services/platformAuthService.js +1 -1
  189. package/lib/module/services/sephoraDataExtractor.js +1 -1
  190. package/lib/module/services/sephoraDataService.js +1 -1
  191. package/lib/module/services/storageService.js +1 -1
  192. package/lib/module/services/telegramDataExtractor.js +1 -1
  193. package/lib/module/services/telegramDataService.js +1 -1
  194. package/lib/module/services/trainingApiHelpers.js +1 -1
  195. package/lib/module/services/userConnectionsService.js +1 -1
  196. package/lib/module/services/youtubeMigrationService.js +1 -1
  197. package/lib/module/theme/index.js +1 -1
  198. package/lib/module/types.js +1 -1
  199. package/lib/module/utils/Portal.js +1 -1
  200. package/lib/module/utils/api.js +1 -1
  201. package/lib/module/utils/assetRegistry.js +1 -1
  202. package/lib/module/utils/auth.js +1 -1
  203. package/lib/module/utils/connectorTests.js +1 -1
  204. package/lib/module/utils/crypto.js +1 -1
  205. package/lib/module/utils/debugHelper.js +1 -1
  206. package/lib/module/utils/encryption.js +1 -1
  207. package/lib/module/utils/eventUtils.js +1 -1
  208. package/lib/module/utils/haptics.js +1 -1
  209. package/lib/module/utils/networkDiagnostics.js +1 -1
  210. package/lib/module/utils/onairosApi.js +1 -1
  211. package/lib/module/utils/programmaticFlow.js +1 -1
  212. package/lib/module/utils/retryHelper.js +1 -1
  213. package/lib/module/utils/secureStorage.js +1 -1
  214. package/lib/module/utils/webviewScripts/chatgpt.js +1 -1
  215. package/lib/module/utils/webviewScripts/claude.js +1 -1
  216. package/lib/module/utils/webviewScripts/hinge.js +1 -1
  217. package/lib/module/utils/webviewScripts/index.js +1 -1
  218. package/lib/module/utils/webviewScripts/instagram.js +1 -1
  219. package/lib/module/utils/webviewScripts/linkedin.js +1 -1
  220. package/lib/module/utils/webviewScripts/sephora.js +1 -1
  221. package/lib/module/utils/webviewScripts/telegram.js +1 -1
  222. package/package.json +1 -1
@@ -1 +1,898 @@
1
- import AsyncStorage from'@react-native-async-storage/async-storage';import NetInfo from'@react-native-community/netinfo';import{API_CONFIG}from'../config/api';function _0xb01b(_0x5f0d8c,_0xb01b7a){_0x5f0d8c=_0x5f0d8c-0x0;const _0x493cd8=_0x5f0d();let _0x535fa5=_0x493cd8[_0x5f0d8c];return _0x535fa5;}export let ApiKeyType=function(_0x421a57){const _0x5649d7={'kFmvn':'DEVELOPER','NYhzK':'developer'};return _0x421a57[_0x5649d7[_0xb01b(0x0)]]=_0x5649d7[_0xb01b(0x1)],_0x421a57[_0xb01b(0x2)]='invalid',_0x421a57;}({});const JWT_TOKEN_KEY=_0xb01b(0x3);let globalConfig=null,validationCache=new Map(),isInitialized=![],userToken=null;const CACHE_DURATION=0x5*0x3c*0x3e8,checkNetworkConnectivity=async()=>{const _0x29eb72={'upwSI':function(_0x2adb8c,_0xd5d75c){return _0x2adb8c===_0xd5d75c;},'JtvRI':'yIQLw','LNeoX':_0xb01b(0x4)};try{const _0x2387e7=await NetInfo[_0xb01b(0x5)]();return _0x29eb72[_0xb01b(0x6)](_0x2387e7[_0xb01b(0x7)],!![])&&_0x2387e7[_0xb01b(0x8)]!==![];}catch(_0x337dc4){if(_0x29eb72[_0xb01b(0x6)](_0xb01b(0x9),_0x29eb72[_0xb01b(0xa)]))throw new _0x4eceb5(_0xb01b(0xb));else return console[_0xb01b(0xc)](_0x29eb72[_0xb01b(0xd)],_0x337dc4),!![];}},API_ENDPOINTS={'production':''+API_CONFIG['BASE_URL'],'staging':''+API_CONFIG[_0xb01b(0xe)],'development':''+API_CONFIG[_0xb01b(0xe)]};export const initializeApiKey=async _0x273995=>{const _0x599c0e={'TSQGr':_0xb01b(0xf),'OqLeq':_0xb01b(0x10),'ctAxo':_0xb01b(0x11),'wLtIh':'❌\x20API\x20rate\x20limit\x20exceeded.\x20Please\x20try\x20again\x20later.','yNaLQ':_0xb01b(0x12),'HdNrc':_0xb01b(0x13),'oBrtR':_0xb01b(0x14),'EiXHs':'🔑\x20Initializing\x20Onairos\x20SDK\x20with\x20developer\x20API\x20key...','IHkaA':function(_0x3b361f,_0x38a8a0){return _0x3b361f===_0x38a8a0;},'BydhG':_0xb01b(0x15),'ytVTN':function(_0x11c72f,_0x537019){return _0x11c72f<_0x537019;},'Cxtgx':'ona_','KkEHm':function(_0x1be510,_0x4d369e){return _0x1be510!==_0x4d369e;},'sLusf':_0xb01b(0x16),'JAORh':_0xb01b(0x17),'VigMs':'📝\x20SDK\x20Configuration:','tDWCE':function(_0x40082e,_0x384941){return _0x40082e+_0x384941;},'DsHOW':function(_0x36b3f5,_0x377b25){return _0x36b3f5(_0x377b25);},'jBnqP':_0xb01b(0x18),'qjwwe':'JSON\x20Parse\x20error','lkttV':_0xb01b(0x19),'ZCGoj':_0xb01b(0x1a),'Kxmnc':_0xb01b(0x1b),'apmAT':_0xb01b(0x5),'PhydX':_0xb01b(0x1c),'VDPIx':_0xb01b(0x1d),'KHCpm':'🌐\x20Error\x20details:','scRfe':'🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation','kmBxj':function(_0xe7ec6f){return _0xe7ec6f();},'pVURh':'✅\x20Onairos\x20SDK\x20initialized\x20successfully','nmSTD':_0xb01b(0x1e),'pIXDn':_0xb01b(0x1f),'OKJQt':_0xb01b(0x20),'ucMDz':_0xb01b(0x21),'mDhzN':'zXXjC','TWcZW':_0xb01b(0x22),'EEmNK':_0xb01b(0x23)};try{if(_0xb01b(0x24)!==_0xb01b(0x25)){console[_0xb01b(0x26)](_0x599c0e[_0xb01b(0x27)]);if(!_0x273995['apiKey']){if(_0x599c0e[_0xb01b(0x28)](_0x599c0e[_0xb01b(0x29)],_0xb01b(0x2a))){const _0xec5040=_0xb01b(0x2b)+_0x4d6359[_0xb01b(0x2c)];return _0x5b7d98[_0xb01b(0x2d)](_0x599c0e[_0xb01b(0x2e)],_0x33d731),{'isValid':![],'error':_0xec5040,'keyType':_0x3f911b[_0xb01b(0x2)]};}else throw new Error(_0xb01b(0x2f));}if(_0x599c0e[_0xb01b(0x30)](_0x273995[_0xb01b(0x31)][_0xb01b(0x32)],0x20))throw new Error(_0xb01b(0x10));const _0x5da904=[_0xb01b(0x33),_0x599c0e[_0xb01b(0x34)],_0xb01b(0x35)],_0x19af8f=_0x5da904['some'](_0x270a74=>_0x273995[_0xb01b(0x31)]['startsWith'](_0x270a74));if(!_0x19af8f){if(_0x599c0e[_0xb01b(0x36)](_0xb01b(0x37),_0x599c0e[_0xb01b(0x38)]))throw new Error(_0x599c0e['JAORh']);else throw new _0x29620f(_0x599c0e[_0xb01b(0x39)]);}globalConfig={'apiKey':_0x273995[_0xb01b(0x31)],'environment':_0x273995[_0xb01b(0x3a)]||_0xb01b(0x3b),'enableLogging':_0x273995[_0xb01b(0x3c)]!==![],'timeout':_0x273995[_0xb01b(0x1a)]||0x7530,'retryAttempts':_0x273995['retryAttempts']||0x3};globalConfig['enableLogging']&&console[_0xb01b(0x26)](_0x599c0e[_0xb01b(0x3d)],{'environment':globalConfig[_0xb01b(0x3a)],'timeout':globalConfig[_0xb01b(0x1a)],'retryAttempts':globalConfig[_0xb01b(0x3e)],'apiKeyPrefix':_0x599c0e[_0xb01b(0x3f)](_0x273995[_0xb01b(0x31)][_0xb01b(0x40)](0x0,0x8),_0xb01b(0x41)),'enableLogging':globalConfig[_0xb01b(0x3c)]});const _0x3c9096=await _0x599c0e['DsHOW'](validateApiKey,_0x273995[_0xb01b(0x31)]);if(!_0x3c9096[_0xb01b(0x42)]){const _0x226236=_0x3c9096[_0xb01b(0x2d)]||'',_0x12e861=_0x3c9096['isNetworkError']||_0x226236['includes'](_0x599c0e['jBnqP'])||_0x226236['includes'](_0xb01b(0x43))||_0x226236[_0xb01b(0x44)](_0x599c0e[_0xb01b(0x45)])||_0x226236['includes'](_0x599c0e[_0xb01b(0x46)])||_0x226236[_0xb01b(0x44)](_0x599c0e['ZCGoj'])||_0x226236[_0xb01b(0x44)](_0x599c0e['Kxmnc'])||_0x226236[_0xb01b(0x44)](_0x599c0e[_0xb01b(0x47)])||_0x226236['includes'](_0x599c0e['PhydX']);if(_0x12e861){const _0x2749dc=_0x599c0e[_0xb01b(0x48)]['split']('|');let _0x3585ad=0x0;while(!![]){switch(_0x2749dc[_0x3585ad++]){case'0':console[_0xb01b(0xc)](_0x599c0e[_0xb01b(0x49)],_0x3c9096[_0xb01b(0x2d)]);continue;case'1':console[_0xb01b(0x26)](_0xb01b(0x4a));continue;case'2':console[_0xb01b(0xc)]('⚠️\x20API\x20key\x20validation\x20failed\x20due\x20to\x20network/connectivity\x20issues');continue;case'3':console[_0xb01b(0xc)]('📝\x20SDK\x20will\x20function\x20with\x20limited\x20validation.\x20Network\x20connectivity\x20will\x20be\x20retried\x20automatically.');continue;case'4':console[_0xb01b(0xc)](_0x599c0e[_0xb01b(0x4b)]);continue;}break;}}else throw new Error(_0xb01b(0x4c)+_0x3c9096['error']);}await _0x599c0e[_0xb01b(0x4d)](loadJWT),isInitialized=!![];if(globalConfig[_0xb01b(0x3c)]){console[_0xb01b(0x26)](_0x599c0e['pVURh']),console[_0xb01b(0x26)](_0x599c0e['nmSTD']);userToken&&console[_0xb01b(0x26)](_0x599c0e['pIXDn']);if(_0x3c9096[_0xb01b(0x4e)]){if(_0x599c0e[_0xb01b(0x4f)]===_0xb01b(0x20))console[_0xb01b(0x26)](_0x599c0e[_0xb01b(0x50)],_0x3c9096[_0xb01b(0x4e)]);else return _0x355c35['error'](_0x599c0e[_0xb01b(0x51)],_0x2294a1),null;}if(_0x3c9096['rateLimits']){if(_0x599c0e[_0xb01b(0x36)](_0xb01b(0x52),_0x599c0e[_0xb01b(0x53)])){_0x4799d6[_0xb01b(0x2d)](_0x599c0e['wLtIh']);throw new _0x344095(_0x599c0e[_0xb01b(0x54)]);}else console['log'](_0xb01b(0x55),_0x3c9096['rateLimits']);}}}else return _0xfacf39[_0xb01b(0x2d)](_0x599c0e['HdNrc']),null;}catch(_0x149fc5){if(_0x599c0e[_0xb01b(0x28)](_0x599c0e['TWcZW'],_0x599c0e['EEmNK'])){_0x4c83bc[_0xb01b(0x2d)](_0x599c0e[_0xb01b(0x56)]);throw new _0x112923(_0xb01b(0x57));}else{console[_0xb01b(0x2d)]('❌\x20Failed\x20to\x20initialize\x20Onairos\x20SDK:',_0x149fc5),isInitialized=![];throw _0x149fc5;}}};export const getApiKeyType=_0x1484d0=>{const _0x4ad433={'SNmnb':function(_0x42f0da,_0x191ff8){return _0x42f0da>=_0x191ff8;},'kanTm':'dev_','EAQbK':'pk_','soRnZ':_0xb01b(0x58)};if(_0x4ad433[_0xb01b(0x59)](_0x1484d0[_0xb01b(0x32)],0x20)&&(_0x1484d0[_0xb01b(0x5a)](_0x4ad433['kanTm'])||_0x1484d0[_0xb01b(0x5a)](_0x4ad433['EAQbK'])||_0x1484d0[_0xb01b(0x5a)](_0x4ad433[_0xb01b(0x5b)])))return ApiKeyType[_0xb01b(0x5c)];return ApiKeyType['INVALID'];};export const validateApiKey=async _0x49f126=>{const _0x36bd49={'wGuWZ':_0xb01b(0x55),'pGvlt':function(_0xe0c95f,_0x6665be){return _0xe0c95f(_0x6665be);},'wrKJx':function(_0x62d1fd,_0x1ac245){return _0x62d1fd===_0x1ac245;},'llgHJ':'AbortError','jnTRW':_0xb01b(0x5d),'Btxdr':_0xb01b(0x5e),'yUZTB':'⚠️\x20Failed\x20to\x20check\x20network\x20connectivity:','poZqh':_0xb01b(0x5f),'TmZdb':function(_0x412158,_0x517999){return _0x412158!==_0x517999;},'sEuTB':_0xb01b(0x60),'uSfOH':function(_0x34ecef,_0x5c88b5){return _0x34ecef(_0x5c88b5);},'GOwyM':'OnairosReactNative/3.0.72','tOxFq':_0xb01b(0x3b),'TwPBP':_0xb01b(0x61),'vXcXu':_0xb01b(0x62),'LSVOO':function(_0x139064,_0x1b3a59){return _0x139064(_0x1b3a59);},'TmyVD':function(_0x4b6952,_0x3f9d45){return _0x4b6952(_0x3f9d45);},'JZxwz':function(_0x1b783b,_0x40d16b){return _0x1b783b!==_0x40d16b;},'ASpbM':_0xb01b(0x63),'BHRtV':_0xb01b(0x64),'agFTt':function(_0x11b715,_0x4aabc1){return _0x11b715<_0x4aabc1;},'IEfCo':_0xb01b(0x65),'EIADf':function(_0x2d0883,_0x4445b7){return _0x2d0883!==_0x4445b7;},'HOxqh':function(_0x33a5cd,_0x47ac72){return _0x33a5cd!==_0x47ac72;},'sSaar':function(_0x16d6f0){return _0x16d6f0();},'PcTzd':function(_0x4b3af2,_0x5a2c68){return _0x4b3af2===_0x5a2c68;},'IQGJw':'vFTGH','JMurJ':'⚠️\x20No\x20network\x20connectivity\x20detected','yhqZH':function(_0xb532cd,_0x28f165){return _0xb532cd===_0x28f165;},'FgQda':function(_0x16078e,_0x5dcaa5){return _0x16078e===_0x5dcaa5;},'auiNg':_0xb01b(0x66),'OWPxc':_0xb01b(0x67),'yoxKr':function(_0xf0c9ce,_0x6309d5){return _0xf0c9ce!==_0x6309d5;},'wosGS':function(_0x599a05,_0x446794){return _0x599a05!==_0x446794;},'RXqld':function(_0xd8d8bc,_0x49fb24){return _0xd8d8bc>_0x49fb24;},'eimNT':'wsdyP','rbejQ':_0xb01b(0x68),'gSaCC':function(_0x43034a,_0x3ef998,_0x946ec5){return _0x43034a(_0x3ef998,_0x946ec5);},'DnKVj':_0xb01b(0x69),'ExQoG':function(_0x3ccd4b,_0x1da59a){return _0x3ccd4b(_0x1da59a);},'IIypv':_0xb01b(0x6a),'VLLiD':function(_0x193ccb,_0x53d565){return _0x193ccb===_0x53d565;},'ejZSD':'Onairos\x20API\x20is\x20temporarily\x20unavailable\x20(502\x20Bad\x20Gateway).\x20Please\x20try\x20again\x20later.','UDbZk':'Onairos\x20API\x20is\x20under\x20maintenance\x20(503\x20Service\x20Unavailable).\x20Please\x20try\x20again\x20later.','WqmIB':function(_0x124812,_0xbdf27){return _0x124812===_0xbdf27;},'WmEWD':_0xb01b(0x6b),'FyvHF':_0xb01b(0x6c),'tyguV':function(_0x4745b5,_0x24bcec){return _0x4745b5===_0x24bcec;},'TYbOb':function(_0x41a899,_0x539ba6){return _0x41a899===_0x539ba6;},'Ktjcm':function(_0x3d8782,_0x21c92d){return _0x3d8782===_0x21c92d;},'uKdUk':_0xb01b(0x6d),'lYLiC':_0xb01b(0x6e),'NFOcT':_0xb01b(0x6f),'DrQgu':function(_0x43fa05,_0x4a2815){return _0x43fa05===_0x4a2815;},'jRgZh':_0xb01b(0x70),'UnArX':'UMVAp','ctrKZ':function(_0x2ece16,_0x309ff6){return _0x2ece16||_0x309ff6;},'edeYk':_0xb01b(0x71),'QmCuz':function(_0x138bf0,_0x1f8326){return _0x138bf0!==_0x1f8326;},'sAdgL':_0xb01b(0x72),'sHMeB':_0xb01b(0x73),'QVHqk':function(_0x340e19,_0x46e870){return _0x340e19!==_0x46e870;},'QKHFv':function(_0x3b1393,_0x578409){return _0x3b1393!==_0x578409;},'kDuAl':_0xb01b(0x74),'gPdOJ':function(_0x4bf625,_0x167cc1){return _0x4bf625===_0x167cc1;},'eIHYV':function(_0xdf45ed,_0x2f7e57){return _0xdf45ed===_0x2f7e57;},'fqKUq':function(_0xc6a904,_0x3a9647){return _0xc6a904>=_0x3a9647;},'hHdMp':function(_0x56b84c,_0x2f6856){return _0x56b84c!==_0x2f6856;},'dhvbO':'❌\x20API\x20key\x20validation\x20failed\x20(client\x20error):','XLekR':_0xb01b(0x75),'ZlkRs':function(_0x3d89fd,_0x154b99){return _0x3d89fd===_0x154b99;},'xbyZI':function(_0x573b11,_0x25cb2e){return _0x573b11!==_0x25cb2e;},'YCeph':_0xb01b(0x76),'KBvdu':'JSON\x20Parse\x20error','xVQyl':_0xb01b(0x77),'fMYVi':_0xb01b(0x78),'AfXgu':_0xb01b(0x5),'GltCL':'VVDVi','gagpk':'ENOTFOUND','gxccK':function(_0x459667,_0x3349f4){return _0x459667<_0x3349f4;},'vrtBj':function(_0x514dec,_0x162327){return _0x514dec===_0x162327;},'oZavg':function(_0x35ba09,_0x491e32){return _0x35ba09!==_0x491e32;},'POBnB':function(_0x4082e5,_0x1ea3dd){return _0x4082e5!==_0x1ea3dd;},'wkZxt':_0xb01b(0x79)};try{var _0x5b0768,_0x315122,_0x31a92c;console[_0xb01b(0x26)](_0xb01b(0x7a));const _0xde9110=_0x36bd49[_0xb01b(0x7b)](getApiKeyType,_0x49f126);if(_0x36bd49[_0xb01b(0x7c)](_0xde9110,ApiKeyType[_0xb01b(0x2)])){if(_0x36bd49[_0xb01b(0x7d)](_0x36bd49[_0xb01b(0x7e)],_0x36bd49[_0xb01b(0x7e)]))_0x13924c[_0xb01b(0x26)](_0x36bd49['wGuWZ'],_0x2646c8[_0xb01b(0x7f)]);else return{'isValid':![],'error':_0x36bd49['BHRtV'],'keyType':ApiKeyType['INVALID']};}const _0xa9a116=validationCache[_0xb01b(0x80)](_0x49f126);if(_0xa9a116&&_0x36bd49[_0xb01b(0x81)](Date[_0xb01b(0x82)]()-_0xa9a116[_0xb01b(0x83)],CACHE_DURATION)){if(_0xb01b(0x65)!==_0x36bd49[_0xb01b(0x84)]){_0x36bd49['pGvlt'](_0x418a8d,_0xe93069);if(_0x36bd49['wrKJx'](_0x43e6bb[_0xb01b(0x85)],_0x36bd49[_0xb01b(0x86)])){_0x1d6a66['error'](_0x36bd49[_0xb01b(0x87)],_0x49a4ed);throw new _0x22912b(_0x36bd49[_0xb01b(0x88)]);}throw _0x592e46;}else{var _0x3099c6;return _0x36bd49[_0xb01b(0x89)](_0x3099c6=globalConfig,null)&&_0x36bd49[_0xb01b(0x8a)](_0x3099c6,void 0x0)&&_0x3099c6[_0xb01b(0x3c)]&&console['log'](_0xb01b(0x61)),_0xa9a116['result'];}}const _0x1f6c7a=await _0x36bd49[_0xb01b(0x8b)](checkNetworkConnectivity);if(!_0x1f6c7a){if(_0x36bd49[_0xb01b(0x8c)](_0x36bd49['IQGJw'],_0x36bd49[_0xb01b(0x8d)]))return console[_0xb01b(0xc)](_0x36bd49['JMurJ']),{'isValid':![],'error':_0xb01b(0x8e),'keyType':_0xde9110,'isNetworkError':!![]};else throw new _0x338d81('SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.');}const _0x486553=(_0x36bd49[_0xb01b(0x7c)](_0x5b0768=globalConfig,null)||_0x36bd49['yhqZH'](_0x5b0768,void 0x0)?void 0x0:_0x5b0768[_0xb01b(0x3a)])||_0x36bd49['tOxFq'],_0x5560a4=API_ENDPOINTS[_0x486553],_0x2d3623=((_0x315122=globalConfig)===null||_0x36bd49['PcTzd'](_0x315122,void 0x0)?void 0x0:_0x315122[_0xb01b(0x1a)])||0x7530,_0x30bc26=(_0x36bd49[_0xb01b(0x8c)](_0x31a92c=globalConfig,null)||_0x36bd49[_0xb01b(0x8f)](_0x31a92c,void 0x0)?void 0x0:_0x31a92c[_0xb01b(0x3e)])||0x3;for(let _0x22ca01=0x1;_0x22ca01<=_0x30bc26;_0x22ca01++){const _0x255991=new AbortController(),_0x27093f=setTimeout(()=>_0x255991['abort'](),_0x2d3623);try{if(_0x36bd49[_0xb01b(0x90)]===_0x36bd49[_0xb01b(0x91)])throw new _0x5bb13e(_0xb01b(0x92));else{var _0x39ebeb;if(_0x36bd49[_0xb01b(0x93)](_0x39ebeb=globalConfig,null)&&_0x36bd49[_0xb01b(0x94)](_0x39ebeb,void 0x0)&&_0x39ebeb['enableLogging']&&_0x36bd49[_0xb01b(0x95)](_0x22ca01,0x1)){if(_0x36bd49[_0xb01b(0x96)]!==_0x36bd49[_0xb01b(0x97)])console[_0xb01b(0x26)](_0xb01b(0x98)+_0x22ca01+'/'+_0x30bc26+'\x20for\x20API\x20key\x20validation');else return _0x1a591e[_0xb01b(0xc)](_0x36bd49[_0xb01b(0x99)],_0x2138c7),!![];}const _0x47df06=await _0x36bd49['gSaCC'](fetch,_0x5560a4+_0xb01b(0x9a),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0xb01b(0x9b)+_0x49f126,'User-Agent':_0xb01b(0x9c),'X-API-Key-Type':_0xde9110,'X-SDK-Platform':'react-native','X-Retry-Attempt':_0x22ca01[_0xb01b(0x9d)]()},'body':JSON[_0xb01b(0x9e)]({'environment':_0x486553,'sdk_version':_0x36bd49[_0xb01b(0x9f)],'platform':'react-native','keyType':_0xde9110,'timestamp':new Date()[_0xb01b(0xa0)](),'attempt':_0x22ca01}),'signal':_0x255991[_0xb01b(0xa1)]});_0x36bd49[_0xb01b(0xa2)](clearTimeout,_0x27093f);if(!_0x47df06)throw new Error(_0x36bd49[_0xb01b(0xa3)]);if(_0x36bd49['VLLiD'](_0x47df06[_0xb01b(0xa4)],0x1f6)){if(_0x36bd49[_0xb01b(0x94)](_0xb01b(0xa5),'xxNUX'))throw new Error(_0x36bd49[_0xb01b(0xa6)]);else{_0x2ca63d[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0x87)],_0x3a4a8d);throw new _0x507cb6(_0x36bd49[_0xb01b(0x88)]);}}if(_0x47df06[_0xb01b(0xa4)]===0x1f7)throw new Error(_0x36bd49['UDbZk']);if(_0x36bd49[_0xb01b(0xa7)](_0x47df06[_0xb01b(0xa4)],0x1f8))throw new Error(_0x36bd49[_0xb01b(0xa8)]);const _0x334a4e=_0x47df06['headers'][_0xb01b(0x80)]('content-type'),_0x50b791=_0x334a4e&&_0x334a4e['includes']('application/json');if(!_0x50b791){const _0x33f0c4=await _0x47df06[_0xb01b(0xa9)](),_0x46a7e5=_0x33f0c4[_0xb01b(0x40)](0x0,0xc8);console[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0xaa)],{'status':_0x47df06['status'],'statusText':_0x47df06['statusText'],'contentType':_0x334a4e||'unknown','preview':_0x46a7e5,'url':_0x5560a4+'/dev/validate-apikey','attempt':_0x22ca01});if(_0x36bd49[_0xb01b(0xab)](_0x47df06[_0xb01b(0xa4)],0x194))throw new Error(_0xb01b(0xac)+_0x5560a4+_0xb01b(0xad));else{if(_0x47df06[_0xb01b(0xa4)]===0x1f4)throw new Error(_0xb01b(0xae));else{if(_0x36bd49[_0xb01b(0xaf)](_0x47df06[_0xb01b(0xa4)],0x1f6)||_0x36bd49[_0xb01b(0x8c)](_0x47df06[_0xb01b(0xa4)],0x1f7)){if(_0x36bd49[_0xb01b(0xb0)](_0x36bd49[_0xb01b(0xb1)],_0x36bd49[_0xb01b(0xb1)]))throw new Error(_0xb01b(0xb2)+_0x47df06[_0xb01b(0xa4)]+').\x20The\x20Onairos\x20backend\x20may\x20be\x20temporarily\x20down.');else _0x556642[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0xb3)],_0x3715aa);}else{if(_0x33f0c4[_0xb01b(0x44)](_0x36bd49[_0xb01b(0xb4)])||_0x33f0c4[_0xb01b(0x44)](_0x36bd49[_0xb01b(0xb5)]))throw new Error(_0xb01b(0x92));else{if(_0x36bd49['DrQgu'](_0x36bd49[_0xb01b(0xb6)],_0x36bd49[_0xb01b(0xb7)])){_0x8c9f07[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0x87)],_0x32bffd);throw new _0x3ccc6a(_0x36bd49[_0xb01b(0x88)]);}else throw new Error(_0xb01b(0xb8)+_0x47df06[_0xb01b(0xa4)]+_0xb01b(0xb9)+_0x47df06[_0xb01b(0xba)]+_0xb01b(0xbb)+_0x36bd49[_0xb01b(0xbc)](_0x334a4e,_0x36bd49[_0xb01b(0xbd)])+'.');}}}}}let _0x8abbf2;try{_0x8abbf2=await _0x47df06[_0xb01b(0xbe)]();}catch(_0x531318){if(_0x36bd49[_0xb01b(0xbf)](_0x36bd49[_0xb01b(0xc0)],_0x36bd49[_0xb01b(0xc0)])){var _0x1ce331;if(!(_0x36bd49[_0xb01b(0xc1)](_0x1ce331=_0x4b7bcc,null)&&_0x36bd49[_0xb01b(0xc1)](_0x1ce331,void 0x0)&&_0x1ce331[_0xb01b(0x31)]))throw new _0x133c6a(_0x36bd49[_0xb01b(0xc2)]);const _0x495b7e=_0x36bd49[_0xb01b(0xc3)](_0xc88ae2,_0x29c635[_0xb01b(0x31)]);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xc3c8eb[_0xb01b(0x31)],'User-Agent':_0x36bd49[_0xb01b(0xc4)],'X-SDK-Version':_0xb01b(0xc5),'X-SDK-Environment':_0x3f987a[_0xb01b(0x3a)]||_0x36bd49[_0xb01b(0xc6)],'X-API-Key-Type':_0x495b7e,'X-Timestamp':new _0x2fe3af()[_0xb01b(0xa0)]()};}else{console[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0xc7)],{'error':_0x531318[_0xb01b(0x2c)],'status':_0x47df06[_0xb01b(0xa4)],'contentType':_0x334a4e,'attempt':_0x22ca01});throw new Error(_0xb01b(0xc8)+_0x531318[_0xb01b(0x2c)]);}}if(_0x47df06['ok']&&(_0x8abbf2[_0xb01b(0xc9)]||_0x8abbf2[_0xb01b(0xca)])){var _0x3eb48a;const _0x44744f={'isValid':!![],'permissions':_0x8abbf2[_0xb01b(0x4e)]||[],'rateLimits':_0x8abbf2['rateLimits']||null,'keyType':_0xde9110};validationCache[_0xb01b(0xcb)](_0x49f126,{'result':_0x44744f,'timestamp':Date['now']()});if(_0x36bd49[_0xb01b(0xcc)](_0x3eb48a=globalConfig,null)&&_0x36bd49['QKHFv'](_0x3eb48a,void 0x0)&&_0x3eb48a['enableLogging']){var _0x12b9d7,_0x3d93c8,_0x4e6742;console['log'](_0x36bd49[_0xb01b(0xcd)],{'apiKeyId':_0x36bd49[_0xb01b(0xce)](_0x12b9d7=_0x8abbf2[_0xb01b(0x31)],null)||_0x36bd49['DrQgu'](_0x12b9d7,void 0x0)?void 0x0:_0x12b9d7['id'],'appName':_0x36bd49[_0xb01b(0xce)](_0x3d93c8=_0x8abbf2[_0xb01b(0xcf)],null)||_0x3d93c8===void 0x0?void 0x0:_0x3d93c8[_0xb01b(0x85)],'usageCount':_0x36bd49[_0xb01b(0xd0)](_0x4e6742=_0x8abbf2[_0xb01b(0x31)],null)||_0x36bd49[_0xb01b(0xd1)](_0x4e6742,void 0x0)?void 0x0:_0x4e6742[_0xb01b(0xd2)]});}return _0x44744f;}else{const _0x14c698=_0x8abbf2[_0xb01b(0x2d)]||_0x8abbf2['message']||_0xb01b(0xd3)+_0x47df06[_0xb01b(0xa4)]+':\x20'+_0x47df06[_0xb01b(0xba)],_0x2193cf={'isValid':![],'error':_0x14c698,'keyType':_0xde9110};if(_0x36bd49['fqKUq'](_0x47df06[_0xb01b(0xa4)],0x190)&&_0x36bd49[_0xb01b(0x81)](_0x47df06['status'],0x1f4)){var _0x13b524;return _0x36bd49[_0xb01b(0xd4)](_0x13b524=globalConfig,null)&&_0x36bd49[_0xb01b(0xd4)](_0x13b524,void 0x0)&&_0x13b524[_0xb01b(0x3c)]&&console[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0xd5)],_0x14c698),_0x2193cf;}throw new Error(_0x14c698);}}}catch(_0x5d2085){if('QyYVK'===_0x36bd49['XLekR']){var _0x483bf9;return _0x36bd49[_0xb01b(0xc1)](_0x483bf9=_0xc63b62,null)&&_0x483bf9!==void 0x0&&_0x483bf9[_0xb01b(0x3c)]&&_0x53b65e[_0xb01b(0x26)](_0x36bd49[_0xb01b(0xd6)]),_0x4c8af1[_0xb01b(0xd7)];}else{var _0x1447ca;clearTimeout(_0x27093f);if(_0x36bd49['ZlkRs'](_0x5d2085[_0xb01b(0x85)],_0x36bd49['llgHJ'])){if(_0x36bd49[_0xb01b(0xd8)](_0xb01b(0x76),_0x36bd49[_0xb01b(0xd9)]))return _0xc1150e['error'](_0x36bd49[_0xb01b(0xda)],_0x4bffe8),null;else{const _0x56041a=_0xb01b(0xdb)+_0x2d3623+_0xb01b(0xdc);console['error'](_0xb01b(0xdd));if(_0x22ca01===_0x30bc26)return{'isValid':![],'error':_0x56041a,'keyType':_0xde9110};continue;}}let _0xc83452='Network\x20error\x20during\x20API\x20key\x20validation:\x20'+_0x5d2085[_0xb01b(0x2c)];if(_0x5d2085[_0xb01b(0x2c)][_0xb01b(0x44)](_0x36bd49[_0xb01b(0xde)])||_0x5d2085['message'][_0xb01b(0x44)](_0x36bd49['xVQyl'])){if(_0x36bd49['VLLiD'](_0xb01b(0xdf),_0x36bd49['fMYVi']))return null;else _0xc83452=_0xb01b(0xe0)+_0x5d2085[_0xb01b(0x2c)];}else{if(_0x5d2085[_0xb01b(0x2c)][_0xb01b(0x44)](_0xb01b(0x18))||_0x5d2085[_0xb01b(0x2c)]['includes'](_0x36bd49[_0xb01b(0xe1)])){if(_0x36bd49[_0xb01b(0xc1)](_0x36bd49[_0xb01b(0xe2)],_0x36bd49[_0xb01b(0xe2)])){_0xc1c5fa['error'](_0xb01b(0x73),{'error':_0x58b812[_0xb01b(0x2c)],'status':_0x7ca260[_0xb01b(0xa4)],'contentType':_0xeb2675,'attempt':_0xbe78ed});throw new _0x2d0db6(_0xb01b(0xc8)+_0x525c72[_0xb01b(0x2c)]);}else _0xc83452=_0xb01b(0xe3)+_0x5d2085[_0xb01b(0x2c)];}else(_0x5d2085['message'][_0xb01b(0x44)]('DNS')||_0x5d2085['message'][_0xb01b(0x44)](_0x36bd49[_0xb01b(0xe4)]))&&(_0xc83452=_0xb01b(0xe5)+_0x5560a4+_0xb01b(0xe6)+_0x5d2085[_0xb01b(0x2c)]);}console[_0xb01b(0x2d)]('🌐\x20Network\x20error\x20during\x20API\x20key\x20validation:',{'error':_0x5d2085,'endpoint':_0x5560a4+_0xb01b(0x9a),'attempt':_0x22ca01,'maxRetries':_0x30bc26,'retryable':_0x36bd49[_0xb01b(0xe7)](_0x22ca01,_0x30bc26)});if(_0x36bd49['vrtBj'](_0x22ca01,_0x30bc26)){if(_0x36bd49[_0xb01b(0xe8)](_0xb01b(0xe9),_0xb01b(0xea)))return{'isValid':![],'error':_0xc83452,'keyType':_0xde9110,'isNetworkError':!![]};else{_0x36bd49[_0xb01b(0xeb)](_0x3aaefd,_0xa85e9b);if(_0x3d79c4['name']===_0x36bd49[_0xb01b(0x86)]){_0x2d7346[_0xb01b(0x2d)](_0x36bd49[_0xb01b(0x87)],_0x4d2e94);throw new _0x389860(_0x36bd49[_0xb01b(0x88)]);}throw _0x170328;}}const _0x4881a9=Math[_0xb01b(0xec)](0x3e8*Math[_0xb01b(0xed)](0x2,_0x22ca01-0x1),0x1388);_0x36bd49['oZavg'](_0x1447ca=globalConfig,null)&&_0x36bd49[_0xb01b(0xee)](_0x1447ca,void 0x0)&&_0x1447ca[_0xb01b(0x3c)]&&console[_0xb01b(0x26)](_0xb01b(0xef)+_0x4881a9+_0xb01b(0xf0)),await new Promise(_0xc90ac5=>setTimeout(()=>_0xc90ac5(),_0x4881a9));}}}return{'isValid':![],'error':_0x36bd49[_0xb01b(0xf1)],'keyType':_0xde9110};}catch(_0x231608){const _0x181957=_0xb01b(0x2b)+_0x231608[_0xb01b(0x2c)];return console[_0xb01b(0x2d)](_0xb01b(0xf),_0x231608),{'isValid':![],'error':_0x181957,'keyType':ApiKeyType[_0xb01b(0x2)]};}};export const getApiConfig=()=>{return globalConfig;};export const getApiKey=()=>{const _0x15f8cc={'SIJBf':function(_0x3a6912,_0x4647d7){return _0x3a6912===_0x4647d7;}};var _0x421bf2;return((_0x421bf2=globalConfig)===null||_0x15f8cc[_0xb01b(0xf2)](_0x421bf2,void 0x0)?void 0x0:_0x421bf2[_0xb01b(0x31)])||null;};export const isApiKeyInitialized=()=>{const _0x35a2b2={'dogFs':function(_0x328a68,_0x59eb22){return _0x328a68!==_0x59eb22;}};return isInitialized&&_0x35a2b2[_0xb01b(0xf3)](globalConfig,null);};export const storeJWT=async _0x37fc96=>{const _0x2dc15f={'Qtowt':_0xb01b(0xf4),'GdOWO':_0xb01b(0xf5),'cYHPl':function(_0x551178,_0x5b2ccc){return _0x551178!==_0x5b2ccc;},'oSXCY':_0xb01b(0xf6),'ADpss':function(_0x31a878,_0x2267c6){return _0x31a878!==_0x2267c6;},'ixgss':function(_0x23390f,_0x4e05f6){return _0x23390f===_0x4e05f6;},'birAO':'VmnyH','zzYpb':_0xb01b(0xf7),'lKkZX':_0xb01b(0xf8),'PLUva':_0xb01b(0xf9)};try{if(_0x2dc15f['cYHPl'](_0x2dc15f[_0xb01b(0xfa)],_0x2dc15f[_0xb01b(0xfa)]))throw new _0x198e16(_0xb01b(0xae));else{var _0x2bacde;await AsyncStorage['setItem'](JWT_TOKEN_KEY,_0x37fc96),userToken=_0x37fc96,_0x2dc15f[_0xb01b(0xfb)](_0x2bacde=globalConfig,null)&&_0x2dc15f[_0xb01b(0xfc)](_0x2bacde,void 0x0)&&_0x2bacde['enableLogging']&&(_0x2dc15f[_0xb01b(0xfd)](_0x2dc15f[_0xb01b(0xfe)],_0xb01b(0xff))?console[_0xb01b(0x26)](_0x2dc15f['zzYpb']):_0x4234c3[_0xb01b(0x26)](_0xb01b(0x98)+_0x26ec56+'/'+_0x437237+'\x20for\x20API\x20key\x20validation'));}}catch(_0x58f96b){if(_0x2dc15f[_0xb01b(0xfd)](_0x2dc15f[_0xb01b(0x100)],_0xb01b(0xf8))){console[_0xb01b(0x2d)](_0x2dc15f[_0xb01b(0x101)],_0x58f96b);throw _0x58f96b;}else{_0x2e22d8[_0xb01b(0x2d)](_0x2dc15f[_0xb01b(0x102)]);throw new _0x2e654c(_0x2dc15f['GdOWO']);}}};export const loadJWT=async()=>{const _0x1e1adf={'SFHTS':_0xb01b(0x103),'UCaKX':function(_0xd569ce,_0x579bd3){return _0xd569ce!==_0x579bd3;},'jgoHt':_0xb01b(0x104),'CXtgX':_0xb01b(0x105),'NQXyM':'❌\x20Failed\x20to\x20load\x20JWT\x20token:'};try{const _0x58406f=await AsyncStorage[_0xb01b(0x106)](JWT_TOKEN_KEY);return userToken=_0x58406f,_0x58406f;}catch(_0x31b61f){if(_0x1e1adf[_0xb01b(0x107)](_0x1e1adf[_0xb01b(0x108)],_0x1e1adf['CXtgX']))return console[_0xb01b(0x2d)](_0x1e1adf['NQXyM'],_0x31b61f),null;else{_0x41e20a[_0xb01b(0x2d)](_0x1e1adf[_0xb01b(0x109)],_0x416b98),_0x2e6f0f=![];throw _0x470bf3;}}};export const getJWT=()=>{return userToken;};export const clearJWT=async()=>{const _0x179864={'QtEjZ':function(_0x311704,_0x4fef6f){return _0x311704!==_0x4fef6f;},'AYpDz':function(_0x29fc3d,_0x520cf6){return _0x29fc3d===_0x520cf6;},'aRflS':_0xb01b(0x10a),'wARjS':_0xb01b(0x5f)};try{var _0xdef796;await AsyncStorage[_0xb01b(0x10b)](JWT_TOKEN_KEY),userToken=null;if(_0x179864[_0xb01b(0x10c)](_0xdef796=globalConfig,null)&&_0xdef796!==void 0x0&&_0xdef796['enableLogging']){if(_0x179864[_0xb01b(0x10d)](_0xb01b(0x10a),_0x179864[_0xb01b(0x10e)]))console[_0xb01b(0x26)]('🗑️\x20JWT\x20token\x20cleared');else return!!_0x444d1a;}}catch(_0x3b2931){console['error'](_0x179864[_0xb01b(0x10f)],_0x3b2931);}};const base64Decode=_0x3ac766=>{const _0x33db1c={'lVibe':_0xb01b(0x110),'HkZGM':function(_0x2d0b29,_0x521a55){return _0x2d0b29<_0x521a55;},'uscaz':function(_0x95fc10,_0x1efad8){return _0x95fc10|_0x1efad8;},'DQiEh':function(_0x39cc16,_0x5935b6){return _0x39cc16|_0x5935b6;},'DElLF':function(_0x442557,_0x430e9b){return _0x442557<<_0x430e9b;},'SiUvI':function(_0x253cd1,_0x352178){return _0x253cd1<<_0x352178;},'EYUJu':function(_0x176822,_0x2bb6af){return _0x176822<<_0x2bb6af;},'UuwRV':function(_0x2c0b70,_0x1c68d6){return _0x2c0b70&_0x1c68d6;},'GpvpF':function(_0x33ac7f,_0x15fb44){return _0x33ac7f>>_0x15fb44;},'PlGZs':function(_0x3e0de5,_0x2eb056){return _0x3e0de5!==_0x2eb056;},'ltwEi':function(_0x4837d7,_0x3688bf){return _0x4837d7&_0x3688bf;}},_0x52e609=_0x33db1c[_0xb01b(0x111)];let _0x11c479='',_0x2f2aae=0x0;_0x3ac766=_0x3ac766[_0xb01b(0x112)](/[^A-Za-z0-9+/]/g,'');while(_0x33db1c['HkZGM'](_0x2f2aae,_0x3ac766['length'])){const _0x5c9b51=_0x52e609['indexOf'](_0x3ac766[_0xb01b(0x113)](_0x2f2aae++)),_0x478cc8=_0x52e609[_0xb01b(0x114)](_0x3ac766[_0xb01b(0x113)](_0x2f2aae++)),_0x26bc07=_0x52e609['indexOf'](_0x3ac766[_0xb01b(0x113)](_0x2f2aae++)),_0x40f927=_0x52e609[_0xb01b(0x114)](_0x3ac766['charAt'](_0x2f2aae++)),_0x9d2589=_0x33db1c[_0xb01b(0x115)](_0x33db1c[_0xb01b(0x115)](_0x33db1c[_0xb01b(0x116)](_0x33db1c[_0xb01b(0x117)](_0x5c9b51,0x12),_0x33db1c['SiUvI'](_0x478cc8,0xc)),_0x33db1c[_0xb01b(0x118)](_0x26bc07,0x6)),_0x40f927);_0x11c479+=String[_0xb01b(0x119)](_0x33db1c[_0xb01b(0x11a)](_0x33db1c[_0xb01b(0x11b)](_0x9d2589,0x10),0xff));if(_0x33db1c[_0xb01b(0x11c)](_0x26bc07,0x40))_0x11c479+=String[_0xb01b(0x119)](_0x33db1c['ltwEi'](_0x9d2589>>0x8,0xff));if(_0x40f927!==0x40)_0x11c479+=String['fromCharCode'](_0x33db1c[_0xb01b(0x11a)](_0x9d2589,0xff));}return _0x11c479;};export const decodeJWTPayload=_0x59893a=>{const _0x29384c={'XjJUw':function(_0x2517af,_0x3ffcea){return _0x2517af!==_0x3ffcea;},'lmnhd':_0xb01b(0x13),'EaPkC':function(_0x259e9a,_0x40b7df){return _0x259e9a*_0x40b7df;},'XTCCS':function(_0x2e7fcf,_0x419dfb){return _0x2e7fcf/_0x419dfb;},'VAcNL':function(_0x3d8172,_0x299f19){return _0x3d8172(_0x299f19);},'gGeJu':_0xb01b(0x11)};try{const _0x2deee1=_0x59893a['split']('.');if(_0x29384c[_0xb01b(0x11d)](_0x2deee1['length'],0x3))return console[_0xb01b(0x2d)](_0x29384c[_0xb01b(0x11e)]),null;const _0x9933a4=_0x2deee1[0x1],_0x274d4e=_0x9933a4[_0xb01b(0x112)](/-/g,'+')[_0xb01b(0x112)](/_/g,'/'),_0x232fe1=_0x274d4e[_0xb01b(0x11f)](_0x29384c[_0xb01b(0x120)](Math[_0xb01b(0x121)](_0x29384c[_0xb01b(0x122)](_0x274d4e[_0xb01b(0x32)],0x4)),0x4),'='),_0x15b940=_0x29384c['VAcNL'](base64Decode,_0x232fe1);return JSON[_0xb01b(0x123)](_0x15b940);}catch(_0x3e16a7){return console[_0xb01b(0x2d)](_0x29384c[_0xb01b(0x124)],_0x3e16a7),null;}};export const extractUsernameFromJWT=_0x234922=>{const _0x132801={'mkvKS':_0xb01b(0x125),'olhjg':function(_0xd6baeb,_0xa9c2fe){return _0xd6baeb(_0xa9c2fe);},'hVOJl':function(_0x180740,_0x1525c5){return _0x180740===_0x1525c5;},'BpZPJ':_0xb01b(0x126),'PRFyb':'⏱️\x20Request\x20timeout\x20for:','JIQcu':function(_0x21d3f0,_0x56977d){return _0x21d3f0+_0x56977d;},'LcEtF':function(_0x4b70c7,_0x424b70){return _0x4b70c7||_0x424b70;},'vAfsx':function(_0x77c6c8,_0x512cc1){return _0x77c6c8(_0x512cc1);},'PyFBW':function(_0x369d75,_0x18199e){return _0x369d75!==_0x18199e;},'OioXD':_0xb01b(0x127),'vyPeT':_0xb01b(0x128),'CYHiL':function(_0x423324,_0x577aaa){return _0x423324!==_0x577aaa;},'yLVHK':function(_0x4aeab2,_0x260d4b){return _0x4aeab2===_0x260d4b;},'vGExx':_0xb01b(0x129),'DIqWx':_0xb01b(0x12a),'tNlkM':_0xb01b(0x12b),'MSXnz':_0xb01b(0x62)};try{var _0x2bf167;const _0x529377=_0x132801['LcEtF'](_0x234922,userToken);if(!_0x529377)return console[_0xb01b(0xc)](_0x132801[_0xb01b(0x12c)]),null;const _0x55ed03=_0x132801[_0xb01b(0x12d)](decodeJWTPayload,_0x529377);if(!_0x55ed03)return _0x132801['PyFBW'](_0x132801['OioXD'],_0x132801[_0xb01b(0x12e)])?null:(_0x258e75[_0xb01b(0xc)](_0x132801[_0xb01b(0x12c)]),null);const _0x53919f=_0x55ed03[_0xb01b(0x12f)]||_0x55ed03[_0xb01b(0x130)]||_0x55ed03[_0xb01b(0x131)]||_0x55ed03[_0xb01b(0x132)];if(_0x132801[_0xb01b(0x133)](_0x2bf167=globalConfig,null)&&_0x132801[_0xb01b(0x134)](_0x2bf167,void 0x0)&&_0x2bf167[_0xb01b(0x3c)]){if(_0x132801[_0xb01b(0x135)](_0x132801[_0xb01b(0x136)],_0x132801['vGExx']))console['log'](_0x132801[_0xb01b(0x137)],_0x53919f);else{_0x132801['olhjg'](_0x61508e,_0x500543);if(_0x132801[_0xb01b(0x138)](_0x2d1bbf[_0xb01b(0x85)],_0x132801['BpZPJ'])){_0x456bac['error'](_0x132801['PRFyb'],_0x80f0ca);throw new _0x53e663('Request\x20timeout');}throw _0x5cff99;}}return _0x53919f||null;}catch(_0x546f1a){if(_0xb01b(0x139)!==_0x132801['tNlkM'])return console['error'](_0x132801['MSXnz'],_0x546f1a),null;else _0x46183b['log'](_0xb01b(0x13a),{'environment':_0x5082ed[_0xb01b(0x3a)],'timeout':_0x24312c[_0xb01b(0x1a)],'retryAttempts':_0x5f4a1d[_0xb01b(0x3e)],'apiKeyPrefix':_0x132801[_0xb01b(0x13b)](_0x196c5a['apiKey'][_0xb01b(0x40)](0x0,0x8),_0xb01b(0x41)),'enableLogging':_0x24a8ed[_0xb01b(0x3c)]});}};export const extractUserDataFromJWT=_0x17a43b=>{const _0x4e4b7b={'HnPIg':function(_0x1ae629,_0xc2463){return _0x1ae629!==_0xc2463;},'hNMXp':_0xb01b(0x13c),'tYApp':_0xb01b(0x13d),'ymBcq':function(_0x1277bc,_0x43b073){return _0x1277bc||_0x43b073;},'WykjX':function(_0x1b8e1e,_0x3df8aa){return _0x1b8e1e===_0x3df8aa;},'mkTGr':_0xb01b(0x13e),'MukPw':_0xb01b(0x13f),'rZRiR':function(_0x810806,_0x54c0c9){return _0x810806(_0x54c0c9);},'nNNxL':function(_0x59a9b1,_0x5def35){return _0x59a9b1!==_0x5def35;},'daYpd':'👤\x20Extracted\x20user\x20data\x20from\x20JWT:','NtljQ':'BeJKO','eRtXw':_0xb01b(0x140)};try{var _0x5116a5;const _0x2fb1eb=_0x4e4b7b[_0xb01b(0x141)](_0x17a43b,userToken);if(!_0x2fb1eb){if(_0x4e4b7b[_0xb01b(0x142)](_0x4e4b7b[_0xb01b(0x143)],_0x4e4b7b['MukPw'])){var _0x16bfab;_0x452be7[_0xb01b(0x144)](),_0x4e4b7b[_0xb01b(0x145)](_0x16bfab=_0x21f97e,null)&&_0x16bfab!==void 0x0&&_0x16bfab[_0xb01b(0x3c)]&&_0x16462c[_0xb01b(0x26)](_0x4e4b7b[_0xb01b(0x146)]);}else return console[_0xb01b(0xc)](_0xb01b(0x147)),null;}const _0x51a1e3=_0x4e4b7b[_0xb01b(0x148)](decodeJWTPayload,_0x2fb1eb);if(!_0x51a1e3)return null;const _0x25df33={'id':_0x51a1e3['id'],'email':_0x51a1e3[_0xb01b(0x132)],'userId':_0x51a1e3[_0xb01b(0x131)],'userName':_0x51a1e3['userName']||_0x51a1e3['username'],'verified':_0x51a1e3['verified'],'iat':_0x51a1e3[_0xb01b(0x149)],'exp':_0x51a1e3['exp']};return _0x4e4b7b[_0xb01b(0x14a)](_0x5116a5=globalConfig,null)&&_0x5116a5!==void 0x0&&_0x5116a5[_0xb01b(0x3c)]&&console['log'](_0x4e4b7b[_0xb01b(0x14b)],_0x25df33),_0x25df33;}catch(_0x49c7f0){if(_0x4e4b7b[_0xb01b(0x142)](_0x4e4b7b[_0xb01b(0x14c)],'Bknjl')){_0x4c4580[_0xb01b(0x2d)](_0x4e4b7b['tYApp']);throw new _0x4b7164('Rate\x20limit\x20exceeded');}else return console['error'](_0x4e4b7b[_0xb01b(0x14d)],_0x49c7f0),null;}};export const isUserAuthenticated=()=>{return!!userToken;};export const getAuthHeaders=()=>{const _0x353617={'HgIRI':_0xb01b(0x6b),'ODFLo':function(_0x5d4aa6,_0xb97514){return _0x5d4aa6!==_0xb97514;},'XyIqY':function(_0x1a35ae,_0x3c4e79){return _0x1a35ae!==_0x3c4e79;},'EPLch':_0xb01b(0x14e),'dPVfx':function(_0x20f430,_0x4c1d73){return _0x20f430(_0x4c1d73);},'MFGeE':_0xb01b(0x14f),'IeWaU':_0xb01b(0xc5),'uGvLF':_0xb01b(0x3b)};var _0xdbf45d;if(!((_0xdbf45d=globalConfig)!==null&&_0x353617['ODFLo'](_0xdbf45d,void 0x0)&&_0xdbf45d[_0xb01b(0x31)])){if(_0x353617[_0xb01b(0x150)](_0x353617[_0xb01b(0x151)],_0x353617['EPLch']))throw new _0xed438b(_0x353617[_0xb01b(0x152)]);else throw new Error('SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.');}const _0x45ddf7=_0x353617[_0xb01b(0x153)](getApiKeyType,globalConfig['apiKey']);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+globalConfig[_0xb01b(0x31)],'User-Agent':_0x353617['MFGeE'],'X-SDK-Version':_0x353617['IeWaU'],'X-SDK-Environment':globalConfig[_0xb01b(0x3a)]||_0x353617[_0xb01b(0x154)],'X-API-Key-Type':_0x45ddf7,'X-Timestamp':new Date()[_0xb01b(0xa0)]()};};export const getDeveloperAuthHeaders=()=>{const _0x251324={'MvRCO':function(_0x291272,_0x2af605){return _0x291272!==_0x2af605;},'cYiYP':_0xb01b(0x155),'Stpnv':_0xb01b(0x60),'gWmKz':'3.0.72','KrmcV':'production'};var _0x40f56c;if(!(_0x251324[_0xb01b(0x156)](_0x40f56c=globalConfig,null)&&_0x40f56c!==void 0x0&&_0x40f56c[_0xb01b(0x31)])){if(_0x251324['MvRCO'](_0x251324[_0xb01b(0x157)],_0xb01b(0x155)))throw new _0x1a5c5a('API\x20validation\x20endpoint\x20not\x20found\x20(404).\x20The\x20endpoint\x20'+_0x428c50+'/dev/validate-apikey\x20may\x20not\x20exist\x20or\x20be\x20configured\x20correctly.');else throw new Error(_0x251324[_0xb01b(0x158)]);}const _0x1eba48=getApiKeyType(globalConfig['apiKey']);return{'Content-Type':'application/json','Authorization':'Bearer\x20'+globalConfig[_0xb01b(0x31)],'User-Agent':_0xb01b(0x159),'X-SDK-Version':_0x251324[_0xb01b(0x15a)],'X-SDK-Environment':globalConfig['environment']||_0x251324[_0xb01b(0x15b)],'X-API-Key-Type':_0x1eba48,'X-Timestamp':new Date()[_0xb01b(0xa0)]()};};export const getUserAuthHeaders=()=>{const _0x493e5={'llIKS':function(_0x24154d,_0x5170e9){return _0x24154d===_0x5170e9;},'ucxHK':_0xb01b(0x15c),'srxjB':_0xb01b(0x159),'wrwvc':_0xb01b(0xc5)};var _0x13e455;if(!userToken){if(_0x493e5[_0xb01b(0x15d)](_0x493e5[_0xb01b(0x15e)],_0x493e5[_0xb01b(0x15e)]))throw new Error(_0xb01b(0x15f));else _0x8ba9e0['log'](_0xb01b(0xef)+_0x39d244+_0xb01b(0xf0));}return{'Content-Type':'application/json','Authorization':_0xb01b(0x9b)+userToken,'User-Agent':_0x493e5[_0xb01b(0x160)],'X-SDK-Version':_0x493e5['wrwvc'],'X-SDK-Environment':(_0x493e5[_0xb01b(0x15d)](_0x13e455=globalConfig,null)||_0x493e5[_0xb01b(0x15d)](_0x13e455,void 0x0)?void 0x0:_0x13e455['environment'])||'production'};};export const makeAuthenticatedRequest=async(_0x9464ad,_0xfc5af7={})=>{const _0x45d587={'RLazm':'❌\x20API\x20key\x20permissions\x20insufficient\x20for\x20this\x20operation.','vMplR':_0xb01b(0xf5),'pbLDG':'Network\x20request\x20failed','cmefq':_0xb01b(0x43),'SBBfI':'JSON\x20Parse\x20error','hIJGl':'API\x20validation\x20endpoint\x20returned','thwOy':_0xb01b(0x1a),'YweWb':_0xb01b(0x1b),'LnogX':_0xb01b(0x5),'KGhvN':_0xb01b(0x161),'bsIDq':_0xb01b(0x162),'yOvph':_0xb01b(0x163),'SRcwq':'🌐\x20Error\x20details:','CNYhS':_0xb01b(0x4a),'ZXrDi':function(_0x4761cb,_0x3fa15c){return _0x4761cb===_0x3fa15c;},'OsKBg':'👤\x20Extracted\x20user\x20data\x20from\x20JWT:','lvaVU':function(_0x57c9fd){return _0x57c9fd();},'yIRsz':function(_0x49b383,_0x21970b){return _0x49b383===_0x21970b;},'FEXaa':_0xb01b(0x164),'RSEfY':_0xb01b(0x165),'NGczU':_0xb01b(0x60),'ORycE':_0xb01b(0x3b),'uTjma':function(_0x5cdb94){return _0x5cdb94();},'ElgGj':function(_0x11fe96,_0x25a778,_0x1f09cb){return _0x11fe96(_0x25a778,_0x1f09cb);},'DykjE':'LnQCo','eVVMi':_0xb01b(0x166),'UhgKu':function(_0x466b21,_0x55daa4,_0x1cdfbb){return _0x466b21(_0x55daa4,_0x1cdfbb);},'CvBYr':_0xb01b(0x167),'sLMGT':function(_0xeaf7d2,_0x1b7543){return _0xeaf7d2===_0x1b7543;},'EiJjf':_0xb01b(0x168),'kJCmy':_0xb01b(0x169),'lORNv':_0xb01b(0x14),'IBAFW':'Invalid\x20or\x20expired\x20API\x20key','LgTaw':_0xb01b(0x16a),'qowAb':_0xb01b(0x12),'lhQgx':function(_0x138809,_0x112557){return _0x138809(_0x112557);},'zfzuE':function(_0x1da53b,_0x43d6f0){return _0x1da53b===_0x43d6f0;},'zHVpj':_0xb01b(0x126),'iFkpA':_0xb01b(0x16b),'FCvdn':_0xb01b(0x16c),'DISeK':'⏱️\x20Request\x20timeout\x20for:','ifXpT':_0xb01b(0x5e)};if(!_0x45d587[_0xb01b(0x16d)](isApiKeyInitialized)){if(_0x45d587[_0xb01b(0x16e)](_0x45d587[_0xb01b(0x16f)],_0x45d587[_0xb01b(0x170)]))throw new _0x4818ad('Service\x20unavailable\x20('+_0x2dfea4['status']+_0xb01b(0x171));else throw new Error(_0x45d587['NGczU']);}const _0xf763eb=getApiConfig(),_0x2ddebf=API_ENDPOINTS[_0xf763eb[_0xb01b(0x3a)]||_0x45d587[_0xb01b(0x172)]],_0x3c8fbb=''+_0x2ddebf+(_0x9464ad[_0xb01b(0x5a)]('/')?'':'/')+_0x9464ad,_0x5dbc9d={..._0x45d587[_0xb01b(0x173)](getAuthHeaders),..._0xfc5af7['headers']||{}},_0x3e68e8=new AbortController(),_0x5454c3=_0x45d587[_0xb01b(0x174)](setTimeout,()=>_0x3e68e8[_0xb01b(0x175)](),_0xf763eb[_0xb01b(0x1a)]||0x7530);try{if(_0x45d587[_0xb01b(0x176)](_0x45d587[_0xb01b(0x177)],'LnQCo')){if(_0xf763eb[_0xb01b(0x3c)]){if(_0x45d587[_0xb01b(0x178)]!==_0x45d587[_0xb01b(0x178)]){_0x528e92[_0xb01b(0x2d)](_0x45d587[_0xb01b(0x179)]);throw new _0x57040b(_0x45d587[_0xb01b(0x17a)]);}else console[_0xb01b(0x26)](_0xb01b(0x17b)+_0x9464ad);}const _0x3114e1=await _0x45d587[_0xb01b(0x17c)](fetch,_0x3c8fbb,{..._0xfc5af7,'headers':_0x5dbc9d,'signal':_0x3e68e8[_0xb01b(0xa1)]});clearTimeout(_0x5454c3);if(_0xf763eb['enableLogging']){if(_0x45d587['CvBYr']!==_0x45d587[_0xb01b(0x17d)]){const _0x51a69c=_0x2986e3[_0xb01b(0x2d)]||'',_0x446e08=_0x56ed00[_0xb01b(0x17e)]||_0x51a69c[_0xb01b(0x44)](_0x45d587[_0xb01b(0x17f)])||_0x51a69c[_0xb01b(0x44)](_0x45d587[_0xb01b(0x180)])||_0x51a69c['includes'](_0x45d587['SBBfI'])||_0x51a69c[_0xb01b(0x44)](_0x45d587[_0xb01b(0x181)])||_0x51a69c['includes'](_0x45d587[_0xb01b(0x182)])||_0x51a69c[_0xb01b(0x44)](_0x45d587['YweWb'])||_0x51a69c[_0xb01b(0x44)](_0x45d587[_0xb01b(0x183)])||_0x51a69c[_0xb01b(0x44)](_0xb01b(0x1c));if(_0x446e08){const _0x2e6784=_0x45d587[_0xb01b(0x184)]['split']('|');let _0x3fa0e1=0x0;while(!![]){switch(_0x2e6784[_0x3fa0e1++]){case'0':_0x4c500a[_0xb01b(0xc)](_0x45d587[_0xb01b(0x185)]);continue;case'1':_0x5c5f4f[_0xb01b(0xc)](_0x45d587[_0xb01b(0x186)]);continue;case'2':_0x1c9942[_0xb01b(0xc)](_0x45d587[_0xb01b(0x187)],_0x4103d2[_0xb01b(0x2d)]);continue;case'3':_0x3e2fe9[_0xb01b(0xc)](_0xb01b(0x188));continue;case'4':_0x5d98a0[_0xb01b(0x26)](_0x45d587[_0xb01b(0x189)]);continue;}break;}}else throw new _0x6eaa7c(_0xb01b(0x4c)+_0x403b07[_0xb01b(0x2d)]);}else console[_0xb01b(0x26)](_0xb01b(0x18a)+_0x3114e1[_0xb01b(0xa4)]+_0xb01b(0x18b)+_0x9464ad);}if(_0x45d587['yIRsz'](_0x3114e1[_0xb01b(0xa4)],0x191)){if(_0x45d587[_0xb01b(0x18c)](_0x45d587[_0xb01b(0x18d)],_0x45d587[_0xb01b(0x18e)]))_0x55f7be=_0xb01b(0xe5)+_0x115fe5+'.\x20Please\x20check\x20network\x20settings\x20and\x20domain\x20accessibility.\x20'+_0x50b79e[_0xb01b(0x2c)];else{console[_0xb01b(0x2d)](_0x45d587[_0xb01b(0x18f)]);throw new Error(_0x45d587[_0xb01b(0x190)]);}}if(_0x45d587[_0xb01b(0x176)](_0x3114e1[_0xb01b(0xa4)],0x193)){console[_0xb01b(0x2d)](_0x45d587[_0xb01b(0x179)]);throw new Error(_0x45d587[_0xb01b(0x17a)]);}if(_0x3114e1['status']===0x1ad){console[_0xb01b(0x2d)](_0x45d587[_0xb01b(0x191)]);throw new Error(_0x45d587[_0xb01b(0x192)]);}return _0x3114e1;}else{var _0x4fadb4;return((_0x4fadb4=_0x44dd72)===null||_0x45d587[_0xb01b(0x176)](_0x4fadb4,void 0x0)?void 0x0:_0x4fadb4[_0xb01b(0x31)])||null;}}catch(_0x34fe18){_0x45d587[_0xb01b(0x193)](clearTimeout,_0x5454c3);if(_0x45d587[_0xb01b(0x194)](_0x34fe18[_0xb01b(0x85)],_0x45d587[_0xb01b(0x195)])){if(_0x45d587[_0xb01b(0x18c)](_0x45d587[_0xb01b(0x196)],_0x45d587[_0xb01b(0x197)]))_0x48bb6d[_0xb01b(0x26)](_0x45d587['OsKBg'],_0x7ecdd1);else{console[_0xb01b(0x2d)](_0x45d587[_0xb01b(0x198)],_0x9464ad);throw new Error(_0x45d587[_0xb01b(0x199)]);}}throw _0x34fe18;}};export const makeDeveloperRequest=async(_0x33bb26,_0x324030={})=>{const _0x4f1480={'EhNuW':function(_0x53d6f0,_0x31eaf8){return _0x53d6f0>=_0x31eaf8;},'NWxAH':'ona_','AOMVA':_0xb01b(0x61),'kCxzP':'❌\x20API\x20key\x20validation\x20failed\x20(client\x20error):','gLdFZ':_0xb01b(0x17),'mlVTi':'No\x20network\x20connection\x20available.\x20Please\x20check\x20your\x20internet\x20connection\x20and\x20try\x20again.','nFcsJ':function(_0x11ed14,_0x245f65){return _0x11ed14||_0x245f65;},'ljgQk':_0xb01b(0x125),'MGAXn':function(_0x4ced54,_0x5ce988){return _0x4ced54(_0x5ce988);},'GdlOt':function(_0x37a5f7,_0xf53258){return _0x37a5f7!==_0xf53258;},'CcFra':function(_0x45fb54){return _0x45fb54();},'kGnQg':function(_0x3878f4){return _0x3878f4();},'YLcXx':_0xb01b(0x3b),'Mlcvl':function(_0xb0a226){return _0xb0a226();},'ezEpA':function(_0x3dbc9e,_0x4835f8,_0x4173ce){return _0x3dbc9e(_0x4835f8,_0x4173ce);},'WBQyl':function(_0x1b3b61,_0x4bb056){return _0x1b3b61!==_0x4bb056;},'vAXWG':_0xb01b(0x19a),'ZTKAw':function(_0x3e59f8,_0x4e93a5){return _0x3e59f8(_0x4e93a5);},'dNCqY':'FFlwb','GVHWP':function(_0x53c837,_0xd7d3dc){return _0x53c837===_0xd7d3dc;},'KakXT':'kQzDU','dZWcj':'Invalid\x20or\x20expired\x20API\x20key','pBYmw':function(_0x3f321d,_0x3098b4){return _0x3f321d===_0x3098b4;},'WefPY':_0xb01b(0xf4),'tQnjp':'Insufficient\x20API\x20key\x20permissions','pXBnz':_0xb01b(0x19b),'OcmvN':_0xb01b(0x19c),'YsSTn':_0xb01b(0x13d),'VqcXe':'yHoIW','CmyUx':function(_0x3c95ea,_0x3f4de3){return _0x3c95ea(_0x3f4de3);},'iJeHB':_0xb01b(0x126),'cFqaw':_0xb01b(0x19d),'aanTJ':_0xb01b(0x5d)};if(!_0x4f1480[_0xb01b(0x19e)](isApiKeyInitialized))throw new Error('SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.');const _0x40e008=_0x4f1480['kGnQg'](getApiConfig),_0xac2ac9=API_ENDPOINTS[_0x40e008['environment']||_0x4f1480[_0xb01b(0x19f)]],_0x582499=''+_0xac2ac9+(_0x33bb26[_0xb01b(0x5a)]('/')?'':'/')+_0x33bb26,_0x13e95d={..._0x4f1480[_0xb01b(0x1a0)](getDeveloperAuthHeaders),..._0x324030[_0xb01b(0x1a1)]||{}},_0x1f5ab6=new AbortController(),_0x3129ad=_0x4f1480[_0xb01b(0x1a2)](setTimeout,()=>_0x1f5ab6[_0xb01b(0x175)](),_0x40e008[_0xb01b(0x1a)]||0x7530);try{if(_0x4f1480[_0xb01b(0x1a3)](_0x4f1480[_0xb01b(0x1a4)],_0xb01b(0x19a))){if(_0x4f1480[_0xb01b(0x1a5)](_0x697635[_0xb01b(0x32)],0x20)&&(_0x21ac20[_0xb01b(0x5a)]('dev_')||_0x5c10b4[_0xb01b(0x5a)](_0xb01b(0x35))||_0x15d269['startsWith'](_0x4f1480[_0xb01b(0x1a6)])))return _0x45b1c1['DEVELOPER'];return _0x5b5937[_0xb01b(0x2)];}else{_0x40e008[_0xb01b(0x3c)]&&console[_0xb01b(0x26)](_0xb01b(0x1a7)+_0x33bb26);const _0x21be7f=await _0x4f1480[_0xb01b(0x1a2)](fetch,_0x582499,{..._0x324030,'headers':_0x13e95d,'signal':_0x1f5ab6[_0xb01b(0xa1)]});_0x4f1480['ZTKAw'](clearTimeout,_0x3129ad);_0x40e008[_0xb01b(0x3c)]&&(_0x4f1480[_0xb01b(0x1a3)](_0x4f1480[_0xb01b(0x1a8)],_0x4f1480[_0xb01b(0x1a8)])?_0x5f2420[_0xb01b(0x26)](_0x4f1480[_0xb01b(0x1a9)]):console['log'](_0xb01b(0x1aa)+_0x21be7f['status']+_0xb01b(0x18b)+_0x33bb26));if(_0x4f1480[_0xb01b(0x1ab)](_0x21be7f[_0xb01b(0xa4)],0x191)){if(_0x4f1480[_0xb01b(0x1ac)]!=='PDsZn'){console[_0xb01b(0x2d)](_0xb01b(0x1ad));throw new Error(_0x4f1480['dZWcj']);}else _0x2fcbb4[_0xb01b(0x2d)](_0x4f1480[_0xb01b(0x1ae)],_0x348267);}if(_0x4f1480['pBYmw'](_0x21be7f['status'],0x193)){console[_0xb01b(0x2d)](_0x4f1480[_0xb01b(0x1af)]);throw new Error(_0x4f1480[_0xb01b(0x1b0)]);}if(_0x21be7f[_0xb01b(0xa4)]===0x1ad){if(_0x4f1480[_0xb01b(0x1b1)]!==_0x4f1480[_0xb01b(0x1b2)]){console[_0xb01b(0x2d)](_0x4f1480[_0xb01b(0x1b3)]);throw new Error(_0xb01b(0x12));}else throw new _0x5c4769(_0x4f1480['gLdFZ']);}return _0x21be7f;}}catch(_0x785deb){if(_0x4f1480[_0xb01b(0x1a3)](_0x4f1480['VqcXe'],_0x4f1480[_0xb01b(0x1b4)]))return _0x29c262[_0xb01b(0xc)](_0xb01b(0x1b5)),{'isValid':![],'error':_0x4f1480[_0xb01b(0x1b6)],'keyType':_0x4a75e7,'isNetworkError':!![]};else{_0x4f1480['CmyUx'](clearTimeout,_0x3129ad);if(_0x785deb[_0xb01b(0x85)]===_0x4f1480[_0xb01b(0x1b7)]){if(_0x4f1480[_0xb01b(0x1a3)](_0x4f1480[_0xb01b(0x1b8)],'KvRDd')){console['error'](_0x4f1480['aanTJ'],_0x33bb26);throw new Error(_0xb01b(0x5e));}else{var _0xdb2971;const _0x281b79=_0x4f1480[_0xb01b(0x1b9)](_0x3d74f5,_0x526527);if(!_0x281b79)return _0x5858ad[_0xb01b(0xc)](_0x4f1480[_0xb01b(0x1ba)]),null;const _0x4501ec=_0x4f1480[_0xb01b(0x1bb)](_0x1c78ae,_0x281b79);if(!_0x4501ec)return null;const _0x327fe2=_0x4501ec[_0xb01b(0x12f)]||_0x4501ec[_0xb01b(0x130)]||_0x4501ec[_0xb01b(0x131)]||_0x4501ec[_0xb01b(0x132)];return(_0xdb2971=_0x5344c3)!==null&&_0x4f1480[_0xb01b(0x1bc)](_0xdb2971,void 0x0)&&_0xdb2971[_0xb01b(0x3c)]&&_0xa0878b[_0xb01b(0x26)](_0xb01b(0x12a),_0x327fe2),_0x4f1480[_0xb01b(0x1b9)](_0x327fe2,null);}}throw _0x785deb;}}};export const makeUserRequest=async(_0x950196,_0x5918fb={})=>{const _0x14c9c6={'jdqio':function(_0x30bd24){return _0x30bd24();},'iLnpE':function(_0x58fde3){return _0x58fde3();},'FMYlq':function(_0x320c62){return _0x320c62();},'yeZjN':_0xb01b(0x15f),'gMEuC':function(_0x22c21b){return _0x22c21b();},'GxkZp':_0xb01b(0x3b),'wEYpk':function(_0x149012){return _0x149012();},'LvKlL':function(_0x333232,_0x59ad16,_0x2932ff){return _0x333232(_0x59ad16,_0x2932ff);},'rtiZX':function(_0x875e67,_0x370696){return _0x875e67(_0x370696);},'TArAD':function(_0x8a7b58,_0x36b1da){return _0x8a7b58===_0x36b1da;},'gGmyY':_0xb01b(0x1bd),'InEsp':function(_0x4004b1,_0xc10c2c){return _0x4004b1!==_0xc10c2c;},'IdVFK':'iioQS','shNAM':_0xb01b(0x1be),'sJXbE':_0xb01b(0x1bf),'gwYYC':_0xb01b(0x126),'jiCVn':'⏱️\x20Request\x20timeout\x20for:','XnHur':_0xb01b(0x5e)};!_0x14c9c6[_0xb01b(0x1c0)](isUserAuthenticated)&&await _0x14c9c6['iLnpE'](loadJWT);if(!_0x14c9c6[_0xb01b(0x1c1)](isUserAuthenticated))throw new Error(_0x14c9c6[_0xb01b(0x1c2)]);const _0x16155c=_0x14c9c6[_0xb01b(0x1c3)](getApiConfig)||{'environment':_0x14c9c6[_0xb01b(0x1c4)],'timeout':0x7530,'enableLogging':![]},_0x7c45de=API_ENDPOINTS[_0x16155c[_0xb01b(0x3a)]||_0x14c9c6['GxkZp']],_0xc563ee=''+_0x7c45de+(_0x950196[_0xb01b(0x5a)]('/')?'':'/')+_0x950196,_0xc2ad7d={..._0x14c9c6[_0xb01b(0x1c5)](getUserAuthHeaders),..._0x5918fb[_0xb01b(0x1a1)]||{}},_0x5010fc=new AbortController(),_0x40f648=_0x14c9c6[_0xb01b(0x1c6)](setTimeout,()=>_0x5010fc[_0xb01b(0x175)](),_0x16155c[_0xb01b(0x1a)]||0x7530);try{_0x16155c[_0xb01b(0x3c)]&&console[_0xb01b(0x26)]('🌐\x20Making\x20user\x20request\x20to:\x20'+_0x950196);const _0x53684f=await _0x14c9c6[_0xb01b(0x1c6)](fetch,_0xc563ee,{..._0x5918fb,'headers':_0xc2ad7d,'signal':_0x5010fc[_0xb01b(0xa1)]});_0x14c9c6[_0xb01b(0x1c7)](clearTimeout,_0x40f648);_0x16155c[_0xb01b(0x3c)]&&console[_0xb01b(0x26)](_0xb01b(0x1c8)+_0x53684f[_0xb01b(0xa4)]+_0xb01b(0x18b)+_0x950196);if(_0x14c9c6[_0xb01b(0x1c9)](_0x53684f[_0xb01b(0xa4)],0x191)){console[_0xb01b(0x2d)](_0x14c9c6[_0xb01b(0x1ca)]),await _0x14c9c6['wEYpk'](clearJWT);throw new Error(_0xb01b(0x1cb));}if(_0x14c9c6[_0xb01b(0x1c9)](_0x53684f['status'],0x193)){if(_0x14c9c6[_0xb01b(0x1cc)](_0x14c9c6['IdVFK'],_0x14c9c6[_0xb01b(0x1cd)]))_0x441e8c[_0xb01b(0x26)](_0xb01b(0x13c));else{console[_0xb01b(0x2d)](_0x14c9c6[_0xb01b(0x1ce)]);throw new Error(_0x14c9c6[_0xb01b(0x1cf)]);}}return _0x53684f;}catch(_0x520742){clearTimeout(_0x40f648);if(_0x14c9c6[_0xb01b(0x1c9)](_0x520742[_0xb01b(0x85)],_0x14c9c6['gwYYC'])){console[_0xb01b(0x2d)](_0x14c9c6[_0xb01b(0x1d0)],_0x950196);throw new Error(_0x14c9c6[_0xb01b(0x1d1)]);}throw _0x520742;}};export const clearValidationCache=()=>{const _0xa2c4dc={'NBNkJ':_0xb01b(0x13c)};var _0x3ebffa;validationCache[_0xb01b(0x144)](),(_0x3ebffa=globalConfig)!==null&&_0x3ebffa!==void 0x0&&_0x3ebffa[_0xb01b(0x3c)]&&console[_0xb01b(0x26)](_0xa2c4dc[_0xb01b(0x1d2)]);};export const resetApiKeyService=()=>{const _0x2773e5={'GkeXz':function(_0x3aa90c){return _0x3aa90c();},'zxYof':_0xb01b(0x1d3)};globalConfig=null,isInitialized=![],_0x2773e5[_0xb01b(0x1d4)](clearValidationCache),console[_0xb01b(0x26)](_0x2773e5[_0xb01b(0x1d5)]);};function _0x5f0d(){const _0x5b31ab=['kFmvn','NYhzK','INVALID','onairos_jwt_token','⚠️\x20Failed\x20to\x20check\x20network\x20connectivity:','fetch','upwSI','isConnected','isInternetReachable','lFrxA','JtvRI','Onairos\x20API\x20is\x20under\x20maintenance\x20(503\x20Service\x20Unavailable).\x20Please\x20try\x20again\x20later.','warn','LNeoX','BASE_URL','❌\x20API\x20key\x20validation\x20error:','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20be\x20at\x20least\x2032\x20characters\x20long.','❌\x20Failed\x20to\x20decode\x20JWT\x20token:','Rate\x20limit\x20exceeded','❌\x20Invalid\x20JWT\x20token\x20format','❌\x20API\x20key\x20authentication\x20failed.\x20Please\x20check\x20your\x20API\x20key.','mvofp','qxWVn','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20start\x20with\x20dev_,\x20ona_,\x20or\x20pk_','Network\x20request\x20failed','API\x20validation\x20endpoint\x20returned','timeout','ENOTFOUND','No\x20network\x20connection','2|4|3|0|1','🔑\x20Developer\x20API\x20key\x20ready\x20for\x20app-level\x20operations','🎫\x20User\x20JWT\x20token\x20loaded\x20from\x20storage','ETnkH','🔐\x20API\x20Key\x20Permissions:','hpmsH','LEPUv','OdpGx','pghHR','log','EiXHs','IHkaA','BydhG','DGVwa','API\x20key\x20validation\x20error:\x20','message','error','TSQGr','Developer\x20API\x20key\x20is\x20required\x20for\x20SDK\x20initialization','ytVTN','apiKey','length','dev_','Cxtgx','pk_','KkEHm','boCMs','sLusf','OqLeq','environment','production','enableLogging','VigMs','retryAttempts','tDWCE','substring','...','isValid','Network\x20error','includes','qjwwe','lkttV','apmAT','VDPIx','KHCpm','📱\x20SDK\x20initialized\x20in\x20offline\x20mode\x20-\x20will\x20retry\x20validation\x20when\x20network\x20is\x20available','scRfe','API\x20key\x20validation\x20failed:\x20','kmBxj','permissions','OKJQt','ucMDz','ctAxo','zXXjC','mDhzN','yNaLQ','⏱️\x20Rate\x20Limits:','oBrtR','Invalid\x20or\x20expired\x20API\x20key','ona_','SNmnb','startsWith','soRnZ','DEVELOPER','⏱️\x20Request\x20timeout\x20for:','Request\x20timeout','❌\x20Failed\x20to\x20clear\x20JWT\x20token:','SDK\x20not\x20initialized.\x20Call\x20initializeApiKey()\x20first.','📋\x20Using\x20cached\x20API\x20key\x20validation\x20result','❌\x20Failed\x20to\x20extract\x20username\x20from\x20JWT:','NMjGa','Invalid\x20API\x20key\x20format.\x20Developer\x20keys\x20must\x20be\x20at\x20least\x2032\x20characters\x20and\x20start\x20with\x20\x22dev_\x22,\x20\x22pk_\x22,\x20or\x20\x22ona_\x22','fdAiU','hNkSB','ShjJP','Gedph','3.3.1','No\x20response\x20received\x20from\x20server','Onairos\x20API\x20request\x20timed\x20out\x20(504\x20Gateway\x20Timeout).\x20Please\x20try\x20again.','❌\x20API\x20endpoint\x20returned\x20non-JSON\x20response:','pXuyM','<html','<!DOCTYPE','SAKTv','unknown\x20content\x20type','jIfbx','❌\x20Failed\x20to\x20parse\x20JSON\x20response:','✅\x20API\x20key\x20validation\x20successful','TcKuy','REcly','Unexpected\x20character','YwXQI','All\x20retry\x20attempts\x20exhausted','🔍\x20Validating\x20developer\x20API\x20key\x20against\x20backend...','TmyVD','wrKJx','JZxwz','ASpbM','rateLimits','get','agFTt','now','timestamp','IEfCo','name','llgHJ','jnTRW','Btxdr','EIADf','HOxqh','sSaar','PcTzd','IQGJw','No\x20network\x20connection\x20available.\x20Please\x20check\x20your\x20internet\x20connection\x20and\x20try\x20again.','FgQda','auiNg','OWPxc','Server\x20returned\x20HTML\x20page\x20instead\x20of\x20JSON\x20API\x20response.\x20This\x20often\x20indicates\x20a\x20routing\x20issue\x20or\x20server\x20misconfiguration.','yoxKr','wosGS','RXqld','eimNT','rbejQ','🔄\x20Retry\x20attempt\x20','yUZTB','/dev/validate-apikey','Bearer\x20','OnairosReactNative/3.3.1','toString','stringify','DnKVj','toISOString','signal','ExQoG','IIypv','status','xIAoB','ejZSD','WqmIB','WmEWD','text','FyvHF','tyguV','API\x20validation\x20endpoint\x20not\x20found\x20(404).\x20The\x20endpoint\x20','/dev/validate-apikey\x20may\x20not\x20exist\x20or\x20be\x20configured\x20correctly.','Server\x20error\x20(500).\x20The\x20Onairos\x20backend\x20is\x20experiencing\x20issues.','TYbOb','Ktjcm','uKdUk','Service\x20unavailable\x20(','poZqh','lYLiC','NFOcT','jRgZh','UnArX','API\x20validation\x20endpoint\x20returned\x20','\x20-\x20','statusText','.\x20Expected\x20JSON\x20but\x20got\x20','ctrKZ','edeYk','json','QmCuz','sAdgL','TmZdb','sEuTB','uSfOH','GOwyM','3.0.72','tOxFq','sHMeB','Failed\x20to\x20parse\x20server\x20response\x20as\x20JSON:\x20','success','valid','set','QVHqk','kDuAl','gPdOJ','application','eIHYV','DrQgu','usageCount','HTTP\x20','hHdMp','dhvbO','TwPBP','result','xbyZI','YCeph','vXcXu','API\x20key\x20validation\x20timeout\x20(','ms)','⏱️\x20API\x20key\x20validation\x20timeout','KBvdu','pjgXS','Server\x20returned\x20invalid\x20JSON\x20response.\x20This\x20usually\x20indicates\x20the\x20API\x20endpoint\x20returned\x20HTML\x20instead\x20of\x20JSON\x20(often\x20a\x20404\x20or\x20server\x20error\x20page).\x20','AfXgu','GltCL','Network\x20connectivity\x20issue.\x20Please\x20check\x20internet\x20connection\x20and\x20verify\x20the\x20Onairos\x20API\x20is\x20accessible.\x20','gagpk','DNS\x20resolution\x20failed\x20for\x20','.\x20Please\x20check\x20network\x20settings\x20and\x20domain\x20accessibility.\x20','gxccK','QKHFv','FwPWG','VkzYt','LSVOO','min','pow','POBnB','⏳\x20Waiting\x20','ms\x20before\x20retry...','wkZxt','SIJBf','dogFs','❌\x20Developer\x20API\x20key\x20permissions\x20insufficient','Insufficient\x20API\x20key\x20permissions','QBGth','🎫\x20JWT\x20token\x20stored\x20successfully','ZgAfd','❌\x20Failed\x20to\x20store\x20JWT\x20token:','oSXCY','cYHPl','ADpss','ixgss','birAO','VmnyH','lKkZX','PLUva','Qtowt','❌\x20Failed\x20to\x20initialize\x20Onairos\x20SDK:','RDUCi','eXkTL','getItem','UCaKX','jgoHt','SFHTS','zIpaz','removeItem','QtEjZ','AYpDz','aRflS','wARjS','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','lVibe','replace','charAt','indexOf','uscaz','DQiEh','DElLF','EYUJu','fromCharCode','UuwRV','GpvpF','PlGZs','XjJUw','lmnhd','padEnd','EaPkC','ceil','XTCCS','parse','gGeJu','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20username\x20extraction','AbortError','pWLWX','lyklx','njCwV','👤\x20Extracted\x20username\x20from\x20JWT:','anghO','mkvKS','vAfsx','vyPeT','userName','username','userId','email','PyFBW','CYHiL','yLVHK','vGExx','DIqWx','hVOJl','ObsVy','📝\x20SDK\x20Configuration:','JIQcu','🗑️\x20API\x20key\x20validation\x20cache\x20cleared','❌\x20API\x20rate\x20limit\x20exceeded','GOiQL','SBLab','❌\x20Failed\x20to\x20extract\x20user\x20data\x20from\x20JWT:','ymBcq','WykjX','mkTGr','clear','HnPIg','hNMXp','⚠️\x20No\x20JWT\x20token\x20available\x20for\x20user\x20data\x20extraction','rZRiR','iat','nNNxL','daYpd','NtljQ','eRtXw','erEDE','OnairosReactNative/3.0.72','XyIqY','EPLch','HgIRI','dPVfx','uGvLF','vneTv','MvRCO','cYiYP','Stpnv','OnairosSDK/1.0.0','gWmKz','KrmcV','hDsUI','llIKS','ucxHK','User\x20not\x20authenticated.\x20Please\x20verify\x20email\x20first.','srxjB','1|3|0|2|4','📝\x20SDK\x20will\x20function\x20with\x20limited\x20validation.\x20Network\x20connectivity\x20will\x20be\x20retried\x20automatically.','⚠️\x20API\x20key\x20validation\x20failed\x20due\x20to\x20network/connectivity\x20issues','nLUVy','Epuye','tSeuN','aPomR','qIodj','aopon','❌\x20API\x20rate\x20limit\x20exceeded.\x20Please\x20try\x20again\x20later.','jieST','FwSFz','lvaVU','yIRsz','FEXaa','RSEfY',').\x20The\x20Onairos\x20backend\x20may\x20be\x20temporarily\x20down.','ORycE','uTjma','ElgGj','abort','ZXrDi','DykjE','eVVMi','RLazm','vMplR','🌐\x20Making\x20authenticated\x20request\x20to:\x20','UhgKu','CvBYr','isNetworkError','pbLDG','cmefq','hIJGl','thwOy','LnogX','KGhvN','bsIDq','yOvph','SRcwq','🔄\x20Continuing\x20in\x20offline\x20mode\x20with\x20basic\x20validation','CNYhS','📡\x20Response\x20status:\x20','\x20for\x20','sLMGT','EiJjf','kJCmy','lORNv','IBAFW','LgTaw','qowAb','lhQgx','zfzuE','zHVpj','iFkpA','FCvdn','DISeK','ifXpT','wTUqG','CHQdu','sOnxj','cOoQn','CcFra','YLcXx','Mlcvl','headers','ezEpA','WBQyl','vAXWG','EhNuW','NWxAH','🌐\x20Making\x20developer\x20request\x20to:\x20','dNCqY','AOMVA','📡\x20Developer\x20request\x20response:\x20','GVHWP','KakXT','❌\x20Developer\x20API\x20key\x20authentication\x20failed','kCxzP','WefPY','tQnjp','pXBnz','OcmvN','YsSTn','VqcXe','⚠️\x20No\x20network\x20connectivity\x20detected','mlVTi','iJeHB','cFqaw','nFcsJ','ljgQk','MGAXn','GdlOt','❌\x20JWT\x20token\x20authentication\x20failed\x20-\x20token\x20may\x20be\x20expired','❌\x20JWT\x20token\x20permissions\x20insufficient','Insufficient\x20permissions\x20for\x20this\x20operation','jdqio','FMYlq','yeZjN','gMEuC','GxkZp','wEYpk','LvKlL','rtiZX','📡\x20User\x20request\x20response:\x20','TArAD','gGmyY','Authentication\x20expired.\x20Please\x20verify\x20email\x20again.','InEsp','IdVFK','shNAM','sJXbE','jiCVn','XnHur','NBNkJ','🔄\x20API\x20key\x20service\x20reset','GkeXz','zxYof'];_0x5f0d=function(){return _0x5b31ab;};return _0x5f0d();}
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+ import NetInfo from '@react-native-community/netinfo';
3
+ import { API_CONFIG } from '../config/api';
4
+
5
+ // API key types - Only developer keys are supported in client SDK
6
+ export let ApiKeyType = /*#__PURE__*/function (ApiKeyType) {
7
+ ApiKeyType["DEVELOPER"] = "developer";
8
+ ApiKeyType["INVALID"] = "invalid";
9
+ return ApiKeyType;
10
+ }({});
11
+
12
+ // JWT token storage key
13
+ const JWT_TOKEN_KEY = 'onairos_jwt_token';
14
+
15
+ /**
16
+ * Two-Tier Authentication Service for Onairos React Native SDK
17
+ *
18
+ * This service implements the two-tier authentication system:
19
+ * 1. Developer API Keys: For app-level operations (email verification, app registration)
20
+ * 2. JWT User Tokens: For user-level operations (PIN storage, user profile)
21
+ *
22
+ * How it works:
23
+ * 1. Initialize with developer API key
24
+ * 2. Use API key for email verification requests
25
+ * 3. Store JWT token from email verification response
26
+ * 4. Use JWT token for user-authenticated requests
27
+ * 5. Handle token expiration gracefully
28
+ *
29
+ * Backend Integration:
30
+ * - Developer routes: Authorization: Bearer ${API_KEY}
31
+ * - User routes: Authorization: Bearer ${JWT_TOKEN}
32
+ */
33
+
34
+ // Global configuration state
35
+ let globalConfig = null;
36
+ let validationCache = new Map();
37
+ let isInitialized = false;
38
+ let userToken = null;
39
+
40
+ // Cache duration (5 minutes)
41
+ const CACHE_DURATION = 5 * 60 * 1000;
42
+
43
+ /**
44
+ * Check network connectivity
45
+ * @returns Promise<boolean> - true if connected, false otherwise
46
+ */
47
+ const checkNetworkConnectivity = async () => {
48
+ try {
49
+ const netInfo = await NetInfo.fetch();
50
+ return netInfo.isConnected === true && netInfo.isInternetReachable !== false;
51
+ } catch (error) {
52
+ console.warn('⚠️ Failed to check network connectivity:', error);
53
+ // If we can't check connectivity, assume we're connected and let the request fail naturally
54
+ return true;
55
+ }
56
+ };
57
+
58
+ // API endpoints for different environments (updated to handle non-existent dev endpoint)
59
+ const API_ENDPOINTS = {
60
+ production: `${API_CONFIG.BASE_URL}`,
61
+ staging: `${API_CONFIG.BASE_URL}`,
62
+ // Fallback to production for staging
63
+ development: `${API_CONFIG.BASE_URL}` // Fallback to production since dev-API server doesn't exist
64
+ };
65
+
66
+ /**
67
+ * Initialize the SDK with developer API key
68
+ * @param config API configuration including developer API key
69
+ */
70
+ export const initializeApiKey = async config => {
71
+ try {
72
+ console.log('🔑 Initializing Onairos SDK with developer API key...');
73
+ if (!config.apiKey) {
74
+ throw new Error('Developer API key is required for SDK initialization');
75
+ }
76
+
77
+ // Validate developer key format
78
+ if (config.apiKey.length < 32) {
79
+ throw new Error('Invalid API key format. Developer keys must be at least 32 characters long.');
80
+ }
81
+
82
+ // Check for valid developer key prefix
83
+ const validPrefixes = ['dev_', 'ona_', 'pk_'];
84
+ const hasValidPrefix = validPrefixes.some(prefix => config.apiKey.startsWith(prefix));
85
+ if (!hasValidPrefix) {
86
+ throw new Error('Invalid API key format. Developer keys must start with dev_, ona_, or pk_');
87
+ }
88
+
89
+ // Set global configuration
90
+ globalConfig = {
91
+ apiKey: config.apiKey,
92
+ environment: config.environment || 'production',
93
+ enableLogging: config.enableLogging !== false,
94
+ // Default to true
95
+ timeout: config.timeout || 30000,
96
+ retryAttempts: config.retryAttempts || 3
97
+ };
98
+ if (globalConfig.enableLogging) {
99
+ console.log('📝 SDK Configuration:', {
100
+ environment: globalConfig.environment,
101
+ timeout: globalConfig.timeout,
102
+ retryAttempts: globalConfig.retryAttempts,
103
+ apiKeyPrefix: config.apiKey.substring(0, 8) + '...',
104
+ enableLogging: globalConfig.enableLogging
105
+ });
106
+ }
107
+
108
+ // Validate the API key (handles both admin and developer keys)
109
+ const validation = await validateApiKey(config.apiKey);
110
+ if (!validation.isValid) {
111
+ // Use defensive coding to handle cases where validation.error might be undefined
112
+ const errorMessage = validation.error || '';
113
+
114
+ // Check if it's a network/connectivity issue (either from error message or the flag)
115
+ const isNetworkError = validation.isNetworkError || errorMessage.includes('Network request failed') || errorMessage.includes('Network error') || errorMessage.includes('JSON Parse error') || errorMessage.includes('API validation endpoint returned') || errorMessage.includes('timeout') || errorMessage.includes('ENOTFOUND') || errorMessage.includes('fetch') || errorMessage.includes('No network connection');
116
+ if (isNetworkError) {
117
+ console.warn('⚠️ API key validation failed due to network/connectivity issues');
118
+ console.warn('🔄 Continuing in offline mode with basic validation');
119
+ console.warn('📝 SDK will function with limited validation. Network connectivity will be retried automatically.');
120
+ console.warn('🌐 Error details:', validation.error);
121
+
122
+ // Continue initialization in offline mode - don't throw error
123
+ console.log('📱 SDK initialized in offline mode - will retry validation when network is available');
124
+ } else {
125
+ // Only throw for actual API key validation errors (not network issues)
126
+ throw new Error(`API key validation failed: ${validation.error}`);
127
+ }
128
+ }
129
+
130
+ // Try to load existing JWT token
131
+ await loadJWT();
132
+ isInitialized = true;
133
+ if (globalConfig.enableLogging) {
134
+ console.log('✅ Onairos SDK initialized successfully');
135
+ console.log('🔑 Developer API key ready for app-level operations');
136
+ if (userToken) {
137
+ console.log('🎫 User JWT token loaded from storage');
138
+ }
139
+ if (validation.permissions) {
140
+ console.log('🔐 API Key Permissions:', validation.permissions);
141
+ }
142
+ if (validation.rateLimits) {
143
+ console.log('⏱️ Rate Limits:', validation.rateLimits);
144
+ }
145
+ }
146
+ } catch (error) {
147
+ console.error('❌ Failed to initialize Onairos SDK:', error);
148
+ isInitialized = false;
149
+ throw error;
150
+ }
151
+ };
152
+
153
+ /**
154
+ * Determine API key type
155
+ * @param apiKey The API key to check
156
+ * @returns The type of API key (only DEVELOPER or INVALID - admin keys not supported in client SDK)
157
+ */
158
+ export const getApiKeyType = apiKey => {
159
+ // Developer keys must be at least 32 characters and start with specific prefix
160
+ if (apiKey.length >= 32 && (apiKey.startsWith('dev_') || apiKey.startsWith('pk_') || apiKey.startsWith('ona_'))) {
161
+ return ApiKeyType.DEVELOPER;
162
+ }
163
+ return ApiKeyType.INVALID;
164
+ };
165
+
166
+ /**
167
+ * Validate an API key with the Onairos backend
168
+ * All developer keys must be validated against the backend - no local bypass
169
+ * @param apiKey The API key to validate
170
+ * @returns Validation result with permissions and rate limits
171
+ */
172
+ export const validateApiKey = async apiKey => {
173
+ try {
174
+ var _globalConfig2, _globalConfig3, _globalConfig4;
175
+ console.log('🔍 Validating developer API key against backend...');
176
+
177
+ // Check basic format for developer keys
178
+ const keyType = getApiKeyType(apiKey);
179
+ if (keyType === ApiKeyType.INVALID) {
180
+ return {
181
+ isValid: false,
182
+ error: 'Invalid API key format. Developer keys must be at least 32 characters and start with "dev_", "pk_", or "ona_"',
183
+ keyType: ApiKeyType.INVALID
184
+ };
185
+ }
186
+
187
+ // Check cache first
188
+ const cached = validationCache.get(apiKey);
189
+ if (cached && Date.now() - cached.timestamp < CACHE_DURATION) {
190
+ var _globalConfig;
191
+ if ((_globalConfig = globalConfig) !== null && _globalConfig !== void 0 && _globalConfig.enableLogging) {
192
+ console.log('📋 Using cached API key validation result');
193
+ }
194
+ return cached.result;
195
+ }
196
+
197
+ // Check network connectivity before making API calls
198
+ const isConnected = await checkNetworkConnectivity();
199
+ if (!isConnected) {
200
+ console.warn('⚠️ No network connectivity detected');
201
+ return {
202
+ isValid: false,
203
+ error: 'No network connection available. Please check your internet connection and try again.',
204
+ keyType: keyType,
205
+ isNetworkError: true
206
+ };
207
+ }
208
+ const environment = ((_globalConfig2 = globalConfig) === null || _globalConfig2 === void 0 ? void 0 : _globalConfig2.environment) || 'production';
209
+ const baseUrl = API_ENDPOINTS[environment];
210
+ const timeout = ((_globalConfig3 = globalConfig) === null || _globalConfig3 === void 0 ? void 0 : _globalConfig3.timeout) || 30000;
211
+ const maxRetries = ((_globalConfig4 = globalConfig) === null || _globalConfig4 === void 0 ? void 0 : _globalConfig4.retryAttempts) || 3;
212
+
213
+ // Retry logic for network failures
214
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
215
+ // Create abort controller for timeout
216
+ const controller = new AbortController();
217
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
218
+ try {
219
+ var _globalConfig5;
220
+ if ((_globalConfig5 = globalConfig) !== null && _globalConfig5 !== void 0 && _globalConfig5.enableLogging && attempt > 1) {
221
+ console.log(`🔄 Retry attempt ${attempt}/${maxRetries} for API key validation`);
222
+ }
223
+ const response = await fetch(`${baseUrl}/dev/validate-apikey`, {
224
+ method: 'POST',
225
+ headers: {
226
+ 'Content-Type': 'application/json',
227
+ 'Authorization': `Bearer ${apiKey}`,
228
+ 'User-Agent': 'OnairosReactNative/3.3.1',
229
+ 'X-API-Key-Type': keyType,
230
+ 'X-SDK-Platform': 'react-native',
231
+ 'X-Retry-Attempt': attempt.toString()
232
+ },
233
+ body: JSON.stringify({
234
+ environment,
235
+ sdk_version: '3.3.1',
236
+ platform: 'react-native',
237
+ keyType,
238
+ timestamp: new Date().toISOString(),
239
+ attempt
240
+ }),
241
+ signal: controller.signal
242
+ });
243
+ clearTimeout(timeoutId);
244
+
245
+ // First check if we got a valid response
246
+ if (!response) {
247
+ throw new Error('No response received from server');
248
+ }
249
+
250
+ // Handle common HTTP errors that indicate server issues
251
+ if (response.status === 502) {
252
+ throw new Error('Onairos API is temporarily unavailable (502 Bad Gateway). Please try again later.');
253
+ }
254
+ if (response.status === 503) {
255
+ throw new Error('Onairos API is under maintenance (503 Service Unavailable). Please try again later.');
256
+ }
257
+ if (response.status === 504) {
258
+ throw new Error('Onairos API request timed out (504 Gateway Timeout). Please try again.');
259
+ }
260
+
261
+ // Check if response is actually JSON before trying to parse
262
+ const contentType = response.headers.get('content-type');
263
+ const isJsonResponse = contentType && contentType.includes('application/json');
264
+ if (!isJsonResponse) {
265
+ const textContent = await response.text();
266
+ const previewText = textContent.substring(0, 200);
267
+ console.error('❌ API endpoint returned non-JSON response:', {
268
+ status: response.status,
269
+ statusText: response.statusText,
270
+ contentType: contentType || 'unknown',
271
+ preview: previewText,
272
+ url: `${baseUrl}/dev/validate-apikey`,
273
+ attempt: attempt
274
+ });
275
+
276
+ // Handle specific error cases
277
+ if (response.status === 404) {
278
+ throw new Error(`API validation endpoint not found (404). The endpoint ${baseUrl}/dev/validate-apikey may not exist or be configured correctly.`);
279
+ } else if (response.status === 500) {
280
+ throw new Error(`Server error (500). The Onairos backend is experiencing issues.`);
281
+ } else if (response.status === 502 || response.status === 503) {
282
+ throw new Error(`Service unavailable (${response.status}). The Onairos backend may be temporarily down.`);
283
+ } else if (textContent.includes('<html') || textContent.includes('<!DOCTYPE')) {
284
+ throw new Error(`Server returned HTML page instead of JSON API response. This often indicates a routing issue or server misconfiguration.`);
285
+ } else {
286
+ throw new Error(`API validation endpoint returned ${response.status} - ${response.statusText}. Expected JSON but got ${contentType || 'unknown content type'}.`);
287
+ }
288
+ }
289
+
290
+ // Parse JSON response
291
+ let data;
292
+ try {
293
+ data = await response.json();
294
+ } catch (jsonError) {
295
+ console.error('❌ Failed to parse JSON response:', {
296
+ error: jsonError.message,
297
+ status: response.status,
298
+ contentType,
299
+ attempt: attempt
300
+ });
301
+ throw new Error(`Failed to parse server response as JSON: ${jsonError.message}`);
302
+ }
303
+
304
+ // Handle successful response
305
+ // Backend returns either {success: true} or {valid: true}
306
+ if (response.ok && (data.success || data.valid)) {
307
+ var _globalConfig6;
308
+ const result = {
309
+ isValid: true,
310
+ permissions: data.permissions || [],
311
+ rateLimits: data.rateLimits || null,
312
+ keyType: keyType
313
+ };
314
+
315
+ // Cache the successful result
316
+ validationCache.set(apiKey, {
317
+ result,
318
+ timestamp: Date.now()
319
+ });
320
+ if ((_globalConfig6 = globalConfig) !== null && _globalConfig6 !== void 0 && _globalConfig6.enableLogging) {
321
+ var _data$apiKey, _data$application, _data$apiKey2;
322
+ console.log('✅ API key validation successful', {
323
+ apiKeyId: (_data$apiKey = data.apiKey) === null || _data$apiKey === void 0 ? void 0 : _data$apiKey.id,
324
+ appName: (_data$application = data.application) === null || _data$application === void 0 ? void 0 : _data$application.name,
325
+ usageCount: (_data$apiKey2 = data.apiKey) === null || _data$apiKey2 === void 0 ? void 0 : _data$apiKey2.usageCount
326
+ });
327
+ }
328
+ return result;
329
+ } else {
330
+ // Handle API errors (invalid key, etc.)
331
+ const errorMessage = data.error || data.message || `HTTP ${response.status}: ${response.statusText}`;
332
+ const result = {
333
+ isValid: false,
334
+ error: errorMessage,
335
+ keyType: keyType
336
+ };
337
+
338
+ // For client errors (4xx), don't retry
339
+ if (response.status >= 400 && response.status < 500) {
340
+ var _globalConfig7;
341
+ if ((_globalConfig7 = globalConfig) !== null && _globalConfig7 !== void 0 && _globalConfig7.enableLogging) {
342
+ console.error('❌ API key validation failed (client error):', errorMessage);
343
+ }
344
+ return result;
345
+ }
346
+
347
+ // For server errors (5xx), retry
348
+ throw new Error(errorMessage);
349
+ }
350
+ } catch (fetchError) {
351
+ var _globalConfig8;
352
+ clearTimeout(timeoutId);
353
+ if (fetchError.name === 'AbortError') {
354
+ const errorMessage = `API key validation timeout (${timeout}ms)`;
355
+ console.error('⏱️ API key validation timeout');
356
+ if (attempt === maxRetries) {
357
+ return {
358
+ isValid: false,
359
+ error: errorMessage,
360
+ keyType: keyType
361
+ };
362
+ }
363
+ continue; // Retry timeout errors
364
+ }
365
+
366
+ // Enhanced error message based on error type
367
+ let errorMessage = `Network error during API key validation: ${fetchError.message}`;
368
+
369
+ // Add specific guidance for common errors
370
+ if (fetchError.message.includes('JSON Parse error') || fetchError.message.includes('Unexpected character')) {
371
+ errorMessage = `Server returned invalid JSON response. This usually indicates the API endpoint returned HTML instead of JSON (often a 404 or server error page). ${fetchError.message}`;
372
+ } else if (fetchError.message.includes('Network request failed') || fetchError.message.includes('fetch')) {
373
+ errorMessage = `Network connectivity issue. Please check internet connection and verify the Onairos API is accessible. ${fetchError.message}`;
374
+ } else if (fetchError.message.includes('DNS') || fetchError.message.includes('ENOTFOUND')) {
375
+ errorMessage = `DNS resolution failed for ${baseUrl}. Please check network settings and domain accessibility. ${fetchError.message}`;
376
+ }
377
+ console.error('🌐 Network error during API key validation:', {
378
+ error: fetchError,
379
+ endpoint: `${baseUrl}/dev/validate-apikey`,
380
+ attempt: attempt,
381
+ maxRetries: maxRetries,
382
+ retryable: attempt < maxRetries
383
+ });
384
+
385
+ // If this is the last attempt, return the error
386
+ if (attempt === maxRetries) {
387
+ return {
388
+ isValid: false,
389
+ error: errorMessage,
390
+ keyType: keyType,
391
+ isNetworkError: true // Flag to indicate this is a network issue, not an API key issue
392
+ };
393
+ }
394
+
395
+ // Wait before retrying (exponential backoff)
396
+ const backoffDelay = Math.min(1000 * Math.pow(2, attempt - 1), 5000);
397
+ if ((_globalConfig8 = globalConfig) !== null && _globalConfig8 !== void 0 && _globalConfig8.enableLogging) {
398
+ console.log(`⏳ Waiting ${backoffDelay}ms before retry...`);
399
+ }
400
+ await new Promise(resolve => setTimeout(() => resolve(), backoffDelay));
401
+ }
402
+ }
403
+
404
+ // This should never be reached, but just in case
405
+ return {
406
+ isValid: false,
407
+ error: 'All retry attempts exhausted',
408
+ keyType: keyType
409
+ };
410
+ } catch (error) {
411
+ const errorMessage = `API key validation error: ${error.message}`;
412
+ console.error('❌ API key validation error:', error);
413
+ return {
414
+ isValid: false,
415
+ error: errorMessage,
416
+ keyType: ApiKeyType.INVALID
417
+ };
418
+ }
419
+ };
420
+
421
+ /**
422
+ * Get the current API configuration
423
+ * @returns Current API configuration or null if not initialized
424
+ */
425
+ export const getApiConfig = () => {
426
+ return globalConfig;
427
+ };
428
+
429
+ /**
430
+ * Get the current API key
431
+ * @returns Current API key or null if not initialized
432
+ */
433
+ export const getApiKey = () => {
434
+ var _globalConfig9;
435
+ return ((_globalConfig9 = globalConfig) === null || _globalConfig9 === void 0 ? void 0 : _globalConfig9.apiKey) || null;
436
+ };
437
+
438
+ /**
439
+ * Check if the SDK is properly initialized
440
+ * @returns True if initialized with valid API key
441
+ */
442
+ export const isApiKeyInitialized = () => {
443
+ return isInitialized && globalConfig !== null;
444
+ };
445
+
446
+ /**
447
+ * Store JWT token securely after email verification
448
+ * @param token JWT token from email verification response
449
+ */
450
+ export const storeJWT = async token => {
451
+ try {
452
+ var _globalConfig0;
453
+ await AsyncStorage.setItem(JWT_TOKEN_KEY, token);
454
+ userToken = token;
455
+ if ((_globalConfig0 = globalConfig) !== null && _globalConfig0 !== void 0 && _globalConfig0.enableLogging) {
456
+ console.log('🎫 JWT token stored successfully');
457
+ }
458
+ } catch (error) {
459
+ console.error('❌ Failed to store JWT token:', error);
460
+ throw error;
461
+ }
462
+ };
463
+
464
+ /**
465
+ * Load JWT token from storage
466
+ * @returns JWT token or null if not found
467
+ */
468
+ export const loadJWT = async () => {
469
+ try {
470
+ const token = await AsyncStorage.getItem(JWT_TOKEN_KEY);
471
+ userToken = token;
472
+ return token;
473
+ } catch (error) {
474
+ console.error('❌ Failed to load JWT token:', error);
475
+ return null;
476
+ }
477
+ };
478
+
479
+ /**
480
+ * Get current JWT token
481
+ * @returns JWT token or null if not available
482
+ */
483
+ export const getJWT = () => {
484
+ return userToken;
485
+ };
486
+
487
+ /**
488
+ * Clear JWT token (on logout or token expiration)
489
+ */
490
+ export const clearJWT = async () => {
491
+ try {
492
+ var _globalConfig1;
493
+ await AsyncStorage.removeItem(JWT_TOKEN_KEY);
494
+ userToken = null;
495
+ if ((_globalConfig1 = globalConfig) !== null && _globalConfig1 !== void 0 && _globalConfig1.enableLogging) {
496
+ console.log('🗑️ JWT token cleared');
497
+ }
498
+ } catch (error) {
499
+ console.error('❌ Failed to clear JWT token:', error);
500
+ }
501
+ };
502
+
503
+ /**
504
+ * React Native compatible base64 decoder
505
+ * @param str Base64 encoded string
506
+ * @returns Decoded string
507
+ */
508
+ const base64Decode = str => {
509
+ // Simple base64 decoding for React Native
510
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
511
+ let result = '';
512
+ let i = 0;
513
+ str = str.replace(/[^A-Za-z0-9+/]/g, '');
514
+ while (i < str.length) {
515
+ const a = chars.indexOf(str.charAt(i++));
516
+ const b = chars.indexOf(str.charAt(i++));
517
+ const c = chars.indexOf(str.charAt(i++));
518
+ const d = chars.indexOf(str.charAt(i++));
519
+ const bitmap = a << 18 | b << 12 | c << 6 | d;
520
+ result += String.fromCharCode(bitmap >> 16 & 255);
521
+ if (c !== 64) result += String.fromCharCode(bitmap >> 8 & 255);
522
+ if (d !== 64) result += String.fromCharCode(bitmap & 255);
523
+ }
524
+ return result;
525
+ };
526
+
527
+ /**
528
+ * Decode JWT token payload (React Native compatible)
529
+ * @param token JWT token string
530
+ * @returns Decoded payload or null if invalid
531
+ */
532
+ export const decodeJWTPayload = token => {
533
+ try {
534
+ // Split JWT token (header.payload.signature)
535
+ const parts = token.split('.');
536
+ if (parts.length !== 3) {
537
+ console.error('❌ Invalid JWT token format');
538
+ return null;
539
+ }
540
+
541
+ // Decode payload (base64url to base64)
542
+ const payload = parts[1];
543
+ const base64 = payload.replace(/-/g, '+').replace(/_/g, '/');
544
+
545
+ // Add padding if needed
546
+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');
547
+
548
+ // Decode base64 to JSON using React Native compatible decoder
549
+ const decoded = base64Decode(padded);
550
+ return JSON.parse(decoded);
551
+ } catch (error) {
552
+ console.error('❌ Failed to decode JWT token:', error);
553
+ return null;
554
+ }
555
+ };
556
+
557
+ /**
558
+ * Extract username from JWT token
559
+ * @param token JWT token (optional, uses stored token if not provided)
560
+ * @returns Username or null if not found
561
+ */
562
+ export const extractUsernameFromJWT = token => {
563
+ try {
564
+ var _globalConfig10;
565
+ const jwtToken = token || userToken;
566
+ if (!jwtToken) {
567
+ console.warn('⚠️ No JWT token available for username extraction');
568
+ return null;
569
+ }
570
+ const payload = decodeJWTPayload(jwtToken);
571
+ if (!payload) {
572
+ return null;
573
+ }
574
+
575
+ // Try different possible username fields in order of preference
576
+ const username = payload.userName || payload.username || payload.userId || payload.email;
577
+ if ((_globalConfig10 = globalConfig) !== null && _globalConfig10 !== void 0 && _globalConfig10.enableLogging) {
578
+ console.log('👤 Extracted username from JWT:', username);
579
+ }
580
+ return username || null;
581
+ } catch (error) {
582
+ console.error('❌ Failed to extract username from JWT:', error);
583
+ return null;
584
+ }
585
+ };
586
+
587
+ /**
588
+ * Extract user data from JWT token
589
+ * @param token JWT token (optional, uses stored token if not provided)
590
+ * @returns User data object or null if not found
591
+ */
592
+ export const extractUserDataFromJWT = token => {
593
+ try {
594
+ var _globalConfig11;
595
+ const jwtToken = token || userToken;
596
+ if (!jwtToken) {
597
+ console.warn('⚠️ No JWT token available for user data extraction');
598
+ return null;
599
+ }
600
+ const payload = decodeJWTPayload(jwtToken);
601
+ if (!payload) {
602
+ return null;
603
+ }
604
+ const userData = {
605
+ id: payload.id,
606
+ email: payload.email,
607
+ userId: payload.userId,
608
+ userName: payload.userName || payload.username,
609
+ verified: payload.verified,
610
+ iat: payload.iat,
611
+ exp: payload.exp
612
+ };
613
+ if ((_globalConfig11 = globalConfig) !== null && _globalConfig11 !== void 0 && _globalConfig11.enableLogging) {
614
+ console.log('👤 Extracted user data from JWT:', userData);
615
+ }
616
+ return userData;
617
+ } catch (error) {
618
+ console.error('❌ Failed to extract user data from JWT:', error);
619
+ return null;
620
+ }
621
+ };
622
+
623
+ /**
624
+ * Check if user is authenticated with JWT token
625
+ * @returns True if user has valid JWT token
626
+ */
627
+ export const isUserAuthenticated = () => {
628
+ return !!userToken;
629
+ };
630
+
631
+ /**
632
+ * Get authenticated headers for API requests
633
+ * @returns Headers object with Authorization and other required headers
634
+ */
635
+ export const getAuthHeaders = () => {
636
+ var _globalConfig12;
637
+ if (!((_globalConfig12 = globalConfig) !== null && _globalConfig12 !== void 0 && _globalConfig12.apiKey)) {
638
+ throw new Error('SDK not initialized. Call initializeApiKey() first.');
639
+ }
640
+ const keyType = getApiKeyType(globalConfig.apiKey);
641
+ return {
642
+ 'Content-Type': 'application/json',
643
+ 'Authorization': `Bearer ${globalConfig.apiKey}`,
644
+ 'User-Agent': 'OnairosReactNative/3.0.72',
645
+ 'X-SDK-Version': '3.0.72',
646
+ 'X-SDK-Environment': globalConfig.environment || 'production',
647
+ 'X-API-Key-Type': keyType,
648
+ 'X-Timestamp': new Date().toISOString()
649
+ };
650
+ };
651
+
652
+ /**
653
+ * Get authentication headers for developer API requests
654
+ * @returns Headers with developer API key
655
+ */
656
+ export const getDeveloperAuthHeaders = () => {
657
+ var _globalConfig13;
658
+ if (!((_globalConfig13 = globalConfig) !== null && _globalConfig13 !== void 0 && _globalConfig13.apiKey)) {
659
+ throw new Error('SDK not initialized. Call initializeApiKey() first.');
660
+ }
661
+ const keyType = getApiKeyType(globalConfig.apiKey);
662
+ return {
663
+ 'Content-Type': 'application/json',
664
+ 'Authorization': `Bearer ${globalConfig.apiKey}`,
665
+ 'User-Agent': 'OnairosSDK/1.0.0',
666
+ 'X-SDK-Version': '3.0.72',
667
+ 'X-SDK-Environment': globalConfig.environment || 'production',
668
+ 'X-API-Key-Type': keyType,
669
+ 'X-Timestamp': new Date().toISOString()
670
+ };
671
+ };
672
+
673
+ /**
674
+ * Get authentication headers for user JWT requests
675
+ * @returns Headers with user JWT token
676
+ */
677
+ export const getUserAuthHeaders = () => {
678
+ var _globalConfig14;
679
+ if (!userToken) {
680
+ throw new Error('User not authenticated. Please verify email first.');
681
+ }
682
+ return {
683
+ 'Content-Type': 'application/json',
684
+ 'Authorization': `Bearer ${userToken}`,
685
+ 'User-Agent': 'OnairosSDK/1.0.0',
686
+ 'X-SDK-Version': '3.0.72',
687
+ 'X-SDK-Environment': ((_globalConfig14 = globalConfig) === null || _globalConfig14 === void 0 ? void 0 : _globalConfig14.environment) || 'production'
688
+ };
689
+ };
690
+
691
+ /**
692
+ * Make an authenticated API request
693
+ * @param endpoint The API endpoint (relative to base URL)
694
+ * @param options Fetch options
695
+ * @returns Response promise
696
+ */
697
+ export const makeAuthenticatedRequest = async (endpoint, options = {}) => {
698
+ if (!isApiKeyInitialized()) {
699
+ throw new Error('SDK not initialized. Call initializeApiKey() first.');
700
+ }
701
+ const config = getApiConfig();
702
+ const baseUrl = API_ENDPOINTS[config.environment || 'production'];
703
+ const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
704
+
705
+ // Merge authentication headers
706
+ const headers = {
707
+ ...getAuthHeaders(),
708
+ ...(options.headers || {})
709
+ };
710
+
711
+ // Add timeout
712
+ const controller = new AbortController();
713
+ const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
714
+ try {
715
+ if (config.enableLogging) {
716
+ console.log(`🌐 Making authenticated request to: ${endpoint}`);
717
+ }
718
+ const response = await fetch(url, {
719
+ ...options,
720
+ headers,
721
+ signal: controller.signal
722
+ });
723
+ clearTimeout(timeoutId);
724
+ if (config.enableLogging) {
725
+ console.log(`📡 Response status: ${response.status} for ${endpoint}`);
726
+ }
727
+
728
+ // Handle API key errors
729
+ if (response.status === 401) {
730
+ console.error('❌ API key authentication failed. Please check your API key.');
731
+ throw new Error('Invalid or expired API key');
732
+ }
733
+ if (response.status === 403) {
734
+ console.error('❌ API key permissions insufficient for this operation.');
735
+ throw new Error('Insufficient API key permissions');
736
+ }
737
+ if (response.status === 429) {
738
+ console.error('❌ API rate limit exceeded. Please try again later.');
739
+ throw new Error('Rate limit exceeded');
740
+ }
741
+ return response;
742
+ } catch (error) {
743
+ clearTimeout(timeoutId);
744
+ if (error.name === 'AbortError') {
745
+ console.error('⏱️ Request timeout for:', endpoint);
746
+ throw new Error('Request timeout');
747
+ }
748
+ throw error;
749
+ }
750
+ };
751
+
752
+ /**
753
+ * Make authenticated request with developer API key
754
+ * @param endpoint The API endpoint
755
+ * @param options Fetch options
756
+ * @returns Response promise
757
+ */
758
+ export const makeDeveloperRequest = async (endpoint, options = {}) => {
759
+ if (!isApiKeyInitialized()) {
760
+ throw new Error('SDK not initialized. Call initializeApiKey() first.');
761
+ }
762
+ const config = getApiConfig();
763
+ const baseUrl = API_ENDPOINTS[config.environment || 'production'];
764
+ const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
765
+
766
+ // Merge developer authentication headers
767
+ const headers = {
768
+ ...getDeveloperAuthHeaders(),
769
+ ...(options.headers || {})
770
+ };
771
+
772
+ // Add timeout
773
+ const controller = new AbortController();
774
+ const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
775
+ try {
776
+ if (config.enableLogging) {
777
+ console.log(`🌐 Making developer request to: ${endpoint}`);
778
+ }
779
+ const response = await fetch(url, {
780
+ ...options,
781
+ headers,
782
+ signal: controller.signal
783
+ });
784
+ clearTimeout(timeoutId);
785
+ if (config.enableLogging) {
786
+ console.log(`📡 Developer request response: ${response.status} for ${endpoint}`);
787
+ }
788
+
789
+ // Handle API key errors
790
+ if (response.status === 401) {
791
+ console.error('❌ Developer API key authentication failed');
792
+ throw new Error('Invalid or expired API key');
793
+ }
794
+ if (response.status === 403) {
795
+ console.error('❌ Developer API key permissions insufficient');
796
+ throw new Error('Insufficient API key permissions');
797
+ }
798
+ if (response.status === 429) {
799
+ console.error('❌ API rate limit exceeded');
800
+ throw new Error('Rate limit exceeded');
801
+ }
802
+ return response;
803
+ } catch (error) {
804
+ clearTimeout(timeoutId);
805
+ if (error.name === 'AbortError') {
806
+ console.error('⏱️ Request timeout for:', endpoint);
807
+ throw new Error('Request timeout');
808
+ }
809
+ throw error;
810
+ }
811
+ };
812
+
813
+ /**
814
+ * Make authenticated request with user JWT token
815
+ * @param endpoint The API endpoint
816
+ * @param options Fetch options
817
+ * @returns Response promise
818
+ */
819
+ export const makeUserRequest = async (endpoint, options = {}) => {
820
+ if (!isUserAuthenticated()) {
821
+ await loadJWT(); // Try to load from storage
822
+ }
823
+ if (!isUserAuthenticated()) {
824
+ throw new Error('User not authenticated. Please verify email first.');
825
+ }
826
+ const config = getApiConfig() || {
827
+ environment: 'production',
828
+ timeout: 30000,
829
+ enableLogging: false
830
+ };
831
+ const baseUrl = API_ENDPOINTS[config.environment || 'production'];
832
+ const url = `${baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
833
+
834
+ // Merge user authentication headers
835
+ const headers = {
836
+ ...getUserAuthHeaders(),
837
+ ...(options.headers || {})
838
+ };
839
+
840
+ // Add timeout
841
+ const controller = new AbortController();
842
+ const timeoutId = setTimeout(() => controller.abort(), config.timeout || 30000);
843
+ try {
844
+ if (config.enableLogging) {
845
+ console.log(`🌐 Making user request to: ${endpoint}`);
846
+ }
847
+ const response = await fetch(url, {
848
+ ...options,
849
+ headers,
850
+ signal: controller.signal
851
+ });
852
+ clearTimeout(timeoutId);
853
+ if (config.enableLogging) {
854
+ console.log(`📡 User request response: ${response.status} for ${endpoint}`);
855
+ }
856
+
857
+ // Handle JWT token errors
858
+ if (response.status === 401) {
859
+ console.error('❌ JWT token authentication failed - token may be expired');
860
+ await clearJWT(); // Clear expired token
861
+ throw new Error('Authentication expired. Please verify email again.');
862
+ }
863
+ if (response.status === 403) {
864
+ console.error('❌ JWT token permissions insufficient');
865
+ throw new Error('Insufficient permissions for this operation');
866
+ }
867
+ return response;
868
+ } catch (error) {
869
+ clearTimeout(timeoutId);
870
+ if (error.name === 'AbortError') {
871
+ console.error('⏱️ Request timeout for:', endpoint);
872
+ throw new Error('Request timeout');
873
+ }
874
+ throw error;
875
+ }
876
+ };
877
+
878
+ /**
879
+ * Clear the API key validation cache
880
+ */
881
+ export const clearValidationCache = () => {
882
+ var _globalConfig15;
883
+ validationCache.clear();
884
+ if ((_globalConfig15 = globalConfig) !== null && _globalConfig15 !== void 0 && _globalConfig15.enableLogging) {
885
+ console.log('🗑️ API key validation cache cleared');
886
+ }
887
+ };
888
+
889
+ /**
890
+ * Reset the SDK initialization state
891
+ */
892
+ export const resetApiKeyService = () => {
893
+ globalConfig = null;
894
+ isInitialized = false;
895
+ clearValidationCache();
896
+ console.log('🔄 API key service reset');
897
+ };
898
+ //# sourceMappingURL=apiKeyService.js.map