@123usmanhaider321/ui 0.1.6 → 1.0.0
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.
- package/README.md +416 -31
- package/dist/images/icon/1LINK.svg +50 -0
- package/dist/images/icon/CreditCard.svg +83 -0
- package/dist/images/icon/Easypaisa.png +0 -0
- package/dist/images/icon/MobileWallet.png +0 -0
- package/dist/images/icon/Raast-Logo.png +0 -0
- package/dist/images/icon/VISA.png +0 -0
- package/dist/images/icon/add-circle-1.svg +5 -0
- package/dist/images/icon/check-circle-broken.svg +3 -0
- package/dist/images/icon/close-circle.svg +5 -0
- package/dist/images/icon/jazzcash.png +0 -0
- package/dist/images/icon/loading_icon.json +3347 -0
- package/dist/images/icon/mastercard-logo.webp +0 -0
- package/dist/images/icon/paymo.jpeg +0 -0
- package/dist/images/icon/preview-svgrepo-com.svg +36 -0
- package/dist/images/icon/trash.svg +7 -0
- package/dist/images/icon/unionpay-logo.svg +9 -0
- package/dist/index-87FQZHOs.js +11119 -0
- package/dist/index-87FQZHOs.js.map +1 -0
- package/dist/index-Tl9g213f.js +60475 -0
- package/dist/index-Tl9g213f.js.map +1 -0
- package/dist/index.d.ts +1 -10
- package/dist/index.es-CpgTaa1Y.js +16734 -0
- package/dist/index.es-CpgTaa1Y.js.map +1 -0
- package/dist/index.js +40 -12
- package/dist/index.js.map +1 -1
- package/dist/loading_icon-n5H5dQBl.js +3375 -0
- package/dist/loading_icon-n5H5dQBl.js.map +1 -0
- package/dist/src/components/Alert/ErrorAlert.d.ts +6 -0
- package/dist/src/components/Alert/SuccessAlert.d.ts +6 -0
- package/dist/{components → src/components}/FormBuilder/DiscountInput.d.ts +3 -6
- package/dist/{components → src/components}/FormBuilder/FormBuilder.d.ts +2 -11
- package/dist/{components → src/components}/FormBuilder/QuestionCard.d.ts +0 -5
- package/dist/{components → src/components}/FormBuilder/QuestionEditor.d.ts +0 -5
- package/dist/{components → src/components}/FormBuilder/SortableQuestionList.d.ts +0 -5
- package/dist/src/components/FormBuilder/questionIcons.d.ts +5 -0
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventLayout.d.ts +2 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/AddEventStepper.d.ts +2 -2
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/ConfirmationModal.d.ts +1 -1
- package/dist/src/components/NewAddEvent/components/EventSubmissionConfirmationModal.d.ts +14 -0
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/TicketTierSection.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTierForm.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useStepperForm.d.ts +22 -22
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/hooks/useTicketTierForm.d.ts +63 -15
- package/dist/src/components/NewAddEvent/schemas/step1.d.ts +211 -0
- package/dist/src/components/NewAddEvent/schemas/step2.d.ts +411 -0
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/schemas/utils.d.ts +8 -2
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/IndividualFormStep.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/SocialProfilesStep.d.ts +1 -1
- package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/TeamFormStep.d.ts +1 -1
- package/dist/src/components/Spinner/spinner.d.ts +4 -0
- package/dist/src/components/TicketlyUIProvider.d.ts +35 -0
- package/dist/src/components/common/Loader/index.d.ts +8 -0
- package/dist/src/components/common/Modals/ConfirmationModal.d.ts +7 -0
- package/dist/{components/FormInput → src/components/ui}/FormInput.d.ts +1 -1
- package/dist/src/components/ui/Loader.d.ts +4 -0
- package/dist/{components/Button/Button.d.ts → src/components/ui/button.d.ts} +1 -1
- package/dist/src/index.d.ts +10 -0
- package/dist/{lib → src/lib}/actions.d.ts +0 -126
- package/dist/src/lib/dom-utils.d.ts +2 -0
- package/dist/src/lib/storage-utils.d.ts +5 -0
- package/dist/src/lib/types.d.ts +258 -0
- package/dist/src/redux/baseQuery.d.ts +16 -0
- package/dist/{services → src/redux/features}/eventApi.d.ts +1053 -1745
- package/dist/src/redux/features/globalSlice.d.ts +17 -0
- package/dist/{services → src/redux/features/single-event}/single-event-api.d.ts +856 -1190
- package/dist/src/redux/types.d.ts +2 -0
- package/dist/src/services/library-services.d.ts +15 -0
- package/dist/src/services/remote-config.d.ts +27 -0
- package/dist/{services → src/services}/utils.d.ts +1 -1
- package/dist/src/theme/colors.d.ts +127 -0
- package/dist/src/theme/typography.d.ts +13 -0
- package/dist/src/types/api.d.ts +18 -0
- package/dist/style.css +2984 -0
- package/dist/styles.css +3758 -3636
- package/package.json +78 -68
- package/dist/_virtual/_commonjsHelpers.js +0 -9
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/customParseFormat.js +0 -5
- package/dist/_virtual/customParseFormat.js.map +0 -1
- package/dist/_virtual/dayjs.min.js +0 -5
- package/dist/_virtual/dayjs.min.js.map +0 -1
- package/dist/_virtual/duration.js +0 -5
- package/dist/_virtual/duration.js.map +0 -1
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index.js.map +0 -1
- package/dist/_virtual/isBetween.js +0 -5
- package/dist/_virtual/isBetween.js.map +0 -1
- package/dist/_virtual/relativeTime.js +0 -5
- package/dist/_virtual/relativeTime.js.map +0 -1
- package/dist/_virtual/use-sync-external-store-shim.development.js +0 -5
- package/dist/_virtual/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/_virtual/use-sync-external-store-shim.production.js +0 -5
- package/dist/_virtual/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/_virtual/with-selector.development.js +0 -5
- package/dist/_virtual/with-selector.development.js.map +0 -1
- package/dist/_virtual/with-selector.js +0 -5
- package/dist/_virtual/with-selector.js.map +0 -1
- package/dist/_virtual/with-selector.production.js +0 -5
- package/dist/_virtual/with-selector.production.js.map +0 -1
- package/dist/components/Alert/Alert.js +0 -51
- package/dist/components/Alert/Alert.js.map +0 -1
- package/dist/components/Button/Button.js +0 -52
- package/dist/components/Button/Button.js.map +0 -1
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.js +0 -50
- package/dist/components/Checkbox/Checkbox.js.map +0 -1
- package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/components/Checkbox/index.d.ts +0 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +0 -25
- package/dist/components/CheckboxGroup/CheckboxGroup.js +0 -99
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +0 -1
- package/dist/components/ConfirmationModal/ConfirmationModal.d.ts +0 -15
- package/dist/components/ConfirmationModal/ConfirmationModal.js +0 -136
- package/dist/components/ConfirmationModal/ConfirmationModal.js.map +0 -1
- package/dist/components/ConfirmationModal/index.d.ts +0 -2
- package/dist/components/CustomSelect/CustomSelect.js +0 -259
- package/dist/components/CustomSelect/CustomSelect.js.map +0 -1
- package/dist/components/EventAddForm/AddEventLayout.js +0 -227
- package/dist/components/EventAddForm/AddEventLayout.js.map +0 -1
- package/dist/components/EventAddForm/AddEventStepper.js +0 -719
- package/dist/components/EventAddForm/AddEventStepper.js.map +0 -1
- package/dist/components/EventAddForm/common/ConfirmationModal.js +0 -136
- package/dist/components/EventAddForm/common/ConfirmationModal.js.map +0 -1
- package/dist/components/EventAddForm/common/DescriptionModal.js +0 -70
- package/dist/components/EventAddForm/common/DescriptionModal.js.map +0 -1
- package/dist/components/EventAddForm/components/AnimatedBackground.d.ts +0 -8
- package/dist/components/EventAddForm/components/ApprovalConfirmationModal.d.ts +0 -7
- package/dist/components/EventAddForm/components/CheckboxGroup.js +0 -92
- package/dist/components/EventAddForm/components/CheckboxGroup.js.map +0 -1
- package/dist/components/EventAddForm/components/CustomMeetingForm.js +0 -237
- package/dist/components/EventAddForm/components/CustomMeetingForm.js.map +0 -1
- package/dist/components/EventAddForm/components/DateTimeField.js +0 -173
- package/dist/components/EventAddForm/components/DateTimeField.js.map +0 -1
- package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.d.ts +0 -33
- package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js +0 -366
- package/dist/components/EventAddForm/components/EventSubmissionConfirmationModal.js.map +0 -1
- package/dist/components/EventAddForm/components/FileUpload.js +0 -412
- package/dist/components/EventAddForm/components/FileUpload.js.map +0 -1
- package/dist/components/EventAddForm/components/FormBuilderProceedModal.js +0 -197
- package/dist/components/EventAddForm/components/FormBuilderProceedModal.js.map +0 -1
- package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js +0 -1179
- package/dist/components/EventAddForm/components/GoogleMapsAutocompleteInput.js.map +0 -1
- package/dist/components/EventAddForm/components/InputField.d.ts +0 -15
- package/dist/components/EventAddForm/components/RadioGroupButton.d.ts +0 -14
- package/dist/components/EventAddForm/components/SelectField.d.ts +0 -19
- package/dist/components/EventAddForm/components/SingleDateTimeInput.js +0 -102
- package/dist/components/EventAddForm/components/SingleDateTimeInput.js.map +0 -1
- package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js +0 -277
- package/dist/components/EventAddForm/components/StepTwo/CustomFormSection.js.map +0 -1
- package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js +0 -148
- package/dist/components/EventAddForm/components/StepTwo/TicketTierSection.js.map +0 -1
- package/dist/components/EventAddForm/components/TicketTierForm.js +0 -418
- package/dist/components/EventAddForm/components/TicketTierForm.js.map +0 -1
- package/dist/components/EventAddForm/components/TicketTypeSelection.js +0 -93
- package/dist/components/EventAddForm/components/TicketTypeSelection.js.map +0 -1
- package/dist/components/EventAddForm/hooks/useStepperForm.js +0 -371
- package/dist/components/EventAddForm/hooks/useStepperForm.js.map +0 -1
- package/dist/components/EventAddForm/hooks/useTicketTierForm.js +0 -237
- package/dist/components/EventAddForm/hooks/useTicketTierForm.js.map +0 -1
- package/dist/components/EventAddForm/index.d.ts +0 -3
- package/dist/components/EventAddForm/index.js +0 -41
- package/dist/components/EventAddForm/index.js.map +0 -1
- package/dist/components/EventAddForm/schemas/index.d.ts +0 -2
- package/dist/components/EventAddForm/schemas/step1.d.ts +0 -47
- package/dist/components/EventAddForm/schemas/step1.js +0 -135
- package/dist/components/EventAddForm/schemas/step1.js.map +0 -1
- package/dist/components/EventAddForm/schemas/step2.d.ts +0 -138
- package/dist/components/EventAddForm/schemas/step2.js +0 -94
- package/dist/components/EventAddForm/schemas/step2.js.map +0 -1
- package/dist/components/EventAddForm/schemas/utils.js +0 -28
- package/dist/components/EventAddForm/schemas/utils.js.map +0 -1
- package/dist/components/EventAddForm/steps/IndividualFormStep.js +0 -85
- package/dist/components/EventAddForm/steps/IndividualFormStep.js.map +0 -1
- package/dist/components/EventAddForm/steps/SocialProfilesStep.js +0 -123
- package/dist/components/EventAddForm/steps/SocialProfilesStep.js.map +0 -1
- package/dist/components/EventAddForm/steps/StepOne.js +0 -462
- package/dist/components/EventAddForm/steps/StepOne.js.map +0 -1
- package/dist/components/EventAddForm/steps/StepTwo.js +0 -173
- package/dist/components/EventAddForm/steps/StepTwo.js.map +0 -1
- package/dist/components/EventAddForm/steps/TeamFormStep.js +0 -13
- package/dist/components/EventAddForm/steps/TeamFormStep.js.map +0 -1
- package/dist/components/FormBuilder/CategoryList.js +0 -242
- package/dist/components/FormBuilder/CategoryList.js.map +0 -1
- package/dist/components/FormBuilder/DiscountInput.js +0 -366
- package/dist/components/FormBuilder/DiscountInput.js.map +0 -1
- package/dist/components/FormBuilder/FormBuilder.js +0 -918
- package/dist/components/FormBuilder/FormBuilder.js.map +0 -1
- package/dist/components/FormBuilder/OptionList.js +0 -120
- package/dist/components/FormBuilder/OptionList.js.map +0 -1
- package/dist/components/FormBuilder/PaymentPreview.d.ts +0 -12
- package/dist/components/FormBuilder/PaymentPreview.js +0 -70
- package/dist/components/FormBuilder/PaymentPreview.js.map +0 -1
- package/dist/components/FormBuilder/PreviewInput.d.ts +0 -10
- package/dist/components/FormBuilder/PreviewInput.js +0 -143
- package/dist/components/FormBuilder/PreviewInput.js.map +0 -1
- package/dist/components/FormBuilder/QuestionCard.js +0 -252
- package/dist/components/FormBuilder/QuestionCard.js.map +0 -1
- package/dist/components/FormBuilder/QuestionEditor.js +0 -166
- package/dist/components/FormBuilder/QuestionEditor.js.map +0 -1
- package/dist/components/FormBuilder/RequiredToggle.js +0 -43
- package/dist/components/FormBuilder/RequiredToggle.js.map +0 -1
- package/dist/components/FormBuilder/SortableQuestionList.js +0 -137
- package/dist/components/FormBuilder/SortableQuestionList.js.map +0 -1
- package/dist/components/FormBuilder/index.d.ts +0 -4
- package/dist/components/FormBuilder/utils.js +0 -229
- package/dist/components/FormBuilder/utils.js.map +0 -1
- package/dist/components/FormInput/FormInput.js +0 -126
- package/dist/components/FormInput/FormInput.js.map +0 -1
- package/dist/components/FormInput/FormInput.test.d.ts +0 -1
- package/dist/components/FormInput/index.d.ts +0 -2
- package/dist/components/ImageCropModal/index.js +0 -464
- package/dist/components/ImageCropModal/index.js.map +0 -1
- package/dist/components/InformationPopover/InformationPopover.d.ts +0 -7
- package/dist/components/InformationPopover/InformationPopover.js +0 -19
- package/dist/components/InformationPopover/InformationPopover.js.map +0 -1
- package/dist/components/InformationPopover.js +0 -19
- package/dist/components/InformationPopover.js.map +0 -1
- package/dist/components/InputErrorMessage/InputErrorMessage.js +0 -21
- package/dist/components/InputErrorMessage/InputErrorMessage.js.map +0 -1
- package/dist/components/Modal/Modal.d.ts +0 -15
- package/dist/components/Modal/Modal.js +0 -73
- package/dist/components/Modal/Modal.js.map +0 -1
- package/dist/components/Radio/Radio.js +0 -35
- package/dist/components/Radio/Radio.js.map +0 -1
- package/dist/components/Spinner/spinner.d.ts +0 -2
- package/dist/components/Spinner/spinner.js +0 -22
- package/dist/components/Spinner/spinner.js.map +0 -1
- package/dist/components/Toggle/Toggle.d.ts +0 -16
- package/dist/components/Toggle/index.d.ts +0 -2
- package/dist/components/Tooltip/Tooltip.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.js +0 -134
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/common/FallbackImage.js +0 -47
- package/dist/components/common/FallbackImage.js.map +0 -1
- package/dist/components/ui/Calendar/calendar-utils.js +0 -51
- package/dist/components/ui/Calendar/calendar-utils.js.map +0 -1
- package/dist/components/ui/Calendar/index.js +0 -142
- package/dist/components/ui/Calendar/index.js.map +0 -1
- package/dist/components/ui/Checkbox.d.ts +0 -9
- package/dist/components/ui/Checkbox.js +0 -50
- package/dist/components/ui/Checkbox.js.map +0 -1
- package/dist/components/ui/DatePicker/index.js +0 -188
- package/dist/components/ui/DatePicker/index.js.map +0 -1
- package/dist/components/ui/FormInput.js +0 -129
- package/dist/components/ui/FormInput.js.map +0 -1
- package/dist/components/ui/InputErrorMessage.d.ts +0 -7
- package/dist/components/ui/InputErrorMessage.js +0 -21
- package/dist/components/ui/InputErrorMessage.js.map +0 -1
- package/dist/components/ui/Modal/index.js +0 -73
- package/dist/components/ui/Modal/index.js.map +0 -1
- package/dist/components/ui/Radio.d.ts +0 -6
- package/dist/components/ui/Radio.js +0 -35
- package/dist/components/ui/Radio.js.map +0 -1
- package/dist/components/ui/RichTextEditor.js +0 -242
- package/dist/components/ui/RichTextEditor.js.map +0 -1
- package/dist/components/ui/TimePicker/index.js +0 -215
- package/dist/components/ui/TimePicker/index.js.map +0 -1
- package/dist/components/ui/TimeSelector/index.js +0 -138
- package/dist/components/ui/TimeSelector/index.js.map +0 -1
- package/dist/components/ui/Tooltip.d.ts +0 -12
- package/dist/components/ui/Tooltip.js +0 -136
- package/dist/components/ui/Tooltip.js.map +0 -1
- package/dist/hooks/useDropdownPosition.d.ts +0 -11
- package/dist/hooks/useFirebaseAuthState.d.ts +0 -6
- package/dist/hooks/useFirebaseAuthState.js +0 -23
- package/dist/hooks/useFirebaseAuthState.js.map +0 -1
- package/dist/hooks/useTicketTierForm.d.ts +0 -61
- package/dist/lib/actions.js +0 -32
- package/dist/lib/actions.js.map +0 -1
- package/dist/lib/cropImage.js +0 -113
- package/dist/lib/cropImage.js.map +0 -1
- package/dist/lib/imageAnalysis.js +0 -58
- package/dist/lib/imageAnalysis.js.map +0 -1
- package/dist/lib/utils.js +0 -9
- package/dist/lib/utils.js.map +0 -1
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +0 -60
- package/dist/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js.map +0 -1
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js +0 -3458
- package/dist/node_modules/@dnd-kit/core/dist/core.esm.js.map +0 -1
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +0 -593
- package/dist/node_modules/@dnd-kit/sortable/dist/sortable.esm.js.map +0 -1
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +0 -302
- package/dist/node_modules/@dnd-kit/utilities/dist/utilities.esm.js.map +0 -1
- package/dist/node_modules/@firebase/app/dist/esm/index.esm.js +0 -768
- package/dist/node_modules/@firebase/app/dist/esm/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/component/dist/esm/index.esm.js +0 -340
- package/dist/node_modules/@firebase/component/dist/esm/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js +0 -123
- package/dist/node_modules/@firebase/logger/dist/esm/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/storage/dist/index.esm.js +0 -2623
- package/dist/node_modules/@firebase/storage/dist/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/util/dist/index.esm.js +0 -658
- package/dist/node_modules/@firebase/util/dist/index.esm.js.map +0 -1
- package/dist/node_modules/@firebase/util/dist/postinstall.js +0 -5
- package/dist/node_modules/@firebase/util/dist/postinstall.js.map +0 -1
- package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js +0 -3179
- package/dist/node_modules/@fortawesome/fontawesome-svg-core/index.js.map +0 -1
- package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js +0 -60
- package/dist/node_modules/@fortawesome/free-solid-svg-icons/index.js.map +0 -1
- package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js +0 -400
- package/dist/node_modules/@fortawesome/react-fontawesome/dist/index.js.map +0 -1
- package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js +0 -27
- package/dist/node_modules/@heroicons/react/20/solid/esm/CheckIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js +0 -27
- package/dist/node_modules/@heroicons/react/20/solid/esm/ChevronDownIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowRightIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/ClockIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/DocumentDuplicateIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/InformationCircleIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/LinkIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js +0 -33
- package/dist/node_modules/@heroicons/react/24/outline/esm/MapPinIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/VideoCameraIcon.js.map +0 -1
- package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js +0 -29
- package/dist/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js.map +0 -1
- package/dist/node_modules/@tiptap/core/dist/index.js +0 -5446
- package/dist/node_modules/@tiptap/core/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +0 -21
- package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +0 -78
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +0 -100
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +0 -70
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +0 -317
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +0 -16
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +0 -66
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +0 -86
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +0 -80
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +0 -98
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +0 -423
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +0 -1039
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +0 -61
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +0 -7
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +0 -79
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +0 -16
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +0 -76
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +0 -376
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +0 -650
- package/dist/node_modules/@tiptap/react/dist/index.js.map +0 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +0 -97
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +0 -1
- package/dist/node_modules/dayjs/dayjs.min.js +0 -283
- package/dist/node_modules/dayjs/dayjs.min.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/customParseFormat.js +0 -130
- package/dist/node_modules/dayjs/plugin/customParseFormat.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/duration.js +0 -137
- package/dist/node_modules/dayjs/plugin/duration.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/isBetween.js +0 -20
- package/dist/node_modules/dayjs/plugin/isBetween.js.map +0 -1
- package/dist/node_modules/dayjs/plugin/relativeTime.js +0 -49
- package/dist/node_modules/dayjs/plugin/relativeTime.js.map +0 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +0 -442
- package/dist/node_modules/fast-equals/dist/es/index.js.map +0 -1
- package/dist/node_modules/idb/build/index.js +0 -70
- package/dist/node_modules/idb/build/index.js.map +0 -1
- package/dist/node_modules/idb/build/wrap-idb-value.js +0 -149
- package/dist/node_modules/idb/build/wrap-idb-value.js.map +0 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +0 -1159
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +0 -1
- package/dist/node_modules/orderedmap/dist/index.js +0 -120
- package/dist/node_modules/orderedmap/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +0 -527
- package/dist/node_modules/prosemirror-commands/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +0 -137
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +0 -221
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +0 -357
- package/dist/node_modules/prosemirror-history/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js +0 -84
- package/dist/node_modules/prosemirror-keymap/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +0 -3209
- package/dist/node_modules/prosemirror-model/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +0 -131
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-state/dist/index.js +0 -936
- package/dist/node_modules/prosemirror-state/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +0 -1881
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +0 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +0 -5232
- package/dist/node_modules/prosemirror-view/dist/index.js.map +0 -1
- package/dist/node_modules/rope-sequence/dist/index.js +0 -184
- package/dist/node_modules/rope-sequence/dist/index.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +0 -82
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +0 -78
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -78
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -63
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/index.js +0 -13
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +0 -1
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +0 -13
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +0 -1
- package/dist/node_modules/w3c-keyname/index.js +0 -106
- package/dist/node_modules/w3c-keyname/index.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/coerce.js +0 -10
- package/dist/node_modules/zod/v4/classic/coerce.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/compat.js +0 -8
- package/dist/node_modules/zod/v4/classic/compat.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/errors.js +0 -45
- package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/iso.js +0 -44
- package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/parse.js +0 -30
- package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -711
- package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/api.js +0 -588
- package/dist/node_modules/zod/v4/core/api.js.map +0 -1
- package/dist/node_modules/zod/v4/core/checks.js +0 -411
- package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
- package/dist/node_modules/zod/v4/core/core.js +0 -75
- package/dist/node_modules/zod/v4/core/core.js.map +0 -1
- package/dist/node_modules/zod/v4/core/doc.js +0 -38
- package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
- package/dist/node_modules/zod/v4/core/errors.js +0 -73
- package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -359
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/parse.js +0 -96
- package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/core/regexes.js +0 -84
- package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
- package/dist/node_modules/zod/v4/core/registries.js +0 -52
- package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
- package/dist/node_modules/zod/v4/core/schemas.js +0 -1391
- package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -363
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
- package/dist/node_modules/zod/v4/core/util.js +0 -431
- package/dist/node_modules/zod/v4/core/util.js.map +0 -1
- package/dist/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
- package/dist/redux/baseQuery.d.ts +0 -1
- package/dist/redux/baseQuery.js +0 -24
- package/dist/redux/baseQuery.js.map +0 -1
- package/dist/services/eventApi.js +0 -411
- package/dist/services/eventApi.js.map +0 -1
- package/dist/services/helpers.js +0 -115
- package/dist/services/helpers.js.map +0 -1
- package/dist/services/initialize-firebase.d.ts +0 -2
- package/dist/services/initialize-firebase.js +0 -20
- package/dist/services/initialize-firebase.js.map +0 -1
- package/dist/services/process-image-on-server.js +0 -30
- package/dist/services/process-image-on-server.js.map +0 -1
- package/dist/services/remote-config.d.ts +0 -5
- package/dist/services/remote-config.js +0 -9
- package/dist/services/remote-config.js.map +0 -1
- package/dist/services/single-event-api.js +0 -301
- package/dist/services/single-event-api.js.map +0 -1
- package/dist/services/utils.js +0 -107
- package/dist/services/utils.js.map +0 -1
- package/dist/setupTests.d.ts +0 -1
- package/dist/stories/Alert.stories.d.ts +0 -10
- package/dist/stories/Button.stories.d.ts +0 -13
- package/dist/types/redux-types.d.ts +0 -15
- package/dist/types/types.d.ts +0 -60
- package/dist/types/types.js +0 -10
- package/dist/types/types.js.map +0 -1
- package/dist/utils/cn.d.ts +0 -6
- package/dist/utils/cn.js +0 -9
- package/dist/utils/cn.js.map +0 -1
- package/dist/utils/date-range.d.ts +0 -4
- package/dist/utils/date-range.js +0 -13
- package/dist/utils/date-range.js.map +0 -1
- package/dist/utils/single-event-helpers.d.ts +0 -50
- package/dist/utils/single-event-helpers.js +0 -18
- package/dist/utils/single-event-helpers.js.map +0 -1
- package/dist/utils/social-validation.js +0 -42
- package/dist/utils/social-validation.js.map +0 -1
- package/dist/utils/utils.js +0 -20
- package/dist/utils/utils.js.map +0 -1
- /package/dist/{components/Alert/Alert.d.ts → src/components/Alert/index.d.ts} +0 -0
- /package/dist/{components → src/components}/FormBuilder/CategoryList.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/OptionList.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/RequiredToggle.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/types.d.ts +0 -0
- /package/dist/{components → src/components}/FormBuilder/utils.d.ts +0 -0
- /package/dist/{components → src/components}/ImageCropModal/index.d.ts +0 -0
- /package/dist/{components → src/components}/InformationPopover.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/common/DescriptionModal.d.ts +0 -0
- /package/dist/{components/ui/FormInput.d.ts → src/components/NewAddEvent/components/AddEventFormInput.d.ts} +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CheckboxGroup.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/CustomMeetingForm.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/DateTimeField.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FileUpload.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/FormBuilderProceedModal.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/GoogleMapsAutocompleteInput.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/SingleDateTimeInput.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/StepTwo/CustomFormSection.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/components/TicketTypeSelection.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepOne.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/steps/StepTwo.d.ts +0 -0
- /package/dist/{components/EventAddForm → src/components/NewAddEvent}/types.d.ts +0 -0
- /package/dist/{components → src/components}/common/FallbackImage.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Calendar/calendar-utils.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Calendar/index.d.ts +0 -0
- /package/dist/{components/Checkbox → src/components/ui}/Checkbox.d.ts +0 -0
- /package/dist/{components/CustomSelect → src/components/ui}/CustomSelect.d.ts +0 -0
- /package/dist/{components → src/components}/ui/DatePicker/index.d.ts +0 -0
- /package/dist/{components/InputErrorMessage → src/components/ui}/InputErrorMessage.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Modal/index.d.ts +0 -0
- /package/dist/{components/Radio → src/components/ui}/Radio.d.ts +0 -0
- /package/dist/{components → src/components}/ui/RichTextEditor.d.ts +0 -0
- /package/dist/{components → src/components}/ui/TimePicker/index.d.ts +0 -0
- /package/dist/{components → src/components}/ui/TimeSelector/index.d.ts +0 -0
- /package/dist/{components → src/components}/ui/Tooltip/index.d.ts +0 -0
- /package/dist/{lib → src/lib}/constants.d.ts +0 -0
- /package/dist/{lib → src/lib}/cropImage.d.ts +0 -0
- /package/dist/{lib → src/lib}/imageAnalysis.d.ts +0 -0
- /package/dist/{utils → src/lib}/social-validation.d.ts +0 -0
- /package/dist/{lib/utils.d.ts → src/lib/tailwind-merge.d.ts} +0 -0
- /package/dist/{utils → src/lib}/utils.d.ts +0 -0
- /package/dist/{services → src/redux/features/single-event}/helpers.d.ts +0 -0
- /package/dist/{services → src/services}/process-image-on-server.d.ts +0 -0
- /package/dist/{types → src/types}/events.d.ts +0 -0
- /package/dist/{types → src/types}/question.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../../../node_modules/@firebase/app/dist/esm/index.esm.js"],"sourcesContent":["import { Component, ComponentContainer } from '@firebase/component';\nimport { Logger, setUserLogHandler, setLogLevel as setLogLevel$1 } from '@firebase/logger';\nimport { ErrorFactory, base64Decode, getDefaultAppConfig, deepEqual, isBrowser, isWebWorker, FirebaseError, base64urlEncodeWithoutPadding, isIndexedDBAvailable, validateIndexedDBOpenable } from '@firebase/util';\nexport { FirebaseError } from '@firebase/util';\nimport { openDB } from 'idb';\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass PlatformLoggerServiceImpl {\n constructor(container) {\n this.container = container;\n }\n // In initial implementation, this will be called by installations on\n // auth token refresh, and installations will send this string.\n getPlatformInfoString() {\n const providers = this.container.getProviders();\n // Loop through providers and get library/version pairs from any that are\n // version components.\n return providers\n .map(provider => {\n if (isVersionServiceProvider(provider)) {\n const service = provider.getImmediate();\n return `${service.library}/${service.version}`;\n }\n else {\n return null;\n }\n })\n .filter(logString => logString)\n .join(' ');\n }\n}\n/**\n *\n * @param provider check if this provider provides a VersionService\n *\n * NOTE: Using Provider<'app-version'> is a hack to indicate that the provider\n * provides VersionService. The provider is not necessarily a 'app-version'\n * provider.\n */\nfunction isVersionServiceProvider(provider) {\n const component = provider.getComponent();\n return component?.type === \"VERSION\" /* ComponentType.VERSION */;\n}\n\nconst name$q = \"@firebase/app\";\nconst version$1 = \"0.14.11\";\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst logger = new Logger('@firebase/app');\n\nconst name$p = \"@firebase/app-compat\";\n\nconst name$o = \"@firebase/analytics-compat\";\n\nconst name$n = \"@firebase/analytics\";\n\nconst name$m = \"@firebase/app-check-compat\";\n\nconst name$l = \"@firebase/app-check\";\n\nconst name$k = \"@firebase/auth\";\n\nconst name$j = \"@firebase/auth-compat\";\n\nconst name$i = \"@firebase/database\";\n\nconst name$h = \"@firebase/data-connect\";\n\nconst name$g = \"@firebase/database-compat\";\n\nconst name$f = \"@firebase/functions\";\n\nconst name$e = \"@firebase/functions-compat\";\n\nconst name$d = \"@firebase/installations\";\n\nconst name$c = \"@firebase/installations-compat\";\n\nconst name$b = \"@firebase/messaging\";\n\nconst name$a = \"@firebase/messaging-compat\";\n\nconst name$9 = \"@firebase/performance\";\n\nconst name$8 = \"@firebase/performance-compat\";\n\nconst name$7 = \"@firebase/remote-config\";\n\nconst name$6 = \"@firebase/remote-config-compat\";\n\nconst name$5 = \"@firebase/storage\";\n\nconst name$4 = \"@firebase/storage-compat\";\n\nconst name$3 = \"@firebase/firestore\";\n\nconst name$2 = \"@firebase/ai\";\n\nconst name$1 = \"@firebase/firestore-compat\";\n\nconst name = \"firebase\";\nconst version = \"12.12.0\";\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The default app name\n *\n * @internal\n */\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\nconst PLATFORM_LOG_STRING = {\n [name$q]: 'fire-core',\n [name$p]: 'fire-core-compat',\n [name$n]: 'fire-analytics',\n [name$o]: 'fire-analytics-compat',\n [name$l]: 'fire-app-check',\n [name$m]: 'fire-app-check-compat',\n [name$k]: 'fire-auth',\n [name$j]: 'fire-auth-compat',\n [name$i]: 'fire-rtdb',\n [name$h]: 'fire-data-connect',\n [name$g]: 'fire-rtdb-compat',\n [name$f]: 'fire-fn',\n [name$e]: 'fire-fn-compat',\n [name$d]: 'fire-iid',\n [name$c]: 'fire-iid-compat',\n [name$b]: 'fire-fcm',\n [name$a]: 'fire-fcm-compat',\n [name$9]: 'fire-perf',\n [name$8]: 'fire-perf-compat',\n [name$7]: 'fire-rc',\n [name$6]: 'fire-rc-compat',\n [name$5]: 'fire-gcs',\n [name$4]: 'fire-gcs-compat',\n [name$3]: 'fire-fst',\n [name$1]: 'fire-fst-compat',\n [name$2]: 'fire-vertex',\n 'fire-js': 'fire-js', // Platform identifier for JS SDK.\n [name]: 'fire-js-all'\n};\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @internal\n */\nconst _apps = new Map();\n/**\n * @internal\n */\nconst _serverApps = new Map();\n/**\n * Registered components.\n *\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _components = new Map();\n/**\n * @param component - the component being added to this app's container\n *\n * @internal\n */\nfunction _addComponent(app, component) {\n try {\n app.container.addComponent(component);\n }\n catch (e) {\n logger.debug(`Component ${component.name} failed to register with FirebaseApp ${app.name}`, e);\n }\n}\n/**\n *\n * @internal\n */\nfunction _addOrOverwriteComponent(app, component) {\n app.container.addOrOverwriteComponent(component);\n}\n/**\n *\n * @param component - the component to register\n * @returns whether or not the component is registered successfully\n *\n * @internal\n */\nfunction _registerComponent(component) {\n const componentName = component.name;\n if (_components.has(componentName)) {\n logger.debug(`There were multiple attempts to register component ${componentName}.`);\n return false;\n }\n _components.set(componentName, component);\n // add the component to existing app instances\n for (const app of _apps.values()) {\n _addComponent(app, component);\n }\n for (const serverApp of _serverApps.values()) {\n _addComponent(serverApp, component);\n }\n return true;\n}\n/**\n *\n * @param app - FirebaseApp instance\n * @param name - service name\n *\n * @returns the provider for the service with the matching name\n *\n * @internal\n */\nfunction _getProvider(app, name) {\n const heartbeatController = app.container\n .getProvider('heartbeat')\n .getImmediate({ optional: true });\n if (heartbeatController) {\n void heartbeatController.triggerHeartbeat();\n }\n return app.container.getProvider(name);\n}\n/**\n *\n * @param app - FirebaseApp instance\n * @param name - service name\n * @param instanceIdentifier - service instance identifier in case the service supports multiple instances\n *\n * @internal\n */\nfunction _removeServiceInstance(app, name, instanceIdentifier = DEFAULT_ENTRY_NAME) {\n _getProvider(app, name).clearInstance(instanceIdentifier);\n}\n/**\n *\n * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.\n *\n * @returns true if the provide object is of type FirebaseApp.\n *\n * @internal\n */\nfunction _isFirebaseApp(obj) {\n return obj.options !== undefined;\n}\n/**\n *\n * @param obj - an object of type FirebaseApp, FirebaseOptions or FirebaseAppSettings.\n *\n * @returns true if the provided object is of type FirebaseServerAppImpl.\n *\n * @internal\n */\nfunction _isFirebaseServerAppSettings(obj) {\n if (_isFirebaseApp(obj)) {\n return false;\n }\n return ('authIdToken' in obj ||\n 'appCheckToken' in obj ||\n 'releaseOnDeref' in obj ||\n 'automaticDataCollectionEnabled' in obj);\n}\n/**\n *\n * @param obj - an object of type FirebaseApp.\n *\n * @returns true if the provided object is of type FirebaseServerAppImpl.\n *\n * @internal\n */\nfunction _isFirebaseServerApp(obj) {\n if (obj === null || obj === undefined) {\n return false;\n }\n return obj.settings !== undefined;\n}\n/**\n * Test only\n *\n * @internal\n */\nfunction _clearComponents() {\n _components.clear();\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst ERRORS = {\n [\"no-app\" /* AppError.NO_APP */]: \"No Firebase App '{$appName}' has been created - \" +\n 'call initializeApp() first',\n [\"bad-app-name\" /* AppError.BAD_APP_NAME */]: \"Illegal App name: '{$appName}'\",\n [\"duplicate-app\" /* AppError.DUPLICATE_APP */]: \"Firebase App named '{$appName}' already exists with different options or config\",\n [\"app-deleted\" /* AppError.APP_DELETED */]: \"Firebase App named '{$appName}' already deleted\",\n [\"server-app-deleted\" /* AppError.SERVER_APP_DELETED */]: 'Firebase Server App has been deleted',\n [\"no-options\" /* AppError.NO_OPTIONS */]: 'Need to provide options, when not being deployed to hosting via source.',\n [\"invalid-app-argument\" /* AppError.INVALID_APP_ARGUMENT */]: 'firebase.{$appName}() takes either no argument or a ' +\n 'Firebase App instance.',\n [\"invalid-log-argument\" /* AppError.INVALID_LOG_ARGUMENT */]: 'First argument to `onLog` must be null or a function.',\n [\"idb-open\" /* AppError.IDB_OPEN */]: 'Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-get\" /* AppError.IDB_GET */]: 'Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-set\" /* AppError.IDB_WRITE */]: 'Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.',\n [\"idb-delete\" /* AppError.IDB_DELETE */]: 'Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.',\n [\"finalization-registry-not-supported\" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */]: 'FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.',\n [\"invalid-server-app-environment\" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */]: 'FirebaseServerApp is not for use in browser environments.'\n};\nconst ERROR_FACTORY = new ErrorFactory('app', 'Firebase', ERRORS);\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nclass FirebaseAppImpl {\n constructor(options, config, container) {\n this._isDeleted = false;\n this._options = { ...options };\n this._config = { ...config };\n this._name = config.name;\n this._automaticDataCollectionEnabled =\n config.automaticDataCollectionEnabled;\n this._container = container;\n this.container.addComponent(new Component('app', () => this, \"PUBLIC\" /* ComponentType.PUBLIC */));\n }\n get automaticDataCollectionEnabled() {\n this.checkDestroyed();\n return this._automaticDataCollectionEnabled;\n }\n set automaticDataCollectionEnabled(val) {\n this.checkDestroyed();\n this._automaticDataCollectionEnabled = val;\n }\n get name() {\n this.checkDestroyed();\n return this._name;\n }\n get options() {\n this.checkDestroyed();\n return this._options;\n }\n get config() {\n this.checkDestroyed();\n return this._config;\n }\n get container() {\n return this._container;\n }\n get isDeleted() {\n return this._isDeleted;\n }\n set isDeleted(val) {\n this._isDeleted = val;\n }\n /**\n * This function will throw an Error if the App has already been deleted -\n * use before performing API actions on the App.\n */\n checkDestroyed() {\n if (this.isDeleted) {\n throw ERROR_FACTORY.create(\"app-deleted\" /* AppError.APP_DELETED */, { appName: this._name });\n }\n }\n}\n\n/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// Parse the token and check to see if the `exp` claim is in the future.\n// Reports an error to the console if the token or claim could not be parsed, or if `exp` is in\n// the past.\nfunction validateTokenTTL(base64Token, tokenName) {\n const secondPart = base64Decode(base64Token.split('.')[1]);\n if (secondPart === null) {\n console.error(`FirebaseServerApp ${tokenName} is invalid: second part could not be parsed.`);\n return;\n }\n const expClaim = JSON.parse(secondPart).exp;\n if (expClaim === undefined) {\n console.error(`FirebaseServerApp ${tokenName} is invalid: expiration claim could not be parsed`);\n return;\n }\n const exp = JSON.parse(secondPart).exp * 1000;\n const now = new Date().getTime();\n const diff = exp - now;\n if (diff <= 0) {\n console.error(`FirebaseServerApp ${tokenName} is invalid: the token has expired.`);\n }\n}\nclass FirebaseServerAppImpl extends FirebaseAppImpl {\n constructor(options, serverConfig, name, container) {\n // Build configuration parameters for the FirebaseAppImpl base class.\n const automaticDataCollectionEnabled = serverConfig.automaticDataCollectionEnabled !== undefined\n ? serverConfig.automaticDataCollectionEnabled\n : true;\n // Create the FirebaseAppSettings object for the FirebaseAppImp constructor.\n const config = {\n name,\n automaticDataCollectionEnabled\n };\n if (options.apiKey !== undefined) {\n // Construct the parent FirebaseAppImp object.\n super(options, config, container);\n }\n else {\n const appImpl = options;\n super(appImpl.options, config, container);\n }\n // Now construct the data for the FirebaseServerAppImpl.\n this._serverConfig = {\n automaticDataCollectionEnabled,\n ...serverConfig\n };\n // Ensure that the current time is within the `authIdtoken` window of validity.\n if (this._serverConfig.authIdToken) {\n validateTokenTTL(this._serverConfig.authIdToken, 'authIdToken');\n }\n // Ensure that the current time is within the `appCheckToken` window of validity.\n if (this._serverConfig.appCheckToken) {\n validateTokenTTL(this._serverConfig.appCheckToken, 'appCheckToken');\n }\n this._finalizationRegistry = null;\n if (typeof FinalizationRegistry !== 'undefined') {\n this._finalizationRegistry = new FinalizationRegistry(() => {\n this.automaticCleanup();\n });\n }\n this._refCount = 0;\n this.incRefCount(this._serverConfig.releaseOnDeref);\n // Do not retain a hard reference to the dref object, otherwise the FinalizationRegistry\n // will never trigger.\n this._serverConfig.releaseOnDeref = undefined;\n serverConfig.releaseOnDeref = undefined;\n registerVersion(name$q, version$1, 'serverapp');\n }\n toJSON() {\n return undefined;\n }\n get refCount() {\n return this._refCount;\n }\n // Increment the reference count of this server app. If an object is provided, register it\n // with the finalization registry.\n incRefCount(obj) {\n if (this.isDeleted) {\n return;\n }\n this._refCount++;\n if (obj !== undefined && this._finalizationRegistry !== null) {\n this._finalizationRegistry.register(obj, this);\n }\n }\n // Decrement the reference count.\n decRefCount() {\n if (this.isDeleted) {\n return 0;\n }\n return --this._refCount;\n }\n // Invoked by the FinalizationRegistry callback to note that this app should go through its\n // reference counts and delete itself if no reference count remain. The coordinating logic that\n // handles this is in deleteApp(...).\n automaticCleanup() {\n void deleteApp(this);\n }\n get settings() {\n this.checkDestroyed();\n return this._serverConfig;\n }\n /**\n * This function will throw an Error if the App has already been deleted -\n * use before performing API actions on the App.\n */\n checkDestroyed() {\n if (this.isDeleted) {\n throw ERROR_FACTORY.create(\"server-app-deleted\" /* AppError.SERVER_APP_DELETED */);\n }\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The current SDK version.\n *\n * @public\n */\nconst SDK_VERSION = version;\nfunction initializeApp(_options, rawConfig = {}) {\n let options = _options;\n if (typeof rawConfig !== 'object') {\n const name = rawConfig;\n rawConfig = { name };\n }\n const config = {\n name: DEFAULT_ENTRY_NAME,\n automaticDataCollectionEnabled: true,\n ...rawConfig\n };\n const name = config.name;\n if (typeof name !== 'string' || !name) {\n throw ERROR_FACTORY.create(\"bad-app-name\" /* AppError.BAD_APP_NAME */, {\n appName: String(name)\n });\n }\n options || (options = getDefaultAppConfig());\n if (!options) {\n throw ERROR_FACTORY.create(\"no-options\" /* AppError.NO_OPTIONS */);\n }\n const existingApp = _apps.get(name);\n if (existingApp) {\n // return the existing app if options and config deep equal the ones in the existing app.\n if (deepEqual(options, existingApp.options) &&\n deepEqual(config, existingApp.config)) {\n return existingApp;\n }\n else {\n throw ERROR_FACTORY.create(\"duplicate-app\" /* AppError.DUPLICATE_APP */, { appName: name });\n }\n }\n const container = new ComponentContainer(name);\n for (const component of _components.values()) {\n container.addComponent(component);\n }\n const newApp = new FirebaseAppImpl(options, config, container);\n _apps.set(name, newApp);\n return newApp;\n}\nfunction initializeServerApp(_options, _serverAppConfig = {}) {\n if (isBrowser() && !isWebWorker()) {\n // FirebaseServerApp isn't designed to be run in browsers.\n throw ERROR_FACTORY.create(\"invalid-server-app-environment\" /* AppError.INVALID_SERVER_APP_ENVIRONMENT */);\n }\n let firebaseOptions;\n let serverAppSettings = _serverAppConfig || {};\n if (_options) {\n if (_isFirebaseApp(_options)) {\n firebaseOptions = _options.options;\n }\n else if (_isFirebaseServerAppSettings(_options)) {\n serverAppSettings = _options;\n }\n else {\n firebaseOptions = _options;\n }\n }\n if (serverAppSettings.automaticDataCollectionEnabled === undefined) {\n serverAppSettings.automaticDataCollectionEnabled = true;\n }\n firebaseOptions || (firebaseOptions = getDefaultAppConfig());\n if (!firebaseOptions) {\n throw ERROR_FACTORY.create(\"no-options\" /* AppError.NO_OPTIONS */);\n }\n // Build an app name based on a hash of the configuration options.\n const nameObj = {\n ...serverAppSettings,\n ...firebaseOptions\n };\n // However, Do not mangle the name based on releaseOnDeref, since it will vary between the\n // construction of FirebaseServerApp instances. For example, if the object is the request headers.\n if (nameObj.releaseOnDeref !== undefined) {\n delete nameObj.releaseOnDeref;\n }\n const hashCode = (s) => {\n return [...s].reduce((hash, c) => (Math.imul(31, hash) + c.charCodeAt(0)) | 0, 0);\n };\n if (serverAppSettings.releaseOnDeref !== undefined) {\n if (typeof FinalizationRegistry === 'undefined') {\n throw ERROR_FACTORY.create(\"finalization-registry-not-supported\" /* AppError.FINALIZATION_REGISTRY_NOT_SUPPORTED */, {});\n }\n }\n const nameString = '' + hashCode(JSON.stringify(nameObj));\n const existingApp = _serverApps.get(nameString);\n if (existingApp) {\n existingApp.incRefCount(serverAppSettings.releaseOnDeref);\n return existingApp;\n }\n const container = new ComponentContainer(nameString);\n for (const component of _components.values()) {\n container.addComponent(component);\n }\n const newApp = new FirebaseServerAppImpl(firebaseOptions, serverAppSettings, nameString, container);\n _serverApps.set(nameString, newApp);\n return newApp;\n}\n/**\n * Retrieves a {@link @firebase/app#FirebaseApp} instance.\n *\n * When called with no arguments, the default app is returned. When an app name\n * is provided, the app corresponding to that name is returned.\n *\n * An exception is thrown if the app being retrieved has not yet been\n * initialized.\n *\n * @example\n * ```javascript\n * // Return the default app\n * const app = getApp();\n * ```\n *\n * @example\n * ```javascript\n * // Return a named app\n * const otherApp = getApp(\"otherApp\");\n * ```\n *\n * @param name - Optional name of the app to return. If no name is\n * provided, the default is `\"[DEFAULT]\"`.\n *\n * @returns The app corresponding to the provided app name.\n * If no app name is provided, the default app is returned.\n *\n * @public\n */\nfunction getApp(name = DEFAULT_ENTRY_NAME) {\n const app = _apps.get(name);\n if (!app && name === DEFAULT_ENTRY_NAME && getDefaultAppConfig()) {\n return initializeApp();\n }\n if (!app) {\n throw ERROR_FACTORY.create(\"no-app\" /* AppError.NO_APP */, { appName: name });\n }\n return app;\n}\n/**\n * A (read-only) array of all initialized apps.\n * @public\n */\nfunction getApps() {\n return Array.from(_apps.values());\n}\n/**\n * Renders this app unusable and frees the resources of all associated\n * services.\n *\n * @example\n * ```javascript\n * deleteApp(app)\n * .then(function() {\n * console.log(\"App deleted successfully\");\n * })\n * .catch(function(error) {\n * console.log(\"Error deleting app:\", error);\n * });\n * ```\n *\n * @public\n */\nasync function deleteApp(app) {\n let cleanupProviders = false;\n const name = app.name;\n if (_apps.has(name)) {\n cleanupProviders = true;\n _apps.delete(name);\n }\n else if (_serverApps.has(name)) {\n const firebaseServerApp = app;\n if (firebaseServerApp.decRefCount() <= 0) {\n _serverApps.delete(name);\n cleanupProviders = true;\n }\n }\n if (cleanupProviders) {\n await Promise.all(app.container\n .getProviders()\n .map(provider => provider.delete()));\n app.isDeleted = true;\n }\n}\n/**\n * Registers a library's name and version for platform logging purposes.\n * @param library - Name of 1p or 3p library (e.g. firestore, angularfire)\n * @param version - Current version of that library.\n * @param variant - Bundle variant, e.g., node, rn, etc.\n *\n * @public\n */\nfunction registerVersion(libraryKeyOrName, version, variant) {\n // TODO: We can use this check to whitelist strings when/if we set up\n // a good whitelist system.\n let library = PLATFORM_LOG_STRING[libraryKeyOrName] ?? libraryKeyOrName;\n if (variant) {\n library += `-${variant}`;\n }\n const libraryMismatch = library.match(/\\s|\\//);\n const versionMismatch = version.match(/\\s|\\//);\n if (libraryMismatch || versionMismatch) {\n const warning = [\n `Unable to register library \"${library}\" with version \"${version}\":`\n ];\n if (libraryMismatch) {\n warning.push(`library name \"${library}\" contains illegal characters (whitespace or \"/\")`);\n }\n if (libraryMismatch && versionMismatch) {\n warning.push('and');\n }\n if (versionMismatch) {\n warning.push(`version name \"${version}\" contains illegal characters (whitespace or \"/\")`);\n }\n logger.warn(warning.join(' '));\n return;\n }\n _registerComponent(new Component(`${library}-version`, () => ({ library, version }), \"VERSION\" /* ComponentType.VERSION */));\n}\n/**\n * Sets log handler for all Firebase SDKs.\n * @param logCallback - An optional custom log handler that executes user code whenever\n * the Firebase SDK makes a logging call.\n *\n * @public\n */\nfunction onLog(logCallback, options) {\n if (logCallback !== null && typeof logCallback !== 'function') {\n throw ERROR_FACTORY.create(\"invalid-log-argument\" /* AppError.INVALID_LOG_ARGUMENT */);\n }\n setUserLogHandler(logCallback, options);\n}\n/**\n * Sets log level for all Firebase SDKs.\n *\n * All of the log types above the current log level are captured (i.e. if\n * you set the log level to `info`, errors are logged, but `debug` and\n * `verbose` logs are not).\n *\n * @public\n */\nfunction setLogLevel(logLevel) {\n setLogLevel$1(logLevel);\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DB_NAME = 'firebase-heartbeat-database';\nconst DB_VERSION = 1;\nconst STORE_NAME = 'firebase-heartbeat-store';\nlet dbPromise = null;\nfunction getDbPromise() {\n if (!dbPromise) {\n dbPromise = openDB(DB_NAME, DB_VERSION, {\n upgrade: (db, oldVersion) => {\n // We don't use 'break' in this switch statement, the fall-through\n // behavior is what we want, because if there are multiple versions between\n // the old version and the current version, we want ALL the migrations\n // that correspond to those versions to run, not only the last one.\n // eslint-disable-next-line default-case\n switch (oldVersion) {\n case 0:\n try {\n db.createObjectStore(STORE_NAME);\n }\n catch (e) {\n // Safari/iOS browsers throw occasional exceptions on\n // db.createObjectStore() that may be a bug. Avoid blocking\n // the rest of the app functionality.\n console.warn(e);\n }\n }\n }\n }).catch(e => {\n throw ERROR_FACTORY.create(\"idb-open\" /* AppError.IDB_OPEN */, {\n originalErrorMessage: e.message\n });\n });\n }\n return dbPromise;\n}\nasync function readHeartbeatsFromIndexedDB(app) {\n try {\n const db = await getDbPromise();\n const tx = db.transaction(STORE_NAME);\n const result = await tx.objectStore(STORE_NAME).get(computeKey(app));\n // We already have the value but tx.done can throw,\n // so we need to await it here to catch errors\n await tx.done;\n return result;\n }\n catch (e) {\n if (e instanceof FirebaseError) {\n logger.warn(e.message);\n }\n else {\n const idbGetError = ERROR_FACTORY.create(\"idb-get\" /* AppError.IDB_GET */, {\n originalErrorMessage: e?.message\n });\n logger.warn(idbGetError.message);\n }\n }\n}\nasync function writeHeartbeatsToIndexedDB(app, heartbeatObject) {\n try {\n const db = await getDbPromise();\n const tx = db.transaction(STORE_NAME, 'readwrite');\n const objectStore = tx.objectStore(STORE_NAME);\n await objectStore.put(heartbeatObject, computeKey(app));\n await tx.done;\n }\n catch (e) {\n if (e instanceof FirebaseError) {\n logger.warn(e.message);\n }\n else {\n const idbGetError = ERROR_FACTORY.create(\"idb-set\" /* AppError.IDB_WRITE */, {\n originalErrorMessage: e?.message\n });\n logger.warn(idbGetError.message);\n }\n }\n}\nfunction computeKey(app) {\n return `${app.name}!${app.options.appId}`;\n}\n\n/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst MAX_HEADER_BYTES = 1024;\nconst MAX_NUM_STORED_HEARTBEATS = 30;\nclass HeartbeatServiceImpl {\n constructor(container) {\n this.container = container;\n /**\n * In-memory cache for heartbeats, used by getHeartbeatsHeader() to generate\n * the header string.\n * Stores one record per date. This will be consolidated into the standard\n * format of one record per user agent string before being sent as a header.\n * Populated from indexedDB when the controller is instantiated and should\n * be kept in sync with indexedDB.\n * Leave public for easier testing.\n */\n this._heartbeatsCache = null;\n const app = this.container.getProvider('app').getImmediate();\n this._storage = new HeartbeatStorageImpl(app);\n this._heartbeatsCachePromise = this._storage.read().then(result => {\n this._heartbeatsCache = result;\n return result;\n });\n }\n /**\n * Called to report a heartbeat. The function will generate\n * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it\n * to IndexedDB.\n * Note that we only store one heartbeat per day. So if a heartbeat for today is\n * already logged, subsequent calls to this function in the same day will be ignored.\n */\n async triggerHeartbeat() {\n try {\n const platformLogger = this.container\n .getProvider('platform-logger')\n .getImmediate();\n // This is the \"Firebase user agent\" string from the platform logger\n // service, not the browser user agent.\n const agent = platformLogger.getPlatformInfoString();\n const date = getUTCDateString();\n if (this._heartbeatsCache?.heartbeats == null) {\n this._heartbeatsCache = await this._heartbeatsCachePromise;\n // If we failed to construct a heartbeats cache, then return immediately.\n if (this._heartbeatsCache?.heartbeats == null) {\n return;\n }\n }\n // Do not store a heartbeat if one is already stored for this day\n // or if a header has already been sent today.\n if (this._heartbeatsCache.lastSentHeartbeatDate === date ||\n this._heartbeatsCache.heartbeats.some(singleDateHeartbeat => singleDateHeartbeat.date === date)) {\n return;\n }\n else {\n // There is no entry for this date. Create one.\n this._heartbeatsCache.heartbeats.push({ date, agent });\n // If the number of stored heartbeats exceeds the maximum number of stored heartbeats, remove the heartbeat with the earliest date.\n // Since this is executed each time a heartbeat is pushed, the limit can only be exceeded by one, so only one needs to be removed.\n if (this._heartbeatsCache.heartbeats.length > MAX_NUM_STORED_HEARTBEATS) {\n const earliestHeartbeatIdx = getEarliestHeartbeatIdx(this._heartbeatsCache.heartbeats);\n this._heartbeatsCache.heartbeats.splice(earliestHeartbeatIdx, 1);\n }\n }\n return this._storage.overwrite(this._heartbeatsCache);\n }\n catch (e) {\n logger.warn(e);\n }\n }\n /**\n * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.\n * It also clears all heartbeats from memory as well as in IndexedDB.\n *\n * NOTE: Consuming product SDKs should not send the header if this method\n * returns an empty string.\n */\n async getHeartbeatsHeader() {\n try {\n if (this._heartbeatsCache === null) {\n await this._heartbeatsCachePromise;\n }\n // If it's still null or the array is empty, there is no data to send.\n if (this._heartbeatsCache?.heartbeats == null ||\n this._heartbeatsCache.heartbeats.length === 0) {\n return '';\n }\n const date = getUTCDateString();\n // Extract as many heartbeats from the cache as will fit under the size limit.\n const { heartbeatsToSend, unsentEntries } = extractHeartbeatsForHeader(this._heartbeatsCache.heartbeats);\n const headerString = base64urlEncodeWithoutPadding(JSON.stringify({ version: 2, heartbeats: heartbeatsToSend }));\n // Store last sent date to prevent another being logged/sent for the same day.\n this._heartbeatsCache.lastSentHeartbeatDate = date;\n if (unsentEntries.length > 0) {\n // Store any unsent entries if they exist.\n this._heartbeatsCache.heartbeats = unsentEntries;\n // This seems more likely than emptying the array (below) to lead to some odd state\n // since the cache isn't empty and this will be called again on the next request,\n // and is probably safest if we await it.\n await this._storage.overwrite(this._heartbeatsCache);\n }\n else {\n this._heartbeatsCache.heartbeats = [];\n // Do not wait for this, to reduce latency.\n void this._storage.overwrite(this._heartbeatsCache);\n }\n return headerString;\n }\n catch (e) {\n logger.warn(e);\n return '';\n }\n }\n}\nfunction getUTCDateString() {\n const today = new Date();\n // Returns date format 'YYYY-MM-DD'\n return today.toISOString().substring(0, 10);\n}\nfunction extractHeartbeatsForHeader(heartbeatsCache, maxSize = MAX_HEADER_BYTES) {\n // Heartbeats grouped by user agent in the standard format to be sent in\n // the header.\n const heartbeatsToSend = [];\n // Single date format heartbeats that are not sent.\n let unsentEntries = heartbeatsCache.slice();\n for (const singleDateHeartbeat of heartbeatsCache) {\n // Look for an existing entry with the same user agent.\n const heartbeatEntry = heartbeatsToSend.find(hb => hb.agent === singleDateHeartbeat.agent);\n if (!heartbeatEntry) {\n // If no entry for this user agent exists, create one.\n heartbeatsToSend.push({\n agent: singleDateHeartbeat.agent,\n dates: [singleDateHeartbeat.date]\n });\n if (countBytes(heartbeatsToSend) > maxSize) {\n // If the header would exceed max size, remove the added heartbeat\n // entry and stop adding to the header.\n heartbeatsToSend.pop();\n break;\n }\n }\n else {\n heartbeatEntry.dates.push(singleDateHeartbeat.date);\n // If the header would exceed max size, remove the added date\n // and stop adding to the header.\n if (countBytes(heartbeatsToSend) > maxSize) {\n heartbeatEntry.dates.pop();\n break;\n }\n }\n // Pop unsent entry from queue. (Skipped if adding the entry exceeded\n // quota and the loop breaks early.)\n unsentEntries = unsentEntries.slice(1);\n }\n return {\n heartbeatsToSend,\n unsentEntries\n };\n}\nclass HeartbeatStorageImpl {\n constructor(app) {\n this.app = app;\n this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();\n }\n async runIndexedDBEnvironmentCheck() {\n if (!isIndexedDBAvailable()) {\n return false;\n }\n else {\n return validateIndexedDBOpenable()\n .then(() => true)\n .catch(() => false);\n }\n }\n /**\n * Read all heartbeats.\n */\n async read() {\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return { heartbeats: [] };\n }\n else {\n const idbHeartbeatObject = await readHeartbeatsFromIndexedDB(this.app);\n if (idbHeartbeatObject?.heartbeats) {\n return idbHeartbeatObject;\n }\n else {\n return { heartbeats: [] };\n }\n }\n }\n // overwrite the storage with the provided heartbeats\n async overwrite(heartbeatsObject) {\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return;\n }\n else {\n const existingHeartbeatsObject = await this.read();\n return writeHeartbeatsToIndexedDB(this.app, {\n lastSentHeartbeatDate: heartbeatsObject.lastSentHeartbeatDate ??\n existingHeartbeatsObject.lastSentHeartbeatDate,\n heartbeats: heartbeatsObject.heartbeats\n });\n }\n }\n // add heartbeats\n async add(heartbeatsObject) {\n const canUseIndexedDB = await this._canUseIndexedDBPromise;\n if (!canUseIndexedDB) {\n return;\n }\n else {\n const existingHeartbeatsObject = await this.read();\n return writeHeartbeatsToIndexedDB(this.app, {\n lastSentHeartbeatDate: heartbeatsObject.lastSentHeartbeatDate ??\n existingHeartbeatsObject.lastSentHeartbeatDate,\n heartbeats: [\n ...existingHeartbeatsObject.heartbeats,\n ...heartbeatsObject.heartbeats\n ]\n });\n }\n }\n}\n/**\n * Calculate bytes of a HeartbeatsByUserAgent array after being wrapped\n * in a platform logging header JSON object, stringified, and converted\n * to base 64.\n */\nfunction countBytes(heartbeatsCache) {\n // base64 has a restricted set of characters, all of which should be 1 byte.\n return base64urlEncodeWithoutPadding(\n // heartbeatsCache wrapper properties\n JSON.stringify({ version: 2, heartbeats: heartbeatsCache })).length;\n}\n/**\n * Returns the index of the heartbeat with the earliest date.\n * If the heartbeats array is empty, -1 is returned.\n */\nfunction getEarliestHeartbeatIdx(heartbeats) {\n if (heartbeats.length === 0) {\n return -1;\n }\n let earliestHeartbeatIdx = 0;\n let earliestHeartbeatDate = heartbeats[0].date;\n for (let i = 1; i < heartbeats.length; i++) {\n if (heartbeats[i].date < earliestHeartbeatDate) {\n earliestHeartbeatDate = heartbeats[i].date;\n earliestHeartbeatIdx = i;\n }\n }\n return earliestHeartbeatIdx;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction registerCoreComponents(variant) {\n _registerComponent(new Component('platform-logger', container => new PlatformLoggerServiceImpl(container), \"PRIVATE\" /* ComponentType.PRIVATE */));\n _registerComponent(new Component('heartbeat', container => new HeartbeatServiceImpl(container), \"PRIVATE\" /* ComponentType.PRIVATE */));\n // Register `app` package.\n registerVersion(name$q, version$1, variant);\n // BUILD_TARGET will be replaced by values like esm, cjs, etc during the compilation\n registerVersion(name$q, version$1, 'esm2020');\n // Register platform SDK identifier (no version).\n registerVersion('fire-js', '');\n}\n\n/**\n * Firebase App\n *\n * @remarks This package coordinates the communication between the different Firebase components\n * @packageDocumentation\n */\nregisterCoreComponents('');\n\nexport { SDK_VERSION, DEFAULT_ENTRY_NAME as _DEFAULT_ENTRY_NAME, _addComponent, _addOrOverwriteComponent, _apps, _clearComponents, _components, _getProvider, _isFirebaseApp, _isFirebaseServerApp, _isFirebaseServerAppSettings, _registerComponent, _removeServiceInstance, _serverApps, deleteApp, getApp, getApps, initializeApp, initializeServerApp, onLog, registerVersion, setLogLevel };\n//# sourceMappingURL=index.esm.js.map\n"],"names":["name","version"],"mappings":";;;;AAMA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,MAAM,0BAA0B;AAAA,EAC5B,YAAY,WAAW;AACnB,SAAK,YAAY;AAAA,EACrB;AAAA;AAAA;AAAA,EAGA,wBAAwB;AACpB,UAAM,YAAY,KAAK,UAAU,aAAY;AAG7C,WAAO,UACF,IAAI,cAAY;AACjB,UAAI,yBAAyB,QAAQ,GAAG;AACpC,cAAM,UAAU,SAAS,aAAY;AACrC,eAAO,GAAG,QAAQ,OAAO,IAAI,QAAQ,OAAO;AAAA,MAChD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,iBAAiB,yBACpC,yBAAyB;AAAA,QAC7B,YAAY;AAAA,UACR,GAAG,yBAAyB;AAAA,UAC5B,GAAG,iBAAiB;AAAA,QACxC;AAAA,MACA,CAAa;AAAA,IACL;AAAA,EACJ;AACJ;AAMA,SAAS,WAAW,iBAAiB;AAEjC,SAAO;AAAA;AAAA,IAEP,KAAK,UAAU,EAAE,SAAS,GAAG,YAAY,gBAAe,CAAE;AAAA,EAAC,EAAE;AACjE;AAKA,SAAS,wBAAwB,YAAY;AACzC,MAAI,WAAW,WAAW,GAAG;AACzB,WAAO;AAAA,EACX;AACA,MAAI,uBAAuB;AAC3B,MAAI,wBAAwB,WAAW,CAAC,EAAE;AAC1C,WAAS,IAAI,GAAG,IAAI,WAAW,QAAQ,KAAK;AACxC,QAAI,WAAW,CAAC,EAAE,OAAO,uBAAuB;AAC5C,8BAAwB,WAAW,CAAC,EAAE;AACtC,6BAAuB;AAAA,IAC3B;AAAA,EACJ;AACA,SAAO;AACX;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,SAAS,uBAAuB,SAAS;AACrC,qBAAmB,IAAI;AAAA,IAAU;AAAA,IAAmB,eAAa,IAAI,0BAA0B,SAAS;AAAA,IAAG;AAAA;AAAA,GAAsC;AACjJ,qBAAmB,IAAI;AAAA,IAAU;AAAA,IAAa,eAAa,IAAI,qBAAqB,SAAS;AAAA,IAAG;AAAA;AAAA,GAAsC;AAEtI,kBAAgB,QAAQ,WAAW,OAAO;AAE1C,kBAAgB,QAAQ,WAAW,SAAS;AAE5C,kBAAgB,WAAW,EAAE;AACjC;AAQA,uBAAuB,EAAE;","x_google_ignoreList":[0]}
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import { Deferred } from "../../../util/dist/index.esm.js";
|
|
2
|
-
class Component {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param name The public service name, e.g. app, auth, firestore, database
|
|
6
|
-
* @param instanceFactory Service factory responsible for creating the public interface
|
|
7
|
-
* @param type whether the service provided by the component is public or private
|
|
8
|
-
*/
|
|
9
|
-
constructor(name, instanceFactory, type) {
|
|
10
|
-
this.name = name;
|
|
11
|
-
this.instanceFactory = instanceFactory;
|
|
12
|
-
this.type = type;
|
|
13
|
-
this.multipleInstances = false;
|
|
14
|
-
this.serviceProps = {};
|
|
15
|
-
this.instantiationMode = "LAZY";
|
|
16
|
-
this.onInstanceCreated = null;
|
|
17
|
-
}
|
|
18
|
-
setInstantiationMode(mode) {
|
|
19
|
-
this.instantiationMode = mode;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
setMultipleInstances(multipleInstances) {
|
|
23
|
-
this.multipleInstances = multipleInstances;
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
setServiceProps(props) {
|
|
27
|
-
this.serviceProps = props;
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
setInstanceCreatedCallback(callback) {
|
|
31
|
-
this.onInstanceCreated = callback;
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* @license
|
|
37
|
-
* Copyright 2019 Google LLC
|
|
38
|
-
*
|
|
39
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
40
|
-
* you may not use this file except in compliance with the License.
|
|
41
|
-
* You may obtain a copy of the License at
|
|
42
|
-
*
|
|
43
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
44
|
-
*
|
|
45
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
46
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
47
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
48
|
-
* See the License for the specific language governing permissions and
|
|
49
|
-
* limitations under the License.
|
|
50
|
-
*/
|
|
51
|
-
const DEFAULT_ENTRY_NAME = "[DEFAULT]";
|
|
52
|
-
/**
|
|
53
|
-
* @license
|
|
54
|
-
* Copyright 2019 Google LLC
|
|
55
|
-
*
|
|
56
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
57
|
-
* you may not use this file except in compliance with the License.
|
|
58
|
-
* You may obtain a copy of the License at
|
|
59
|
-
*
|
|
60
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
61
|
-
*
|
|
62
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
63
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
64
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
65
|
-
* See the License for the specific language governing permissions and
|
|
66
|
-
* limitations under the License.
|
|
67
|
-
*/
|
|
68
|
-
class Provider {
|
|
69
|
-
constructor(name, container) {
|
|
70
|
-
this.name = name;
|
|
71
|
-
this.container = container;
|
|
72
|
-
this.component = null;
|
|
73
|
-
this.instances = /* @__PURE__ */ new Map();
|
|
74
|
-
this.instancesDeferred = /* @__PURE__ */ new Map();
|
|
75
|
-
this.instancesOptions = /* @__PURE__ */ new Map();
|
|
76
|
-
this.onInitCallbacks = /* @__PURE__ */ new Map();
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @param identifier A provider can provide multiple instances of a service
|
|
80
|
-
* if this.component.multipleInstances is true.
|
|
81
|
-
*/
|
|
82
|
-
get(identifier) {
|
|
83
|
-
const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
|
|
84
|
-
if (!this.instancesDeferred.has(normalizedIdentifier)) {
|
|
85
|
-
const deferred = new Deferred();
|
|
86
|
-
this.instancesDeferred.set(normalizedIdentifier, deferred);
|
|
87
|
-
if (this.isInitialized(normalizedIdentifier) || this.shouldAutoInitialize()) {
|
|
88
|
-
try {
|
|
89
|
-
const instance = this.getOrInitializeService({
|
|
90
|
-
instanceIdentifier: normalizedIdentifier
|
|
91
|
-
});
|
|
92
|
-
if (instance) {
|
|
93
|
-
deferred.resolve(instance);
|
|
94
|
-
}
|
|
95
|
-
} catch (e) {
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return this.instancesDeferred.get(normalizedIdentifier).promise;
|
|
100
|
-
}
|
|
101
|
-
getImmediate(options) {
|
|
102
|
-
const normalizedIdentifier = this.normalizeInstanceIdentifier(options == null ? void 0 : options.identifier);
|
|
103
|
-
const optional = (options == null ? void 0 : options.optional) ?? false;
|
|
104
|
-
if (this.isInitialized(normalizedIdentifier) || this.shouldAutoInitialize()) {
|
|
105
|
-
try {
|
|
106
|
-
return this.getOrInitializeService({
|
|
107
|
-
instanceIdentifier: normalizedIdentifier
|
|
108
|
-
});
|
|
109
|
-
} catch (e) {
|
|
110
|
-
if (optional) {
|
|
111
|
-
return null;
|
|
112
|
-
} else {
|
|
113
|
-
throw e;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
if (optional) {
|
|
118
|
-
return null;
|
|
119
|
-
} else {
|
|
120
|
-
throw Error(`Service ${this.name} is not available`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
getComponent() {
|
|
125
|
-
return this.component;
|
|
126
|
-
}
|
|
127
|
-
setComponent(component) {
|
|
128
|
-
if (component.name !== this.name) {
|
|
129
|
-
throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`);
|
|
130
|
-
}
|
|
131
|
-
if (this.component) {
|
|
132
|
-
throw Error(`Component for ${this.name} has already been provided`);
|
|
133
|
-
}
|
|
134
|
-
this.component = component;
|
|
135
|
-
if (!this.shouldAutoInitialize()) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (isComponentEager(component)) {
|
|
139
|
-
try {
|
|
140
|
-
this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME });
|
|
141
|
-
} catch (e) {
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {
|
|
145
|
-
const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
|
|
146
|
-
try {
|
|
147
|
-
const instance = this.getOrInitializeService({
|
|
148
|
-
instanceIdentifier: normalizedIdentifier
|
|
149
|
-
});
|
|
150
|
-
instanceDeferred.resolve(instance);
|
|
151
|
-
} catch (e) {
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
clearInstance(identifier = DEFAULT_ENTRY_NAME) {
|
|
156
|
-
this.instancesDeferred.delete(identifier);
|
|
157
|
-
this.instancesOptions.delete(identifier);
|
|
158
|
-
this.instances.delete(identifier);
|
|
159
|
-
}
|
|
160
|
-
// app.delete() will call this method on every provider to delete the services
|
|
161
|
-
// TODO: should we mark the provider as deleted?
|
|
162
|
-
async delete() {
|
|
163
|
-
const services = Array.from(this.instances.values());
|
|
164
|
-
await Promise.all([
|
|
165
|
-
...services.filter((service) => "INTERNAL" in service).map((service) => service.INTERNAL.delete()),
|
|
166
|
-
...services.filter((service) => "_delete" in service).map((service) => service._delete())
|
|
167
|
-
]);
|
|
168
|
-
}
|
|
169
|
-
isComponentSet() {
|
|
170
|
-
return this.component != null;
|
|
171
|
-
}
|
|
172
|
-
isInitialized(identifier = DEFAULT_ENTRY_NAME) {
|
|
173
|
-
return this.instances.has(identifier);
|
|
174
|
-
}
|
|
175
|
-
getOptions(identifier = DEFAULT_ENTRY_NAME) {
|
|
176
|
-
return this.instancesOptions.get(identifier) || {};
|
|
177
|
-
}
|
|
178
|
-
initialize(opts = {}) {
|
|
179
|
-
const { options = {} } = opts;
|
|
180
|
-
const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);
|
|
181
|
-
if (this.isInitialized(normalizedIdentifier)) {
|
|
182
|
-
throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`);
|
|
183
|
-
}
|
|
184
|
-
if (!this.isComponentSet()) {
|
|
185
|
-
throw Error(`Component ${this.name} has not been registered yet`);
|
|
186
|
-
}
|
|
187
|
-
const instance = this.getOrInitializeService({
|
|
188
|
-
instanceIdentifier: normalizedIdentifier,
|
|
189
|
-
options
|
|
190
|
-
});
|
|
191
|
-
for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {
|
|
192
|
-
const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);
|
|
193
|
-
if (normalizedIdentifier === normalizedDeferredIdentifier) {
|
|
194
|
-
instanceDeferred.resolve(instance);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return instance;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
*
|
|
201
|
-
* @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
|
|
202
|
-
* The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
|
|
203
|
-
*
|
|
204
|
-
* @param identifier An optional instance identifier
|
|
205
|
-
* @returns a function to unregister the callback
|
|
206
|
-
*/
|
|
207
|
-
onInit(callback, identifier) {
|
|
208
|
-
const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);
|
|
209
|
-
const existingCallbacks = this.onInitCallbacks.get(normalizedIdentifier) ?? /* @__PURE__ */ new Set();
|
|
210
|
-
existingCallbacks.add(callback);
|
|
211
|
-
this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);
|
|
212
|
-
const existingInstance = this.instances.get(normalizedIdentifier);
|
|
213
|
-
if (existingInstance) {
|
|
214
|
-
callback(existingInstance, normalizedIdentifier);
|
|
215
|
-
}
|
|
216
|
-
return () => {
|
|
217
|
-
existingCallbacks.delete(callback);
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Invoke onInit callbacks synchronously
|
|
222
|
-
* @param instance the service instance`
|
|
223
|
-
*/
|
|
224
|
-
invokeOnInitCallbacks(instance, identifier) {
|
|
225
|
-
const callbacks = this.onInitCallbacks.get(identifier);
|
|
226
|
-
if (!callbacks) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
for (const callback of callbacks) {
|
|
230
|
-
try {
|
|
231
|
-
callback(instance, identifier);
|
|
232
|
-
} catch {
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
getOrInitializeService({ instanceIdentifier, options = {} }) {
|
|
237
|
-
let instance = this.instances.get(instanceIdentifier);
|
|
238
|
-
if (!instance && this.component) {
|
|
239
|
-
instance = this.component.instanceFactory(this.container, {
|
|
240
|
-
instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),
|
|
241
|
-
options
|
|
242
|
-
});
|
|
243
|
-
this.instances.set(instanceIdentifier, instance);
|
|
244
|
-
this.instancesOptions.set(instanceIdentifier, options);
|
|
245
|
-
this.invokeOnInitCallbacks(instance, instanceIdentifier);
|
|
246
|
-
if (this.component.onInstanceCreated) {
|
|
247
|
-
try {
|
|
248
|
-
this.component.onInstanceCreated(this.container, instanceIdentifier, instance);
|
|
249
|
-
} catch {
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return instance || null;
|
|
254
|
-
}
|
|
255
|
-
normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME) {
|
|
256
|
-
if (this.component) {
|
|
257
|
-
return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME;
|
|
258
|
-
} else {
|
|
259
|
-
return identifier;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
shouldAutoInitialize() {
|
|
263
|
-
return !!this.component && this.component.instantiationMode !== "EXPLICIT";
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
function normalizeIdentifierForFactory(identifier) {
|
|
267
|
-
return identifier === DEFAULT_ENTRY_NAME ? void 0 : identifier;
|
|
268
|
-
}
|
|
269
|
-
function isComponentEager(component) {
|
|
270
|
-
return component.instantiationMode === "EAGER";
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* @license
|
|
274
|
-
* Copyright 2019 Google LLC
|
|
275
|
-
*
|
|
276
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
277
|
-
* you may not use this file except in compliance with the License.
|
|
278
|
-
* You may obtain a copy of the License at
|
|
279
|
-
*
|
|
280
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
281
|
-
*
|
|
282
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
283
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
284
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
285
|
-
* See the License for the specific language governing permissions and
|
|
286
|
-
* limitations under the License.
|
|
287
|
-
*/
|
|
288
|
-
class ComponentContainer {
|
|
289
|
-
constructor(name) {
|
|
290
|
-
this.name = name;
|
|
291
|
-
this.providers = /* @__PURE__ */ new Map();
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
*
|
|
295
|
-
* @param component Component being added
|
|
296
|
-
* @param overwrite When a component with the same name has already been registered,
|
|
297
|
-
* if overwrite is true: overwrite the existing component with the new component and create a new
|
|
298
|
-
* provider with the new component. It can be useful in tests where you want to use different mocks
|
|
299
|
-
* for different tests.
|
|
300
|
-
* if overwrite is false: throw an exception
|
|
301
|
-
*/
|
|
302
|
-
addComponent(component) {
|
|
303
|
-
const provider = this.getProvider(component.name);
|
|
304
|
-
if (provider.isComponentSet()) {
|
|
305
|
-
throw new Error(`Component ${component.name} has already been registered with ${this.name}`);
|
|
306
|
-
}
|
|
307
|
-
provider.setComponent(component);
|
|
308
|
-
}
|
|
309
|
-
addOrOverwriteComponent(component) {
|
|
310
|
-
const provider = this.getProvider(component.name);
|
|
311
|
-
if (provider.isComponentSet()) {
|
|
312
|
-
this.providers.delete(component.name);
|
|
313
|
-
}
|
|
314
|
-
this.addComponent(component);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* getProvider provides a type safe interface where it can only be called with a field name
|
|
318
|
-
* present in NameServiceMapping interface.
|
|
319
|
-
*
|
|
320
|
-
* Firebase SDKs providing services should extend NameServiceMapping interface to register
|
|
321
|
-
* themselves.
|
|
322
|
-
*/
|
|
323
|
-
getProvider(name) {
|
|
324
|
-
if (this.providers.has(name)) {
|
|
325
|
-
return this.providers.get(name);
|
|
326
|
-
}
|
|
327
|
-
const provider = new Provider(name, this);
|
|
328
|
-
this.providers.set(name, provider);
|
|
329
|
-
return provider;
|
|
330
|
-
}
|
|
331
|
-
getProviders() {
|
|
332
|
-
return Array.from(this.providers.values());
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
export {
|
|
336
|
-
Component,
|
|
337
|
-
ComponentContainer,
|
|
338
|
-
Provider
|
|
339
|
-
};
|
|
340
|
-
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../../../node_modules/@firebase/component/dist/esm/index.esm.js"],"sourcesContent":["import { Deferred } from '@firebase/util';\n\n/**\n * Component for service name T, e.g. `auth`, `auth-internal`\n */\nclass Component {\n /**\n *\n * @param name The public service name, e.g. app, auth, firestore, database\n * @param instanceFactory Service factory responsible for creating the public interface\n * @param type whether the service provided by the component is public or private\n */\n constructor(name, instanceFactory, type) {\n this.name = name;\n this.instanceFactory = instanceFactory;\n this.type = type;\n this.multipleInstances = false;\n /**\n * Properties to be added to the service namespace\n */\n this.serviceProps = {};\n this.instantiationMode = \"LAZY\" /* InstantiationMode.LAZY */;\n this.onInstanceCreated = null;\n }\n setInstantiationMode(mode) {\n this.instantiationMode = mode;\n return this;\n }\n setMultipleInstances(multipleInstances) {\n this.multipleInstances = multipleInstances;\n return this;\n }\n setServiceProps(props) {\n this.serviceProps = props;\n return this;\n }\n setInstanceCreatedCallback(callback) {\n this.onInstanceCreated = callback;\n return this;\n }\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst DEFAULT_ENTRY_NAME = '[DEFAULT]';\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Provider for instance for service name T, e.g. 'auth', 'auth-internal'\n * NameServiceMapping[T] is an alias for the type of the instance\n */\nclass Provider {\n constructor(name, container) {\n this.name = name;\n this.container = container;\n this.component = null;\n this.instances = new Map();\n this.instancesDeferred = new Map();\n this.instancesOptions = new Map();\n this.onInitCallbacks = new Map();\n }\n /**\n * @param identifier A provider can provide multiple instances of a service\n * if this.component.multipleInstances is true.\n */\n get(identifier) {\n // if multipleInstances is not supported, use the default name\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\n if (!this.instancesDeferred.has(normalizedIdentifier)) {\n const deferred = new Deferred();\n this.instancesDeferred.set(normalizedIdentifier, deferred);\n if (this.isInitialized(normalizedIdentifier) ||\n this.shouldAutoInitialize()) {\n // initialize the service if it can be auto-initialized\n try {\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n if (instance) {\n deferred.resolve(instance);\n }\n }\n catch (e) {\n // when the instance factory throws an exception during get(), it should not cause\n // a fatal error. We just return the unresolved promise in this case.\n }\n }\n }\n return this.instancesDeferred.get(normalizedIdentifier).promise;\n }\n getImmediate(options) {\n // if multipleInstances is not supported, use the default name\n const normalizedIdentifier = this.normalizeInstanceIdentifier(options?.identifier);\n const optional = options?.optional ?? false;\n if (this.isInitialized(normalizedIdentifier) ||\n this.shouldAutoInitialize()) {\n try {\n return this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n }\n catch (e) {\n if (optional) {\n return null;\n }\n else {\n throw e;\n }\n }\n }\n else {\n // In case a component is not initialized and should/cannot be auto-initialized at the moment, return null if the optional flag is set, or throw\n if (optional) {\n return null;\n }\n else {\n throw Error(`Service ${this.name} is not available`);\n }\n }\n }\n getComponent() {\n return this.component;\n }\n setComponent(component) {\n if (component.name !== this.name) {\n throw Error(`Mismatching Component ${component.name} for Provider ${this.name}.`);\n }\n if (this.component) {\n throw Error(`Component for ${this.name} has already been provided`);\n }\n this.component = component;\n // return early without attempting to initialize the component if the component requires explicit initialization (calling `Provider.initialize()`)\n if (!this.shouldAutoInitialize()) {\n return;\n }\n // if the service is eager, initialize the default instance\n if (isComponentEager(component)) {\n try {\n this.getOrInitializeService({ instanceIdentifier: DEFAULT_ENTRY_NAME });\n }\n catch (e) {\n // when the instance factory for an eager Component throws an exception during the eager\n // initialization, it should not cause a fatal error.\n // TODO: Investigate if we need to make it configurable, because some component may want to cause\n // a fatal error in this case?\n }\n }\n // Create service instances for the pending promises and resolve them\n // NOTE: if this.multipleInstances is false, only the default instance will be created\n // and all promises with resolve with it regardless of the identifier.\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\n const normalizedIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\n try {\n // `getOrInitializeService()` should always return a valid instance since a component is guaranteed. use ! to make typescript happy.\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier\n });\n instanceDeferred.resolve(instance);\n }\n catch (e) {\n // when the instance factory throws an exception, it should not cause\n // a fatal error. We just leave the promise unresolved.\n }\n }\n }\n clearInstance(identifier = DEFAULT_ENTRY_NAME) {\n this.instancesDeferred.delete(identifier);\n this.instancesOptions.delete(identifier);\n this.instances.delete(identifier);\n }\n // app.delete() will call this method on every provider to delete the services\n // TODO: should we mark the provider as deleted?\n async delete() {\n const services = Array.from(this.instances.values());\n await Promise.all([\n ...services\n .filter(service => 'INTERNAL' in service) // legacy services\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .map(service => service.INTERNAL.delete()),\n ...services\n .filter(service => '_delete' in service) // modularized services\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .map(service => service._delete())\n ]);\n }\n isComponentSet() {\n return this.component != null;\n }\n isInitialized(identifier = DEFAULT_ENTRY_NAME) {\n return this.instances.has(identifier);\n }\n getOptions(identifier = DEFAULT_ENTRY_NAME) {\n return this.instancesOptions.get(identifier) || {};\n }\n initialize(opts = {}) {\n const { options = {} } = opts;\n const normalizedIdentifier = this.normalizeInstanceIdentifier(opts.instanceIdentifier);\n if (this.isInitialized(normalizedIdentifier)) {\n throw Error(`${this.name}(${normalizedIdentifier}) has already been initialized`);\n }\n if (!this.isComponentSet()) {\n throw Error(`Component ${this.name} has not been registered yet`);\n }\n const instance = this.getOrInitializeService({\n instanceIdentifier: normalizedIdentifier,\n options\n });\n // resolve any pending promise waiting for the service instance\n for (const [instanceIdentifier, instanceDeferred] of this.instancesDeferred.entries()) {\n const normalizedDeferredIdentifier = this.normalizeInstanceIdentifier(instanceIdentifier);\n if (normalizedIdentifier === normalizedDeferredIdentifier) {\n instanceDeferred.resolve(instance);\n }\n }\n return instance;\n }\n /**\n *\n * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().\n * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.\n *\n * @param identifier An optional instance identifier\n * @returns a function to unregister the callback\n */\n onInit(callback, identifier) {\n const normalizedIdentifier = this.normalizeInstanceIdentifier(identifier);\n const existingCallbacks = this.onInitCallbacks.get(normalizedIdentifier) ??\n new Set();\n existingCallbacks.add(callback);\n this.onInitCallbacks.set(normalizedIdentifier, existingCallbacks);\n const existingInstance = this.instances.get(normalizedIdentifier);\n if (existingInstance) {\n callback(existingInstance, normalizedIdentifier);\n }\n return () => {\n existingCallbacks.delete(callback);\n };\n }\n /**\n * Invoke onInit callbacks synchronously\n * @param instance the service instance`\n */\n invokeOnInitCallbacks(instance, identifier) {\n const callbacks = this.onInitCallbacks.get(identifier);\n if (!callbacks) {\n return;\n }\n for (const callback of callbacks) {\n try {\n callback(instance, identifier);\n }\n catch {\n // ignore errors in the onInit callback\n }\n }\n }\n getOrInitializeService({ instanceIdentifier, options = {} }) {\n let instance = this.instances.get(instanceIdentifier);\n if (!instance && this.component) {\n instance = this.component.instanceFactory(this.container, {\n instanceIdentifier: normalizeIdentifierForFactory(instanceIdentifier),\n options\n });\n this.instances.set(instanceIdentifier, instance);\n this.instancesOptions.set(instanceIdentifier, options);\n /**\n * Invoke onInit listeners.\n * Note this.component.onInstanceCreated is different, which is used by the component creator,\n * while onInit listeners are registered by consumers of the provider.\n */\n this.invokeOnInitCallbacks(instance, instanceIdentifier);\n /**\n * Order is important\n * onInstanceCreated() should be called after this.instances.set(instanceIdentifier, instance); which\n * makes `isInitialized()` return true.\n */\n if (this.component.onInstanceCreated) {\n try {\n this.component.onInstanceCreated(this.container, instanceIdentifier, instance);\n }\n catch {\n // ignore errors in the onInstanceCreatedCallback\n }\n }\n }\n return instance || null;\n }\n normalizeInstanceIdentifier(identifier = DEFAULT_ENTRY_NAME) {\n if (this.component) {\n return this.component.multipleInstances ? identifier : DEFAULT_ENTRY_NAME;\n }\n else {\n return identifier; // assume multiple instances are supported before the component is provided.\n }\n }\n shouldAutoInitialize() {\n return (!!this.component &&\n this.component.instantiationMode !== \"EXPLICIT\" /* InstantiationMode.EXPLICIT */);\n }\n}\n// undefined should be passed to the service factory for the default instance\nfunction normalizeIdentifierForFactory(identifier) {\n return identifier === DEFAULT_ENTRY_NAME ? undefined : identifier;\n}\nfunction isComponentEager(component) {\n return component.instantiationMode === \"EAGER\" /* InstantiationMode.EAGER */;\n}\n\n/**\n * @license\n * Copyright 2019 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * ComponentContainer that provides Providers for service name T, e.g. `auth`, `auth-internal`\n */\nclass ComponentContainer {\n constructor(name) {\n this.name = name;\n this.providers = new Map();\n }\n /**\n *\n * @param component Component being added\n * @param overwrite When a component with the same name has already been registered,\n * if overwrite is true: overwrite the existing component with the new component and create a new\n * provider with the new component. It can be useful in tests where you want to use different mocks\n * for different tests.\n * if overwrite is false: throw an exception\n */\n addComponent(component) {\n const provider = this.getProvider(component.name);\n if (provider.isComponentSet()) {\n throw new Error(`Component ${component.name} has already been registered with ${this.name}`);\n }\n provider.setComponent(component);\n }\n addOrOverwriteComponent(component) {\n const provider = this.getProvider(component.name);\n if (provider.isComponentSet()) {\n // delete the existing provider from the container, so we can register the new component\n this.providers.delete(component.name);\n }\n this.addComponent(component);\n }\n /**\n * getProvider provides a type safe interface where it can only be called with a field name\n * present in NameServiceMapping interface.\n *\n * Firebase SDKs providing services should extend NameServiceMapping interface to register\n * themselves.\n */\n getProvider(name) {\n if (this.providers.has(name)) {\n return this.providers.get(name);\n }\n // create a Provider for a service that hasn't registered with Firebase\n const provider = new Provider(name, this);\n this.providers.set(name, provider);\n return provider;\n }\n getProviders() {\n return Array.from(this.providers.values());\n }\n}\n\nexport { Component, ComponentContainer, Provider };\n//# sourceMappingURL=index.esm.js.map\n"],"names":[],"mappings":";AAKA,MAAM,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOZ,YAAY,MAAM,iBAAiB,MAAM;AACrC,SAAK,OAAO;AACZ,SAAK,kBAAkB;AACvB,SAAK,OAAO;AACZ,SAAK,oBAAoB;AAIzB,SAAK,eAAe,CAAA;AACpB,SAAK,oBAAoB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AAM;AACd,QAAI,KAAK,UAAU,IAAI,IAAI,GAAG;AAC1B,aAAO,KAAK,UAAU,IAAI,IAAI;AAAA,IAClC;AAEA,UAAM,WAAW,IAAI,SAAS,MAAM,IAAI;AACxC,SAAK,UAAU,IAAI,MAAM,QAAQ;AACjC,WAAO;AAAA,EACX;AAAA,EACA,eAAe;AACX,WAAO,MAAM,KAAK,KAAK,UAAU,OAAM,CAAE;AAAA,EAC7C;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var LogLevel;
|
|
18
|
-
(function(LogLevel2) {
|
|
19
|
-
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
20
|
-
LogLevel2[LogLevel2["VERBOSE"] = 1] = "VERBOSE";
|
|
21
|
-
LogLevel2[LogLevel2["INFO"] = 2] = "INFO";
|
|
22
|
-
LogLevel2[LogLevel2["WARN"] = 3] = "WARN";
|
|
23
|
-
LogLevel2[LogLevel2["ERROR"] = 4] = "ERROR";
|
|
24
|
-
LogLevel2[LogLevel2["SILENT"] = 5] = "SILENT";
|
|
25
|
-
})(LogLevel || (LogLevel = {}));
|
|
26
|
-
const levelStringToEnum = {
|
|
27
|
-
"debug": LogLevel.DEBUG,
|
|
28
|
-
"verbose": LogLevel.VERBOSE,
|
|
29
|
-
"info": LogLevel.INFO,
|
|
30
|
-
"warn": LogLevel.WARN,
|
|
31
|
-
"error": LogLevel.ERROR,
|
|
32
|
-
"silent": LogLevel.SILENT
|
|
33
|
-
};
|
|
34
|
-
const defaultLogLevel = LogLevel.INFO;
|
|
35
|
-
const ConsoleMethod = {
|
|
36
|
-
[LogLevel.DEBUG]: "log",
|
|
37
|
-
[LogLevel.VERBOSE]: "log",
|
|
38
|
-
[LogLevel.INFO]: "info",
|
|
39
|
-
[LogLevel.WARN]: "warn",
|
|
40
|
-
[LogLevel.ERROR]: "error"
|
|
41
|
-
};
|
|
42
|
-
const defaultLogHandler = (instance, logType, ...args) => {
|
|
43
|
-
if (logType < instance.logLevel) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
47
|
-
const method = ConsoleMethod[logType];
|
|
48
|
-
if (method) {
|
|
49
|
-
console[method](`[${now}] ${instance.name}:`, ...args);
|
|
50
|
-
} else {
|
|
51
|
-
throw new Error(`Attempted to log a message with an invalid logType (value: ${logType})`);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
class Logger {
|
|
55
|
-
/**
|
|
56
|
-
* Gives you an instance of a Logger to capture messages according to
|
|
57
|
-
* Firebase's logging scheme.
|
|
58
|
-
*
|
|
59
|
-
* @param name The name that the logs will be associated with
|
|
60
|
-
*/
|
|
61
|
-
constructor(name) {
|
|
62
|
-
this.name = name;
|
|
63
|
-
this._logLevel = defaultLogLevel;
|
|
64
|
-
this._logHandler = defaultLogHandler;
|
|
65
|
-
this._userLogHandler = null;
|
|
66
|
-
}
|
|
67
|
-
get logLevel() {
|
|
68
|
-
return this._logLevel;
|
|
69
|
-
}
|
|
70
|
-
set logLevel(val) {
|
|
71
|
-
if (!(val in LogLevel)) {
|
|
72
|
-
throw new TypeError(`Invalid value "${val}" assigned to \`logLevel\``);
|
|
73
|
-
}
|
|
74
|
-
this._logLevel = val;
|
|
75
|
-
}
|
|
76
|
-
// Workaround for setter/getter having to be the same type.
|
|
77
|
-
setLogLevel(val) {
|
|
78
|
-
this._logLevel = typeof val === "string" ? levelStringToEnum[val] : val;
|
|
79
|
-
}
|
|
80
|
-
get logHandler() {
|
|
81
|
-
return this._logHandler;
|
|
82
|
-
}
|
|
83
|
-
set logHandler(val) {
|
|
84
|
-
if (typeof val !== "function") {
|
|
85
|
-
throw new TypeError("Value assigned to `logHandler` must be a function");
|
|
86
|
-
}
|
|
87
|
-
this._logHandler = val;
|
|
88
|
-
}
|
|
89
|
-
get userLogHandler() {
|
|
90
|
-
return this._userLogHandler;
|
|
91
|
-
}
|
|
92
|
-
set userLogHandler(val) {
|
|
93
|
-
this._userLogHandler = val;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* The functions below are all based on the `console` interface
|
|
97
|
-
*/
|
|
98
|
-
debug(...args) {
|
|
99
|
-
this._userLogHandler && this._userLogHandler(this, LogLevel.DEBUG, ...args);
|
|
100
|
-
this._logHandler(this, LogLevel.DEBUG, ...args);
|
|
101
|
-
}
|
|
102
|
-
log(...args) {
|
|
103
|
-
this._userLogHandler && this._userLogHandler(this, LogLevel.VERBOSE, ...args);
|
|
104
|
-
this._logHandler(this, LogLevel.VERBOSE, ...args);
|
|
105
|
-
}
|
|
106
|
-
info(...args) {
|
|
107
|
-
this._userLogHandler && this._userLogHandler(this, LogLevel.INFO, ...args);
|
|
108
|
-
this._logHandler(this, LogLevel.INFO, ...args);
|
|
109
|
-
}
|
|
110
|
-
warn(...args) {
|
|
111
|
-
this._userLogHandler && this._userLogHandler(this, LogLevel.WARN, ...args);
|
|
112
|
-
this._logHandler(this, LogLevel.WARN, ...args);
|
|
113
|
-
}
|
|
114
|
-
error(...args) {
|
|
115
|
-
this._userLogHandler && this._userLogHandler(this, LogLevel.ERROR, ...args);
|
|
116
|
-
this._logHandler(this, LogLevel.ERROR, ...args);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
export {
|
|
120
|
-
LogLevel,
|
|
121
|
-
Logger
|
|
122
|
-
};
|
|
123
|
-
//# sourceMappingURL=index.esm.js.map
|