@aastrika_npmjs/sunbird-sdk 5.1.1
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/LICENSE +21 -0
- package/README.md +2 -0
- package/__test__/mocks.d.ts +6 -0
- package/__test__/setup.d.ts +2 -0
- package/api/api-service-impl.d.ts +32 -0
- package/api/config/api-config.d.ts +21 -0
- package/api/config/app-config.d.ts +6 -0
- package/api/def/api-request-handler.d.ts +4 -0
- package/api/def/api-service.d.ts +8 -0
- package/api/handlers/api-token-handler.d.ts +17 -0
- package/api/index.d.ts +7 -0
- package/api/network-queue/db/schema.d.ts +28 -0
- package/api/network-queue/def/network-queue.d.ts +20 -0
- package/api/network-queue/handlers/network-request-handler.d.ts +7 -0
- package/api/network-queue/impl/network-queue-impl.d.ts +16 -0
- package/api/network-queue/index.d.ts +2 -0
- package/api/util/authenticators/bearer-token-refresh-interceptor.d.ts +14 -0
- package/api/util/authenticators/user-token-refresh-interceptor.d.ts +11 -0
- package/api/util/jwt.util.d.ts +7 -0
- package/archive/def/archive-service.d.ts +60 -0
- package/archive/export/def/archive-export-delegate.d.ts +5 -0
- package/archive/export/def/telemetry-archive-package-meta.d.ts +5 -0
- package/archive/export/error/export-assertion-error.d.ts +4 -0
- package/archive/export/error/invalid-request-error.d.ts +4 -0
- package/archive/export/error/object-not-found-error.d.ts +4 -0
- package/archive/export/impl/telemetry-export-delegate.d.ts +18 -0
- package/archive/export/index.d.ts +1 -0
- package/archive/impl/archive-service-impl.d.ts +31 -0
- package/archive/import/def/archive-import-delegate.d.ts +6 -0
- package/archive/import/error/import-assertion-error.d.ts +4 -0
- package/archive/import/error/invalid-archive-error.d.ts +4 -0
- package/archive/import/error/unknown-object-error.d.ts +4 -0
- package/archive/import/impl/telemetry-import-delegate.d.ts +19 -0
- package/archive/import/index.d.ts +1 -0
- package/archive/index.d.ts +4 -0
- package/auth/def/auth-end-points.d.ts +5 -0
- package/auth/def/auth-event.d.ts +8 -0
- package/auth/def/auth-service.d.ts +10 -0
- package/auth/def/o-auth-session.d.ts +7 -0
- package/auth/def/session-provider.d.ts +4 -0
- package/auth/errors/auth-token-refresh-error.d.ts +4 -0
- package/auth/errors/in-app-browser-exit-error.d.ts +4 -0
- package/auth/errors/processing-error.d.ts +4 -0
- package/auth/errors/sign-in-error.d.ts +4 -0
- package/auth/impl/auth-service-impl.d.ts +22 -0
- package/auth/index.d.ts +20 -0
- package/auth/util/auth-util.d.ts +15 -0
- package/auth/util/native-apple-session-provider/impl/native-apple-session-provider.d.ts +27 -0
- package/auth/util/native-custombrowser-session-provider/impl/native-custombrowser-session-provider.d.ts +19 -0
- package/auth/util/native-google-session-provider/impl/native-google-session-provider.d.ts +15 -0
- package/auth/util/native-keycloak-session-provider/impl/native-keycloak-session-provider.d.ts +18 -0
- package/auth/util/webview-session-provider/def/webview-register-session-provider-config.d.ts +22 -0
- package/auth/util/webview-session-provider/def/webview-runner.d.ts +49 -0
- package/auth/util/webview-session-provider/def/webview-session-provider-config.d.ts +22 -0
- package/auth/util/webview-session-provider/def/webview-state-session-provider-config.d.ts +22 -0
- package/auth/util/webview-session-provider/errors/interrupt-error.d.ts +4 -0
- package/auth/util/webview-session-provider/errors/no-inappbrowser-session-assertion-fail-error.d.ts +4 -0
- package/auth/util/webview-session-provider/errors/param-not-captured-error.d.ts +4 -0
- package/auth/util/webview-session-provider/errors/webview-runner-error.d.ts +4 -0
- package/auth/util/webview-session-provider/impl/webview-auto-merge-session-provider.d.ts +15 -0
- package/auth/util/webview-session-provider/impl/webview-base-session-provider.d.ts +23 -0
- package/auth/util/webview-session-provider/impl/webview-login-session-provider.d.ts +14 -0
- package/auth/util/webview-session-provider/impl/webview-manual-merge-session-provider.d.ts +11 -0
- package/auth/util/webview-session-provider/impl/webview-runner-impl.d.ts +56 -0
- package/auth/util/webview-session-provider/impl/webview-state-session-provider.d.ts +14 -0
- package/certificate/config/certificate-service-config.d.ts +5 -0
- package/certificate/db/schema.d.ts +18 -0
- package/certificate/def/certificate-service.d.ts +17 -0
- package/certificate/handlers/get-public-key-handler.d.ts +18 -0
- package/certificate/impl/certificate-service-impl.d.ts +32 -0
- package/certificate/index.d.ts +3 -0
- package/codepush-experiment/def/codepush-experiment-service.d.ts +9 -0
- package/codepush-experiment/handler/codepush-experiment-handler.d.ts +3 -0
- package/codepush-experiment/impl/codepush-experiment-service-impl.d.ts +14 -0
- package/codepush-experiment/index.d.ts +2 -0
- package/content/config/content-config.d.ts +8 -0
- package/content/db/schema.d.ts +124 -0
- package/content/def/content-delete-listener.d.ts +3 -0
- package/content/def/content-event.d.ts +33 -0
- package/content/def/content-feedback-service.d.ts +21 -0
- package/content/def/content-service.d.ts +46 -0
- package/content/def/content.d.ts +43 -0
- package/content/def/requests.d.ts +219 -0
- package/content/def/response.d.ts +93 -0
- package/content/def/search-request.d.ts +37 -0
- package/content/handlers/content-aggregator.d.ts +166 -0
- package/content/handlers/content-feedback-handler.d.ts +5 -0
- package/content/handlers/content-marker-handler.d.ts +10 -0
- package/content/handlers/content-storage-handler.d.ts +9 -0
- package/content/handlers/delete-content-handler.d.ts +18 -0
- package/content/handlers/export/clean-temp-loc.d.ts +8 -0
- package/content/handlers/export/compress-content.d.ts +8 -0
- package/content/handlers/export/copy-asset.d.ts +8 -0
- package/content/handlers/export/copy-to-destination.d.ts +6 -0
- package/content/handlers/export/create-content-export-manifest.d.ts +12 -0
- package/content/handlers/export/create-temp-loc.d.ts +8 -0
- package/content/handlers/export/delete-temp-ecar.d.ts +8 -0
- package/content/handlers/export/deletete-temp-dir.d.ts +6 -0
- package/content/handlers/export/device-memory-check.d.ts +9 -0
- package/content/handlers/export/ecar-bundle.d.ts +11 -0
- package/content/handlers/export/generate-export-share-telemetry.d.ts +8 -0
- package/content/handlers/export/write-manifest.d.ts +10 -0
- package/content/handlers/get-child-contents-handler.d.ts +21 -0
- package/content/handlers/get-child-question-set-handler.d.ts +16 -0
- package/content/handlers/get-content-details-handler.d.ts +30 -0
- package/content/handlers/get-content-heirarchy-handler.d.ts +10 -0
- package/content/handlers/get-contents-handler.d.ts +12 -0
- package/content/handlers/import/content-search-api-handler.d.ts +13 -0
- package/content/handlers/import/create-content-import-manifest.d.ts +15 -0
- package/content/handlers/import/create-hierarchy.d.ts +18 -0
- package/content/handlers/import/device-memory-check.d.ts +10 -0
- package/content/handlers/import/ecar-cleanup.d.ts +8 -0
- package/content/handlers/import/extract-ecar.d.ts +11 -0
- package/content/handlers/import/extract-payloads.d.ts +53 -0
- package/content/handlers/import/generate-import-share-telemetry.d.ts +8 -0
- package/content/handlers/import/generate-interact-telemetry.d.ts +8 -0
- package/content/handlers/import/hierarchy-manifest-conversion.d.ts +11 -0
- package/content/handlers/import/update-size-on-device.d.ts +18 -0
- package/content/handlers/import/validate-ecar.d.ts +18 -0
- package/content/handlers/import-n-export-handler.d.ts +25 -0
- package/content/handlers/question-set-file-read-handler.d.ts +11 -0
- package/content/handlers/search-content-handler.d.ts +33 -0
- package/content/impl/content-feedback-service-impl.d.ts +13 -0
- package/content/impl/content-service-impl.d.ts +100 -0
- package/content/index.d.ts +9 -0
- package/content/util/content-constants.d.ts +93 -0
- package/content/util/content-mapper.d.ts +7 -0
- package/content/util/content-util.d.ts +94 -0
- package/content/util/linked-list.d.ts +16 -0
- package/content/util/stack.d.ts +10 -0
- package/course/config/course-service-config.d.ts +3 -0
- package/course/course-util.d.ts +6 -0
- package/course/def/batch.d.ts +1 -0
- package/course/def/course-batches-response.d.ts +5 -0
- package/course/def/course-certificate-manager.d.ts +9 -0
- package/course/def/course-service.d.ts +51 -0
- package/course/def/course.d.ts +1 -0
- package/course/def/download-certificate-request.d.ts +5 -0
- package/course/def/download-certificate-response.d.ts +3 -0
- package/course/def/get-certificate-request.d.ts +6 -0
- package/course/def/get-enrolled-course-response.d.ts +10 -0
- package/course/def/get-learner-certificate-response.d.ts +22 -0
- package/course/def/request-types.d.ts +83 -0
- package/course/def/unenrollCourseRequest.d.ts +5 -0
- package/course/def/update-content-state-response.d.ts +1 -0
- package/course/def/update-course-content-state-request.d.ts +1 -0
- package/course/errors/certificate-already-downloaded.d.ts +5 -0
- package/course/errors/no-certificate-found.d.ts +4 -0
- package/course/handlers/enroll-course-handler.d.ts +11 -0
- package/course/handlers/get-batch-details-handler.d.ts +10 -0
- package/course/handlers/get-content-state-handler.d.ts +16 -0
- package/course/handlers/get-course-batches-handler.d.ts +10 -0
- package/course/handlers/get-enrolled-course-handler.d.ts +21 -0
- package/course/handlers/get-learner-certificate-handler.d.ts +20 -0
- package/course/handlers/offline-content-state-handler.d.ts +12 -0
- package/course/handlers/offline-course-cache-handler.d.ts +15 -0
- package/course/handlers/sync-assessment-events-handler.d.ts +22 -0
- package/course/handlers/unenroll-course-handler.d.ts +10 -0
- package/course/handlers/update-content-state-api-handler.d.ts +16 -0
- package/course/handlers/update-enrolled-courses-handler.d.ts +11 -0
- package/course/impl/course-certificate-manager-impl.d.ts +21 -0
- package/course/impl/course-service-impl.d.ts +84 -0
- package/course/impl/offline-assessment-score-processor.d.ts +12 -0
- package/course/index.d.ts +11 -0
- package/db/config/db-config.d.ts +3 -0
- package/db/db-constants.d.ts +0 -0
- package/db/def/db-constants.d.ts +14 -0
- package/db/def/db-service.d.ts +14 -0
- package/db/def/migration.d.ts +10 -0
- package/db/def/query.d.ts +26 -0
- package/db/impl/db-cordova-service.d.ts +23 -0
- package/db/impl/db-web-sql-service.d.ts +0 -0
- package/db/index.d.ts +5 -0
- package/db/migrations/certificate-public-key-migration.d.ts +6 -0
- package/db/migrations/content-dialcode-migration.d.ts +9 -0
- package/db/migrations/content-generalization-migration.d.ts +8 -0
- package/db/migrations/content-marker-migration.d.ts +6 -0
- package/db/migrations/course-assessment-migration.d.ts +6 -0
- package/db/migrations/error-stack-migration.d.ts +6 -0
- package/db/migrations/group-profile-migration.d.ts +7 -0
- package/db/migrations/initial-migration.d.ts +6 -0
- package/db/migrations/milliseconds-to-seconds-migration.d.ts +6 -0
- package/db/migrations/network-queue-migration.d.ts +10 -0
- package/db/migrations/offline-search-textbook-migration.d.ts +6 -0
- package/db/migrations/player-config-data-migrations.d.ts +7 -0
- package/db/migrations/profile-syllabus-migration.d.ts +6 -0
- package/db/migrations/recently-viewed-migration.d.ts +6 -0
- package/db/migrations/search-history-migration.d.ts +6 -0
- package/db/util/query-builder.d.ts +7 -0
- package/db/util/unique-id.d.ts +3 -0
- package/debugging/def/debugging-service.d.ts +12 -0
- package/debugging/handler/debugging-duration-handler.d.ts +9 -0
- package/debugging/impl/debuggin-service-impl.d.ts +17 -0
- package/debugging/index.d.ts +3 -0
- package/device-register/config/device-register-config.d.ts +4 -0
- package/device-register/def/device-register-service.d.ts +7 -0
- package/device-register/def/request.d.ts +16 -0
- package/device-register/def/response.d.ts +7 -0
- package/device-register/handler/device-register-handler.d.ts +24 -0
- package/device-register/handler/get-device-profile-handler.d.ts +16 -0
- package/device-register/impl/device-register-service-impl.d.ts +21 -0
- package/device-register/index.d.ts +5 -0
- package/discussion/def/discussion-service.d.ts +10 -0
- package/discussion/impl/discussion-service.impl.d.ts +15 -0
- package/discussion/index.d.ts +1 -0
- package/error/config/error-logger-config.d.ts +3 -0
- package/error/db/schema.d.ts +17 -0
- package/error/def/error-logger-service.d.ts +6 -0
- package/error/def/error-stack.d.ts +6 -0
- package/error/handlers/error-stack-sync-handler.d.ts +19 -0
- package/error/handlers/error-stack-sync-request-decorator.d.ts +23 -0
- package/error/impl/error-logger-service-impl.d.ts +31 -0
- package/error/index.d.ts +1 -0
- package/error/util/error-stack-mapper.d.ts +6 -0
- package/errors/index.d.ts +1 -0
- package/errors/validation-error.d.ts +4 -0
- package/events-bus/config/events-bus-config.d.ts +3 -0
- package/events-bus/def/emit-request.d.ts +4 -0
- package/events-bus/def/error-event.d.ts +24 -0
- package/events-bus/def/event-namespace.d.ts +8 -0
- package/events-bus/def/event-observer.d.ts +5 -0
- package/events-bus/def/events-bus-event.d.ts +4 -0
- package/events-bus/def/events-bus-service.d.ts +11 -0
- package/events-bus/def/register-observer-request.d.ts +6 -0
- package/events-bus/impl/events-bus-service-impl.d.ts +16 -0
- package/events-bus/index.d.ts +4 -0
- package/faq/config/faq-service-config.d.ts +3 -0
- package/faq/def/faq-service.d.ts +6 -0
- package/faq/def/faq.d.ts +1 -0
- package/faq/def/get-faq-request.d.ts +4 -0
- package/faq/handler/get-faq-details-handler.d.ts +18 -0
- package/faq/impl/faq-service-impl.d.ts +15 -0
- package/faq/index.d.ts +5 -0
- package/form/config/form-service-config.d.ts +4 -0
- package/form/def/form-request.d.ts +9 -0
- package/form/def/form-service.d.ts +7 -0
- package/form/def/models.d.ts +1 -0
- package/form/handle/get-form-handler.d.ts +23 -0
- package/form/impl/form-service-impl.d.ts +17 -0
- package/form/index.d.ts +4 -0
- package/framework/config/framework-service-config.d.ts +9 -0
- package/framework/def/channel.d.ts +1 -0
- package/framework/def/framework-category-code.d.ts +12 -0
- package/framework/def/framework-service.d.ts +18 -0
- package/framework/def/framework.d.ts +1 -0
- package/framework/def/organization.d.ts +1 -0
- package/framework/def/requests.d.ts +20 -0
- package/framework/def/responses.d.ts +5 -0
- package/framework/def/suggested-framework.d.ts +6 -0
- package/framework/errors/no-active-channel-found-error.d.ts +4 -0
- package/framework/handler/get-channel-detail-handler.d.ts +18 -0
- package/framework/handler/get-framework-category-terms-handler.d.ts +16 -0
- package/framework/handler/get-framework-detail-handler.d.ts +19 -0
- package/framework/impl/framework-service-impl.d.ts +32 -0
- package/framework/index.d.ts +12 -0
- package/framework/util/framework-mapper.d.ts +7 -0
- package/framework/util/framework-util-service-impl.d.ts +15 -0
- package/framework/util/framework-util-service.d.ts +13 -0
- package/framework/util/requests.d.ts +19 -0
- package/group/def/group-activity-service.d.ts +7 -0
- package/group/def/group-service.d.ts +25 -0
- package/group/def/models.d.ts +1 -0
- package/group/def/requests.d.ts +56 -0
- package/group/def/responses.d.ts +2 -0
- package/group/impl/group-activity-service-impl.d.ts +12 -0
- package/group/impl/group-service-impl.d.ts +34 -0
- package/group/index.d.ts +5 -0
- package/group-deprecated/db/schema.d.ts +35 -0
- package/group-deprecated/def/get-all-group-request-deprecated.d.ts +3 -0
- package/group-deprecated/def/group-service-deprecated.d.ts +16 -0
- package/group-deprecated/def/group-session-deprecated.d.ts +9 -0
- package/group-deprecated/def/groupDeprecated.d.ts +16 -0
- package/group-deprecated/def/profiles-to-group-request-deprecated.d.ts +4 -0
- package/group-deprecated/error/no-active-group-session-error.d.ts +4 -0
- package/group-deprecated/error/no-group-found-error.d.ts +4 -0
- package/group-deprecated/impl/group-service-deprecated-impl.d.ts +24 -0
- package/group-deprecated/index.d.ts +7 -0
- package/group-deprecated/util/group-mapper.d.ts +6 -0
- package/group-deprecated/util/group-profile-mapper.d.ts +6 -0
- package/index.d.ts +38 -0
- package/index.js +14 -0
- package/injection-tokens.d.ts +60 -0
- package/key-value-store/db/schema.d.ts +12 -0
- package/key-value-store/def/cached-item-request.d.ts +7 -0
- package/key-value-store/def/cached-item-store.d.ts +14 -0
- package/key-value-store/def/key-value-store.d.ts +5 -0
- package/key-value-store/impl/cached-item-store-impl.d.ts +19 -0
- package/key-value-store/impl/key-value-store-impl.d.ts +9 -0
- package/key-value-store/index.d.ts +3 -0
- package/notification/db/schema.d.ts +21 -0
- package/notification/def/notification-service.d.ts +11 -0
- package/notification/def/requests.d.ts +32 -0
- package/notification/handler/notification-handler.d.ts +9 -0
- package/notification/impl/notification-service-impl.d.ts +26 -0
- package/notification/index.d.ts +2 -0
- package/notification-v2/def/notification-service-v2.d.ts +8 -0
- package/notification-v2/impl/notification-service-v2-impl.d.ts +14 -0
- package/notification-v2/index.d.ts +1 -0
- package/open-rap-configurable.d.ts +3 -0
- package/package.json +114 -0
- package/page/config/page-service-config.d.ts +4 -0
- package/page/def/page-assemble-service.d.ts +7 -0
- package/page/def/page-assemble.d.ts +5 -0
- package/page/def/requests.d.ts +41 -0
- package/page/handle/delegates/course-request-delegate.d.ts +18 -0
- package/page/handle/delegates/default-request-delegate.d.ts +28 -0
- package/page/handle/delegates/dialcode-request-delegate.d.ts +15 -0
- package/page/handle/page-assembler-factory.d.ts +27 -0
- package/page/impl/page-assemble-service-impl.d.ts +28 -0
- package/page/index.d.ts +4 -0
- package/partner/db/schema.d.ts +9 -0
- package/player/db/schema.d.ts +27 -0
- package/player/def/player-service.d.ts +10 -0
- package/player/def/response.d.ts +42 -0
- package/player/impl/player-service-impl.d.ts +27 -0
- package/player/index.d.ts +2 -0
- package/preference-keys.d.ts +54 -0
- package/profile/config/profile-service-config.d.ts +9 -0
- package/profile/db/schema.d.ts +190 -0
- package/profile/def/accept-terms-condition-request.d.ts +5 -0
- package/profile/def/add-managed-profile-request.d.ts +10 -0
- package/profile/def/check-user-exists-request.d.ts +7 -0
- package/profile/def/check-user-exists-response.d.ts +1 -0
- package/profile/def/content-access-filter-criteria.d.ts +4 -0
- package/profile/def/content-access.d.ts +16 -0
- package/profile/def/delete-user-feed-request.d.ts +5 -0
- package/profile/def/export-profile-context.d.ts +10 -0
- package/profile/def/generate-otp-request.d.ts +6 -0
- package/profile/def/get-all-group-request.d.ts +3 -0
- package/profile/def/get-all-profile-request.d.ts +5 -0
- package/profile/def/get-managed-server-profiles-request.d.ts +4 -0
- package/profile/def/import-profile-context.d.ts +8 -0
- package/profile/def/is-profile-already-in-use-request.d.ts +4 -0
- package/profile/def/location-search-criteria.d.ts +11 -0
- package/profile/def/location-search-result.d.ts +1 -0
- package/profile/def/merge-server-profiles-request.d.ts +10 -0
- package/profile/def/profile-exists-response.d.ts +3 -0
- package/profile/def/profile-export-request.d.ts +12 -0
- package/profile/def/profile-export-response.d.ts +3 -0
- package/profile/def/profile-import-request.d.ts +3 -0
- package/profile/def/profile-import-response.d.ts +4 -0
- package/profile/def/profile-service.d.ts +70 -0
- package/profile/def/profile-session.d.ts +7 -0
- package/profile/def/profile.d.ts +30 -0
- package/profile/def/profiles-to-group-request.d.ts +4 -0
- package/profile/def/server-profile-details-request.d.ts +5 -0
- package/profile/def/server-profile.d.ts +1 -0
- package/profile/def/tenant-info-request.d.ts +3 -0
- package/profile/def/tenant-info.d.ts +7 -0
- package/profile/def/update-server-profile-declarations-request.d.ts +4 -0
- package/profile/def/update-server-profile-declarations-response.d.ts +1 -0
- package/profile/def/update-server-profile-info-request.d.ts +1 -0
- package/profile/def/update-server-profile-response.d.ts +1 -0
- package/profile/def/update-user-feed-request.d.ts +7 -0
- package/profile/def/user-migrate-request.d.ts +7 -0
- package/profile/def/user-migrate-response.d.ts +11 -0
- package/profile/def/verify-otp-request.d.ts +6 -0
- package/profile/errors/invalid-profile-error.d.ts +4 -0
- package/profile/errors/no-active-session-error.d.ts +4 -0
- package/profile/errors/no-profile-found-error.d.ts +4 -0
- package/profile/handler/accept-term-condition-handler.d.ts +10 -0
- package/profile/handler/export/clean-up-exported-file.d.ts +20 -0
- package/profile/handler/export/copy-database.d.ts +8 -0
- package/profile/handler/export/create-metadata.d.ts +14 -0
- package/profile/handler/export/generate-profile-export-telemetry.d.ts +8 -0
- package/profile/handler/export/get-epar-file-path.d.ts +8 -0
- package/profile/handler/generate-otp-handler.d.ts +10 -0
- package/profile/handler/get-server-profile-details-handler.d.ts +20 -0
- package/profile/handler/import/generate-profile-import-telemetry.d.ts +8 -0
- package/profile/handler/import/transport-assesments.d.ts +11 -0
- package/profile/handler/import/transport-framework-n-channel.d.ts +9 -0
- package/profile/handler/import/transport-group-profile.d.ts +9 -0
- package/profile/handler/import/transport-group.d.ts +9 -0
- package/profile/handler/import/transport-profiles.d.ts +9 -0
- package/profile/handler/import/transport-user.d.ts +9 -0
- package/profile/handler/import/update-imported-profile-metadata.d.ts +8 -0
- package/profile/handler/import/validate-profile-metadata.d.ts +9 -0
- package/profile/handler/is-profile-already-in-use-handler.d.ts +11 -0
- package/profile/handler/managed-profile-manager.d.ts +34 -0
- package/profile/handler/profile-handler.d.ts +5 -0
- package/profile/handler/search-location-handler.d.ts +19 -0
- package/profile/handler/tenant-info-handler.d.ts +12 -0
- package/profile/handler/user-migrate-handler.d.ts +15 -0
- package/profile/handler/verify-otp-handler.d.ts +10 -0
- package/profile/impl/profile-service-impl.d.ts +83 -0
- package/profile/index.d.ts +25 -0
- package/profile/util/profile-db-entry-mapper.d.ts +6 -0
- package/sdk-config.d.ts +41 -0
- package/sdk-service-on-init-delegate.d.ts +5 -0
- package/sdk-service-pre-init-delegate.d.ts +5 -0
- package/sdk.d.ts +91 -0
- package/segmentation/def/segmentation-service.d.ts +9 -0
- package/segmentation/handler/fetch-segmentation-command-handler.d.ts +8 -0
- package/segmentation/handler/fetch-segmentation-tags-handler.d.ts +8 -0
- package/segmentation/handler/store-segmentation-command-handler.d.ts +8 -0
- package/segmentation/handler/store-segmentation-tag-handler.d.ts +8 -0
- package/segmentation/impl/segmentaion-service-impl.d.ts +13 -0
- package/segmentation/index.d.ts +6 -0
- package/storage/def/scan-requests.d.ts +5 -0
- package/storage/def/storage-destination.d.ts +4 -0
- package/storage/def/storage-event.d.ts +36 -0
- package/storage/def/storage-requests.d.ts +15 -0
- package/storage/def/storage-service.d.ts +16 -0
- package/storage/errors/cancellation-error.d.ts +4 -0
- package/storage/errors/duplicate-content-error.d.ts +4 -0
- package/storage/errors/low-memory-error.d.ts +4 -0
- package/storage/errors/transfer-failed-duplicate-content-error.d.ts +4 -0
- package/storage/errors/transfer-failed-error.d.ts +5 -0
- package/storage/handler/scan/get-modified-content-handler.d.ts +15 -0
- package/storage/handler/scan/perform-actoin-on-content-handler.d.ts +8 -0
- package/storage/handler/storage-handler.d.ts +14 -0
- package/storage/handler/transfer/copy-content-from-source-to-destination.d.ts +15 -0
- package/storage/handler/transfer/delete-destination-folder.d.ts +6 -0
- package/storage/handler/transfer/delete-source-folder.d.ts +12 -0
- package/storage/handler/transfer/device-memory-check.d.ts +9 -0
- package/storage/handler/transfer/duplicate-content-check.d.ts +13 -0
- package/storage/handler/transfer/store-destination-content-in-db.d.ts +17 -0
- package/storage/handler/transfer/update-source-content-path-in-db.d.ts +8 -0
- package/storage/handler/transfer/validate-destination-content.d.ts +13 -0
- package/storage/handler/transfer/validate-destination-folder.d.ts +11 -0
- package/storage/handler/transfer-content-handler.d.ts +51 -0
- package/storage/impl/storage-service-impl.d.ts +35 -0
- package/storage/index.d.ts +6 -0
- package/summarizer/assesment-analyzer.d.ts +4 -0
- package/summarizer/db/schema.d.ts +21 -0
- package/summarizer/def/request.d.ts +6 -0
- package/summarizer/def/response.d.ts +77 -0
- package/summarizer/def/summarizer-service.d.ts +22 -0
- package/summarizer/handler/summarizer-handler.d.ts +22 -0
- package/summarizer/handler/summarizer-queries.d.ts +12 -0
- package/summarizer/handler/summary-telemetry-event-handler.d.ts +40 -0
- package/summarizer/impl/summarizer-service-impl.d.ts +40 -0
- package/summarizer/index.d.ts +7 -0
- package/sunbird-error.d.ts +5 -0
- package/system-settings/config/system-settings-config.d.ts +4 -0
- package/system-settings/def/request-types.d.ts +3 -0
- package/system-settings/def/system-settings-org-ids.d.ts +5 -0
- package/system-settings/def/system-settings-service.d.ts +5 -0
- package/system-settings/def/system-settings.d.ts +5 -0
- package/system-settings/handlers/get-system-settings-handler.d.ts +18 -0
- package/system-settings/impl/system-settings-service-impl.d.ts +15 -0
- package/system-settings/index.d.ts +5 -0
- package/telemetry/config/telemetry-config.d.ts +7 -0
- package/telemetry/db/schema.d.ts +66 -0
- package/telemetry/def/requests.d.ts +171 -0
- package/telemetry/def/telemetry-constants.d.ts +64 -0
- package/telemetry/def/telemetry-decorator.d.ts +13 -0
- package/telemetry/def/telemetry-event.d.ts +12 -0
- package/telemetry/def/telemetry-model.d.ts +193 -0
- package/telemetry/def/telemetry-service.d.ts +31 -0
- package/telemetry/def/telemetry-stat.d.ts +4 -0
- package/telemetry/def/telemetry-sync-preprocessor.d.ts +3 -0
- package/telemetry/def/telemetry-sync-stat.d.ts +6 -0
- package/telemetry/errors/invalid-input-for-sync-preprocessor-error.d.ts +4 -0
- package/telemetry/handler/import/generate-import-telemetry-share.d.ts +9 -0
- package/telemetry/handler/import/transport-processed-telemetry.d.ts +9 -0
- package/telemetry/handler/import/update-imported-telemetry-metadata.d.ts +8 -0
- package/telemetry/handler/import/validate-telemetry-metadata.d.ts +9 -0
- package/telemetry/handler/telemetry-sync-handler.d.ts +41 -0
- package/telemetry/impl/decorator-impl.d.ts +26 -0
- package/telemetry/impl/process-event.d.ts +5 -0
- package/telemetry/impl/string-to-byte-array-preprocessor.d.ts +4 -0
- package/telemetry/impl/string-to-gzipped-string.d.ts +4 -0
- package/telemetry/impl/telemetry-entries-to-string-preprocessor.d.ts +4 -0
- package/telemetry/impl/telemetry-service-impl.d.ts +74 -0
- package/telemetry/index.d.ts +9 -0
- package/telemetry/util/telemetry-auto-sync-modes.d.ts +5 -0
- package/telemetry/util/telemetry-auto-sync-service-impl.d.ts +17 -0
- package/telemetry/util/telemetry-auto-sync-service.d.ts +9 -0
- package/telemetry/util/telemetry-logger.d.ts +4 -0
- package/util/app/def/app-info.d.ts +7 -0
- package/util/app/impl/app-info-impl.d.ts +19 -0
- package/util/app/index.d.ts +1 -0
- package/util/array-util.d.ts +6 -0
- package/util/device/def/device-info.d.ts +33 -0
- package/util/device/impl/device-info-impl.d.ts +12 -0
- package/util/device/index.d.ts +1 -0
- package/util/download/def/download-complete-delegate.d.ts +5 -0
- package/util/download/def/download-event.d.ts +20 -0
- package/util/download/def/download-service.d.ts +14 -0
- package/util/download/def/download-status.d.ts +7 -0
- package/util/download/def/requests.d.ts +20 -0
- package/util/download/def/response.d.ts +5 -0
- package/util/download/impl/download-service-impl.d.ts +38 -0
- package/util/download/index.d.ts +5 -0
- package/util/encoders/encoder.d.ts +4 -0
- package/util/encoders/utf8-to-b64-encoder.d.ts +5 -0
- package/util/file/config/file-config.d.ts +2 -0
- package/util/file/def/file-service.d.ts +21 -0
- package/util/file/errors/no-file-found.d.ts +4 -0
- package/util/file/impl/file-service-impl.d.ts +98 -0
- package/util/file/index.d.ts +271 -0
- package/util/file/util/file-util.d.ts +9 -0
- package/util/file/util/path.d.ts +6 -0
- package/util/list/comparator.d.ts +3 -0
- package/util/list/linked-list.d.ts +11 -0
- package/util/list/list-node.d.ts +6 -0
- package/util/network/def/network-info-service.d.ts +5 -0
- package/util/network/def/network-status.d.ts +4 -0
- package/util/network/impl/network-info-service-impl.d.ts +7 -0
- package/util/network/index.d.ts +2 -0
- package/util/number-util.d.ts +5 -0
- package/util/object-util.d.ts +7 -0
- package/util/queue/queue.d.ts +8 -0
- package/util/search-history/db/schema.d.ts +17 -0
- package/util/search-history/def/requests.d.ts +9 -0
- package/util/search-history/def/search-entry.d.ts +5 -0
- package/util/search-history/def/search-history-service.d.ts +7 -0
- package/util/search-history/impl/search-history-service-impl.d.ts +13 -0
- package/util/search-history/index.d.ts +2 -0
- package/util/search-history/util/search-history-db-entry-mapper.d.ts +5 -0
- package/util/shared-preferences/config/shared-prefernces-config.d.ts +2 -0
- package/util/shared-preferences/def/shared-preferences-set-collection.d.ts +12 -0
- package/util/shared-preferences/def/shared-preferences.d.ts +9 -0
- package/util/shared-preferences/impl/shared-preferences-android.d.ts +13 -0
- package/util/shared-preferences/impl/shared-preferences-local-storage.d.ts +11 -0
- package/util/shared-preferences/impl/shared-preferences-set-collection-impl.d.ts +19 -0
- package/util/shared-preferences/index.d.ts +2 -0
- package/util/zip/def/zip-service.d.ts +4 -0
- package/util/zip/impl/zip-service-impl.d.ts +5 -0
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("rxjs/operators"),require("rxjs"),require("@project-sunbird/client-services"),require("@project-sunbird/client-services/core/http-service"),require("@project-sunbird/client-services/services/content/utilities/primary-category-mapper"),require("@project-sunbird/client-services/services/content"),require("@project-sunbird/client-services/models/content"),require("@project-sunbird/client-services/models"),require("@project-sunbird/client-services/core"),require("@project-sunbird/client-services/core/http-service/utilities/interceptors"),require("@project-sunbird/client-services/models/group"),require("@project-sunbird/client-services/models/user"),require("@project-sunbird/client-services/services/content/utilities/content-group-generator"),require("@project-sunbird/client-services/services/content/utilities/content-progress-calculator"),require("@project-sunbird/client-services/services/content/utilities/mime-type-facet-to-mime-type-category-aggregator"));else if("function"==typeof define&&define.amd)define(["rxjs/operators","rxjs","@project-sunbird/client-services","@project-sunbird/client-services/core/http-service","@project-sunbird/client-services/services/content/utilities/primary-category-mapper","@project-sunbird/client-services/services/content","@project-sunbird/client-services/models/content","@project-sunbird/client-services/models","@project-sunbird/client-services/core","@project-sunbird/client-services/core/http-service/utilities/interceptors","@project-sunbird/client-services/models/group","@project-sunbird/client-services/models/user","@project-sunbird/client-services/services/content/utilities/content-group-generator","@project-sunbird/client-services/services/content/utilities/content-progress-calculator","@project-sunbird/client-services/services/content/utilities/mime-type-facet-to-mime-type-category-aggregator"],e);else{var n="object"==typeof exports?e(require("rxjs/operators"),require("rxjs"),require("@project-sunbird/client-services"),require("@project-sunbird/client-services/core/http-service"),require("@project-sunbird/client-services/services/content/utilities/primary-category-mapper"),require("@project-sunbird/client-services/services/content"),require("@project-sunbird/client-services/models/content"),require("@project-sunbird/client-services/models"),require("@project-sunbird/client-services/core"),require("@project-sunbird/client-services/core/http-service/utilities/interceptors"),require("@project-sunbird/client-services/models/group"),require("@project-sunbird/client-services/models/user"),require("@project-sunbird/client-services/services/content/utilities/content-group-generator"),require("@project-sunbird/client-services/services/content/utilities/content-progress-calculator"),require("@project-sunbird/client-services/services/content/utilities/mime-type-facet-to-mime-type-category-aggregator")):e(t.rxjs.operators,t.rxjs,t["@project-sunbird"]["client-services"],t["@project-sunbird"]["client-services"].core["http-service"],t["@project-sunbird"]["client-services"].services.content.utilities["primary-category-mapper"],t["@project-sunbird"]["client-services"].services.content,t["@project-sunbird"]["client-services"].models.content,t["@project-sunbird"]["client-services"].models,t["@project-sunbird"]["client-services"].core,t["@project-sunbird"]["client-services"].core["http-service"].utilities.interceptors,t["@project-sunbird"]["client-services"].models.group,t["@project-sunbird"]["client-services"].models.user,t["@project-sunbird"]["client-services"].services.content.utilities["content-group-generator"],t["@project-sunbird"]["client-services"].services.content.utilities["content-progress-calculator"],t["@project-sunbird"]["client-services"].services.content.utilities["mime-type-facet-to-mime-type-category-aggregator"]);for(var r in n)("object"==typeof exports?exports:t)[r]=n[r]}}(window,(function(t,e,n,r,i,o,a,s,u,c,f,h,l,d,p){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=329)}([function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=e.getServiceIdentifierAsString=e.typeConstraint=e.namedConstraint=e.taggedConstraint=e.traverseAncerstors=e.decorate=e.id=e.MetadataReader=e.postConstruct=e.targetName=e.multiInject=e.unmanaged=e.optional=e.LazyServiceIdentifer=e.inject=e.named=e.tagged=e.injectable=e.ContainerModule=e.AsyncContainerModule=e.TargetTypeEnum=e.BindingTypeEnum=e.BindingScopeEnum=e.Container=e.METADATA_KEY=void 0;var r=n(9);e.METADATA_KEY=r;var i=n(170);Object.defineProperty(e,"Container",{enumerable:!0,get:function(){return i.Container}});var o=n(20);Object.defineProperty(e,"BindingScopeEnum",{enumerable:!0,get:function(){return o.BindingScopeEnum}}),Object.defineProperty(e,"BindingTypeEnum",{enumerable:!0,get:function(){return o.BindingTypeEnum}}),Object.defineProperty(e,"TargetTypeEnum",{enumerable:!0,get:function(){return o.TargetTypeEnum}});var a=n(186);Object.defineProperty(e,"AsyncContainerModule",{enumerable:!0,get:function(){return a.AsyncContainerModule}}),Object.defineProperty(e,"ContainerModule",{enumerable:!0,get:function(){return a.ContainerModule}});var s=n(187);Object.defineProperty(e,"injectable",{enumerable:!0,get:function(){return s.injectable}});var u=n(188);Object.defineProperty(e,"tagged",{enumerable:!0,get:function(){return u.tagged}});var c=n(189);Object.defineProperty(e,"named",{enumerable:!0,get:function(){return c.named}});var f=n(96);Object.defineProperty(e,"inject",{enumerable:!0,get:function(){return f.inject}}),Object.defineProperty(e,"LazyServiceIdentifer",{enumerable:!0,get:function(){return f.LazyServiceIdentifer}});var h=n(190);Object.defineProperty(e,"optional",{enumerable:!0,get:function(){return h.optional}});var l=n(191);Object.defineProperty(e,"unmanaged",{enumerable:!0,get:function(){return l.unmanaged}});var d=n(192);Object.defineProperty(e,"multiInject",{enumerable:!0,get:function(){return d.multiInject}});var p=n(193);Object.defineProperty(e,"targetName",{enumerable:!0,get:function(){return p.targetName}});var m=n(194);Object.defineProperty(e,"postConstruct",{enumerable:!0,get:function(){return m.postConstruct}});var b=n(94);Object.defineProperty(e,"MetadataReader",{enumerable:!0,get:function(){return b.MetadataReader}});var y=n(28);Object.defineProperty(e,"id",{enumerable:!0,get:function(){return y.id}});var v=n(23);Object.defineProperty(e,"decorate",{enumerable:!0,get:function(){return v.decorate}});var g=n(99);Object.defineProperty(e,"traverseAncerstors",{enumerable:!0,get:function(){return g.traverseAncerstors}}),Object.defineProperty(e,"taggedConstraint",{enumerable:!0,get:function(){return g.taggedConstraint}}),Object.defineProperty(e,"namedConstraint",{enumerable:!0,get:function(){return g.namedConstraint}}),Object.defineProperty(e,"typeConstraint",{enumerable:!0,get:function(){return g.typeConstraint}});var _=n(45);Object.defineProperty(e,"getServiceIdentifierAsString",{enumerable:!0,get:function(){return _.getServiceIdentifierAsString}});var E=n(195);Object.defineProperty(e,"multiBindToService",{enumerable:!0,get:function(){return E.multiBindToService}})},function(t,e){t.exports=n},function(t,e,n){var r=n(6),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e,n){"use strict";(function(t){
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
var r=n(197),i=n(198),o=n(101);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=l(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|p(e,n),i=(t=s(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|d(e.length);return 0===(t=s(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?s(t,0):l(t,e);if("Buffer"===e.type&&o(e.data))return l(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(f(e),t=s(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function l(t,e){var n=e.length<0?0:0|d(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(r)return F(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return N(this,e,n);case"base64":return O(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var f=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===f?0:o-f)){if(-1===f&&(f=o),o-f+1===u)return f*a}else-1!==f&&(o-=o-f),f=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var h=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){h=!1;break}if(h)return o}return-1}function g(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function _(t,e,n,r){return q(F(e,t.length-n),t,n,r)}function E(t,e,n,r){return q(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function M(t,e,n,r){return E(t,e,n,r)}function w(t,e,n,r){return q(V(e),t,n,r)}function S(t,e,n,r){return q(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function O(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,u,c=t[i],f=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(f=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(f=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(f=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(f=u)}null===f?(f=65533,h=1):f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|1023&f),r.push(f),i+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return c(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return function(t,e,n,r){return f(e),e<=0?s(t,e):void 0!==n?"string"==typeof r?s(t,e).fill(n,r):s(t,e).fill(n):s(t,e)}(null,t,e,n)},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var a=t[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)b(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)b(this,e,e+3),b(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)b(this,e,e+7),b(this,e+1,e+6),b(this,e+2,e+5),b(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?A(this,0,t):m.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(r,i),f=t.slice(e,n),h=0;h<s;++h)if(c[h]!==f[h]){o=c[h],a=f[h];break}return o<a?-1:a<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return E(this,t,e,n);case"latin1":case"binary":return M(this,t,e,n);case"base64":return w(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function N(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function C(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=B(t[o]);return i}function I(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function R(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,n,r,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function D(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function j(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function k(t,e,n,r,o){return o||j(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function U(t,e,n,r,o){return o||j(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;n=new u(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||R(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||R(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||R(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||R(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||R(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||R(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||P(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||P(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);P(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);P(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return k(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return k(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=u.isBuffer(t)?t:F(new u(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var x=/[^+\/0-9A-Za-z-_]/g;function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function V(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(x,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(10))},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],f=!1,h=-1;function l(){f&&u&&(f=!1,u.length?c=u.concat(c):h=-1,c.length&&d())}function d(){if(!f){var t=s(l);f=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||f||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){t.exports=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.NON_CUSTOM_TAG_KEYS=e.POST_CONSTRUCT=e.DESIGN_PARAM_TYPES=e.PARAM_TYPES=e.TAGGED_PROP=e.TAGGED=e.MULTI_INJECT_TAG=e.INJECT_TAG=e.OPTIONAL_TAG=e.UNMANAGED_TAG=e.NAME_TAG=e.NAMED_TAG=void 0,e.NAMED_TAG="named",e.NAME_TAG="name",e.UNMANAGED_TAG="unmanaged",e.OPTIONAL_TAG="optional",e.INJECT_TAG="inject",e.MULTI_INJECT_TAG="multi_inject",e.TAGGED="inversify:tagged",e.TAGGED_PROP="inversify:tagged_props",e.PARAM_TYPES="inversify:paramtypes",e.DESIGN_PARAM_TYPES="design:paramtypes",e.POST_CONSTRUCT="post_construct",e.NON_CUSTOM_TAG_KEYS=[e.INJECT_TAG,e.MULTI_INJECT_TAG,e.NAME_TAG,e.UNMANAGED_TAG,e.NAMED_TAG,e.OPTIONAL_TAG]},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){t.exports=function(){"use strict";var t="millisecond",e="second",n="minute",r="hour",i="day",o="week",a="month",s="quarter",u="year",c=/^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,f=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,h=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},l={s:h,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+h(r,2,"0")+":"+h(i,2,"0")},m:function(t,e){var n=12*(e.year()-t.year())+(e.month()-t.month()),r=t.clone().add(n,a),i=e-r<0,o=t.clone().add(n+(i?-1:1),a);return Number(-(n+(e-r)/(i?r-o:o-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(c){return{M:a,y:u,w:o,d:i,h:r,m:n,s:e,ms:t,Q:s}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},p="en",m={};m[p]=d;var b=function(t){return t instanceof _},y=function(t,e,n){var r;if(!t)return p;if("string"==typeof t)m[t]&&(r=t),e&&(m[t]=e,r=t);else{var i=t.name;m[i]=t,r=i}return n||(p=r),r},v=function(t,e,n){if(b(t))return t.clone();var r=e?"string"==typeof e?{format:e,pl:n}:e:{};return r.date=t,new _(r)},g=l;g.l=y,g.i=b,g.w=function(t,e){return v(t,{locale:e.$L,utc:e.$u,$offset:e.$offset})};var _=function(){function h(t){this.$L=this.$L||y(t.locale,null,!0),this.parse(t)}var l=h.prototype;return l.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(g.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(c);if(r)return n?new Date(Date.UTC(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)):new Date(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)}return new Date(e)}(t),this.init()},l.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},l.$utils=function(){return g},l.isValid=function(){return!("Invalid Date"===this.$d.toString())},l.isSame=function(t,e){var n=v(t);return this.startOf(e)<=n&&n<=this.endOf(e)},l.isAfter=function(t,e){return v(t)<this.startOf(e)},l.isBefore=function(t,e){return this.endOf(e)<v(t)},l.$g=function(t,e,n){return g.u(t)?this[e]:this.set(n,t)},l.year=function(t){return this.$g(t,"$y",u)},l.month=function(t){return this.$g(t,"$M",a)},l.day=function(t){return this.$g(t,"$W",i)},l.date=function(t){return this.$g(t,"$D","date")},l.hour=function(t){return this.$g(t,"$H",r)},l.minute=function(t){return this.$g(t,"$m",n)},l.second=function(t){return this.$g(t,"$s",e)},l.millisecond=function(e){return this.$g(e,"$ms",t)},l.unix=function(){return Math.floor(this.valueOf()/1e3)},l.valueOf=function(){return this.$d.getTime()},l.startOf=function(t,s){var c=this,f=!!g.u(s)||s,h=g.p(t),l=function(t,e){var n=g.w(c.$u?Date.UTC(c.$y,e,t):new Date(c.$y,e,t),c);return f?n:n.endOf(i)},d=function(t,e){return g.w(c.toDate()[t].apply(c.toDate(),(f?[0,0,0,0]:[23,59,59,999]).slice(e)),c)},p=this.$W,m=this.$M,b=this.$D,y="set"+(this.$u?"UTC":"");switch(h){case u:return f?l(1,0):l(31,11);case a:return f?l(1,m):l(0,m+1);case o:var v=this.$locale().weekStart||0,_=(p<v?p+7:p)-v;return l(f?b-_:b+(6-_),m);case i:case"date":return d(y+"Hours",0);case r:return d(y+"Minutes",1);case n:return d(y+"Seconds",2);case e:return d(y+"Milliseconds",3);default:return this.clone()}},l.endOf=function(t){return this.startOf(t,!1)},l.$set=function(o,s){var c,f=g.p(o),h="set"+(this.$u?"UTC":""),l=(c={},c.day=h+"Date",c.date=h+"Date",c[a]=h+"Month",c[u]=h+"FullYear",c[r]=h+"Hours",c[n]=h+"Minutes",c[e]=h+"Seconds",c[t]=h+"Milliseconds",c)[f],d=f===i?this.$D+(s-this.$W):s;if(f===a||f===u){var p=this.clone().set("date",1);p.$d[l](d),p.init(),this.$d=p.set("date",Math.min(this.$D,p.daysInMonth())).toDate()}else l&&this.$d[l](d);return this.init(),this},l.set=function(t,e){return this.clone().$set(t,e)},l.get=function(t){return this[g.p(t)]()},l.add=function(t,s){var c,f=this;t=Number(t);var h=g.p(s),l=function(e){var n=v(f);return g.w(n.date(n.date()+Math.round(e*t)),f)};if(h===a)return this.set(a,this.$M+t);if(h===u)return this.set(u,this.$y+t);if(h===i)return l(1);if(h===o)return l(7);var d=(c={},c[n]=6e4,c[r]=36e5,c[e]=1e3,c)[h]||1,p=this.$d.getTime()+t*d;return g.w(p,this)},l.subtract=function(t,e){return this.add(-1*t,e)},l.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=g.z(this),i=this.$locale(),o=this.$H,a=this.$m,s=this.$M,u=i.weekdays,c=i.months,h=function(t,r,i,o){return t&&(t[r]||t(e,n))||i[r].substr(0,o)},l=function(t){return g.s(o%12||12,t,"0")},d=i.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},p={YY:String(this.$y).slice(-2),YYYY:this.$y,M:s+1,MM:g.s(s+1,2,"0"),MMM:h(i.monthsShort,s,c,3),MMMM:c[s]||c(this,n),D:this.$D,DD:g.s(this.$D,2,"0"),d:String(this.$W),dd:h(i.weekdaysMin,this.$W,u,2),ddd:h(i.weekdaysShort,this.$W,u,3),dddd:u[this.$W],H:String(o),HH:g.s(o,2,"0"),h:l(1),hh:l(2),a:d(o,a,!0),A:d(o,a,!1),m:String(a),mm:g.s(a,2,"0"),s:String(this.$s),ss:g.s(this.$s,2,"0"),SSS:g.s(this.$ms,3,"0"),Z:r};return n.replace(f,(function(t,e){return e||p[t]||r.replace(":","")}))},l.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},l.diff=function(t,i,c){var f,h=g.p(i),l=v(t),d=6e4*(l.utcOffset()-this.utcOffset()),p=this-l,m=g.m(this,l);return m=(f={},f[u]=m/12,f[a]=m,f[s]=m/3,f[o]=(p-d)/6048e5,f.day=(p-d)/864e5,f[r]=p/36e5,f[n]=p/6e4,f[e]=p/1e3,f)[h]||p,c?m:g.a(m)},l.daysInMonth=function(){return this.endOf(a).$D},l.$locale=function(){return m[this.$L]},l.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=y(t,e,!0);return r&&(n.$L=r),n},l.clone=function(){return g.w(this.$d,this)},l.toDate=function(){return new Date(this.valueOf())},l.toJSON=function(){return this.isValid()?this.toISOString():null},l.toISOString=function(){return this.$d.toISOString()},l.toString=function(){return this.$d.toUTCString()},h}();return v.prototype=_.prototype,v.extend=function(t,e){return t(e,_,v),v},v.locale=y,v.isDayjs=b,v.unix=function(t){return v(1e3*t)},v.en=m[p],v.Ls=m,v}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STACK_OVERFLOW=e.CIRCULAR_DEPENDENCY_IN_FACTORY=e.POST_CONSTRUCT_ERROR=e.MULTIPLE_POST_CONSTRUCT_METHODS=e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=e.ARGUMENTS_LENGTH_MISMATCH=e.INVALID_DECORATOR_OPERATION=e.INVALID_TO_SELF_VALUE=e.INVALID_FUNCTION_BINDING=e.INVALID_MIDDLEWARE_RETURN=e.NO_MORE_SNAPSHOTS_AVAILABLE=e.INVALID_BINDING_TYPE=e.NOT_IMPLEMENTED=e.CIRCULAR_DEPENDENCY=e.UNDEFINED_INJECT_ANNOTATION=e.MISSING_INJECT_ANNOTATION=e.MISSING_INJECTABLE_ANNOTATION=e.NOT_REGISTERED=e.CANNOT_UNBIND=e.AMBIGUOUS_MATCH=e.KEY_NOT_FOUND=e.NULL_ARGUMENT=e.DUPLICATED_METADATA=e.DUPLICATED_INJECTABLE_DECORATOR=void 0,e.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",e.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",e.NULL_ARGUMENT="NULL argument",e.KEY_NOT_FOUND="Key Not Found",e.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",e.CANNOT_UNBIND="Could not unbind serviceIdentifier:",e.NOT_REGISTERED="No matching bindings found for serviceIdentifier:",e.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",e.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:";e.UNDEFINED_INJECT_ANNOTATION=function(t){return"@inject called with undefined this could mean that the class "+t+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},e.CIRCULAR_DEPENDENCY="Circular dependency found:",e.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.",e.INVALID_BINDING_TYPE="Invalid binding type:",e.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",e.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",e.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",e.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",e.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";e.ARGUMENTS_LENGTH_MISMATCH=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."},e.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",e.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",e.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",e.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",e.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class";e.POST_CONSTRUCT_ERROR=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"@postConstruct error in class "+t[0]+": "+t[1]};e.CIRCULAR_DEPENDENCY_IN_FACTORY=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."},e.STACK_OVERFLOW="Maximum call stack size exceeded"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(18),i=n(163),o=n(326),a=function(){function t(t){this.dictionary=new o.default(t)}return t.prototype.contains=function(t){return this.dictionary.containsKey(t)},t.prototype.add=function(t){return!this.contains(t)&&!r.isUndefined(t)&&(this.dictionary.setValue(t,t),!0)},t.prototype.intersection=function(t){var e=this;this.forEach((function(n){return t.contains(n)||e.remove(n),!0}))},t.prototype.union=function(t){var e=this;t.forEach((function(t){return e.add(t),!0}))},t.prototype.difference=function(t){var e=this;t.forEach((function(t){return e.remove(t),!0}))},t.prototype.isSubsetOf=function(t){if(this.size()>t.size())return!1;var e=!0;return this.forEach((function(n){return!!t.contains(n)||(e=!1,!1)})),e},t.prototype.remove=function(t){return!!this.contains(t)&&(this.dictionary.remove(t),!0)},t.prototype.forEach=function(t){this.dictionary.forEach((function(e,n){return t(n)}))},t.prototype.toArray=function(){return this.dictionary.values()},t.prototype.isEmpty=function(){return this.dictionary.isEmpty()},t.prototype.size=function(){return this.dictionary.size()},t.prototype.clear=function(){this.dictionary.clear()},t.prototype.toString=function(){return i.toString(this.toArray())},t}();e.default=a},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=n,n.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e,n){"use strict";var r=e,i=n(21),o=n(14),a=n(141);r.assert=o,r.toArray=a.toArray,r.zero2=a.zero2,r.toHex=a.toHex,r.encode=a.encode,r.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},r.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},r.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},r.parseBytes=function(t){return"string"==typeof t?r.toArray(t,"hex"):t},r.intFromLE=function(t){return new i(t,"hex","le")}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var r=n(9),i=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===r.NAMED_TAG?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},t}();e.Metadata=i},function(t,e,n){"use strict";var r=n(14),i=n(5);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function u(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=i,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var a=t.charCodeAt(i);a<128?n[r++]=a:a<2048?(n[r++]=a>>6|192,n[r++]=63&a|128):o(t,i)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++i)),n[r++]=a>>18|240,n[r++]=a>>12&63|128,n[r++]=a>>6&63|128,n[r++]=63&a|128):(n[r++]=a>>12|224,n[r++]=a>>6&63|128,n[r++]=63&a|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n},e.toHex=function(t){for(var e="",n=0;n<t.length;n++)e+=s(t[n].toString(16));return e},e.htonl=a,e.toHex32=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=a(i)),n+=u(i.toString(16))}return n},e.zero2=s,e.zero8=u,e.join32=function(t,e,n,i){var o=n-e;r(o%4==0);for(var a=new Array(o/4),s=0,u=e;s<a.length;s++,u+=4){var c;c="big"===i?t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]:t[u+3]<<24|t[u+2]<<16|t[u+1]<<8|t[u],a[s]=c>>>0}return a},e.split32=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<<e|t>>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,r){return t+e+n+r>>>0},e.sum32_5=function(t,e,n,r,i){return t+e+n+r+i>>>0},e.sum64=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0},e.sum64_lo=function(t,e,n,r){return e+r>>>0},e.sum64_4_hi=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},e.sum64_4_lo=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0},e.sum64_5_hi=function(t,e,n,r,i,o,a,s,u,c){var f=0,h=e;return f+=(h=h+r>>>0)<e?1:0,f+=(h=h+o>>>0)<o?1:0,f+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(f+=(h=h+c>>>0)<c?1:0)>>>0},e.sum64_5_lo=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.prototype.hasOwnProperty;function i(t){return"function"==typeof t}function o(t){return void 0===t}function a(t){return"[object String]"===Object.prototype.toString.call(t)}e.has=function(t,e){return r.call(t,e)},e.defaultCompare=function(t,e){return t<e?-1:t===e?0:1},e.defaultEquals=function(t,e){return t===e},e.defaultToString=function(t){return null===t?"COLLECTION_NULL":o(t)?"COLLECTION_UNDEFINED":a(t)?"$s"+t:"$o"+t.toString()},e.makeString=function(t,n){if(void 0===n&&(n=","),null===t)return"COLLECTION_NULL";if(o(t))return"COLLECTION_UNDEFINED";if(a(t))return t.toString();var r="{",i=!0;for(var s in t)e.has(t,s)&&(i?i=!1:r+=n,r=r+s+":"+t[s]);return r+"}"},e.isFunction=i,e.isUndefined=o,e.isString=a,e.reverseCompareFunction=function(t){return o(t)||!i(t)?function(t,e){return t<e?1:t===e?0:-1}:function(e,n){return-1*t(e,n)}},e.compareToEquals=function(t){return function(e,n){return 0===t(e,n)}}},function(t,e,n){"use strict";var r=n(313),i=n(323),o=n(90);t.exports={formats:o,parse:i,stringify:r}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TargetTypeEnum=e.BindingTypeEnum=e.BindingScopeEnum=void 0;e.BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"};e.BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};e.TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"}},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(262).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:f[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new b).mulp(t,e,n)}function b(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},b.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},b.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},b.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},b.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},b.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},b.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(g,v),g.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},w.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},i(S,w),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e,n){var r,i,o,a,s,u,c,f;t.exports=(f=n(162),i=(r=f).lib,o=i.WordArray,a=i.Hasher,s=r.algo,u=[],c=s.SHA1=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],c=0;c<80;c++){if(c<16)u[c]=0|t[e+c];else{var f=u[c-3]^u[c-8]^u[c-14]^u[c-16];u[c]=f<<1|f>>>31}var h=(r<<5|r>>>27)+s+u[c];h+=c<20?1518500249+(i&o|~i&a):c<40?1859775393+(i^o^a):c<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,s=a,a=o,o=i<<30|i>>>2,i=r,r=h}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}}),r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c),f.SHA1)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagProperty=e.tagParameter=e.decorate=void 0;var r=n(12),i=n(9);function o(t,e,n,i,o){var a={},s="number"==typeof o,u=void 0!==o&&s?o.toString():n;if(s&&void 0!==n)throw new Error(r.INVALID_DECORATOR_OPERATION);Reflect.hasOwnMetadata(t,e)&&(a=Reflect.getMetadata(t,e));var c=a[u];if(Array.isArray(c))for(var f=0,h=c;f<h.length;f++){var l=h[f];if(l.key===i.key)throw new Error(r.DUPLICATED_METADATA+" "+l.key.toString())}else c=[];c.push(i),a[u]=c,Reflect.defineMetadata(t,a,e)}function a(t,e){Reflect.decorate(t,e)}function s(t,e){return function(n,r){e(n,r,t)}}e.tagParameter=function(t,e,n,r){o(i.TAGGED,t,e,r,n)},e.tagProperty=function(t,e,n){o(i.TAGGED_PROP,t.constructor,e,n)},e.decorate=function(t,e,n){"number"==typeof n?a([s(n,t)],e):"string"==typeof n?Reflect.decorate([t],e,n):a([t],e)}},function(t,e,n){var r=n(4).Buffer,i=n(52).Transform,o=n(31).StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(5)(a,i),a.prototype.update=function(t,e,n){"string"==typeof t&&(t=r.from(t,e));var i=this._update(t);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,n){var r;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){r=t}finally{n(r)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||r.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var r=this._decoder.write(t);return n&&(r+=this._decoder.end()),r},t.exports=a},function(t,e,n){t.exports=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,n,r)}return n[a].exports}for(var o=!1,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}n.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(t[r]=n[r])}}return t},n.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){var e,n,r,i,o,a;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(a=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)o=t[e],a.set(o,i),i+=o.length;return a}},a={arraySet:function(t,e,n,r,i){for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};n.setTyped=function(t){t?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,o)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,a))},n.setTyped(r)},{}],2:[function(t,e,n){"use strict";var r=t("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new r.Buf8(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",a=0;a<e;a++)n+=String.fromCharCode(t[a]);return n}a[254]=a[254]=1,n.string2buf=function(t){var e,n,i,o,a,s=t.length,u=0;for(o=0;o<s;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),u+=n<128?1:n<2048?2:n<65536?3:4;for(e=new r.Buf8(u),a=0,o=0;a<u;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?e[a++]=n:n<2048?(e[a++]=192|n>>>6,e[a++]=128|63&n):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|63&n):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|63&n);return e},n.buf2binstring=function(t){return u(t,t.length)},n.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n<i;n++)e[n]=t.charCodeAt(n);return e},n.buf2string=function(t,e){var n,r,i,o,s=e||t.length,c=new Array(2*s);for(r=0,n=0;n<s;)if((i=t[n++])<128)c[r++]=i;else if((o=a[i])>4)c[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&n<s;)i=i<<6|63&t[n++],o--;o>1?c[r++]=65533:i<65536?c[r++]=i:(i-=65536,c[r++]=55296|i>>10&1023,c[r++]=56320|1023&i)}return u(c,r)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+a[t[n]]>e?n:e}},{"./common":1}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},{}],4:[function(t,e,n){"use strict";var r=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var o=r,a=i+n;t^=-1;for(var s=i;s<a;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}},{}],5:[function(t,e,n){"use strict";var r,i=t("../utils/common"),o=t("./trees"),a=t("./adler32"),s=t("./crc32"),u=t("./messages");function c(t,e){return t.msg=u[e],e}function f(t){return(t<<1)-(t>4?9:0)}function h(t){for(var e=t.length;--e>=0;)t[e]=0}function l(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function d(t,e){o._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,l(t.strm)}function p(t,e){t.pending_buf[t.pending++]=e}function m(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function b(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-262?t.strstart-(t.w_size-262):0,c=t.window,f=t.w_mask,h=t.prev,l=t.strstart+258,d=c[o+a-1],p=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(n=e)+a]===p&&c[n+a-1]===d&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&o<l);if(r=258-(l-o),o=l-258,r>a){if(t.match_start=e,a=r,r>=s)break;d=c[o+a-1],p=c[o+a]}}}while((e=h[e&f])>u&&0!=--i);return a<=t.lookahead?a:t.lookahead}function y(t){var e,n,r,o,u,c,f,h,l,d,p=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-262)){i.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=n=t.hash_size;do{r=t.head[--e],t.head[e]=r>=p?r-p:0}while(--n);e=n=p;do{r=t.prev[--e],t.prev[e]=r>=p?r-p:0}while(--n);o+=p}if(0===t.strm.avail_in)break;if(c=t.strm,f=t.window,h=t.strstart+t.lookahead,l=o,d=void 0,(d=c.avail_in)>l&&(d=l),n=0===d?0:(c.avail_in-=d,i.arraySet(f,c.input,c.next_in,d,h),1===c.state.wrap?c.adler=a(c.adler,f,d,h):2===c.state.wrap&&(c.adler=s(c.adler,f,d,h)),c.next_in+=d,c.total_in+=d,d),t.lookahead+=n,t.lookahead+t.insert>=3)for(u=t.strstart-t.insert,t.ins_h=t.window[u],t.ins_h=(t.ins_h<<t.hash_shift^t.window[u+1])&t.hash_mask;t.insert&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[u+3-1])&t.hash_mask,t.prev[u&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=u,u++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<262&&0!==t.strm.avail_in)}function v(t,e){for(var n,r;;){if(t.lookahead<262){if(y(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==n&&t.strstart-n<=t.w_size-262&&(t.match_length=b(t,n)),t.match_length>=3)if(r=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!=--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+1])&t.hash_mask;else r=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(r&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}function g(t,e){for(var n,r,i;;){if(t.lookahead<262){if(y(t),t.lookahead<262&&0===e)return 1;if(0===t.lookahead)break}if(n=0,t.lookahead>=3&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==n&&t.prev_length<t.max_lazy_match&&t.strstart-n<=t.w_size-262&&(t.match_length=b(t,n),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-3,r=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=i&&(t.ins_h=(t.ins_h<<t.hash_shift^t.window[t.strstart+3-1])&t.hash_mask,n=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,r&&(d(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((r=o._tr_tally(t,0,t.window[t.strstart-1]))&&d(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(r=o._tr_tally(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}function _(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}function E(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(1146),this.dyn_dtree=new i.Buf16(122),this.bl_tree=new i.Buf16(78),h(this.dyn_ltree),h(this.dyn_dtree),h(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(16),this.heap=new i.Buf16(573),h(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(573),h(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function M(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=2,(e=t.state).pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:113,t.adler=2===e.wrap?0:1,e.last_flush=0,o._tr_init(e),0):c(t,-2)}function w(t){var e,n=M(t);return 0===n&&((e=t.state).window_size=2*e.w_size,h(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),n}function S(t,e,n,r,o,a){if(!t)return-2;var s=1;if(-1===e&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),o<1||o>9||8!==n||r<8||r>15||e<0||e>9||a<0||a>4)return c(t,-2);8===r&&(r=9);var u=new E;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=r,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+3-1)/3),u.window=new i.Buf8(2*u.w_size),u.head=new i.Buf16(u.hash_size),u.prev=new i.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new i.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=e,u.strategy=a,u.method=n,w(t)}r=[new _(0,0,0,0,(function(t,e){var n=65535;for(n>t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(y(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,d(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-262&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(d(t,!1),t.strm.avail_out),1)})),new _(4,4,8,4,v),new _(4,5,16,8,v),new _(4,6,32,32,v),new _(4,4,16,16,g),new _(8,16,32,32,g),new _(8,16,128,128,g),new _(8,32,128,256,g),new _(32,128,258,1024,g),new _(32,258,258,4096,g)],n.deflateInit=function(t,e){return S(t,e,8,15,8,0)},n.deflateInit2=S,n.deflateReset=w,n.deflateResetKeep=M,n.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?-2:(t.state.gzhead=e,0):-2},n.deflate=function(t,e){var n,i,a,u;if(!t||!t.state||e>5||e<0)return t?c(t,-2):-2;if(i=t.state,!t.output||!t.input&&0!==t.avail_in||666===i.status&&4!==e)return c(t,0===t.avail_out?-5:-2);if(i.strm=t,n=i.last_flush,i.last_flush=e,42===i.status)if(2===i.wrap)t.adler=0,p(i,31),p(i,139),p(i,8),i.gzhead?(p(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),p(i,255&i.gzhead.time),p(i,i.gzhead.time>>8&255),p(i,i.gzhead.time>>16&255),p(i,i.gzhead.time>>24&255),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(p(i,255&i.gzhead.extra.length),p(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(p(i,0),p(i,0),p(i,0),p(i,0),p(i,0),p(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),p(i,3),i.status=113);else{var b=8+(i.w_bits-8<<4)<<8;b|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(b|=32),b+=31-b%31,i.status=113,m(i,b),0!==i.strstart&&(m(i,t.adler>>>16),m(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending!==i.pending_buf_size));)p(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,p(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),l(t),a=i.pending,i.pending===i.pending_buf_size)){u=1;break}u=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,p(i,u)}while(0!==u);i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===u&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&l(t),i.pending+2<=i.pending_buf_size&&(p(i,255&t.adler),p(i,t.adler>>8&255),t.adler=0,i.status=113)):i.status=113),0!==i.pending){if(l(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&f(e)<=f(n)&&4!==e)return c(t,-5);if(666===i.status&&0!==t.avail_in)return c(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&666!==i.status){var v=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(y(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var n,r,i,a,s=t.window;;){if(t.lookahead<=258){if(y(t),t.lookahead<=258&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(r=s[i=t.strstart-1])===s[++i]&&r===s[++i]&&r===s[++i]){a=t.strstart+258;do{}while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&i<a);t.match_length=258-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(d(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(d(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(d(t,!1),0===t.strm.avail_out)?1:2}(i,e):r[i.level].func(i,e);if(3!==v&&4!==v||(i.status=666),1===v||3===v)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===v&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(h(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),l(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(p(i,255&t.adler),p(i,t.adler>>8&255),p(i,t.adler>>16&255),p(i,t.adler>>24&255),p(i,255&t.total_in),p(i,t.total_in>>8&255),p(i,t.total_in>>16&255),p(i,t.total_in>>24&255)):(m(i,t.adler>>>16),m(i,65535&t.adler)),l(t),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},n.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&103!==e&&113!==e&&666!==e?c(t,-2):(t.state=null,113===e?c(t,-3):0):-2},n.deflateSetDictionary=function(t,e){var n,r,o,s,u,c,f,l,d=e.length;if(!t||!t.state)return-2;if(2===(s=(n=t.state).wrap)||1===s&&42!==n.status||n.lookahead)return-2;for(1===s&&(t.adler=a(t.adler,e,d,0)),n.wrap=0,d>=n.w_size&&(0===s&&(h(n.head),n.strstart=0,n.block_start=0,n.insert=0),l=new i.Buf8(n.w_size),i.arraySet(l,e,d-n.w_size,n.w_size,0),e=l,d=n.w_size),u=t.avail_in,c=t.next_in,f=t.input,t.avail_in=d,t.next_in=0,t.input=e,y(n);n.lookahead>=3;){r=n.strstart,o=n.lookahead-2;do{n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+3-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++}while(--o);n.strstart=r,n.lookahead=2,y(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=c,t.input=f,t.avail_in=u,n.wrap=s,0},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":4,"./messages":6,"./trees":7}],6:[function(t,e,n){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],7:[function(t,e,n){"use strict";var r=t("../utils/common");function i(t){for(var e=t.length;--e>=0;)t[e]=0}var o=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],a=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],u=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],c=new Array(576);i(c);var f=new Array(60);i(f);var h=new Array(512);i(h);var l=new Array(256);i(l);var d=new Array(29);i(d);var p,m,b,y=new Array(30);function v(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}function g(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function _(t){return t<256?h[t]:h[256+(t>>>7)]}function E(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function M(t,e,n){t.bi_valid>16-n?(t.bi_buf|=e<<t.bi_valid&65535,E(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=n)}function w(t,e,n){M(t,n[2*e],n[2*e+1])}function S(t,e){var n=0;do{n|=1&t,t>>>=1,n<<=1}while(--e>0);return n>>>1}function O(t,e,n){var r,i,o=new Array(16),a=0;for(r=1;r<=15;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=S(o[s]++,s))}}function A(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0}function T(t){t.bi_valid>8?E(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function N(t,e,n,r){var i=2*e,o=2*n;return t[i]<t[o]||t[i]===t[o]&&r[e]<=r[n]}function C(t,e,n){for(var r=t.heap[n],i=n<<1;i<=t.heap_len&&(i<t.heap_len&&N(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!N(e,r,t.heap[i],t.depth));)t.heap[n]=t.heap[i],n=i,i<<=1;t.heap[n]=r}function I(t,e,n){var r,i,s,u,c=0;if(0!==t.last_lit)do{r=t.pending_buf[t.d_buf+2*c]<<8|t.pending_buf[t.d_buf+2*c+1],i=t.pending_buf[t.l_buf+c],c++,0===r?w(t,i,e):(w(t,(s=l[i])+256+1,e),0!==(u=o[s])&&M(t,i-=d[s],u),w(t,s=_(--r),n),0!==(u=a[s])&&M(t,r-=y[s],u))}while(c<t.last_lit);w(t,256,e)}function R(t,e){var n,r,i,o=e.dyn_tree,a=e.stat_desc.static_tree,s=e.stat_desc.has_stree,u=e.stat_desc.elems,c=-1;for(t.heap_len=0,t.heap_max=573,n=0;n<u;n++)0!==o[2*n]?(t.heap[++t.heap_len]=c=n,t.depth[n]=0):o[2*n+1]=0;for(;t.heap_len<2;)o[2*(i=t.heap[++t.heap_len]=c<2?++c:0)]=1,t.depth[i]=0,t.opt_len--,s&&(t.static_len-=a[2*i+1]);for(e.max_code=c,n=t.heap_len>>1;n>=1;n--)C(t,o,n);i=u;do{n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],C(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,C(t,o,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,u=e.dyn_tree,c=e.max_code,f=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(o=0;o<=15;o++)t.bl_count[o]=0;for(u[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)(o=u[2*u[2*(r=t.heap[n])+1]+1]+1)>p&&(o=p,m++),u[2*r+1]=o,r>c||(t.bl_count[o]++,a=0,r>=d&&(a=l[r-d]),s=u[2*r],t.opt_len+=s*(o+a),h&&(t.static_len+=s*(f[2*r+1]+a)));if(0!==m){do{for(o=p-1;0===t.bl_count[o];)o--;t.bl_count[o]--,t.bl_count[o+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(o=p;0!==o;o--)for(r=t.bl_count[o];0!==r;)(i=t.heap[--n])>c||(u[2*i+1]!==o&&(t.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),r--)}}(t,e),O(o,c,t.bl_count)}function P(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),e[2*(n+1)+1]=65535,r=0;r<=n;r++)i=a,a=e[2*(r+1)+1],++s<u&&i===a||(s<c?t.bl_tree[2*i]+=s:0!==i?(i!==o&&t.bl_tree[2*i]++,t.bl_tree[32]++):s<=10?t.bl_tree[34]++:t.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function L(t,e,n){var r,i,o=-1,a=e[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),r=0;r<=n;r++)if(i=a,a=e[2*(r+1)+1],!(++s<u&&i===a)){if(s<c)do{w(t,i,t.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(w(t,i,t.bl_tree),s--),w(t,16,t.bl_tree),M(t,s-3,2)):s<=10?(w(t,17,t.bl_tree),M(t,s-3,3)):(w(t,18,t.bl_tree),M(t,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}i(y);var D=!1;function j(t,e,n,i){M(t,0+(i?1:0),3),function(t,e,n,i){T(t),i&&(E(t,n),E(t,~n)),r.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}(t,e,n,!0)}n._tr_init=function(t){D||(function(){var t,e,n,r,i,u=new Array(16);for(n=0,r=0;r<28;r++)for(d[r]=n,t=0;t<1<<o[r];t++)l[n++]=r;for(l[n-1]=r,i=0,r=0;r<16;r++)for(y[r]=i,t=0;t<1<<a[r];t++)h[i++]=r;for(i>>=7;r<30;r++)for(y[r]=i<<7,t=0;t<1<<a[r]-7;t++)h[256+i++]=r;for(e=0;e<=15;e++)u[e]=0;for(t=0;t<=143;)c[2*t+1]=8,t++,u[8]++;for(;t<=255;)c[2*t+1]=9,t++,u[9]++;for(;t<=279;)c[2*t+1]=7,t++,u[7]++;for(;t<=287;)c[2*t+1]=8,t++,u[8]++;for(O(c,287,u),t=0;t<30;t++)f[2*t+1]=5,f[2*t]=S(t,5);p=new v(c,o,257,286,15),m=new v(f,a,0,30,15),b=new v(new Array(0),s,0,19,7)}(),D=!0),t.l_desc=new g(t.dyn_ltree,p),t.d_desc=new g(t.dyn_dtree,m),t.bl_desc=new g(t.bl_tree,b),t.bi_buf=0,t.bi_valid=0,A(t)},n._tr_stored_block=j,n._tr_flush_block=function(t,e,n,r){var i,o,a=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,n=4093624447;for(e=0;e<=31;e++,n>>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),R(t,t.l_desc),R(t,t.d_desc),a=function(t){var e;for(P(t,t.dyn_ltree,t.l_desc.max_code),P(t,t.dyn_dtree,t.d_desc.max_code),R(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*u[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),i=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=i&&(i=o)):i=o=n+5,n+4<=i&&-1!==e?j(t,e,n,r):4===t.strategy||o===i?(M(t,2+(r?1:0),3),I(t,c,f)):(M(t,4+(r?1:0),3),function(t,e,n,r){var i;for(M(t,e-257,5),M(t,n-1,5),M(t,r-4,4),i=0;i<r;i++)M(t,t.bl_tree[2*u[i]+1],3);L(t,t.dyn_ltree,e-1),L(t,t.dyn_dtree,n-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),I(t,t.dyn_ltree,t.dyn_dtree)),A(t),r&&T(t)},n._tr_tally=function(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(l[n]+256+1)]++,t.dyn_dtree[2*_(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){M(t,2,3),w(t,256,c),function(t){16===t.bi_valid?(E(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":1}],8:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/deflate.js":[function(t,e,n){"use strict";var r=t("./zlib/deflate"),i=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/messages"),s=t("./zlib/zstream"),u=Object.prototype.toString;function c(t){if(!(this instanceof c))return new c(t);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==n)throw new Error(a[n]);if(e.header&&r.deflateSetHeader(this.strm,e.header),e.dictionary){var f;if(f="string"==typeof e.dictionary?o.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(n=r.deflateSetDictionary(this.strm,f)))throw new Error(a[n]);this._dict_set=!0}}function f(t,e){var n=new c(e);if(n.push(t,!0),n.err)throw n.msg||a[n.err];return n.result}c.prototype.push=function(t,e){var n,a,s=this.strm,c=this.options.chunkSize;if(this.ended)return!1;a=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=o.string2buf(t):"[object ArrayBuffer]"===u.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new i.Buf8(c),s.next_out=0,s.avail_out=c),1!==(n=r.deflate(s,a))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==a&&2!==a)||("string"===this.options.to?this.onData(o.buf2binstring(i.shrinkBuf(s.output,s.next_out))):this.onData(i.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==n);return 4===a?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==a||(this.onEnd(0),s.avail_out=0,!0)},c.prototype.onData=function(t){this.chunks.push(t)},c.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Deflate=c,n.deflate=f,n.deflateRaw=function(t,e){return(e=e||{}).raw=!0,f(t,e)},n.gzip=function(t,e){return(e=e||{}).gzip=!0,f(t,e)}},{"./utils/common":1,"./utils/strings":2,"./zlib/deflate":5,"./zlib/messages":6,"./zlib/zstream":8}]},{},[])("/lib/deflate.js")},function(t,e){t.exports=i},function(t,e){t.exports=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.id=void 0;var r=0;e.id=function(){return r++}},function(t,e,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&y(t,"error",e,n)}(t,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=f(t))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function p(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):b(i,i.length)}function m(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function b(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function y(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(o){r.once&&t.removeEventListener(e,i),n(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||a(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return f(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[t];if(void 0===u)return!1;if("function"==typeof u)o(u,this,e);else{var c=u.length,f=b(u,c);for(n=0;n<c;++n)o(f[n],this,e)}return!0},s.prototype.addListener=function(t,e){return h(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return h(this,t,e,!0)},s.prototype.once=function(t,e){return c(e),this.on(t,d(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,d(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,r,i,o,a;if(c(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,a||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(t,e,n){"use strict";var r=n(53),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=h;var o=Object.create(n(46));o.inherits=n(5);var a=n(103),s=n(65);o.inherits(h,a);for(var u=i(s.prototype),c=0;c<u.length;c++){var f=u[c];h.prototype[f]||(h.prototype[f]=s.prototype[f])}function h(t){if(!(this instanceof h))return new h(t);a.call(this,t),s.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",l)}function l(){this.allowHalfOpen||this._writableState.ended||r.nextTick(d,this)}function d(t){t.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),h.prototype._destroy=function(t,e){this.push(null),this.end(),r.nextTick(e,t)}},function(t,e,n){"use strict";var r=n(4).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=f,this.end=h,e=3;break;default:return this.write=l,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function f(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},o.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},o.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=a(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if((i=a(e[r]))>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if((i=a(e[r]))>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=a},function(t,e){t.exports=s},function(t,e,n){"use strict";(function(e,r){var i=n(4).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=i.allocUnsafe(t);if(t>0)if(t>65536)for(var a=0;a<t;a+=65536)o.getRandomValues(n.slice(a,a+65536));else o.getRandomValues(n);if("function"==typeof e)return r.nextTick((function(){e(null,n)}));return n}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,n(10),n(7))},function(t,e,n){"use strict";var r={};function i(t,e,n){n||(n=Error);var i=function(t){var n,r;function i(n,r,i){return t.call(this,function(t,n,r){return"string"==typeof e?e:e(t,n,r)}(n,r,i))||this}return r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);i.prototype.name=n.name,i.prototype.code=t,r[t]=i}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(r," ").concat(o(e,"type"));else{var u=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(r," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=r},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";(function(e){var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var i=n(109),o=n(113);n(37)(c,i);for(var a=r(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||e.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,n(7))},function(t,e,n){var r=n(4).Buffer;function i(t,e){this._block=r.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=r.from(t,e));for(var n=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s<o;){for(var u=a%i,c=Math.min(o-s,i-u),f=0;f<c;f++)n[u+f]=t[s+f];s+=c,(a+=c)%i==0&&this._update(n)}return this._len+=o,this},i.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(4294967295&n)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=i},function(t,e,n){"use strict";var r={};function i(t,e,n){n||(n=Error);var i=function(t){var n,r;function i(n,r,i){return t.call(this,function(t,n,r){return"string"==typeof e?e:e(t,n,r)}(n,r,i))||this}return r=t,(n=i).prototype=Object.create(r.prototype),n.prototype.constructor=n,n.__proto__=r,i}(n);i.prototype.name=n.name,i.prototype.code=t,r[t]=i}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}i("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(t,e,n){var r,i,a,s;if("string"==typeof e&&(i="not ",e.substr(!a||a<0?0:+a,i.length)===i)?(r="must not be",e=e.replace(/^not /,"")):r="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(r," ").concat(o(e,"type"));else{var u=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(u," ").concat(r," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=r},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";(function(e){var r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var i=n(135),o=n(139);n(41)(c,i);for(var a=r(o.prototype),s=0;s<a.length;s++){var u=a[s];c.prototype[u]||(c.prototype[u]=o.prototype[u])}function c(t){if(!(this instanceof c))return new c(t);i.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",f)))}function f(){this._writableState.ended||e.nextTick(h,this)}function h(t){t.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,n(7))},function(t,e,n){t.exports=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,n,r)}return n[a].exports}for(var o=!1,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(t,e,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}n.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var r in n)i(n,r)&&(t[r]=n[r])}}return t},n.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var o={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray)t.set(e.subarray(n,n+r),i);else for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){var e,n,r,i,o,a;for(r=0,e=0,n=t.length;e<n;e++)r+=t[e].length;for(a=new Uint8Array(r),i=0,e=0,n=t.length;e<n;e++)o=t[e],a.set(o,i),i+=o.length;return a}},a={arraySet:function(t,e,n,r,i){for(var o=0;o<r;o++)t[i+o]=e[n+o]},flattenChunks:function(t){return[].concat.apply([],t)}};n.setTyped=function(t){t?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,o)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,a))},n.setTyped(r)},{}],2:[function(t,e,n){"use strict";var r=t("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new r.Buf8(256),s=0;s<256;s++)a[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function u(t,e){if(e<65534&&(t.subarray&&o||!t.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(t,e));for(var n="",a=0;a<e;a++)n+=String.fromCharCode(t[a]);return n}a[254]=a[254]=1,n.string2buf=function(t){var e,n,i,o,a,s=t.length,u=0;for(o=0;o<s;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),u+=n<128?1:n<2048?2:n<65536?3:4;for(e=new r.Buf8(u),a=0,o=0;a<u;o++)55296==(64512&(n=t.charCodeAt(o)))&&o+1<s&&56320==(64512&(i=t.charCodeAt(o+1)))&&(n=65536+(n-55296<<10)+(i-56320),o++),n<128?e[a++]=n:n<2048?(e[a++]=192|n>>>6,e[a++]=128|63&n):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|63&n):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|63&n);return e},n.buf2binstring=function(t){return u(t,t.length)},n.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n<i;n++)e[n]=t.charCodeAt(n);return e},n.buf2string=function(t,e){var n,r,i,o,s=e||t.length,c=new Array(2*s);for(r=0,n=0;n<s;)if((i=t[n++])<128)c[r++]=i;else if((o=a[i])>4)c[r++]=65533,n+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&n<s;)i=i<<6|63&t[n++],o--;o>1?c[r++]=65533:i<65536?c[r++]=i:(i-=65536,c[r++]=55296|i>>10&1023,c[r++]=56320|1023&i)}return u(c,r)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;n>=0&&128==(192&t[n]);)n--;return n<0||0===n?e:n+a[t[n]]>e?n:e}},{"./common":1}],3:[function(t,e,n){"use strict";e.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){n-=a=n>2e3?2e3:n;do{o=o+(i=i+e[r++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0}},{}],4:[function(t,e,n){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(t,e,n){"use strict";var r=function(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var o=r,a=i+n;t^=-1;for(var s=i;s<a;s++)t=t>>>8^o[255&(t^e[s])];return-1^t}},{}],6:[function(t,e,n){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],7:[function(t,e,n){"use strict";e.exports=function(t,e){var n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y,v,g,_,E,M,w,S,O,A;n=t.state,r=t.next_in,O=t.input,i=r+(t.avail_in-5),o=t.next_out,A=t.output,a=o-(e-t.avail_out),s=o+(t.avail_out-257),u=n.dmax,c=n.wsize,f=n.whave,h=n.wnext,l=n.window,d=n.hold,p=n.bits,m=n.lencode,b=n.distcode,y=(1<<n.lenbits)-1,v=(1<<n.distbits)-1;t:do{p<15&&(d+=O[r++]<<p,p+=8,d+=O[r++]<<p,p+=8),g=m[d&y];e:for(;;){if(d>>>=_=g>>>24,p-=_,0==(_=g>>>16&255))A[o++]=65535&g;else{if(!(16&_)){if(0==(64&_)){g=m[(65535&g)+(d&(1<<_)-1)];continue e}if(32&_){n.mode=12;break t}t.msg="invalid literal/length code",n.mode=30;break t}E=65535&g,(_&=15)&&(p<_&&(d+=O[r++]<<p,p+=8),E+=d&(1<<_)-1,d>>>=_,p-=_),p<15&&(d+=O[r++]<<p,p+=8,d+=O[r++]<<p,p+=8),g=b[d&v];n:for(;;){if(d>>>=_=g>>>24,p-=_,!(16&(_=g>>>16&255))){if(0==(64&_)){g=b[(65535&g)+(d&(1<<_)-1)];continue n}t.msg="invalid distance code",n.mode=30;break t}if(M=65535&g,p<(_&=15)&&(d+=O[r++]<<p,(p+=8)<_&&(d+=O[r++]<<p,p+=8)),(M+=d&(1<<_)-1)>u){t.msg="invalid distance too far back",n.mode=30;break t}if(d>>>=_,p-=_,M>(_=o-a)){if((_=M-_)>f&&n.sane){t.msg="invalid distance too far back",n.mode=30;break t}if(w=0,S=l,0===h){if(w+=c-_,_<E){E-=_;do{A[o++]=l[w++]}while(--_);w=o-M,S=A}}else if(h<_){if(w+=c+h-_,(_-=h)<E){E-=_;do{A[o++]=l[w++]}while(--_);if(w=0,h<E){E-=_=h;do{A[o++]=l[w++]}while(--_);w=o-M,S=A}}}else if(w+=h-_,_<E){E-=_;do{A[o++]=l[w++]}while(--_);w=o-M,S=A}for(;E>2;)A[o++]=S[w++],A[o++]=S[w++],A[o++]=S[w++],E-=3;E&&(A[o++]=S[w++],E>1&&(A[o++]=S[w++]))}else{w=o-M;do{A[o++]=A[w++],A[o++]=A[w++],A[o++]=A[w++],E-=3}while(E>2);E&&(A[o++]=A[w++],E>1&&(A[o++]=A[w++]))}break}}break}}while(r<i&&o<s);r-=E=p>>3,d&=(1<<(p-=E<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r<i?i-r+5:5-(r-i),t.avail_out=o<s?s-o+257:257-(o-s),n.hold=d,n.bits=p}},{}],8:[function(t,e,n){"use strict";var r=t("../utils/common"),i=t("./adler32"),o=t("./crc32"),a=t("./inffast"),s=t("./inftrees");function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function c(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(852),e.distcode=e.distdyn=new r.Buf32(592),e.sane=1,e.back=-1,0):-2}function h(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,f(t)):-2}function l(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?-2:(null!==r.window&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,h(t))):-2}function d(t,e){var n,r;return t?(r=new c,t.state=r,r.window=null,0!==(n=l(t,e))&&(t.state=null),n):-2}var p,m,b=!0;function y(t){if(b){var e;for(p=new r.Buf32(512),m=new r.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(1,t.lens,0,288,p,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(2,t.lens,0,32,m,0,t.work,{bits:5}),b=!1}t.lencode=p,t.lenbits=9,t.distcode=m,t.distbits=5}function v(t,e,n,i){var o,a=t.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new r.Buf8(a.wsize)),i>=a.wsize?(r.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((o=a.wsize-a.wnext)>i&&(o=i),r.arraySet(a.window,e,n-i,o,a.wnext),(i-=o)?(r.arraySet(a.window,e,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=o))),0}n.inflateReset=h,n.inflateReset2=l,n.inflateResetKeep=f,n.inflateInit=function(t){return d(t,15)},n.inflateInit2=d,n.inflate=function(t,e){var n,c,f,h,l,d,p,m,b,g,_,E,M,w,S,O,A,T,N,C,I,R,P,L,D=0,j=new r.Buf8(4),k=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return-2;12===(n=t.state).mode&&(n.mode=13),l=t.next_out,f=t.output,p=t.avail_out,h=t.next_in,c=t.input,d=t.avail_in,m=n.hold,b=n.bits,g=d,_=p,R=0;t:for(;;)switch(n.mode){case 1:if(0===n.wrap){n.mode=13;break}for(;b<16;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(2&n.wrap&&35615===m){n.check=0,j[0]=255&m,j[1]=m>>>8&255,n.check=o(n.check,j,2,0),m=0,b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&m)<<8)+(m>>8))%31){t.msg="incorrect header check",n.mode=30;break}if(8!=(15&m)){t.msg="unknown compression method",n.mode=30;break}if(b-=4,I=8+(15&(m>>>=4)),0===n.wbits)n.wbits=I;else if(I>n.wbits){t.msg="invalid window size",n.mode=30;break}n.dmax=1<<I,t.adler=n.check=1,n.mode=512&m?10:12,m=0,b=0;break;case 2:for(;b<16;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(n.flags=m,8!=(255&n.flags)){t.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){t.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=m>>8&1),512&n.flags&&(j[0]=255&m,j[1]=m>>>8&255,n.check=o(n.check,j,2,0)),m=0,b=0,n.mode=3;case 3:for(;b<32;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}n.head&&(n.head.time=m),512&n.flags&&(j[0]=255&m,j[1]=m>>>8&255,j[2]=m>>>16&255,j[3]=m>>>24&255,n.check=o(n.check,j,4,0)),m=0,b=0,n.mode=4;case 4:for(;b<16;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}n.head&&(n.head.xflags=255&m,n.head.os=m>>8),512&n.flags&&(j[0]=255&m,j[1]=m>>>8&255,n.check=o(n.check,j,2,0)),m=0,b=0,n.mode=5;case 5:if(1024&n.flags){for(;b<16;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}n.length=m,n.head&&(n.head.extra_len=m),512&n.flags&&(j[0]=255&m,j[1]=m>>>8&255,n.check=o(n.check,j,2,0)),m=0,b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&((E=n.length)>d&&(E=d),E&&(n.head&&(I=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,c,h,E,I)),512&n.flags&&(n.check=o(n.check,c,E,h)),d-=E,h+=E,n.length-=E),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===d)break t;E=0;do{I=c[h+E++],n.head&&I&&n.length<65536&&(n.head.name+=String.fromCharCode(I))}while(I&&E<d);if(512&n.flags&&(n.check=o(n.check,c,E,h)),d-=E,h+=E,I)break t}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===d)break t;E=0;do{I=c[h+E++],n.head&&I&&n.length<65536&&(n.head.comment+=String.fromCharCode(I))}while(I&&E<d);if(512&n.flags&&(n.check=o(n.check,c,E,h)),d-=E,h+=E,I)break t}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;b<16;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(m!==(65535&n.check)){t.msg="header crc mismatch",n.mode=30;break}m=0,b=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=12;break;case 10:for(;b<32;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}t.adler=n.check=u(m),m=0,b=0,n.mode=11;case 11:if(0===n.havedict)return t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,n.hold=m,n.bits=b,2;t.adler=n.check=1,n.mode=12;case 12:if(5===e||6===e)break t;case 13:if(n.last){m>>>=7&b,b-=7&b,n.mode=27;break}for(;b<3;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}switch(n.last=1&m,b-=1,3&(m>>>=1)){case 0:n.mode=14;break;case 1:if(y(n),n.mode=20,6===e){m>>>=2,b-=2;break t}break;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=30}m>>>=2,b-=2;break;case 14:for(m>>>=7&b,b-=7&b;b<32;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if((65535&m)!=(m>>>16^65535)){t.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&m,m=0,b=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(E=n.length){if(E>d&&(E=d),E>p&&(E=p),0===E)break t;r.arraySet(f,c,h,E,l),d-=E,h+=E,p-=E,l+=E,n.length-=E;break}n.mode=12;break;case 17:for(;b<14;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(n.nlen=257+(31&m),m>>>=5,b-=5,n.ndist=1+(31&m),m>>>=5,b-=5,n.ncode=4+(15&m),m>>>=4,b-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;b<3;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}n.lens[k[n.have++]]=7&m,m>>>=3,b-=3}for(;n.have<19;)n.lens[k[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,P={bits:n.lenbits},R=s(0,n.lens,0,19,n.lencode,0,n.work,P),n.lenbits=P.bits,R){t.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;O=(D=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,A=65535&D,!((S=D>>>24)<=b);){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(A<16)m>>>=S,b-=S,n.lens[n.have++]=A;else{if(16===A){for(L=S+2;b<L;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(m>>>=S,b-=S,0===n.have){t.msg="invalid bit length repeat",n.mode=30;break}I=n.lens[n.have-1],E=3+(3&m),m>>>=2,b-=2}else if(17===A){for(L=S+3;b<L;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}b-=S,I=0,E=3+(7&(m>>>=S)),m>>>=3,b-=3}else{for(L=S+7;b<L;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}b-=S,I=0,E=11+(127&(m>>>=S)),m>>>=7,b-=7}if(n.have+E>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=30;break}for(;E--;)n.lens[n.have++]=I}}if(30===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,P={bits:n.lenbits},R=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,P),n.lenbits=P.bits,R){t.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,P={bits:n.distbits},R=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,P),n.distbits=P.bits,R){t.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(d>=6&&p>=258){t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,n.hold=m,n.bits=b,a(t,_),l=t.next_out,f=t.output,p=t.avail_out,h=t.next_in,c=t.input,d=t.avail_in,m=n.hold,b=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;O=(D=n.lencode[m&(1<<n.lenbits)-1])>>>16&255,A=65535&D,!((S=D>>>24)<=b);){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(O&&0==(240&O)){for(T=S,N=O,C=A;O=(D=n.lencode[C+((m&(1<<T+N)-1)>>T)])>>>16&255,A=65535&D,!(T+(S=D>>>24)<=b);){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}m>>>=T,b-=T,n.back+=T}if(m>>>=S,b-=S,n.back+=S,n.length=A,0===O){n.mode=26;break}if(32&O){n.back=-1,n.mode=12;break}if(64&O){t.msg="invalid literal/length code",n.mode=30;break}n.extra=15&O,n.mode=22;case 22:if(n.extra){for(L=n.extra;b<L;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}n.length+=m&(1<<n.extra)-1,m>>>=n.extra,b-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;O=(D=n.distcode[m&(1<<n.distbits)-1])>>>16&255,A=65535&D,!((S=D>>>24)<=b);){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(0==(240&O)){for(T=S,N=O,C=A;O=(D=n.distcode[C+((m&(1<<T+N)-1)>>T)])>>>16&255,A=65535&D,!(T+(S=D>>>24)<=b);){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}m>>>=T,b-=T,n.back+=T}if(m>>>=S,b-=S,n.back+=S,64&O){t.msg="invalid distance code",n.mode=30;break}n.offset=A,n.extra=15&O,n.mode=24;case 24:if(n.extra){for(L=n.extra;b<L;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}n.offset+=m&(1<<n.extra)-1,m>>>=n.extra,b-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===p)break t;if(E=_-p,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=30;break}E>n.wnext?(E-=n.wnext,M=n.wsize-E):M=n.wnext-E,E>n.length&&(E=n.length),w=n.window}else w=f,M=l-n.offset,E=n.length;E>p&&(E=p),p-=E,n.length-=E;do{f[l++]=w[M++]}while(--E);0===n.length&&(n.mode=21);break;case 26:if(0===p)break t;f[l++]=n.length,p--,n.mode=21;break;case 27:if(n.wrap){for(;b<32;){if(0===d)break t;d--,m|=c[h++]<<b,b+=8}if(_-=p,t.total_out+=_,n.total+=_,_&&(t.adler=n.check=n.flags?o(n.check,f,_,l-_):i(n.check,f,_,l-_)),_=p,(n.flags?m:u(m))!==n.check){t.msg="incorrect data check",n.mode=30;break}m=0,b=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;b<32;){if(0===d)break t;d--,m+=c[h++]<<b,b+=8}if(m!==(4294967295&n.total)){t.msg="incorrect length check",n.mode=30;break}m=0,b=0}n.mode=29;case 29:R=1;break t;case 30:R=-3;break t;case 31:return-4;case 32:default:return-2}return t.next_out=l,t.avail_out=p,t.next_in=h,t.avail_in=d,n.hold=m,n.bits=b,(n.wsize||_!==t.avail_out&&n.mode<30&&(n.mode<27||4!==e))&&v(t,t.output,t.next_out,_-t.avail_out)?(n.mode=31,-4):(g-=t.avail_in,_-=t.avail_out,t.total_in+=g,t.total_out+=_,n.total+=_,n.wrap&&_&&(t.adler=n.check=n.flags?o(n.check,f,_,t.next_out-_):i(n.check,f,_,t.next_out-_)),t.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0===g&&0===_||4===e)&&0===R&&(R=-5),R)},n.inflateEnd=function(t){if(!t||!t.state)return-2;var e=t.state;return e.window&&(e.window=null),t.state=null,0},n.inflateGetHeader=function(t,e){var n;return t&&t.state?0==(2&(n=t.state).wrap)?-2:(n.head=e,e.done=!1,0):-2},n.inflateSetDictionary=function(t,e){var n,r=e.length;return t&&t.state?0!==(n=t.state).wrap&&11!==n.mode?-2:11===n.mode&&i(1,e,r,0)!==n.check?-3:v(t,e,r,r)?(n.mode=31,-4):(n.havedict=1,0):-2},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(t,e,n){"use strict";var r=t("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,n,u,c,f,h,l){var d,p,m,b,y,v,g,_,E,M=l.bits,w=0,S=0,O=0,A=0,T=0,N=0,C=0,I=0,R=0,P=0,L=null,D=0,j=new r.Buf16(16),k=new r.Buf16(16),U=null,x=0;for(w=0;w<=15;w++)j[w]=0;for(S=0;S<u;S++)j[e[n+S]]++;for(T=M,A=15;A>=1&&0===j[A];A--);if(T>A&&(T=A),0===A)return c[f++]=20971520,c[f++]=20971520,l.bits=1,0;for(O=1;O<A&&0===j[O];O++);for(T<O&&(T=O),I=1,w=1;w<=15;w++)if(I<<=1,(I-=j[w])<0)return-1;if(I>0&&(0===t||1!==A))return-1;for(k[1]=0,w=1;w<15;w++)k[w+1]=k[w]+j[w];for(S=0;S<u;S++)0!==e[n+S]&&(h[k[e[n+S]]++]=S);if(0===t?(L=U=h,v=19):1===t?(L=i,D-=257,U=o,x-=257,v=256):(L=a,U=s,v=-1),P=0,S=0,w=O,y=f,N=T,C=0,m=-1,b=(R=1<<T)-1,1===t&&R>852||2===t&&R>592)return 1;for(;;){g=w-C,h[S]<v?(_=0,E=h[S]):h[S]>v?(_=U[x+h[S]],E=L[D+h[S]]):(_=96,E=0),d=1<<w-C,O=p=1<<N;do{c[y+(P>>C)+(p-=d)]=g<<24|_<<16|E|0}while(0!==p);for(d=1<<w-1;P&d;)d>>=1;if(0!==d?(P&=d-1,P+=d):P=0,S++,0==--j[w]){if(w===A)break;w=e[n+h[S]]}if(w>T&&(P&b)!==m){for(0===C&&(C=T),y+=O,I=1<<(N=w-C);N+C<A&&!((I-=j[N+C])<=0);)N++,I<<=1;if(R+=1<<N,1===t&&R>852||2===t&&R>592)return 1;c[m=P&b]=T<<24|N<<16|y-f|0}}return 0!==P&&(c[y+P]=w-C<<24|64<<16|0),l.bits=T,0}},{"../utils/common":1}],10:[function(t,e,n){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(t,e,n){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],"/lib/inflate.js":[function(t,e,n){"use strict";var r=t("./zlib/inflate"),i=t("./utils/common"),o=t("./utils/strings"),a=t("./zlib/constants"),s=t("./zlib/messages"),u=t("./zlib/zstream"),c=t("./zlib/gzheader"),f=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(t);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,e.windowBits);if(n!==a.Z_OK)throw new Error(s[n]);if(this.header=new c,r.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=o.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=r.inflateSetDictionary(this.strm,e.dictionary))!==a.Z_OK))throw new Error(s[n])}function l(t,e){var n=new h(e);if(n.push(t,!0),n.err)throw n.msg||s[n.err];return n.result}h.prototype.push=function(t,e){var n,s,u,c,h,l=this.strm,d=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?a.Z_FINISH:a.Z_NO_FLUSH,"string"==typeof t?l.input=o.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?l.input=new Uint8Array(t):l.input=t,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new i.Buf8(d),l.next_out=0,l.avail_out=d),(n=r.inflate(l,a.Z_NO_FLUSH))===a.Z_NEED_DICT&&p&&(n=r.inflateSetDictionary(this.strm,p)),n===a.Z_BUF_ERROR&&!0===m&&(n=a.Z_OK,m=!1),n!==a.Z_STREAM_END&&n!==a.Z_OK)return this.onEnd(n),this.ended=!0,!1;l.next_out&&(0!==l.avail_out&&n!==a.Z_STREAM_END&&(0!==l.avail_in||s!==a.Z_FINISH&&s!==a.Z_SYNC_FLUSH)||("string"===this.options.to?(u=o.utf8border(l.output,l.next_out),c=l.next_out-u,h=o.buf2string(l.output,u),l.next_out=c,l.avail_out=d-c,c&&i.arraySet(l.output,l.output,u,c,0),this.onData(h)):this.onData(i.shrinkBuf(l.output,l.next_out)))),0===l.avail_in&&0===l.avail_out&&(m=!0)}while((l.avail_in>0||0===l.avail_out)&&n!==a.Z_STREAM_END);return n===a.Z_STREAM_END&&(s=a.Z_FINISH),s===a.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===a.Z_OK):s!==a.Z_SYNC_FLUSH||(this.onEnd(a.Z_OK),l.avail_out=0,!0)},h.prototype.onData=function(t){this.chunks.push(t)},h.prototype.onEnd=function(t){t===a.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},n.Inflate=h,n.inflate=l,n.inflateRaw=function(t,e){return(e=e||{}).raw=!0,l(t,e)},n.ungzip=l},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},function(t,e){t.exports=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.circularDependencyToException=e.listMetadataForTarget=e.listRegisteredBindingsForServiceIdentifier=e.getServiceIdentifierAsString=e.getFunctionName=void 0;var r=n(12);function i(t){return"function"==typeof t?t.name:"symbol"==typeof t?t.toString():t}function o(t){if(t.name)return t.name;var e=t.toString(),n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}e.getServiceIdentifierAsString=i,e.listRegisteredBindingsForServiceIdentifier=function(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=o(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r},e.circularDependencyToException=function t(e){e.childRequests.forEach((function(e){if(function t(e,n){return null!==e.parentRequest&&(e.parentRequest.serviceIdentifier===n||t(e.parentRequest,n))}(e,e.serviceIdentifier)){var n=function(t){return function t(e,n){void 0===n&&(n=[]);var r=i(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t).reverse().join(" --\x3e ")}(e);throw new Error(r.CIRCULAR_DEPENDENCY+" "+n)}t(e)}))},e.listMetadataForTarget=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r.toString()+"\n"),null!==i&&i.forEach((function(t){n+=t.toString()+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t},e.getFunctionName=o},function(t,e,n){(function(t){function n(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===n(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===n(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===n(t)},e.isError=function(t){return"[object Error]"===n(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,n(6).Buffer)},function(t,e,n){"use strict";var r=n(5),i=n(67),o=n(69),a=n(70),s=n(24);function u(t){s.call(this,"digest"),this._hash=t}r(u,s),u.prototype._update=function(t){this._hash.update(t)},u.prototype._final=function(){return this._hash.digest()},t.exports=function(t){return"md5"===(t=t.toLowerCase())?new i:"rmd160"===t||"ripemd160"===t?new o:new u(a(t))}},function(t,e,n){(function(e){t.exports=function(t,n){for(var r=Math.min(t.length,n.length),i=new e(r),o=0;o<r;++o)i[o]=t[o]^n[o];return i}}).call(this,n(6).Buffer)},function(t,e,n){"use strict";var r=n(17),i=n(14);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=o,o.prototype.update=function(t,e){if(t=r.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=r.join32(t,0,t.length-n,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},o.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},o.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r}},function(t,e,n){"use strict";const r=n(5),i=n(85).Reporter,o=n(83).Buffer;function a(t,e){i.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function s(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return s.isEncoderBuffer(t)||(t=new s(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}r(a,i),e.DecoderBuffer=a,a.isDecoderBuffer=function(t){if(t instanceof a)return!0;return"object"==typeof t&&o.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},a.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},a.prototype.restore=function(t){const e=new a(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,i.prototype.restore.call(this,t.reporter),e},a.prototype.isEmpty=function(){return this.offset===this.length},a.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},a.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");const n=new a(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+t,this.offset+=t,n},a.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=s,s.isEncoderBuffer=function(t){if(t instanceof s)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},s.prototype.join=function(t,e){return t||(t=o.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(n){n.join(t,e),e+=n.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},function(t,e){t.exports=c},function(t,e,n){t.exports=i;var r=n(29).EventEmitter;function i(){r.call(this)}n(5)(i,r),i.Readable=n(64),i.Writable=n(205),i.Duplex=n(206),i.Transform=n(207),i.PassThrough=n(208),i.Stream=i,i.prototype.pipe=function(t,e){var n=this;function i(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function o(){n.readable&&n.resume&&n.resume()}n.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(f(),0===r.listenerCount(this,"error"))throw t}function f(){n.removeListener("data",i),t.removeListener("drain",o),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",c),t.removeListener("error",c),n.removeListener("end",f),n.removeListener("close",f),t.removeListener("close",f)}return n.on("error",c),t.on("error",c),n.on("end",f),n.on("close",f),t.on("close",f),t.emit("pipe",n),t}},function(t,e,n){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,r,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,n)}));case 3:return e.nextTick((function(){t.call(null,n,r)}));case 4:return e.nextTick((function(){t.call(null,n,r,i)}));default:for(o=new Array(s-1),a=0;a<o.length;)o[a++]=arguments[a];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this,n(7))},function(t,e,n){(function(t){var r=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},i=/%[sdj%]/g;e.format=function(t){if(!y(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(s(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,o=r.length,a=String(t).replace(i,(function(t){if("%%"===t)return"%";if(n>=o)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),u=r[n];n<o;u=r[++n])m(u)||!_(u)?a+=" "+u:a+=" "+s(u);return a},e.deprecate=function(n,r){if(void 0!==t&&!0===t.noDeprecation)return n;if(void 0===t)return function(){return e.deprecate(n,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(t.throwDeprecation)throw new Error(r);t.traceDeprecation?console.trace(r):console.error(r),i=!0}return n.apply(this,arguments)}};var o,a={};function s(t,n){var r={seen:[],stylize:c};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(n)?r.showHidden=n:n&&e._extend(r,n),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),f(r,t,r.depth)}function u(t,e){var n=s.styles[e];return n?"["+s.colors[n][0]+"m"+t+"["+s.colors[n][1]+"m":t}function c(t,e){return t}function f(t,n,r){if(t.customInspect&&n&&w(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return y(i)||(i=f(t,i,r)),i}var o=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(y(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(b(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),M(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return h(n);if(0===a.length){if(w(n)){var u=n.name?": "+n.name:"";return t.stylize("[Function"+u+"]","special")}if(g(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return t.stylize(Date.prototype.toString.call(n),"date");if(M(n))return h(n)}var c,_="",S=!1,O=["{","}"];(d(n)&&(S=!0,O=["[","]"]),w(n))&&(_=" [Function"+(n.name?": "+n.name:"")+"]");return g(n)&&(_=" "+RegExp.prototype.toString.call(n)),E(n)&&(_=" "+Date.prototype.toUTCString.call(n)),M(n)&&(_=" "+h(n)),0!==a.length||S&&0!=n.length?r<0?g(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),c=S?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a<s;++a)N(e,String(a))?o.push(l(t,e,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(l(t,e,n,r,i,!0))})),o}(t,n,r,s,a):a.map((function(e){return l(t,n,r,s,e,S)})),t.seen.pop(),function(t,e,n){if(t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(c,_,O)):O[0]+_+O[1]}function h(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),N(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(n)?f(t,u.value,null):f(t,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),v(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function b(t){return"number"==typeof t}function y(t){return"string"==typeof t}function v(t){return void 0===t}function g(t){return _(t)&&"[object RegExp]"===S(t)}function _(t){return"object"==typeof t&&null!==t}function E(t){return _(t)&&"[object Date]"===S(t)}function M(t){return _(t)&&("[object Error]"===S(t)||t instanceof Error)}function w(t){return"function"==typeof t}function S(t){return Object.prototype.toString.call(t)}function O(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(n){if(v(o)&&(o=t.env.NODE_DEBUG||""),n=n.toUpperCase(),!a[n])if(new RegExp("\\b"+n+"\\b","i").test(o)){var r=t.pid;a[n]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",n,r,t)}}else a[n]=function(){};return a[n]},e.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=b,e.isString=y,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=v,e.isRegExp=g,e.isObject=_,e.isDate=E,e.isError=M,e.isFunction=w,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=n(209);var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),A[t.getMonth()],e].join(" ")}function N(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",T(),e.format.apply(e,arguments))},e.inherits=n(5),e._extend=function(t,e){if(!e||!_(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};var C="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function I(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(C&&t[C]){var e;if("function"!=typeof(e=t[C]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,C,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,n,r=new Promise((function(t,r){e=t,n=r})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(t,r){t?n(t):e(r)}));try{t.apply(this,i)}catch(t){n(t)}return r}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),C&&Object.defineProperty(e,C,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,r(t))},e.promisify.custom=C,e.callbackify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,a=function(){return i.apply(o,arguments)};e.apply(this,n).then((function(e){t.nextTick(a,null,e)}),(function(e){t.nextTick(I,e,a)}))}return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.defineProperties(n,r(e)),n}}).call(this,n(7))},function(t,e,n){var r=n(4).Buffer;function i(t){r.isBuffer(t)||(t=r.from(t));for(var e=t.length/4|0,n=new Array(e),i=0;i<e;i++)n[i]=t.readUInt32BE(4*i);return n}function o(t){for(;0<t.length;t++)t[0]=0}function a(t,e,n,r,i){for(var o,a,s,u,c=n[0],f=n[1],h=n[2],l=n[3],d=t[0]^e[0],p=t[1]^e[1],m=t[2]^e[2],b=t[3]^e[3],y=4,v=1;v<i;v++)o=c[d>>>24]^f[p>>>16&255]^h[m>>>8&255]^l[255&b]^e[y++],a=c[p>>>24]^f[m>>>16&255]^h[b>>>8&255]^l[255&d]^e[y++],s=c[m>>>24]^f[b>>>16&255]^h[d>>>8&255]^l[255&p]^e[y++],u=c[b>>>24]^f[d>>>16&255]^h[p>>>8&255]^l[255&m]^e[y++],d=o,p=a,m=s,b=u;return o=(r[d>>>24]<<24|r[p>>>16&255]<<16|r[m>>>8&255]<<8|r[255&b])^e[y++],a=(r[p>>>24]<<24|r[m>>>16&255]<<16|r[b>>>8&255]<<8|r[255&d])^e[y++],s=(r[m>>>24]<<24|r[b>>>16&255]<<16|r[d>>>8&255]<<8|r[255&p])^e[y++],u=(r[b>>>24]<<24|r[d>>>16&255]<<16|r[p>>>8&255]<<8|r[255&m])^e[y++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],r=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,n[a]=c,r[c]=a;var f=t[a],h=t[f],l=t[h],d=257*t[c]^16843008*c;i[0][a]=d<<24|d>>>8,i[1][a]=d<<16|d>>>16,i[2][a]=d<<8|d>>>24,i[3][a]=d,d=16843009*l^65537*h^257*f^16843008*a,o[0][c]=d<<24|d>>>8,o[1][c]=d<<16|d>>>16,o[2][c]=d<<8|d>>>24,o[3][c]=d,0===a?a=s=1:(a=f^t[t[t[l^f]]],s^=t[t[s]])}return{SBOX:n,INV_SBOX:r,SUB_MIX:i,INV_SUB_MIX:o}}();function c(t){this._key=i(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,r=4*(n+1),i=[],o=0;o<e;o++)i[o]=t[o];for(o=e;o<r;o++){var a=i[o-1];o%e==0?(a=a<<8|a>>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-e]^a}for(var c=[],f=0;f<r;f++){var h=r-f,l=i[h-(f%4?0:4)];c[f]=f<4||h<=4?l:u.INV_SUB_MIX[0][u.SBOX[l>>>24]]^u.INV_SUB_MIX[1][u.SBOX[l>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[l>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&l]]}this._nRounds=n,this._keySchedule=i,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=r.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},c.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var n=a(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=r.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},function(t,e,n){var r=n(4).Buffer,i=n(67);t.exports=function(t,e,n,o){if(r.isBuffer(t)||(t=r.from(t,"binary")),e&&(r.isBuffer(e)||(e=r.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=r.alloc(a),u=r.alloc(o||0),c=r.alloc(0);a>0||o>0;){var f=new i;f.update(c),f.update(t),e&&f.update(e),c=f.digest();var h=0;if(a>0){var l=s.length-a;h=Math.min(a,c.length),c.copy(s,l,0,h),a-=h}if(h<c.length&&o>0){var d=u.length-o,p=Math.min(o,c.length-h);c.copy(u,d,h,h+p),o-=p}}return c.fill(0),{key:s,iv:u}}},function(t,e,n){"use strict";var r=n(21),i=n(15),o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new r(e.p,16),this.red=e.prime?r.red(e.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=e.n&&new r(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var n=t._getDoubles(),r=o(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var a,u,c=[];for(a=0;a<r.length;a+=n.step){u=0;for(var f=a+n.step-1;f>=a;f--)u=(u<<1)+r[f];c.push(u)}for(var h=this.jpoint(null,null,null),l=this.jpoint(null,null,null),d=i;d>0;d--){for(a=0;a<c.length;a++)(u=c[a])===d?l=l.mixedAdd(n.points[a]):u===-d&&(l=l.mixedAdd(n.points[a].neg()));h=h.add(l)}return h.toP()},u.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,a=o(e,n,this._bitLength),u=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var f=0;c>=0&&0===a[c];c--)f++;if(c>=0&&f++,u=u.dblp(f),c<0)break;var h=a[c];s(0!==h),u="affine"===t.type?h>0?u.mixedAdd(i[h-1>>1]):u.mixedAdd(i[-h-1>>1].neg()):h>0?u.add(i[h-1>>1]):u.add(i[-h-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,n,r,i){var s,u,c,f=this._wnafT1,h=this._wnafT2,l=this._wnafT3,d=0;for(s=0;s<r;s++){var p=(c=e[s])._getNAFPoints(t);f[s]=p.wnd,h[s]=p.points}for(s=r-1;s>=1;s-=2){var m=s-1,b=s;if(1===f[m]&&1===f[b]){var y=[e[m],null,null,e[b]];0===e[m].y.cmp(e[b].y)?(y[1]=e[m].add(e[b]),y[2]=e[m].toJ().mixedAdd(e[b].neg())):0===e[m].y.cmp(e[b].y.redNeg())?(y[1]=e[m].toJ().mixedAdd(e[b]),y[2]=e[m].add(e[b].neg())):(y[1]=e[m].toJ().mixedAdd(e[b]),y[2]=e[m].toJ().mixedAdd(e[b].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=a(n[m],n[b]);for(d=Math.max(g[0].length,d),l[m]=new Array(d),l[b]=new Array(d),u=0;u<d;u++){var _=0|g[0][u],E=0|g[1][u];l[m][u]=v[3*(_+1)+(E+1)],l[b][u]=0,h[m]=y}}else l[m]=o(n[m],f[m],this._bitLength),l[b]=o(n[b],f[b],this._bitLength),d=Math.max(l[m].length,d),d=Math.max(l[b].length,d)}var M=this.jpoint(null,null,null),w=this._wnafT4;for(s=d;s>=0;s--){for(var S=0;s>=0;){var O=!0;for(u=0;u<r;u++)w[u]=0|l[u][s],0!==w[u]&&(O=!1);if(!O)break;S++,s--}if(s>=0&&S++,M=M.dblp(S),s<0)break;for(u=0;u<r;u++){var A=w[u];0!==A&&(A>0?c=h[u][A-1>>1]:A<0&&(c=h[u][-A-1>>1].neg()),M="affine"===c.type?M.mixedAdd(c):M.add(c))}}for(s=0;s<r;s++)h[s]=null;return i?M:M.toP()},u.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},u.prototype.decodePoint=function(t,e){t=i.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?s(t[t.length-1]%2==0):7===t[0]&&s(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(t){return this.encode(t,!0)},c.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},c.prototype.encode=function(t,e){return i.encode(this._encode(e),t)},c.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},c.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},c.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e}},function(t,e,n){var r=n(280),i=n(288),o=n(289),a=n(72),s=n(120),u=n(4).Buffer;function c(t){var e;"object"!=typeof t||u.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=u.from(t));var n,c,f=o(t,e),h=f.tag,l=f.data;switch(h){case"CERTIFICATE":c=r.certificate.decode(l,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(c||(c=r.PublicKey.decode(l,"der")),n=c.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(c.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return c.subjectPrivateKey=c.subjectPublicKey,{type:"ec",data:c};case"1.2.840.10040.4.1":return c.algorithm.params.pub_key=r.DSAparam.decode(c.subjectPublicKey.data,"der"),{type:"dsa",data:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"ENCRYPTED PRIVATE KEY":l=function(t,e){var n=t.algorithm.decrypt.kde.kdeparams.salt,r=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),o=i[t.algorithm.decrypt.cipher.algo.join(".")],c=t.algorithm.decrypt.cipher.iv,f=t.subjectPrivateKey,h=parseInt(o.split("-")[1],10)/8,l=s.pbkdf2Sync(e,n,r,h,"sha1"),d=a.createDecipheriv(o,l,c),p=[];return p.push(d.update(f)),p.push(d.final()),u.concat(p)}(l=r.EncryptedPrivateKey.decode(l,"der"),e);case"PRIVATE KEY":switch(n=(c=r.PrivateKey.decode(l,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(c.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:c.algorithm.curve,privateKey:r.ECPrivateKey.decode(c.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return c.algorithm.params.priv_key=r.DSAparam.decode(c.subjectPrivateKey,"der"),{type:"dsa",params:c.algorithm.params};default:throw new Error("unknown key id "+n)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(l,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(l,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(l,"der")};case"EC PRIVATE KEY":return{curve:(l=r.ECPrivateKey.decode(l,"der")).parameters.value,privateKey:l.privateKey};default:throw new Error("unknown key type "+h)}}t.exports=c,c.signature=r.signature},function(t,e){var n=function(t,e){Error.call(this,t),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=t,e&&(this.inner=e)};(n.prototype=Object.create(Error.prototype)).constructor=n,t.exports=n},function(t,e){t.exports=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingOnSyntax=void 0;var r=n(62),i=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new r.BindingWhenSyntax(this._binding)},t}();e.BindingOnSyntax=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenSyntax=void 0;var r=n(61),i=n(99),o=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=i.namedConstraint(t),new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new r.BindingOnSyntax(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=i.taggedConstraint(t)(e),new r.BindingOnSyntax(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return i.typeConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return i.namedConstraint(t)(e.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return i.taggedConstraint(t)(e)(n.parentRequest)},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.typeConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,i.namedConstraint(t))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return!i.traverseAncerstors(n,i.taggedConstraint(t)(e))},new r.BindingOnSyntax(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return!i.traverseAncerstors(e,t)},new r.BindingOnSyntax(this._binding)},t}();e.BindingWhenSyntax=o},function(t,e,n){var r=n(196),i=n(301);e.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],e.sign=r.sign,e.verify=i.verify,e.decode=i.decode,e.isValid=i.isValid,e.createSign=function(t){return new r(t)},e.createVerify=function(t){return new i(t)}},function(t,e,n){(e=t.exports=n(103)).Stream=e,e.Readable=e,e.Writable=n(65),e.Duplex=n(30),e.Transform=n(106),e.PassThrough=n(204)},function(t,e,n){"use strict";(function(e,r,i){var o=n(53);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var s,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?r:o.nextTick;v.WritableState=y;var c=Object.create(n(46));c.inherits=n(5);var f={deprecate:n(66)},h=n(104),l=n(4).Buffer,d=i.Uint8Array||function(){};var p,m=n(105);function b(){}function y(t,e){s=s||n(30),t=t||{};var r=e instanceof s;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,c=t.writableHighWaterMark,f=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(c||0===c)?c:f,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(o.nextTick(i,r),o.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(i(r),t._writableState.errorEmitted=!0,t.emit("error",r),S(t,e))}(t,n,r,e,i);else{var a=M(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||E(t,n),r?u(_,t,n,a,i):_(t,n,a,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function v(t){if(s=s||n(30),!(p.call(v,this)||this instanceof s))return new v(t);this._writableState=new y(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function g(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function _(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),S(t,e)}function E(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),o=e.corkedRequestsFree;o.entry=n;for(var s=0,u=!0;n;)i[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;i.allBuffers=u,g(t,e,!0,e.length,i,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,f=n.encoding,h=n.callback;if(g(t,e,!1,e.objectMode?1:c.length,c,f,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function M(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function w(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),S(t,e)}))}function S(t,e){var n=M(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(w,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(v,h),y.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(y.prototype,"buffer",{get:f.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===v&&(t&&t._writableState instanceof y)}})):p=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,n){var r,i=this._writableState,a=!1,s=!i.objectMode&&(r=t,l.isBuffer(r)||r instanceof d);return s&&!l.isBuffer(t)&&(t=function(t){return l.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=b),i.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(s||function(t,e,n,r){var i=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(r,a),i=!1),i}(this,i,t,n))&&(i.pendingcb++,a=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=l.from(e,n));return e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var u=e.length<e.highWaterMark;u||(e.needDrain=!0);if(e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else g(t,e,!1,s,r,i,o);return u}(this,i,s,t,e,n)),a},v.prototype.cork=function(){this._writableState.corked++},v.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||E(this,t))},v.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,S(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=m.destroy,v.prototype._undestroy=m.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(7),n(202).setImmediate,n(10))},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,n(10))},function(t,e,n){"use strict";var r=n(5),i=n(108),o=n(4).Buffer,a=new Array(16);function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function u(t,e){return t<<e|t>>>32-e}function c(t,e,n,r,i,o,a){return u(t+(e&n|~e&r)+i+o|0,a)+e|0}function f(t,e,n,r,i,o,a){return u(t+(e&r|n&~r)+i+o|0,a)+e|0}function h(t,e,n,r,i,o,a){return u(t+(e^n^r)+i+o|0,a)+e|0}function l(t,e,n,r,i,o,a){return u(t+(n^(e|~r))+i+o|0,a)+e|0}r(s,i),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,r=this._b,i=this._c,o=this._d;n=c(n,r,i,o,t[0],3614090360,7),o=c(o,n,r,i,t[1],3905402710,12),i=c(i,o,n,r,t[2],606105819,17),r=c(r,i,o,n,t[3],3250441966,22),n=c(n,r,i,o,t[4],4118548399,7),o=c(o,n,r,i,t[5],1200080426,12),i=c(i,o,n,r,t[6],2821735955,17),r=c(r,i,o,n,t[7],4249261313,22),n=c(n,r,i,o,t[8],1770035416,7),o=c(o,n,r,i,t[9],2336552879,12),i=c(i,o,n,r,t[10],4294925233,17),r=c(r,i,o,n,t[11],2304563134,22),n=c(n,r,i,o,t[12],1804603682,7),o=c(o,n,r,i,t[13],4254626195,12),i=c(i,o,n,r,t[14],2792965006,17),n=f(n,r=c(r,i,o,n,t[15],1236535329,22),i,o,t[1],4129170786,5),o=f(o,n,r,i,t[6],3225465664,9),i=f(i,o,n,r,t[11],643717713,14),r=f(r,i,o,n,t[0],3921069994,20),n=f(n,r,i,o,t[5],3593408605,5),o=f(o,n,r,i,t[10],38016083,9),i=f(i,o,n,r,t[15],3634488961,14),r=f(r,i,o,n,t[4],3889429448,20),n=f(n,r,i,o,t[9],568446438,5),o=f(o,n,r,i,t[14],3275163606,9),i=f(i,o,n,r,t[3],4107603335,14),r=f(r,i,o,n,t[8],1163531501,20),n=f(n,r,i,o,t[13],2850285829,5),o=f(o,n,r,i,t[2],4243563512,9),i=f(i,o,n,r,t[7],1735328473,14),n=h(n,r=f(r,i,o,n,t[12],2368359562,20),i,o,t[5],4294588738,4),o=h(o,n,r,i,t[8],2272392833,11),i=h(i,o,n,r,t[11],1839030562,16),r=h(r,i,o,n,t[14],4259657740,23),n=h(n,r,i,o,t[1],2763975236,4),o=h(o,n,r,i,t[4],1272893353,11),i=h(i,o,n,r,t[7],4139469664,16),r=h(r,i,o,n,t[10],3200236656,23),n=h(n,r,i,o,t[13],681279174,4),o=h(o,n,r,i,t[0],3936430074,11),i=h(i,o,n,r,t[3],3572445317,16),r=h(r,i,o,n,t[6],76029189,23),n=h(n,r,i,o,t[9],3654602809,4),o=h(o,n,r,i,t[12],3873151461,11),i=h(i,o,n,r,t[15],530742520,16),n=l(n,r=h(r,i,o,n,t[2],3299628645,23),i,o,t[0],4096336452,6),o=l(o,n,r,i,t[7],1126891415,10),i=l(i,o,n,r,t[14],2878612391,15),r=l(r,i,o,n,t[5],4237533241,21),n=l(n,r,i,o,t[12],1700485571,6),o=l(o,n,r,i,t[3],2399980690,10),i=l(i,o,n,r,t[10],4293915773,15),r=l(r,i,o,n,t[1],2240044497,21),n=l(n,r,i,o,t[8],1873313359,6),o=l(o,n,r,i,t[15],4264355552,10),i=l(i,o,n,r,t[6],2734768916,15),r=l(r,i,o,n,t[13],1309151649,21),n=l(n,r,i,o,t[4],4149444226,6),o=l(o,n,r,i,t[11],3174756917,10),i=l(i,o,n,r,t[2],718787259,15),r=l(r,i,o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+r|0,this._c=this._c+i|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,n){"use strict";var r=n(36).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}}(o||i);var a=n.readable||!1!==n.readable&&e.readable,s=n.writable||!1!==n.writable&&e.writable,u=function(){e.writable||f()},c=e._writableState&&e._writableState.finished,f=function(){s=!1,c=!0,a||o.call(e)},h=e._readableState&&e._readableState.endEmitted,l=function(){a=!1,h=!0,s||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return a&&!h?(e._readableState&&e._readableState.ended||(t=new r),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new r),o.call(e,t)):void 0},m=function(){e.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",f),e.on("abort",p),e.req?m():e.on("request",m)),e.on("end",l),e.on("finish",f),!1!==n.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",m),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,n){"use strict";var r=n(6).Buffer,i=n(5),o=n(108),a=new Array(16),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],u=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],c=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],f=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],h=[0,1518500249,1859775393,2400959708,2840853838],l=[1352829926,1548603684,1836072691,2053994217,0];function d(){o.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function p(t,e){return t<<e|t>>>32-e}function m(t,e,n,r,i,o,a,s){return p(t+(e^n^r)+o+a|0,s)+i|0}function b(t,e,n,r,i,o,a,s){return p(t+(e&n|~e&r)+o+a|0,s)+i|0}function y(t,e,n,r,i,o,a,s){return p(t+((e|~n)^r)+o+a|0,s)+i|0}function v(t,e,n,r,i,o,a,s){return p(t+(e&r|n&~r)+o+a|0,s)+i|0}function g(t,e,n,r,i,o,a,s){return p(t+(e^(n|~r))+o+a|0,s)+i|0}i(d,o),d.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,r=0|this._b,i=0|this._c,o=0|this._d,d=0|this._e,_=0|this._a,E=0|this._b,M=0|this._c,w=0|this._d,S=0|this._e,O=0;O<80;O+=1){var A,T;O<16?(A=m(n,r,i,o,d,t[s[O]],h[0],c[O]),T=g(_,E,M,w,S,t[u[O]],l[0],f[O])):O<32?(A=b(n,r,i,o,d,t[s[O]],h[1],c[O]),T=v(_,E,M,w,S,t[u[O]],l[1],f[O])):O<48?(A=y(n,r,i,o,d,t[s[O]],h[2],c[O]),T=y(_,E,M,w,S,t[u[O]],l[2],f[O])):O<64?(A=v(n,r,i,o,d,t[s[O]],h[3],c[O]),T=b(_,E,M,w,S,t[u[O]],l[3],f[O])):(A=g(n,r,i,o,d,t[s[O]],h[4],c[O]),T=m(_,E,M,w,S,t[u[O]],l[4],f[O])),n=d,d=o,o=p(i,10),i=r,r=A,_=S,S=w,w=p(M,10),M=E,E=T}var N=this._b+i+w|0;this._b=this._c+o+S|0,this._c=this._d+d+_|0,this._d=this._e+n+E|0,this._e=this._a+r+M|0,this._a=N},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=r.alloc?r.alloc(20):new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=d},function(t,e,n){(e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n}).sha=n(221),e.sha1=n(222),e.sha224=n(223),e.sha256=n(115),e.sha384=n(224),e.sha512=n(116)},function(t,e,n){"use strict";var r=n(14);function i(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=i,i.prototype._init=function(){},i.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},i.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),r=0;r<n;r++)this.buffer[this.bufferOff+r]=t[e+r];return this.bufferOff+=n,n},i.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},i.prototype._updateEncrypt=function(t){var e=0,n=0,r=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(r*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(n+=this._flushBuffer(i,n)));for(var o=t.length-(t.length-e)%this.blockSize;e<o;e+=this.blockSize)this._update(t,e,i,n),n+=this.blockSize;for(;e<t.length;e++,this.bufferOff++)this.buffer[this.bufferOff]=t[e];return i},i.prototype._updateDecrypt=function(t){for(var e=0,n=0,r=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,i=new Array(r*this.blockSize);r>0;r--)e+=this._buffer(t,e),n+=this._flushBuffer(i,n);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e<t.length;)t[e++]=0;return!0},i.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},i.prototype._unpad=function(t){return t},i.prototype._finalDecrypt=function(){r.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,e,n){var r=n(233),i=n(241),o=n(129);e.createCipher=e.Cipher=r.createCipher,e.createCipheriv=e.Cipheriv=r.createCipheriv,e.createDecipher=e.Decipher=i.createDecipher,e.createDecipheriv=e.Decipheriv=i.createDecipheriv,e.listCiphers=e.getCiphers=function(){return Object.keys(o)}},function(t,e,n){var r={ECB:n(234),CBC:n(235),CFB:n(236),CFB8:n(237),CFB1:n(238),OFB:n(239),CTR:n(127),GCM:n(127)},i=n(129);for(var o in i)i[o].module=r[i[o].mode];t.exports=i},function(t,e,n){var r;function i(t){this.rand=t}if(t.exports=function(t){return r||(r=new i(null)),r.generate(t)},t.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),n=0;n<e.length;n++)e[n]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=n(247);if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(t){return o.randomBytes(t)}}catch(t){}},function(t,e,n){
|
|
9
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
10
|
+
var r=n(6),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){"use strict";var r=n(40).codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}}(o||i);var a=n.readable||!1!==n.readable&&e.readable,s=n.writable||!1!==n.writable&&e.writable,u=function(){e.writable||f()},c=e._writableState&&e._writableState.finished,f=function(){s=!1,c=!0,a||o.call(e)},h=e._readableState&&e._readableState.endEmitted,l=function(){a=!1,h=!0,s||o.call(e)},d=function(t){o.call(e,t)},p=function(){var t;return a&&!h?(e._readableState&&e._readableState.ended||(t=new r),o.call(e,t)):s&&!c?(e._writableState&&e._writableState.ended||(t=new r),o.call(e,t)):void 0},m=function(){e.req.on("finish",f)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?s&&!e._writableState&&(e.on("end",u),e.on("close",u)):(e.on("complete",f),e.on("abort",p),e.req?m():e.on("request",m)),e.on("end",l),e.on("finish",f),!1!==n.error&&e.on("error",d),e.on("close",p),function(){e.removeListener("complete",f),e.removeListener("abort",p),e.removeListener("request",m),e.req&&e.req.removeListener("finish",f),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",f),e.removeListener("end",l),e.removeListener("error",d),e.removeListener("close",p)}}},function(t,e,n){(function(e){var r=n(78),i=n(35);function o(t){var e,n=t.modulus.byteLength();do{e=new r(i(n))}while(e.cmp(t.modulus)>=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,n){var i=function(t){var e=o(t);return{blinder:e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(n),a=n.modulus.byteLength(),s=new r(t).mul(i.blinder).umod(n.modulus),u=s.toRed(r.mont(n.prime1)),c=s.toRed(r.mont(n.prime2)),f=n.coefficient,h=n.prime1,l=n.prime2,d=u.redPow(n.exponent1).fromRed(),p=c.redPow(n.exponent2).fromRed(),m=d.isub(p).imul(f).umod(h).imul(l);return p.iadd(m).imul(i.unblinder).umod(n.modulus).toArrayLike(e,"be",a)}a.getr=o,t.exports=a}).call(this,n(6).Buffer)},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(260).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+t)}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,i){for(var o=0,a=0,s=Math.min(t.length,n),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,r(c>=0&&a<i,"Invalid character"),o+=a}return o}function f(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype._move=function(t){f(t,this)},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(t){o.prototype.inspect=h}else o.prototype.inspect=h;function h(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?l[6-u.length]+u+n:u+n}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],f=p[t];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(f).toString(t);n=(h=h.idivn(f)).isZero()?m+n:l[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16,2)},a&&(o.prototype.toBuffer=function(t,e){return this.toArrayLike(a,t,e)}),o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function m(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}o.prototype.toArrayLike=function(t,e,n){this._strip();var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},o.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},o.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this._strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var b=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function y(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function v(t,e,n){return y(t,e,n)}function g(t,e){this.x=t,this.y=e}Math.imul||(b=m),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?b(this,t,e):n<63?m(this,t,e):n<1024?y(this,t,e):v(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},g.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},g.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},g.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},g.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},g.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},g.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},g.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},g.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},g.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n._strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),v(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){var e=t<0;e&&(t=-t),r("number"==typeof t),r(t<67108864);for(var n=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&n);n>>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,this.length++),e?this.ineg():this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modrn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modrn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(n*i+(0|this.words[o]))%t;return e?-i:i},o.prototype.modn=function(t){return this.modrn(t)},o.prototype.idivn=function(t){var e=t<0;e&&(t=-t),r(t<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/t|0,n=o%t}return this._strip(),e?this.ineg():this},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new A(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var _={k256:null,p224:null,p192:null,p25519:null};function E(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function M(){E.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){E.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function S(){E.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function O(){E.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function T(t){A.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}E.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},E.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},E.prototype.split=function(t,e){t.iushrn(this.n,0,e)},E.prototype.imulK=function(t){return t.imul(this.k)},i(M,E),M.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},M.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,E),i(S,E),i(O,E),O.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(_[t])return _[t];var e;if("k256"===t)e=new M;else if("p224"===t)e=new w;else if("p192"===t)e=new S;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new O}return _[t]=e,e},A.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},A.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},A.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(f(t,t.umod(this.m)._forceRed(this)),t)},A.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},A.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},A.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},A.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},A.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},A.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},A.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},A.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},A.prototype.isqr=function(t){return this.imul(t,t.clone())},A.prototype.sqr=function(t){return this.mul(t,t)},A.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},A.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},A.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},A.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new T(t)},i(T,A),T.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},T.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},T.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e,n){"use strict";var r=e;r.version=n(261).version,r.utils=n(15),r.rand=n(74),r.curve=n(142),r.curves=n(81),r.ec=n(273),r.eddsa=n(277)},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";var r,i=e,o=n(82),a=n(142),s=n(15).assert;function u(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var n=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:n}),n}})}i.PresetCurve=u,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=n(272)}catch(t){r=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})},function(t,e,n){var r=e;r.utils=n(17),r.common=n(49),r.sha=n(266),r.ripemd=n(270),r.hmac=n(271),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(t,e,n){"use strict";(function(e){var r,i=n(6),o=i.Buffer,a={};for(r in i)i.hasOwnProperty(r)&&"SlowBuffer"!==r&&"Buffer"!==r&&(a[r]=i[r]);var s=a.Buffer={};for(r in o)o.hasOwnProperty(r)&&"allocUnsafe"!==r&&"allocUnsafeSlow"!==r&&(s[r]=o[r]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(t,e,n){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return o(t,e,n)}),s.alloc||(s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var r=o(t);return e&&0!==e.length?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r}),!a.kStringMaxLength)try{a.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this,n(7))},function(t,e,n){"use strict";const r=n(85).Reporter,i=n(50).EncoderBuffer,o=n(50).DecoderBuffer,a=n(14),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(t,e,n){const r={};this._baseState=r,r.name=n,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=c;const f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};f.forEach((function(n){e[n]=t[n]}));const n=new this.constructor(e.parent);return n._baseState=e,n},c.prototype._wrap=function(){const t=this._baseState;u.forEach((function(e){this[e]=function(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,n=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==n.length&&(a(null===e.children),e.children=n,n.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(n){n==(0|n)&&(n|=0);const r=t[n];e[r]=n})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,n=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(n),this}})),c.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));let r,i=n.default,a=!0,s=null;if(null!==n.key&&(s=t.enterKey(n.key)),n.optional){let r=null;if(null!==n.explicit?r=n.explicit:null!==n.implicit?r=n.implicit:null!==n.tag&&(r=n.tag),null!==r||n.any){if(a=this._peekTag(t,r,n.any),t.isError(a))return a}else{const r=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(r)}}if(n.obj&&a&&(r=t.enterObject()),a){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const r=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const r=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(r))return r;n.any?i=t.raw(e):t=r}if(e&&e.track&&null!==n.tag&&e.track(t.path(),r,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),n.any||(i=null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e)),t.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(t,e)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const r=new o(i);i=this._getUse(n.contains,t._reporterState.obj)._decode(r,e)}}return n.obj&&a&&(i=t.leaveObject(r)),null===n.key||null===i&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,n.key,i),i},c.prototype._decodeGeneric=function(t,e,n){const r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0],n):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const n=this._baseState;return n.useDecoder=this._use(t,e),a(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},c.prototype._decodeChoice=function(t,e){const n=this._baseState;let r=null,i=!1;return Object.keys(n.choice).some((function(o){const a=t.save(),s=n.choice[o];try{const n=s._decode(t,e);if(t.isError(n))return!1;r={type:o,value:n},i=!0}catch(e){return t.restore(a),!1}return!0}),this),i?r:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},c.prototype._encode=function(t,e,n){const r=this._baseState;if(null!==r.default&&r.default===t)return;const i=this._encodeValue(t,e,n);return void 0===i||this._skipDefault(i,e,n)?void 0:i},c.prototype._encodeValue=function(t,e,n){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(t,e||new r);let o=null;if(this.reporter=e,i.optional&&void 0===t){if(null===i.default)return;t=i.default}let a=null,s=!1;if(i.any)o=this._createEncoderBuffer(t);else if(i.choice)o=this._encodeChoice(t,e);else if(i.contains)a=this._getUse(i.contains,n)._encode(t,e),s=!0;else if(i.children)a=i.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,e,t);if(null===n._baseState.key)return e.error("Child should have a key");const r=e.enterKey(n._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const i=n._encode(t[n._baseState.key],e,t);return e.leaveKey(r),i}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return e.error("Too many args for : "+i.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(n){const r=this._baseState;return this._getUse(r.args[0],t)._encode(n,e)}),n))}else null!==i.use?o=this._getUse(i.use,n)._encode(t,e):(a=this._encodePrimitive(i.tag,t),s=!0);if(!i.any&&null===i.choice){const t=null!==i.implicit?i.implicit:i.tag,n=null===i.implicit?"universal":"context";null===t?null===i.use&&e.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(t,s,n,a))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const n=this._baseState,r=n.choice[t.type];return r||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),r._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,n){"use strict";const r=n(5);function i(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=i,i.prototype.isError=function(t){return t instanceof o},i.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},i.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},i.prototype.enterKey=function(t){return this._reporterState.path.push(t)},i.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},i.prototype.leaveKey=function(t,e,n){const r=this._reporterState;this.exitKey(t),null!==r.obj&&(r.obj[e]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},i.prototype.leaveObject=function(t){const e=this._reporterState,n=e.obj;return e.obj=t,n},i.prototype.error=function(t){let e;const n=this._reporterState,r=t instanceof o;if(e=r?t:new o(n.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!n.options.partial)throw e;return r||n.errors.push(e),e},i.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},r(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,n){"use strict";function r(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const r=t[n];e[r]=n})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=r(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=r(e.tag)},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(296).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:f[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new b).mulp(t,e,n)}function b(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},b.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},b.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},b.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},b.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},b.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},b.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(g,v),g.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},w.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},i(S,w),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e,n){"use strict";var r=SyntaxError,i=Function,o=TypeError,a=function(t){try{return i('"use strict"; return ('+t+").constructor;")()}catch(t){}},s=Object.getOwnPropertyDescriptor;if(s)try{s({},"")}catch(t){s=null}var u=function(){throw new o},c=s?function(){try{return u}catch(t){try{return s(arguments,"callee").get}catch(t){return u}}}():u,f=n(315)(),h=Object.getPrototypeOf||function(t){return t.__proto__},l={},d="undefined"==typeof Uint8Array?void 0:h(Uint8Array),p={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":f?h([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":l,"%AsyncGenerator%":l,"%AsyncGeneratorFunction%":l,"%AsyncIteratorPrototype%":l,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":l,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":f?h(h([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&f?h((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&f?h((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":f?h(""[Symbol.iterator]()):void 0,"%Symbol%":f?Symbol:void 0,"%SyntaxError%":r,"%ThrowTypeError%":c,"%TypedArray%":d,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=n(89),y=n(318),v=b.call(Function.call,Array.prototype.concat),g=b.call(Function.apply,Array.prototype.splice),_=b.call(Function.call,String.prototype.replace),E=b.call(Function.call,String.prototype.slice),M=b.call(Function.call,RegExp.prototype.exec),w=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,O=function(t){var e=E(t,0,1),n=E(t,-1);if("%"===e&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new r("invalid intrinsic syntax, expected opening `%`");var i=[];return _(t,w,(function(t,e,n,r){i[i.length]=n?_(r,S,"$1"):e||t})),i},A=function(t,e){var n,i=t;if(y(m,i)&&(i="%"+(n=m[i])[0]+"%"),y(p,i)){var s=p[i];if(s===l&&(s=function t(e){var n;if("%AsyncFunction%"===e)n=a("async function () {}");else if("%GeneratorFunction%"===e)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=a("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var i=t("%AsyncGenerator%");i&&(n=h(i.prototype))}return p[e]=n,n}(i)),void 0===s&&!e)throw new o("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new r("intrinsic "+t+" does not exist!")};t.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new o('"allowMissing" argument must be a boolean');if(null===M(/^%?[^%]*%?$/g,t))throw new r("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=O(t),i=n.length>0?n[0]:"",a=A("%"+i+"%",e),u=a.name,c=a.value,f=!1,h=a.alias;h&&(i=h[0],g(n,v([0,1],h)));for(var l=1,d=!0;l<n.length;l+=1){var m=n[l],b=E(m,0,1),_=E(m,-1);if(('"'===b||"'"===b||"`"===b||'"'===_||"'"===_||"`"===_)&&b!==_)throw new r("property names with quotes must have matching quotes");if("constructor"!==m&&d||(f=!0),y(p,u="%"+(i+="."+m)+"%"))c=p[u];else if(null!=c){if(!(m in c)){if(!e)throw new o("base intrinsic for "+t+" exists, but the property is not available.");return}if(s&&l+1>=n.length){var w=s(c,m);c=(d=!!w)&&"get"in w&&!("originalValue"in w.get)?w.get:c[m]}else d=y(c,m),c=c[m];d&&!f&&(p[u]=c)}}return c}},function(t,e,n){"use strict";var r=n(317);t.exports=Function.prototype.bind||r},function(t,e,n){"use strict";var r=String.prototype.replace,i=/%20/g,o="RFC1738",a="RFC3986";t.exports={default:a,formatters:{RFC1738:function(t){return r.call(t,i,"+")},RFC3986:function(t){return String(t)}},RFC1738:o,RFC3986:a}},function(t,e){t.exports=h},function(t,e,n){t.exports={decode:n(100),verify:n(302),sign:n(305),JsonWebTokenError:n(59),NotBeforeError:n(157),TokenExpiredError:n(158)}},function(t,e){t.exports=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataReader=void 0;var r=n(9),i=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(r.PARAM_TYPES,t),userGeneratedMetadata:Reflect.getMetadata(r.TAGGED,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(r.TAGGED_PROP,t)||[]},t}();e.MetadataReader=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isStackOverflowExeption=void 0;var r=n(12);e.isStackOverflowExeption=function(t){return t instanceof RangeError||t.message===r.STACK_OVERFLOW}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.inject=e.LazyServiceIdentifer=void 0;var r=n(12),i=n(9),o=n(16),a=n(23),s=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();e.LazyServiceIdentifer=s,e.inject=function(t){return function(e,n,s){if(void 0===t)throw new Error(r.UNDEFINED_INJECT_ANNOTATION(e.name));var u=new o.Metadata(i.INJECT_TAG,t);"number"==typeof s?a.tagParameter(e,n,s,u):a.tagProperty(e,n,u)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Target=void 0;var r=n(9),i=n(28),o=n(16),a=n(177),s=function(){function t(t,e,n,s){this.id=i.id(),this.type=t,this.serviceIdentifier=n,this.name=new a.QueryableString(e||""),this.metadata=new Array;var u=null;"string"==typeof s?u=new o.Metadata(r.NAMED_TAG,s):s instanceof o.Metadata&&(u=s),null!==u&&this.metadata.push(u)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;e<n.length;e++){if(n[e].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(r.MULTI_INJECT_TAG)},t.prototype.matchesArray=function(t){return this.matchesTag(r.MULTI_INJECT_TAG)(t)},t.prototype.isNamed=function(){return this.hasTag(r.NAMED_TAG)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(r.OPTIONAL_TAG)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===r.NAMED_TAG}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return r.NON_CUSTOM_TAG_KEYS.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(r.NAMED_TAG)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;r<i.length;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}();e.Target=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingWhenOnSyntax=void 0;var r=n(61),i=n(62),o=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new i.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new r.BindingOnSyntax(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingWhenOnSyntax=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.typeConstraint=e.namedConstraint=e.taggedConstraint=e.traverseAncerstors=void 0;var r=n(9),i=n(16),o=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||o(n,e))};e.traverseAncerstors=o;var a=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new i.Metadata(t,e),n}};e.taggedConstraint=a;var s=a(r.NAMED_TAG);e.namedConstraint=s;e.typeConstraint=function(t){return function(e){var n=null;if(null!==e){if(n=e.bindings[0],"string"==typeof t)return n.serviceIdentifier===t;var r=e.bindings[0].implementationType;return t===r}return!1}}},function(t,e,n){var r=n(63);t.exports=function(t,e){e=e||{};var n=r.decode(t,e);if(!n)return null;var i=n.payload;if("string"==typeof i)try{var o=JSON.parse(i);null!==o&&"object"==typeof o&&(i=o)}catch(t){}return!0===e.complete?{header:n.header,payload:i,signature:n.signature}:i}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){(function(e){var r=n(4).Buffer,i=n(52);function o(t){if(this.buffer=null,this.writable=!0,this.readable=!0,!t)return this.buffer=r.alloc(0),this;if("function"==typeof t.pipe)return this.buffer=r.alloc(0),t.pipe(this),this;if(t.length||"object"==typeof t)return this.buffer=t,this.writable=!1,e.nextTick(function(){this.emit("end",t),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof t+")")}n(54).inherits(o,i),o.prototype.write=function(t){this.buffer=r.concat([this.buffer,r.from(t)]),this.emit("data",t)},o.prototype.end=function(t){t&&this.write(t),this.emit("end",t),this.emit("close"),this.writable=!1,this.readable=!1},t.exports=o}).call(this,n(7))},function(t,e,n){"use strict";(function(e,r){var i=n(53);t.exports=g;var o,a=n(101);g.ReadableState=v;n(29).EventEmitter;var s=function(t,e){return t.listeners(e).length},u=n(104),c=n(4).Buffer,f=e.Uint8Array||function(){};var h=Object.create(n(46));h.inherits=n(5);var l=n(199),d=void 0;d=l&&l.debuglog?l.debuglog("stream"):function(){};var p,m=n(200),b=n(105);h.inherits(g,u);var y=["error","close","destroy","pause","resume"];function v(t,e){t=t||{};var r=e instanceof(o=o||n(30));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var i=t.highWaterMark,a=t.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(a||0===a)?a:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=n(31).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function g(t){if(o=o||n(30),!(this instanceof g))return new g(t);this._readableState=new v(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function _(t,e,n,r,i){var o,a=t._readableState;null===e?(a.reading=!1,function(t,e){if(e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,w(t)}(t,a)):(i||(o=function(t,e){var n;r=e,c.isBuffer(r)||r instanceof f||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(a,e)),o?t.emit("error",o):a.objectMode||e&&e.length>0?("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r?a.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,a,e,!0):a.ended?t.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?E(t,a,e,!1):O(t,a)):E(t,a,e,!1))):r||(a.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(a)}function E(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&w(t)),O(t,e)}Object.defineProperty(g.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),g.prototype.destroy=b.destroy,g.prototype._undestroy=b.undestroy,g.prototype._destroy=function(t,e){this.push(null),e(t)},g.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=c.from(t,e),e=""),n=!0),_(this,t,e,!1,n)},g.prototype.unshift=function(t){return _(this,t,null,!0,!1)},g.prototype.isPaused=function(){return!1===this._readableState.flowing},g.prototype.setEncoding=function(t){return p||(p=n(31).StringDecoder),this._readableState.decoder=new p(t),this._readableState.encoding=t,this};function M(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function w(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(d("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i.nextTick(S,t):S(t))}function S(t){d("emit readable"),t.emit("readable"),C(t)}function O(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(A,t,e))}function A(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(d("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function T(t){d("readable nexttick read 0"),t.read(0)}function N(t,e){e.reading||(d("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),C(t),e.flowing&&!e.reading&&t.read(0)}function C(t){var e=t._readableState;for(d("flow",e.flowing);e.flowing&&null!==t.read(););}function I(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,i=n.data;t-=i.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++r}return e.length-=r,i}(t,e):function(t,e){var n=c.allocUnsafe(t),r=e.head,i=1;r.data.copy(n),t-=r.data.length;for(;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(o.copy(n,n.length-t,0,a),0===(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e);return r}(t,e.buffer,e.decoder),n);var n}function R(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i.nextTick(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function L(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}g.prototype.read=function(t){d("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return d("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?R(this):w(this),null;if(0===(t=M(t,e))&&e.ended)return 0===e.length&&R(this),null;var r,i=e.needReadable;return d("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&d("length less than watermark",i=!0),e.ended||e.reading?d("reading or ended",i=!1):i&&(d("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=M(n,e))),null===(r=t>0?I(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&R(this)),null!==r&&this.emit("data",r),r},g.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,d("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?f:g;function c(e,r){d("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),t.removeListener("close",y),t.removeListener("finish",v),t.removeListener("drain",h),t.removeListener("error",b),t.removeListener("unpipe",c),n.removeListener("end",f),n.removeListener("end",g),n.removeListener("data",m),l=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function f(){d("onend"),t.end()}o.endEmitted?i.nextTick(u):n.once("end",u),t.on("unpipe",c);var h=function(t){return function(){var e=t._readableState;d("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,C(t))}}(n);t.on("drain",h);var l=!1;var p=!1;function m(e){d("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==L(o.pipes,t))&&!l&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,p=!0),n.pause())}function b(e){d("onerror",e),g(),t.removeListener("error",b),0===s(t,"error")&&t.emit("error",e)}function y(){t.removeListener("finish",v),g()}function v(){d("onfinish"),t.removeListener("close",y),g()}function g(){d("unpipe"),n.unpipe(t)}return n.on("data",m),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",b),t.once("close",y),t.once("finish",v),t.emit("pipe",n),o.flowing||(d("pipe resume"),n.resume()),t},g.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,n);return this}var a=L(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},g.prototype.on=function(t,e){var n=u.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&w(this):i.nextTick(T,this))}return n},g.prototype.addListener=g.prototype.on,g.prototype.resume=function(){var t=this._readableState;return t.flowing||(d("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(N,t,e))}(this,t)),this},g.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this},g.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(d("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(d("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<y.length;o++)t.on(y[o],this.emit.bind(this,y[o]));return this._read=function(e){d("wrapped _read",e),r&&(r=!1,t.resume())},this},Object.defineProperty(g.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),g._fromList=I}).call(this,n(10),n(7))},function(t,e,n){t.exports=n(29).EventEmitter},function(t,e,n){"use strict";var r=n(53);function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(r.nextTick(i,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,n){"use strict";t.exports=a;var r=n(30),i=Object.create(n(46));function o(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function a(t){if(!(this instanceof a))return new a(t);r.call(this,t),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",s)}function s(){var t=this;"function"==typeof this._flush?this._flush((function(e,n){u(t,e,n)})):u(this,null,null)}function u(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}i.inherits=n(5),i.inherits(a,r),a.prototype.push=function(t,e){return this._transformState.needTransform=!1,r.prototype.push.call(this,t,e)},a.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},a.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},a.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},a.prototype._destroy=function(t,e){var n=this;r.prototype._destroy.call(this,t,(function(t){e(t),n.emit("close")}))}},function(t,e,n){var r=n(210),i=n(4).Buffer,o=n(211),a=n(299),s=n(54),u="secret must be a string or buffer",c="key must be a string or a buffer",f="function"==typeof o.createPublicKey;function h(t){if(!i.isBuffer(t)&&"string"!=typeof t){if(!f)throw m(c);if("object"!=typeof t)throw m(c);if("string"!=typeof t.type)throw m(c);if("string"!=typeof t.asymmetricKeyType)throw m(c);if("function"!=typeof t.export)throw m(c)}}function l(t){if(!i.isBuffer(t)&&"string"!=typeof t&&"object"!=typeof t)throw m("key must be a string, a buffer or an object")}function d(t){return t.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(t){var e=4-(t=t.toString()).length%4;if(4!==e)for(var n=0;n<e;++n)t+="=";return t.replace(/\-/g,"+").replace(/_/g,"/")}function m(t){var e=[].slice.call(arguments,1),n=s.format.bind(s,t).apply(null,e);return new TypeError(n)}function b(t){var e;return e=t,i.isBuffer(e)||"string"==typeof e||(t=JSON.stringify(t)),t}function y(t){return function(e,n){!function(t){if(!i.isBuffer(t)){if("string"==typeof t)return t;if(!f)throw m(u);if("object"!=typeof t)throw m(u);if("secret"!==t.type)throw m(u);if("function"!=typeof t.export)throw m(u)}}(n),e=b(e);var r=o.createHmac("sha"+t,n);return d((r.update(e),r.digest("base64")))}}function v(t){return function(e,n,o){var a=y(t)(e,o);return r(i.from(n),i.from(a))}}function g(t){return function(e,n){l(n),e=b(e);var r=o.createSign("RSA-SHA"+t);return d((r.update(e),r.sign(n,"base64")))}}function _(t){return function(e,n,r){h(r),e=b(e),n=p(n);var i=o.createVerify("RSA-SHA"+t);return i.update(e),i.verify(r,n,"base64")}}function E(t){return function(e,n){l(n),e=b(e);var r=o.createSign("RSA-SHA"+t);return d((r.update(e),r.sign({key:n,padding:o.constants.RSA_PKCS1_PSS_PADDING,saltLength:o.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function M(t){return function(e,n,r){h(r),e=b(e),n=p(n);var i=o.createVerify("RSA-SHA"+t);return i.update(e),i.verify({key:r,padding:o.constants.RSA_PKCS1_PSS_PADDING,saltLength:o.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function w(t){var e=g(t);return function(){var n=e.apply(null,arguments);return n=a.derToJose(n,"ES"+t)}}function S(t){var e=_(t);return function(n,r,i){return r=a.joseToDer(r,"ES"+t).toString("base64"),e(n,r,i)}}function O(){return function(){return""}}function A(){return function(t,e){return""===e}}f&&(c+=" or a KeyObject",u+="or a KeyObject"),t.exports=function(t){var e={hs:y,rs:g,ps:E,es:w,none:O},n={hs:v,rs:_,ps:M,es:S,none:A},r=t.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!r)throw m('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',t);var i=(r[1]||r[3]).toLowerCase(),o=r[2];return{sign:e[i](o),verify:n[i](o)}}},function(t,e,n){"use strict";var r=n(212).Buffer,i=n(213).Transform;function o(t){i.call(this),this._block=r.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}n(37)(o,i),o.prototype._transform=function(t,e,n){var r=null;try{this.update(t,e)}catch(t){r=t}n(r)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=r.from(t,e));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)n[o++]=t[i++];this._update(),this._blockOffset=0}for(;i<t.length;)n[this._blockOffset++]=t[i++];for(var a=0,s=8*t.length;s>0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var n=0;n<4;++n)this._length[n]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=o},function(t,e,n){"use strict";(function(e,r){var i;t.exports=O,O.ReadableState=S;n(29).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=n(110),s=n(6).Buffer,u=e.Uint8Array||function(){};var c,f=n(214);c=f&&f.debuglog?f.debuglog("stream"):function(){};var h,l,d,p=n(215),m=n(111),b=n(112).getHighWaterMark,y=n(36).codes,v=y.ERR_INVALID_ARG_TYPE,g=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,E=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(37)(O,a);var M=m.errorOrDestroy,w=["error","close","destroy","pause","resume"];function S(t,e,r){i=i||n(38),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=b(this,t,"readableHighWaterMark",r),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=n(31).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function O(t){if(i=i||n(38),!(this instanceof O))return new O(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,n,r,i){c("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?C(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,I(t)))}(t,a);else if(i||(o=function(t,e){var n;r=e,s.isBuffer(r)||r instanceof u||"string"==typeof e||void 0===e||t.objectMode||(n=new v("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(a,e)),o)M(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),r)a.endEmitted?M(t,new E):T(t,a,e,!0);else if(a.ended)M(t,new g);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?T(t,a,e,!1):R(t,a)):T(t,a,e,!1)}else r||(a.reading=!1,R(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function T(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&C(t)),R(t,e)}Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),O.prototype.destroy=m.destroy,O.prototype._undestroy=m.undestroy,O.prototype._destroy=function(t,e){e(t)},O.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=s.from(t,e),e=""),n=!0),A(this,t,e,!1,n)},O.prototype.unshift=function(t){return A(this,t,null,!0,!1)},O.prototype.isPaused=function(){return!1===this._readableState.flowing},O.prototype.setEncoding=function(t){h||(h=n(31).StringDecoder);var e=new h(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function N(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function C(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(I,t))}function I(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,k(t)}function R(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(c("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function L(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function D(t){c("readable nexttick read 0"),t.read(0)}function j(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),k(t),e.flowing&&!e.reading&&t.read(0)}function k(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function x(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(B,e,t))}function B(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function F(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}O.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?x(this):C(this),null;if(0===(t=N(t,e))&&e.ended)return 0===e.length&&x(this),null;var r,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=N(n,e))),null===(r=t>0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&x(this)),null!==r&&this.emit("data",r),r},O.prototype._read=function(t){M(this,new _("_read()"))},O.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?u:b;function s(e,r){c("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),n.removeListener("end",u),n.removeListener("end",b),n.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){c("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,k(t))}}(n);t.on("drain",f);var h=!1;function l(e){c("ondata");var r=t.write(e);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(e){c("onerror",e),b(),t.removeListener("error",d),0===o(t,"error")&&M(t,e)}function p(){t.removeListener("finish",m),b()}function m(){c("onfinish"),t.removeListener("close",p),b()}function b(){c("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),t},O.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},O.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?C(this):i.reading||r.nextTick(D,this))),n},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(L,this),n},O.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(L,this),e},O.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(j,t,e))}(this,t)),t.paused=!1,this},O.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},O.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<w.length;o++)t.on(w[o],this.emit.bind(this,w[o]));return this._read=function(e){c("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(O.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=n(217)),l(this)}),Object.defineProperty(O.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(O.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(O.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),O._fromList=U,Object.defineProperty(O.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(O.from=function(t,e){return void 0===d&&(d=n(218)),d(O,t,e)})}).call(this,n(10),n(7))},function(t,e,n){t.exports=n(29).EventEmitter},function(t,e,n){"use strict";(function(e){function n(t,e){i(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(r,a):(a._writableState.errorEmitted=!0,e.nextTick(n,a,t)):e.nextTick(n,a,t):o?(e.nextTick(r,a),o(t)):e.nextTick(r,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,n(7))},function(t,e,n){"use strict";var r=n(36).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,n){"use strict";(function(e,r){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=O,O.WritableState=S;var a={deprecate:n(66)},s=n(110),u=n(6).Buffer,c=e.Uint8Array||function(){};var f,h=n(111),l=n(112).getHighWaterMark,d=n(36).codes,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_METHOD_NOT_IMPLEMENTED,b=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,g=d.ERR_STREAM_NULL_VALUES,_=d.ERR_STREAM_WRITE_AFTER_END,E=d.ERR_UNKNOWN_ENCODING,M=h.errorOrDestroy;function w(){}function S(t,e,a){o=o||n(38),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new b;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(R,t,e),t._writableState.errorEmitted=!0,M(t,i)):(o(i),t._writableState.errorEmitted=!0,M(t,i),R(t,e))}(t,n,i,e,o);else{var a=C(n)||t.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||N(t,n),i?r.nextTick(T,t,n,a,o):T(t,n,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function O(t){var e=this instanceof(o=o||n(38));if(!e&&!f.call(O,this))return new O(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function A(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function T(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),R(t,e)}function N(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),a=e.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)o[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;o.allBuffers=u,A(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,f=n.encoding,h=n.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,f,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function I(t,e){t._final((function(n){e.pendingcb--,n&&M(t,n),e.prefinished=!0,t.emit("prefinish"),R(t,e)}))}function R(t,e){var n=C(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(I,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}n(37)(O,s),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===O&&(t&&t._writableState instanceof S)}})):f=function(t){return t instanceof this},O.prototype.pipe=function(){M(this,new y)},O.prototype.write=function(t,e,n){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=w),o.ending?function(t,e){var n=new _;M(t,n),r.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var o;return null===n?o=new g:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(M(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,a=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,n));return e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var f=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},f?f.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,s,r,i,o);return c}(this,o,s,t,e,n)),a},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||N(this,t))},O.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),O.prototype._write=function(t,e,n){n(new m("_write()"))},O.prototype._writev=null,O.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,R(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(O.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),O.prototype.destroy=h.destroy,O.prototype._undestroy=h.undestroy,O.prototype._destroy=function(t,e){e(t)}}).call(this,n(10),n(7))},function(t,e,n){"use strict";t.exports=f;var r=n(36).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,a=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(38);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function f(t){if(!(this instanceof f))return new f(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,n){l(t,e,n)}))}function l(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}n(37)(f,u),f.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},f.prototype._transform=function(t,e,n){n(new i("_transform()"))},f.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},f.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},f.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,n){var r=n(5),i=n(39),o=n(4).Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t,e,n){return n^t&(e^n)}function f(t,e,n){return t&e|n&(t|e)}function h(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function l(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function d(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}r(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,p=0|this._f,m=0|this._g,b=0|this._h,y=0;y<16;++y)n[y]=t.readInt32BE(4*y);for(;y<64;++y)n[y]=0|(((e=n[y-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[y-7]+d(n[y-15])+n[y-16];for(var v=0;v<64;++v){var g=b+l(u)+c(u,p,m)+a[v]+n[v]|0,_=h(r)+f(r,i,o)|0;b=m,m=p,p=u,u=s+g|0,s=o,o=i,i=r,r=g+_|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=b+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=u},function(t,e,n){var r=n(5),i=n(39),o=n(4).Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function c(t,e,n){return n^t&(e^n)}function f(t,e,n){return t&e|n&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function l(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function d(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function p(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function m(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function b(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function y(t,e){return t>>>0<e>>>0?1:0}r(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e=this._w,n=0|this._ah,r=0|this._bh,i=0|this._ch,o=0|this._dh,s=0|this._eh,u=0|this._fh,v=0|this._gh,g=0|this._hh,_=0|this._al,E=0|this._bl,M=0|this._cl,w=0|this._dl,S=0|this._el,O=0|this._fl,A=0|this._gl,T=0|this._hl,N=0;N<32;N+=2)e[N]=t.readInt32BE(4*N),e[N+1]=t.readInt32BE(4*N+4);for(;N<160;N+=2){var C=e[N-30],I=e[N-30+1],R=d(C,I),P=p(I,C),L=m(C=e[N-4],I=e[N-4+1]),D=b(I,C),j=e[N-14],k=e[N-14+1],U=e[N-32],x=e[N-32+1],B=P+k|0,F=R+j+y(B,P)|0;F=(F=F+L+y(B=B+D|0,D)|0)+U+y(B=B+x|0,x)|0,e[N]=F,e[N+1]=B}for(var V=0;V<160;V+=2){F=e[V],B=e[V+1];var q=f(n,r,i),Y=f(_,E,M),G=h(n,_),H=h(_,n),z=l(s,S),K=l(S,s),W=a[V],X=a[V+1],J=c(s,u,v),Z=c(S,O,A),Q=T+K|0,$=g+z+y(Q,T)|0;$=($=($=$+J+y(Q=Q+Z|0,Z)|0)+W+y(Q=Q+X|0,X)|0)+F+y(Q=Q+B|0,B)|0;var tt=H+Y|0,et=G+q+y(tt,H)|0;g=v,T=A,v=u,A=O,u=s,O=S,s=o+$+y(S=w+Q|0,w)|0,o=i,w=M,i=r,M=E,r=n,E=_,n=$+et+y(_=Q+tt|0,Q)|0}this._al=this._al+_|0,this._bl=this._bl+E|0,this._cl=this._cl+M|0,this._dl=this._dl+w|0,this._el=this._el+S|0,this._fl=this._fl+O|0,this._gl=this._gl+A|0,this._hl=this._hl+T|0,this._ah=this._ah+n+y(this._al,_)|0,this._bh=this._bh+r+y(this._bl,E)|0,this._ch=this._ch+i+y(this._cl,M)|0,this._dh=this._dh+o+y(this._dl,w)|0,this._eh=this._eh+s+y(this._el,S)|0,this._fh=this._fh+u+y(this._fl,O)|0,this._gh=this._gh+v+y(this._gl,A)|0,this._hh=this._hh+g+y(this._hl,T)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},t.exports=u},function(t,e,n){"use strict";var r=n(5),i=n(225),o=n(24),a=n(4).Buffer,s=n(118),u=n(69),c=n(70),f=a.alloc(128);function h(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var n="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>n)?e=("rmd160"===t?new u:c(t)).update(e).digest():e.length<n&&(e=a.concat([e,f],n));for(var r=this._ipad=a.allocUnsafe(n),i=this._opad=a.allocUnsafe(n),s=0;s<n;s++)r[s]=54^e[s],i[s]=92^e[s];this._hash="rmd160"===t?new u:c(t),this._hash.update(r)}r(h,o),h.prototype._update=function(t){this._hash.update(t)},h.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new u:c(this._alg)).update(this._opad).update(t).digest()},t.exports=function(t,e){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new h("rmd160",e):"md5"===t?new i(s,e):new h(t,e)}},function(t,e,n){var r=n(67);t.exports=function(t){return(new r).update(t).digest()}},function(t){t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},function(t,e,n){e.pbkdf2=n(227),e.pbkdf2Sync=n(123)},function(t,e){var n=Math.pow(2,30)-1;t.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>n||e!=e)throw new TypeError("Bad key length")}},function(t,e,n){(function(e,n){var r;if(e.process&&e.process.browser)r="utf-8";else if(e.process&&e.process.version){r=parseInt(n.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else r="utf-8";t.exports=r}).call(this,n(10),n(7))},function(t,e,n){var r=n(118),i=n(69),o=n(70),a=n(4).Buffer,s=n(121),u=n(122),c=n(124),f=a.alloc(128),h={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function l(t,e,n){var s=function(t){function e(e){return o(t).update(e).digest()}return"rmd160"===t||"ripemd160"===t?function(t){return(new i).update(t).digest()}:"md5"===t?r:e}(t),u="sha512"===t||"sha384"===t?128:64;e.length>u?e=s(e):e.length<u&&(e=a.concat([e,f],u));for(var c=a.allocUnsafe(u+h[t]),l=a.allocUnsafe(u+h[t]),d=0;d<u;d++)c[d]=54^e[d],l[d]=92^e[d];var p=a.allocUnsafe(u+n+4);c.copy(p,0,0,u),this.ipad1=p,this.ipad2=c,this.opad=l,this.alg=t,this.blocksize=u,this.hash=s,this.size=h[t]}l.prototype.run=function(t,e){return t.copy(e,this.blocksize),this.hash(e).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function(t,e,n,r,i){s(n,r);var o=new l(i=i||"sha1",t=c(t,u,"Password"),(e=c(e,u,"Salt")).length),f=a.allocUnsafe(r),d=a.allocUnsafe(e.length+4);e.copy(d,0,0,e.length);for(var p=0,m=h[i],b=Math.ceil(r/m),y=1;y<=b;y++){d.writeUInt32BE(y,e.length);for(var v=o.run(d,o.ipad1),g=v,_=1;_<n;_++){g=o.run(g,o.ipad2);for(var E=0;E<m;E++)v[E]^=g[E]}v.copy(f,p),p+=m}return f}},function(t,e,n){var r=n(4).Buffer;t.exports=function(t,e,n){if(r.isBuffer(t))return t;if("string"==typeof t)return r.from(t,e);if(ArrayBuffer.isView(t))return r.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")}},function(t,e,n){"use strict";e.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},e.writeUInt32BE=function(t,e,n){t[0+n]=e>>>24,t[1+n]=e>>>16&255,t[2+n]=e>>>8&255,t[3+n]=255&e},e.ip=function(t,e,n,r){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}n[r+0]=i>>>0,n[r+1]=o>>>0},e.rip=function(t,e,n,r){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.pc1=function(t,e,n,r){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;n[r+0]=i>>>0,n[r+1]=o>>>0},e.r28shl=function(t,e){return t<<e&268435455|t>>>28-e};var r=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];e.pc2=function(t,e,n,i){for(var o=0,a=0,s=r.length>>>1,u=0;u<s;u++)o<<=1,o|=t>>>r[u]&1;for(u=s;u<r.length;u++)a<<=1,a|=e>>>r[u]&1;n[i+0]=o>>>0,n[i+1]=a>>>0},e.expand=function(t,e,n){var r=0,i=0;r=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)r<<=6,r|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[n+0]=r>>>0,e[n+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];e.substitute=function(t,e){for(var n=0,r=0;r<4;r++){n<<=4,n|=i[64*r+(t>>>18-6*r&63)]}for(r=0;r<4;r++){n<<=4,n|=i[256+64*r+(e>>>18-6*r&63)]}return n>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];e.permute=function(t){for(var e=0,n=0;n<o.length;n++)e<<=1,e|=t>>>o[n]&1;return e>>>0},e.padSplit=function(t,e,n){for(var r=t.toString(2);r.length<e;)r="0"+r;for(var i=[],o=0;o<e;o+=n)i.push(r.slice(o,o+n));return i.join(" ")}},function(t,e,n){"use strict";var r=n(14),i=n(5),o=n(125),a=n(71);function s(){this.tmp=new Array(2),this.keys=null}function u(t){a.call(this,t);var e=new s;this._desState=e,this.deriveKeys(e,t.key)}i(u,a),t.exports=u,u.create=function(t){return new u(t)};var c=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];u.prototype.deriveKeys=function(t,e){t.keys=new Array(32),r.equal(e.length,this.blockSize,"Invalid key length");var n=o.readUInt32BE(e,0),i=o.readUInt32BE(e,4);o.pc1(n,i,t.tmp,0),n=t.tmp[0],i=t.tmp[1];for(var a=0;a<t.keys.length;a+=2){var s=c[a>>>1];n=o.r28shl(n,s),i=o.r28shl(i,s),o.pc2(n,i,t.keys,a)}},u.prototype._update=function(t,e,n,r){var i=this._desState,a=o.readUInt32BE(t,e),s=o.readUInt32BE(t,e+4);o.ip(a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,a,s,i.tmp,0):this._decrypt(i,a,s,i.tmp,0),a=i.tmp[0],s=i.tmp[1],o.writeUInt32BE(n,a,r),o.writeUInt32BE(n,s,r+4)},u.prototype._pad=function(t,e){for(var n=t.length-e,r=e;r<t.length;r++)t[r]=n;return!0},u.prototype._unpad=function(t){for(var e=t[t.length-1],n=t.length-e;n<t.length;n++)r.equal(t[n],e);return t.slice(0,t.length-e)},u.prototype._encrypt=function(t,e,n,r,i){for(var a=e,s=n,u=0;u<t.keys.length;u+=2){var c=t.keys[u],f=t.keys[u+1];o.expand(s,t.tmp,0),c^=t.tmp[0],f^=t.tmp[1];var h=o.substitute(c,f),l=s;s=(a^o.permute(h))>>>0,a=l}o.rip(s,a,r,i)},u.prototype._decrypt=function(t,e,n,r,i){for(var a=n,s=e,u=t.keys.length-2;u>=0;u-=2){var c=t.keys[u],f=t.keys[u+1];o.expand(a,t.tmp,0),c^=t.tmp[0],f^=t.tmp[1];var h=o.substitute(c,f),l=a;a=(s^o.permute(h))>>>0,s=l}o.rip(a,s,r,i)}},function(t,e,n){var r=n(48),i=n(4).Buffer,o=n(128);function a(t){var e=t._cipher.encryptBlockRaw(t._prev);return o(t._prev),e}e.encrypt=function(t,e){var n=Math.ceil(e.length/16),o=t._cache.length;t._cache=i.concat([t._cache,i.allocUnsafe(16*n)]);for(var s=0;s<n;s++){var u=a(t),c=o+16*s;t._cache.writeUInt32BE(u[0],c+0),t._cache.writeUInt32BE(u[1],c+4),t._cache.writeUInt32BE(u[2],c+8),t._cache.writeUInt32BE(u[3],c+12)}var f=t._cache.slice(0,e.length);return t._cache=t._cache.slice(e.length),r(e,f)}},function(t,e){t.exports=function(t){for(var e,n=t.length;n--;){if(255!==(e=t.readUInt8(n))){e++,t.writeUInt8(e,n);break}t.writeUInt8(0,n)}}},function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(t,e,n){var r=n(55),i=n(4).Buffer,o=n(24),a=n(5),s=n(240),u=n(48),c=n(128);function f(t,e,n,a){o.call(this);var u=i.alloc(4,0);this._cipher=new r.AES(e);var f=this._cipher.encryptBlock(u);this._ghash=new s(f),n=function(t,e,n){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var r=new s(n),o=e.length,a=o%16;r.update(e),a&&(a=16-a,r.update(i.alloc(a,0))),r.update(i.alloc(8,0));var u=8*o,f=i.alloc(8);f.writeUIntBE(u,0,8),r.update(f),t._finID=r.state;var h=i.from(t._finID);return c(h),h}(this,n,f),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(f,o),f.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},f.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var n=0;t.length!==e.length&&n++;for(var r=Math.min(t.length,e.length),i=0;i<r;++i)n+=t[i]^e[i];return n}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},f.prototype.getAuthTag=function(){if(this._decrypt||!i.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},f.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},f.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=f},function(t,e,n){var r=n(55),i=n(4).Buffer,o=n(24);function a(t,e,n,a){o.call(this),this._cipher=new r.AES(e),this._prev=i.from(n),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._mode=t}n(5)(a,o),a.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},t.exports=a},function(t,e,n){var r=n(35);t.exports=v,v.simpleSieve=b,v.fermatTest=y;var i=n(133),o=new i(24),a=new(n(134)),s=new i(1),u=new i(2),c=new i(5),f=(new i(16),new i(8),new i(10)),h=new i(3),l=(new i(7),new i(11)),d=new i(4),p=(new i(12),null);function m(){if(null!==p)return p;var t=[];t[0]=2;for(var e=1,n=3;n<1048576;n+=2){for(var r=Math.ceil(Math.sqrt(n)),i=0;i<e&&t[i]<=r&&n%t[i]!=0;i++);e!==i&&t[i]<=r||(t[e++]=n)}return p=t,t}function b(t){for(var e=m(),n=0;n<e.length;n++)if(0===t.modn(e[n]))return 0===t.cmpn(e[n]);return!0}function y(t){var e=i.mont(t);return 0===u.toRed(e).redPow(t.subn(1)).fromRed().cmpn(1)}function v(t,e){if(t<16)return new i(2===e||5===e?[140,123]:[140,39]);var n,p;for(e=new i(e);;){for(n=new i(r(Math.ceil(t/8)));n.bitLength()>t;)n.ishrn(1);if(n.isEven()&&n.iadd(s),n.testn(1)||n.iadd(u),e.cmp(u)){if(!e.cmp(c))for(;n.mod(f).cmp(h);)n.iadd(d)}else for(;n.mod(o).cmp(l);)n.iadd(d);if(b(p=n.shrn(1))&&b(n)&&y(p)&&y(n)&&a.test(p)&&a.test(n))return n}}},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(244).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:f[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new b).mulp(t,e,n)}function b(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},b.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},b.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},b.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},b.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},b.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},b.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(g,v),g.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},w.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},i(S,w),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e,n){var r=n(245),i=n(74);function o(t){this.rand=t||new i.Rand}t.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),n=Math.ceil(e/8);do{var i=new r(this.rand.generate(n))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var n=e.sub(t);return t.add(this._randbelow(n))},o.prototype.test=function(t,e,n){var i=t.bitLength(),o=r.mont(t),a=new r(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var c=t.shrn(u),f=s.toRed(o);e>0;e--){var h=this._randrange(new r(2),s);n&&n(h);var l=h.toRed(o).redPow(c);if(0!==l.cmp(a)&&0!==l.cmp(f)){for(var d=1;d<u;d++){if(0===(l=l.redSqr()).cmp(a))return!1;if(0===l.cmp(f))break}if(d===u)return!1}}return!0},o.prototype.getDivisor=function(t,e){var n=t.bitLength(),i=r.mont(t),o=new r(1).toRed(i);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),s=0;!a.testn(s);s++);for(var u=t.shrn(s),c=a.toRed(i);e>0;e--){var f=this._randrange(new r(2),a),h=t.gcd(f);if(0!==h.cmpn(1))return h;var l=f.toRed(i).redPow(u);if(0!==l.cmp(o)&&0!==l.cmp(c)){for(var d=1;d<s;d++){if(0===(l=l.redSqr()).cmp(o))return l.fromRed().subn(1).gcd(t);if(0===l.cmp(c))break}if(d===s)return(l=l.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,e,n){"use strict";(function(e,r){var i;t.exports=O,O.ReadableState=S;n(29).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=n(136),s=n(6).Buffer,u=e.Uint8Array||function(){};var c,f=n(252);c=f&&f.debuglog?f.debuglog("stream"):function(){};var h,l,d,p=n(253),m=n(137),b=n(138).getHighWaterMark,y=n(40).codes,v=y.ERR_INVALID_ARG_TYPE,g=y.ERR_STREAM_PUSH_AFTER_EOF,_=y.ERR_METHOD_NOT_IMPLEMENTED,E=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(41)(O,a);var M=m.errorOrDestroy,w=["error","close","destroy","pause","resume"];function S(t,e,r){i=i||n(42),t=t||{},"boolean"!=typeof r&&(r=e instanceof i),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=b(this,t,"readableHighWaterMark",r),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(h||(h=n(31).StringDecoder),this.decoder=new h(t.encoding),this.encoding=t.encoding)}function O(t){if(i=i||n(42),!(this instanceof O))return new O(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,n,r,i){c("readableAddChunk",e);var o,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(c("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?C(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,I(t)))}(t,a);else if(i||(o=function(t,e){var n;r=e,s.isBuffer(r)||r instanceof u||"string"==typeof e||void 0===e||t.objectMode||(n=new v("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(a,e)),o)M(t,o);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),r)a.endEmitted?M(t,new E):T(t,a,e,!0);else if(a.ended)M(t,new g);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?T(t,a,e,!1):R(t,a)):T(t,a,e,!1)}else r||(a.reading=!1,R(t,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function T(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&C(t)),R(t,e)}Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),O.prototype.destroy=m.destroy,O.prototype._undestroy=m.undestroy,O.prototype._destroy=function(t,e){e(t)},O.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=s.from(t,e),e=""),n=!0),A(this,t,e,!1,n)},O.prototype.unshift=function(t){return A(this,t,null,!0,!1)},O.prototype.isPaused=function(){return!1===this._readableState.flowing},O.prototype.setEncoding=function(t){h||(h=n(31).StringDecoder);var e=new h(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};function N(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function C(t){var e=t._readableState;c("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(c("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(I,t))}function I(t){var e=t._readableState;c("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,k(t)}function R(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(P,t,e))}function P(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(c("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function L(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function D(t){c("readable nexttick read 0"),t.read(0)}function j(t,e){c("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),k(t),e.flowing&&!e.reading&&t.read(0)}function k(t){var e=t._readableState;for(c("flow",e.flowing);e.flowing&&null!==t.read(););}function U(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function x(t){var e=t._readableState;c("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(B,e,t))}function B(t,e){if(c("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function F(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}O.prototype.read=function(t){c("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return c("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?x(this):C(this),null;if(0===(t=N(t,e))&&e.ended)return 0===e.length&&x(this),null;var r,i=e.needReadable;return c("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&c("length less than watermark",i=!0),e.ended||e.reading?c("reading or ended",i=!1):i&&(c("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=N(n,e))),null===(r=t>0?U(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&x(this)),null!==r&&this.emit("data",r),r},O.prototype._read=function(t){M(this,new _("_read()"))},O.prototype.pipe=function(t,e){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,c("pipe count=%d opts=%j",i.pipesCount,e);var a=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?u:b;function s(e,r){c("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,c("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),n.removeListener("end",u),n.removeListener("end",b),n.removeListener("data",l),h=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){c("onend"),t.end()}i.endEmitted?r.nextTick(a):n.once("end",a),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;c("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,k(t))}}(n);t.on("drain",f);var h=!1;function l(e){c("ondata");var r=t.write(e);c("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==F(i.pipes,t))&&!h&&(c("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function d(e){c("onerror",e),b(),t.removeListener("error",d),0===o(t,"error")&&M(t,e)}function p(){t.removeListener("finish",m),b()}function m(){c("onfinish"),t.removeListener("close",p),b()}function b(){c("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",n),i.flowing||(c("pipe resume"),n.resume()),t},O.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<i;o++)r[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=F(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},O.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,c("on readable",i.length,i.reading),i.length?C(this):i.reading||r.nextTick(D,this))),n},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(L,this),n},O.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(L,this),e},O.prototype.resume=function(){var t=this._readableState;return t.flowing||(c("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(j,t,e))}(this,t)),t.paused=!1,this},O.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},O.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(c("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(c("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var o=0;o<w.length;o++)t.on(w[o],this.emit.bind(this,w[o]));return this._read=function(e){c("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(O.prototype[Symbol.asyncIterator]=function(){return void 0===l&&(l=n(255)),l(this)}),Object.defineProperty(O.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(O.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(O.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),O._fromList=U,Object.defineProperty(O.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(O.from=function(t,e){return void 0===d&&(d=n(256)),d(O,t,e)})}).call(this,n(10),n(7))},function(t,e,n){t.exports=n(29).EventEmitter},function(t,e,n){"use strict";(function(e){function n(t,e){i(t,e),r(t)}function r(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function i(t,e){t.emit("error",e)}t.exports={destroy:function(t,o){var a=this,s=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return s||u?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?e.nextTick(r,a):(a._writableState.errorEmitted=!0,e.nextTick(n,a,t)):e.nextTick(n,a,t):o?(e.nextTick(r,a),o(t)):e.nextTick(r,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}}).call(this,n(7))},function(t,e,n){"use strict";var r=n(40).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},function(t,e,n){"use strict";(function(e,r){function i(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}var o;t.exports=O,O.WritableState=S;var a={deprecate:n(66)},s=n(136),u=n(6).Buffer,c=e.Uint8Array||function(){};var f,h=n(137),l=n(138).getHighWaterMark,d=n(40).codes,p=d.ERR_INVALID_ARG_TYPE,m=d.ERR_METHOD_NOT_IMPLEMENTED,b=d.ERR_MULTIPLE_CALLBACK,y=d.ERR_STREAM_CANNOT_PIPE,v=d.ERR_STREAM_DESTROYED,g=d.ERR_STREAM_NULL_VALUES,_=d.ERR_STREAM_WRITE_AFTER_END,E=d.ERR_UNKNOWN_ENCODING,M=h.errorOrDestroy;function w(){}function S(t,e,a){o=o||n(42),t=t||{},"boolean"!=typeof a&&(a=e instanceof o),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=l(this,t,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===t.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new b;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,o){--e.pendingcb,n?(r.nextTick(o,i),r.nextTick(R,t,e),t._writableState.errorEmitted=!0,M(t,i)):(o(i),t._writableState.errorEmitted=!0,M(t,i),R(t,e))}(t,n,i,e,o);else{var a=C(n)||t.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||N(t,n),i?r.nextTick(T,t,n,a,o):T(t,n,a,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function O(t){var e=this instanceof(o=o||n(42));if(!e&&!f.call(O,this))return new O(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),s.call(this)}function A(t,e,n,r,i,o,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function T(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),R(t,e)}function N(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),a=e.corkedRequestsFree;a.entry=n;for(var s=0,u=!0;n;)o[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;o.allBuffers=u,A(t,e,!0,e.length,o,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new i(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,f=n.encoding,h=n.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,f,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function I(t,e){t._final((function(n){e.pendingcb--,n&&M(t,n),e.prefinished=!0,t.emit("prefinish"),R(t,e)}))}function R(t,e){var n=C(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,r.nextTick(I,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return n}n(41)(O,s),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(O,Symbol.hasInstance,{value:function(t){return!!f.call(this,t)||this===O&&(t&&t._writableState instanceof S)}})):f=function(t){return t instanceof this},O.prototype.pipe=function(){M(this,new y)},O.prototype.write=function(t,e,n){var i,o=this._writableState,a=!1,s=!o.objectMode&&(i=t,u.isBuffer(i)||i instanceof c);return s&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=w),o.ending?function(t,e){var n=new _;M(t,n),r.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var o;return null===n?o=new g:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(M(t,o),r.nextTick(i,o),!1)}(this,o,t,n))&&(o.pendingcb++,a=function(t,e,n,r,i,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,n));return e}(e,r,i);r!==a&&(n=!0,i="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var f=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},f?f.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else A(t,e,!1,s,r,i,o);return c}(this,o,s,t,e,n)),a},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||N(this,t))},O.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(O.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(O.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),O.prototype._write=function(t,e,n){n(new m("_write()"))},O.prototype._writev=null,O.prototype.end=function(t,e,n){var i=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,n){e.ending=!0,R(t,e),n&&(e.finished?r.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n),this},Object.defineProperty(O.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(O.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),O.prototype.destroy=h.destroy,O.prototype._undestroy=h.undestroy,O.prototype._destroy=function(t,e){e(t)}}).call(this,n(10),n(7))},function(t,e,n){"use strict";t.exports=f;var r=n(40).codes,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,a=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(42);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function f(t){if(!(this instanceof f))return new f(t);u.call(this,t),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush((function(e,n){l(t,e,n)}))}function l(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new s;if(t._transformState.transforming)throw new a;return t.push(null)}n(41)(f,u),f.prototype.push=function(t,e){return this._transformState.needTransform=!1,u.prototype.push.call(this,t,e)},f.prototype._transform=function(t,e,n){n(new i("_transform()"))},f.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},f.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},f.prototype._destroy=function(t,e){u.prototype._destroy.call(this,t,(function(t){e(t)}))}},function(t,e,n){"use strict";var r=e;function i(t){return 1===t.length?"0"+t:t}function o(t){for(var e="",n=0;n<t.length;n++)e+=i(t[n].toString(16));return e}r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},r.zero2=i,r.toHex=o,r.encode=function(t,e){return"hex"===e?o(t):t}},function(t,e,n){"use strict";var r=e;r.base=n(57),r.short=n(263),r.mont=n(264),r.edwards=n(265)},function(t,e,n){"use strict";var r=n(17).rotr32;function i(t,e,n){return t&e^~t&n}function o(t,e,n){return t&e^t&n^e&n}function a(t,e,n){return t^e^n}e.ft_1=function(t,e,n,r){return 0===t?i(e,n,r):1===t||3===t?a(e,n,r):2===t?o(e,n,r):void 0},e.ch32=i,e.maj32=o,e.p32=a,e.s0_256=function(t){return r(t,2)^r(t,13)^r(t,22)},e.s1_256=function(t){return r(t,6)^r(t,11)^r(t,25)},e.g0_256=function(t){return r(t,7)^r(t,18)^t>>>3},e.g1_256=function(t){return r(t,17)^r(t,19)^t>>>10}},function(t,e,n){"use strict";var r=n(17),i=n(49),o=n(143),a=n(14),s=r.sum32,u=r.sum32_4,c=r.sum32_5,f=o.ch32,h=o.maj32,l=o.s0_256,d=o.s1_256,p=o.g0_256,m=o.g1_256,b=i.BlockHash,y=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function v(){if(!(this instanceof v))return new v;b.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=y,this.W=new Array(64)}r.inherits(v,b),t.exports=v,v.blockSize=512,v.outSize=256,v.hmacStrength=192,v.padLength=64,v.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=u(m(n[r-2]),n[r-7],p(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],b=this.h[2],y=this.h[3],v=this.h[4],g=this.h[5],_=this.h[6],E=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var M=c(E,d(v),f(v,g,_),this.k[r],n[r]),w=s(l(i),h(i,o,b));E=_,_=g,g=v,v=s(y,M),y=b,b=o,o=i,i=s(M,w)}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],b),this.h[3]=s(this.h[3],y),this.h[4]=s(this.h[4],v),this.h[5]=s(this.h[5],g),this.h[6]=s(this.h[6],_),this.h[7]=s(this.h[7],E)},v.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(17),i=n(49),o=n(14),a=r.rotr64_hi,s=r.rotr64_lo,u=r.shr64_hi,c=r.shr64_lo,f=r.sum64,h=r.sum64_hi,l=r.sum64_lo,d=r.sum64_4_hi,p=r.sum64_4_lo,m=r.sum64_5_hi,b=r.sum64_5_lo,y=i.BlockHash,v=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function g(){if(!(this instanceof g))return new g;y.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=v,this.W=new Array(160)}function _(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function E(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function M(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function w(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function S(t,e){var n=a(t,e,28)^a(e,t,2)^a(e,t,7);return n<0&&(n+=4294967296),n}function O(t,e){var n=s(t,e,28)^s(e,t,2)^s(e,t,7);return n<0&&(n+=4294967296),n}function A(t,e){var n=a(t,e,14)^a(t,e,18)^a(e,t,9);return n<0&&(n+=4294967296),n}function T(t,e){var n=s(t,e,14)^s(t,e,18)^s(e,t,9);return n<0&&(n+=4294967296),n}function N(t,e){var n=a(t,e,1)^a(t,e,8)^u(t,e,7);return n<0&&(n+=4294967296),n}function C(t,e){var n=s(t,e,1)^s(t,e,8)^c(t,e,7);return n<0&&(n+=4294967296),n}function I(t,e){var n=a(t,e,19)^a(e,t,29)^u(t,e,6);return n<0&&(n+=4294967296),n}function R(t,e){var n=s(t,e,19)^s(e,t,29)^c(t,e,6);return n<0&&(n+=4294967296),n}r.inherits(g,y),t.exports=g,g.blockSize=1024,g.outSize=512,g.hmacStrength=192,g.padLength=128,g.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=I(n[r-4],n[r-3]),o=R(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=N(n[r-30],n[r-29]),c=C(n[r-30],n[r-29]),f=n[r-32],h=n[r-31];n[r]=d(i,o,a,s,u,c,f,h),n[r+1]=p(i,o,a,s,u,c,f,h)}},g.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],d=this.h[6],p=this.h[7],y=this.h[8],v=this.h[9],g=this.h[10],N=this.h[11],C=this.h[12],I=this.h[13],R=this.h[14],P=this.h[15];o(this.k.length===n.length);for(var L=0;L<n.length;L+=2){var D=R,j=P,k=A(y,v),U=T(y,v),x=_(y,v,g,N,C),B=E(y,v,g,N,C,I),F=this.k[L],V=this.k[L+1],q=n[L],Y=n[L+1],G=m(D,j,k,U,x,B,F,V,q,Y),H=b(D,j,k,U,x,B,F,V,q,Y);D=S(r,i),j=O(r,i),k=M(r,i,a,s,u),U=w(r,i,a,s,u,c);var z=h(D,j,k,U),K=l(D,j,k,U);R=C,P=I,C=g,I=N,g=y,N=v,y=h(d,p,G,H),v=l(p,p,G,H),d=u,p=c,u=a,c=s,a=r,s=i,r=h(G,H,z,K),i=l(G,H,z,K)}f(this.h,0,r,i),f(this.h,2,a,s),f(this.h,4,u,c),f(this.h,6,d,p),f(this.h,8,y,v),f(this.h,10,g,N),f(this.h,12,C,I),f(this.h,14,R,P)},g.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";const r=e;r.bignum=n(147),r.define=n(282).define,r.base=n(285),r.constants=n(286),r.decoders=n(150),r.encoders=n(148)},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(281).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:f[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new b).mulp(t,e,n)}function b(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},b.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},b.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},b.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},b.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},b.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},b.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(g,v),g.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},w.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},i(S,w),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e,n){"use strict";const r=e;r.der=n(149),r.pem=n(283)},function(t,e,n){"use strict";const r=n(5),i=n(83).Buffer,o=n(84),a=n(86);function s(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.call(this,"der",t)}function c(t){return t<10?"0"+t:t}t.exports=s,s.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(u,o),u.prototype._encodeComposite=function(t,e,n,r){const o=function(t,e,n,r){let i;"seqof"===t?t="seq":"setof"===t&&(t="set");if(a.tagByName.hasOwnProperty(t))i=a.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);i=t}if(i>=31)return r.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=a.tagClassByName[n||"universal"]<<6,i}(t,e,n,this.reporter);if(r.length<128){const t=i.alloc(2);return t[0]=o,t[1]=r.length,this._createEncoderBuffer([t,r])}let s=1;for(let t=r.length;t>=256;t>>=8)s++;const u=i.alloc(2+s);u[0]=o,u[1]=128|s;for(let t=1+s,e=r.length;e>0;t--,e>>=8)u[t]=255&e;return this._createEncoderBuffer([u,r])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){const e=i.alloc(2*t.length);for(let n=0;n<t.length;n++)e.writeUInt16BE(t.charCodeAt(n),2*n);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},u.prototype._encodeObjid=function(t,e,n){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s.]+/g);for(let e=0;e<t.length;e++)t[e]|=0}else if(Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++)t[e]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!n){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let r=0;for(let e=0;e<t.length;e++){let n=t[e];for(r++;n>=128;n>>=7)r++}const o=i.alloc(r);let a=o.length-1;for(let e=t.length-1;e>=0;e--){let n=t[e];for(o[a--]=127&n;(n>>=7)>0;)o[a--]=128|127&n}return this._createEncoderBuffer(o)},u.prototype._encodeTime=function(t,e){let n;const r=new Date(t);return"gentime"===e?n=[c(r.getUTCFullYear()),c(r.getUTCMonth()+1),c(r.getUTCDate()),c(r.getUTCHours()),c(r.getUTCMinutes()),c(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?n=[c(r.getUTCFullYear()%100),c(r.getUTCMonth()+1),c(r.getUTCDate()),c(r.getUTCHours()),c(r.getUTCMinutes()),c(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(n,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){const e=t.toArray();!t.sign&&128&e[0]&&e.unshift(0),t=i.from(e)}if(i.isBuffer(t)){let e=t.length;0===t.length&&e++;const n=i.alloc(e);return t.copy(n),0===t.length&&(n[0]=0),this._createEncoderBuffer(n)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let n=1;for(let e=t;e>=256;e>>=8)n++;const r=new Array(n);for(let e=r.length-1;e>=0;e--)r[e]=255&t,t>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(i.from(r))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,n){const r=this._baseState;let i;if(null===r.default)return!1;const o=t.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,e,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==r.defaultBuffer[i])return!1;return!0}},function(t,e,n){"use strict";const r=e;r.der=n(151),r.pem=n(284)},function(t,e,n){"use strict";const r=n(5),i=n(147),o=n(50).DecoderBuffer,a=n(84),s=n(86);function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new c,this.tree._init(t.body)}function c(t){a.call(this,"der",t)}function f(t,e){let n=t.readUInt8(e);if(t.isError(n))return n;const r=s.tagClass[n>>6],i=0==(32&n);if(31==(31&n)){let r=n;for(n=0;128==(128&r);){if(r=t.readUInt8(e),t.isError(r))return r;n<<=7,n|=127&r}}else n&=31;return{cls:r,primitive:i,tag:n,tagStr:s.tag[n]}}function h(t,e,n){let r=t.readUInt8(n);if(t.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;const i=127&r;if(i>4)return t.error("length octect is too long");r=0;for(let e=0;e<i;e++){r<<=8;const e=t.readUInt8(n);if(t.isError(e))return e;r|=e}return r}t.exports=u,u.prototype.decode=function(t,e){return o.isDecoderBuffer(t)||(t=new o(t,e)),this.tree._decode(t,e)},r(c,a),c.prototype._peekTag=function(t,e,n){if(t.isEmpty())return!1;const r=t.save(),i=f(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(r),i.tag===e||i.tagStr===e||i.tagStr+"of"===e||n)},c.prototype._decodeTag=function(t,e,n){const r=f(t,'Failed to decode tag of "'+e+'"');if(t.isError(r))return r;let i=h(t,r.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!n&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');const o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(i=t.offset-o.offset,t.restore(o),t.skip(i,'Failed to match body of: "'+e+'"'))},c.prototype._skipUntilEnd=function(t,e){for(;;){const n=f(t,e);if(t.isError(n))return n;const r=h(t,n.primitive,e);if(t.isError(r))return r;let i;if(i=n.primitive||null!==r?t.skip(r):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===n.tagStr)break}},c.prototype._decodeList=function(t,e,n,r){const i=[];for(;!t.isEmpty();){const e=this._peekTag(t,"end");if(t.isError(e))return e;const o=n.decode(t,"der",r);if(t.isError(o)&&e)break;i.push(o)}return i},c.prototype._decodeStr=function(t,e){if("bitstr"===e){const e=t.readUInt8();return t.isError(e)?e:{unused:e,data:t.raw()}}if("bmpstr"===e){const e=t.raw();if(e.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let n="";for(let t=0;t<e.length/2;t++)n+=String.fromCharCode(e.readUInt16BE(2*t));return n}if("numstr"===e){const e=t.raw().toString("ascii");return this._isNumstr(e)?e:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){const e=t.raw().toString("ascii");return this._isPrintstr(e)?e:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},c.prototype._decodeObjid=function(t,e,n){let r;const i=[];let o=0,a=0;for(;!t.isEmpty();)a=t.readUInt8(),o<<=7,o|=127&a,0==(128&a)&&(i.push(o),o=0);128&a&&i.push(o);const s=i[0]/40|0,u=i[0]%40;if(r=n?i:[s,u].concat(i.slice(1)),e){let t=e[r.join(" ")];void 0===t&&(t=e[r.join(".")]),void 0!==t&&(r=t)}return r},c.prototype._decodeTime=function(t,e){const n=t.raw().toString();let r,i,o,a,s,u;if("gentime"===e)r=0|n.slice(0,4),i=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),u=0|n.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");r=0|n.slice(0,2),i=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),u=0|n.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,i-1,o,a,s,u,0)},c.prototype._decodeNull=function(){return null},c.prototype._decodeBool=function(t){const e=t.readUInt8();return t.isError(e)?e:0!==e},c.prototype._decodeInt=function(t,e){const n=t.raw();let r=new i(n);return e&&(r=e[r.toString(10)]||r),r},c.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},function(t){t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},function(t,e,n){var r=n(47),i=n(4).Buffer;function o(t){var e=i.allocUnsafe(4);return e.writeUInt32BE(t,0),e}t.exports=function(t,e){for(var n,a=i.alloc(0),s=0;a.length<e;)n=o(s++),a=i.concat([a,r("sha1").update(t).update(n).digest()]);return a.slice(0,e)}},function(t,e){t.exports=function(t,e){for(var n=t.length,r=-1;++r<n;)t[r]^=e[r];return t}},function(t,e,n){var r=n(87),i=n(4).Buffer;t.exports=function(t,e){return i.from(t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed().toArray())}},function(t,e,n){var r=n(6).Buffer;t.exports=function(t){return"string"==typeof t?t:"number"==typeof t||r.isBuffer(t)?t.toString():JSON.stringify(t)}},function(t,e,n){var r=n(59),i=function(t,e){r.call(this,t),this.name="NotBeforeError",this.date=e};(i.prototype=Object.create(r.prototype)).constructor=i,t.exports=i},function(t,e,n){var r=n(59),i=function(t,e){r.call(this,t),this.name="TokenExpiredError",this.expiredAt=e};(i.prototype=Object.create(r.prototype)).constructor=i,t.exports=i},function(t,e,n){var r=n(303);t.exports=function(t,e){var n=e||Math.floor(Date.now()/1e3);if("string"==typeof t){var i=r(t);if(void 0===i)return;return Math.floor(n+i/1e3)}return"number"==typeof t?n+t:void 0}},function(t,e,n){(function(e){var r=n(304);t.exports=r.satisfies(e.version,"^6.12.0 || >=8.0.0")}).call(this,n(7))},function(t,e,n){"use strict";var r=n(90),i=Object.prototype.hasOwnProperty,o=Array.isArray,a=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),s=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},r=0;r<t.length;++r)void 0!==t[r]&&(n[r]=t[r]);return n};t.exports={arrayToObject:s,assign:function(t,e){return Object.keys(e).reduce((function(t,n){return t[n]=e[n],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],r=0;r<e.length;++r)for(var i=e[r],a=i.obj[i.prop],s=Object.keys(a),u=0;u<s.length;++u){var c=s[u],f=a[c];"object"==typeof f&&null!==f&&-1===n.indexOf(f)&&(e.push({obj:a,prop:c}),n.push(f))}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(o(n)){for(var r=[],i=0;i<n.length;++i)void 0!==n[i]&&r.push(n[i]);e.obj[e.prop]=r}}}(e),t},decode:function(t,e,n){var r=t.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(t){return r}},encode:function(t,e,n,i,o){if(0===t.length)return t;var s=t;if("symbol"==typeof t?s=Symbol.prototype.toString.call(t):"string"!=typeof t&&(s=String(t)),"iso-8859-1"===n)return escape(s).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var u="",c=0;c<s.length;++c){var f=s.charCodeAt(c);45===f||46===f||95===f||126===f||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||o===r.RFC1738&&(40===f||41===f)?u+=s.charAt(c):f<128?u+=a[f]:f<2048?u+=a[192|f>>6]+a[128|63&f]:f<55296||f>=57344?u+=a[224|f>>12]+a[128|f>>6&63]+a[128|63&f]:(c+=1,f=65536+((1023&f)<<10|1023&s.charCodeAt(c)),u+=a[240|f>>18]+a[128|f>>12&63]+a[128|f>>6&63]+a[128|63&f])}return u},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(o(t)){for(var n=[],r=0;r<t.length;r+=1)n.push(e(t[r]));return n}return e(t)},merge:function t(e,n,r){if(!n)return e;if("object"!=typeof n){if(o(e))e.push(n);else{if(!e||"object"!=typeof e)return[e,n];(r&&(r.plainObjects||r.allowPrototypes)||!i.call(Object.prototype,n))&&(e[n]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(n);var a=e;return o(e)&&!o(n)&&(a=s(e,r)),o(e)&&o(n)?(n.forEach((function(n,o){if(i.call(e,o)){var a=e[o];a&&"object"==typeof a&&n&&"object"==typeof n?e[o]=t(a,n,r):e.push(n)}else e[o]=n})),e):Object.keys(n).reduce((function(e,o){var a=n[o];return i.call(e,o)?e[o]=t(e[o],a,r):e[o]=a,e}),a)}}},function(t,e,n){var r;t.exports=(r=r||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},i=r.lib={},o=i.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=i.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(o=0;o<i;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){e=e;var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},o=0;o<e;o+=4){var s=i(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new a.init(r,e)}}),s=r.enc={},u=s.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new a.init(n,e/2)}},c=s.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new a.init(n,e)}},f=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},h=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,s=i/(4*o),u=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*o,c=t.min(4*u,i);if(u){for(var f=0;f<u;f+=o)this._doProcessBlock(r,f);var h=r.splice(0,u);n.sigBytes-=c}return new a.init(h,c)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),l=(i.Hasher=h.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new l.HMAC.init(t,n).finalize(e)}}}),r.algo={});return r}(Math),r)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(18);function i(t,e,n){for(var i=n||r.defaultEquals,o=t.length,a=0;a<o;a++)if(i(t[a],e))return a;return-1}e.indexOf=i,e.lastIndexOf=function(t,e,n){for(var i=n||r.defaultEquals,o=t.length-1;o>=0;o--)if(i(t[o],e))return o;return-1},e.contains=function(t,e,n){return i(t,e,n)>=0},e.remove=function(t,e,n){var r=i(t,e,n);return!(r<0)&&(t.splice(r,1),!0)},e.frequency=function(t,e,n){for(var i=n||r.defaultEquals,o=t.length,a=0,s=0;s<o;s++)i(t[s],e)&&a++;return a},e.equals=function(t,e,n){var i=n||r.defaultEquals;if(t.length!==e.length)return!1;for(var o=t.length,a=0;a<o;a++)if(!i(t[a],e[a]))return!1;return!0},e.copy=function(t){return t.concat()},e.swap=function(t,e,n){if(e<0||e>=t.length||n<0||n>=t.length)return!1;var r=t[e];return t[e]=t[n],t[n]=r,!0},e.toString=function(t){return"["+t.toString()+"]"},e.forEach=function(t,e){for(var n=0,r=t;n<r.length;n++){if(!1===e(r[n]))return}}},function(t,e,n){var r=n(324),i=n(325);t.exports=function(t,e,n){var o=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var a=(t=t||{}).random||(t.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,e)for(var s=0;s<16;++s)e[o+s]=a[s];return e||i(a)}},function(t,e,n){var r;t.exports=(r=n(162),function(t){var e=r,n=e.lib,i=n.WordArray,o=n.Hasher,a=e.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var u=a.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var r=e+n,i=t[r];t[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=t[e+0],u=t[e+1],d=t[e+2],p=t[e+3],m=t[e+4],b=t[e+5],y=t[e+6],v=t[e+7],g=t[e+8],_=t[e+9],E=t[e+10],M=t[e+11],w=t[e+12],S=t[e+13],O=t[e+14],A=t[e+15],T=o[0],N=o[1],C=o[2],I=o[3];T=c(T,N,C,I,a,7,s[0]),I=c(I,T,N,C,u,12,s[1]),C=c(C,I,T,N,d,17,s[2]),N=c(N,C,I,T,p,22,s[3]),T=c(T,N,C,I,m,7,s[4]),I=c(I,T,N,C,b,12,s[5]),C=c(C,I,T,N,y,17,s[6]),N=c(N,C,I,T,v,22,s[7]),T=c(T,N,C,I,g,7,s[8]),I=c(I,T,N,C,_,12,s[9]),C=c(C,I,T,N,E,17,s[10]),N=c(N,C,I,T,M,22,s[11]),T=c(T,N,C,I,w,7,s[12]),I=c(I,T,N,C,S,12,s[13]),C=c(C,I,T,N,O,17,s[14]),T=f(T,N=c(N,C,I,T,A,22,s[15]),C,I,u,5,s[16]),I=f(I,T,N,C,y,9,s[17]),C=f(C,I,T,N,M,14,s[18]),N=f(N,C,I,T,a,20,s[19]),T=f(T,N,C,I,b,5,s[20]),I=f(I,T,N,C,E,9,s[21]),C=f(C,I,T,N,A,14,s[22]),N=f(N,C,I,T,m,20,s[23]),T=f(T,N,C,I,_,5,s[24]),I=f(I,T,N,C,O,9,s[25]),C=f(C,I,T,N,p,14,s[26]),N=f(N,C,I,T,g,20,s[27]),T=f(T,N,C,I,S,5,s[28]),I=f(I,T,N,C,d,9,s[29]),C=f(C,I,T,N,v,14,s[30]),T=h(T,N=f(N,C,I,T,w,20,s[31]),C,I,b,4,s[32]),I=h(I,T,N,C,g,11,s[33]),C=h(C,I,T,N,M,16,s[34]),N=h(N,C,I,T,O,23,s[35]),T=h(T,N,C,I,u,4,s[36]),I=h(I,T,N,C,m,11,s[37]),C=h(C,I,T,N,v,16,s[38]),N=h(N,C,I,T,E,23,s[39]),T=h(T,N,C,I,S,4,s[40]),I=h(I,T,N,C,a,11,s[41]),C=h(C,I,T,N,p,16,s[42]),N=h(N,C,I,T,y,23,s[43]),T=h(T,N,C,I,_,4,s[44]),I=h(I,T,N,C,w,11,s[45]),C=h(C,I,T,N,A,16,s[46]),T=l(T,N=h(N,C,I,T,d,23,s[47]),C,I,a,6,s[48]),I=l(I,T,N,C,v,10,s[49]),C=l(C,I,T,N,O,15,s[50]),N=l(N,C,I,T,b,21,s[51]),T=l(T,N,C,I,w,6,s[52]),I=l(I,T,N,C,p,10,s[53]),C=l(C,I,T,N,E,15,s[54]),N=l(N,C,I,T,u,21,s[55]),T=l(T,N,C,I,g,6,s[56]),I=l(I,T,N,C,A,10,s[57]),C=l(C,I,T,N,y,15,s[58]),N=l(N,C,I,T,S,21,s[59]),T=l(T,N,C,I,m,6,s[60]),I=l(I,T,N,C,M,10,s[61]),C=l(C,I,T,N,d,15,s[62]),N=l(N,C,I,T,_,21,s[63]),o[0]=o[0]+T|0,o[1]=o[1]+N|0,o[2]=o[2]+C|0,o[3]=o[3]+I|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var o=t.floor(r/4294967296),a=r;n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var f=u[c];u[c]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,n,r,i,o,a){var s=t+(e&n|~e&r)+i+a;return(s<<o|s>>>32-o)+e}function f(t,e,n,r,i,o,a){var s=t+(e&r|n&~r)+i+a;return(s<<o|s>>>32-o)+e}function h(t,e,n,r,i,o,a){var s=t+(e^n^r)+i+a;return(s<<o|s>>>32-o)+e}function l(t,e,n,r,i,o,a){var s=t+(n^(e|~r))+i+a;return(s<<o|s>>>32-o)+e}e.MD5=o._createHelper(u),e.HmacMD5=o._createHmacHelper(u)}(Math),r.MD5)},function(t,e){t.exports=d},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(327),i=function(){function t(){this.list=new r.default}return t.prototype.enqueue=function(t){return this.list.add(t)},t.prototype.add=function(t){return this.list.add(t)},t.prototype.dequeue=function(){if(0!==this.list.size()){var t=this.list.first();return this.list.removeElementAtIndex(0),t}},t.prototype.peek=function(){if(0!==this.list.size())return this.list.first()},t.prototype.size=function(){return this.list.size()},t.prototype.contains=function(t,e){return this.list.contains(t,e)},t.prototype.isEmpty=function(){return this.list.size()<=0},t.prototype.clear=function(){this.list.clear()},t.prototype.forEach=function(t){this.list.forEach(t)},t}();e.default=i},function(t,e){t.exports=p},function(t,e,n){var r=n(328);function i(){}function o(t,e,n){null==n&&(n=a),cordova.exec((function(){var t=Array.prototype.slice.call(arguments);t.unshift(null),n.apply(null,t)}),(function(t){t=t instanceof Error?t:new Error(t),n(t)}),"DownloadManagerPlugin",t,e||[])}function a(){}t.exports=new i,i.prototype.enqueue=function(t,e){"string"==typeof t&&(t={uri:t}),t.url&&(t.uri=t.url),r("string"==typeof t.uri,"req.uri must be string"),r(null==e||"function"==typeof e,"cb must be function"),r(null==t.title||"string"==typeof t.title,"req.title must be string"),r(null==t.description||"string"==typeof t.description,"req.description must be string"),r(null==t.mimeType||"string"==typeof t.mimeType,"req.mimeType must be string"),r(null==t.destinationInExternalFilesDir||"string"==typeof t.destinationInExternalFilesDir.dirType,"req.destinationInExternalFilesDir.dirType must be string"),r(null==t.destinationInExternalFilesDir||"string"==typeof t.destinationInExternalFilesDir.subPath,"req.destinationInExternalFilesDir.subPath must be string"),r(null==t.destinationInExternalPublicDir||"string"==typeof t.destinationInExternalPublicDir.dirType,"req.destinationInExternalPublicDir.dirType must be string"),r(null==t.destinationInExternalPublicDir||"string"==typeof t.destinationInExternalPublicDir.subPath,"req.destinationInExternalPublicDir.subPath must be string"),r(null==t.destinationUri||"string"==typeof t.destinationUri,"req.destinationUri must be string"),r(null==t.visibleInDownloadsUi||"boolean"==typeof t.visibleInDownloadsUi,"req.visibleInDownloadsUi must be boolean"),r(null==t.notificationVisibility||Number.isSafeInteger(t.notificationVisibility),"req.notificationVisibility must be safe integer"),o("enqueue",[t],e)},i.prototype.query=function(t,e){"function"==typeof t&&(e=t,t=null),null==t&&(t={}),r("function"==typeof e,"cb must be function"),o("query",[t],e)},i.prototype.remove=function(t,e){r(Array.isArray(t),"ids must be array"),r(null==e||"function"==typeof e,"cb must be function"),o("remove",t,e)},i.prototype.addCompletedDownload=function(t,e){o("addCompletedDownload",[t],e)},i.prototype.fetchSpeedLog=function(t){o("fetchSpeedLog",[],t)}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},o=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Container=void 0;var a=n(171),s=n(12),u=n(20),c=n(9),f=n(94),h=n(172),l=n(179),d=n(181),p=n(28),m=n(45),b=n(184),y=n(185),v=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!=typeof e)throw new Error(""+s.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===e.defaultScope)e.defaultScope=u.BindingScopeEnum.Transient;else if(e.defaultScope!==u.BindingScopeEnum.Singleton&&e.defaultScope!==u.BindingScopeEnum.Transient&&e.defaultScope!==u.BindingScopeEnum.Request)throw new Error(""+s.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw new Error(""+s.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw new Error(""+s.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=p.id(),this._bindingDictionary=new y.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new f.MetadataReader}return t.merge=function(e,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var a=new t,s=o([e,n],r).map((function(t){return h.getBindingDictionary(t)})),u=h.getBindingDictionary(a);function c(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return s.forEach((function(t){c(t,u)})),a},t.prototype.load=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;r<i.length;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r(this,void 0,void 0,(function(){var e,n,r,o,a;return i(this,(function(i){switch(i.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,i.label=1;case 1:return n<r.length?(o=r[n],a=e(o.id),[4,o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)]):[3,4];case 2:i.sent(),i.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=this.options.defaultScope||u.BindingScopeEnum.Transient,n=new a.Binding(t,e);return this._bindingDictionary.add(t,n),new d.BindingToSyntax(n)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw new Error(s.CANNOT_UNBIND+" "+m.getServiceIdentifierAsString(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new y.Lookup},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,c.NAMED_TAG,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=h.createMockRequest(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(b.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw new Error(s.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,u.TargetTypeEnum.Variable,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,u.TargetTypeEnum.Variable,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,c.NAMED_TAG,e)},t.prototype.getAll=function(t){return this._get(!0,!0,u.TargetTypeEnum.Variable,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,u.TargetTypeEnum.Variable,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,c.NAMED_TAG,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,u={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(u)))throw new Error(s.INVALID_MIDDLEWARE_RETURN)}else a=this._planAndResolve()(u);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=h.plan(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return n=e.contextInterceptor(n),l.resolve(n)}},t}();e.Container=v},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Binding=void 0;var r=n(20),i=n(28),o=function(){function t(t,e){this.id=i.id(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=r.BindingTypeEnum.Invalid,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===r.BindingScopeEnum.Singleton&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}();e.Binding=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBindingDictionary=e.createMockRequest=e.plan=void 0;var r=n(173),i=n(12),o=n(20),a=n(9),s=n(95),u=n(45),c=n(174),f=n(16),h=n(175),l=n(176),d=n(178),p=n(97);function m(t){return t._bindingDictionary}function b(t,e,n,o,a){var s=y(n.container,a.serviceIdentifier),c=[];return s.length===r.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof a.serviceIdentifier&&t.getConstructorMetadata(a.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(a.serviceIdentifier).toSelf(),s=y(n.container,a.serviceIdentifier)),c=e?s:s.filter((function(t){var e=new d.Request(t.serviceIdentifier,n,o,t,a);return t.constraint(e)})),function(t,e,n,o){switch(e.length){case r.BindingCount.NoBindingsAvailable:if(n.isOptional())return e;var a=u.getServiceIdentifierAsString(t),s=i.NOT_REGISTERED;throw s+=u.listMetadataForTarget(a,n),s+=u.listRegisteredBindingsForServiceIdentifier(o,a,y),new Error(s);case r.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return e;case r.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return e;a=u.getServiceIdentifierAsString(t),s=i.AMBIGUOUS_MATCH+" "+a;throw s+=u.listRegisteredBindingsForServiceIdentifier(o,a,y),new Error(s)}}(a.serviceIdentifier,c,a,n.container),c}function y(t,e){var n=[],r=m(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=y(t.parent,e)),n}e.getBindingDictionary=m,e.plan=function(t,e,n,r,m,y,v,g){void 0===g&&(g=!1);var _=new c.Context(e),E=function(t,e,n,r,i,o){var s=t?a.MULTI_INJECT_TAG:a.INJECT_TAG,u=new f.Metadata(s,n),c=new p.Target(e,r,n,u);if(void 0!==i){var h=new f.Metadata(i,o);c.metadata.push(h)}return c}(n,r,m,"",y,v);try{return function t(e,n,r,a,s,u){var c,f;if(null===s){c=b(e,n,a,null,u),f=new d.Request(r,a,null,c,u);var p=new h.Plan(a,f);a.addPlan(p)}else c=b(e,n,a,s,u),f=s.addChildRequest(u.serviceIdentifier,c,u);c.forEach((function(n){var r=null;if(u.isArray())r=f.addChildRequest(n.serviceIdentifier,n,u);else{if(n.cache)return;r=f}if(n.type===o.BindingTypeEnum.Instance&&null!==n.implementationType){var s=l.getDependencies(e,n.implementationType);if(!a.container.options.skipBaseClassChecks){var c=l.getBaseClassDependencyCount(e,n.implementationType);if(s.length<c){var h=i.ARGUMENTS_LENGTH_MISMATCH(l.getFunctionName(n.implementationType));throw new Error(h)}}s.forEach((function(n){t(e,!1,n.serviceIdentifier,a,r,n)}))}}))}(t,g,m,_,null,E),_}catch(t){throw s.isStackOverflowExeption(t)&&_.plan&&u.circularDependencyToException(_.plan.rootRequest),t}},e.createMockRequest=function(t,e,n,r){var i=new p.Target(o.TargetTypeEnum.Variable,"",e,new f.Metadata(n,r)),a=new c.Context(t);return new d.Request(e,a,null,[],i)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingCount=void 0;e.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Context=void 0;var r=n(28),i=function(){function t(t){this.id=r.id(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}();e.Context=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Plan=void 0;var r=function(t,e){this.parentContext=t,this.rootRequest=e};e.Plan=r},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.getFunctionName=e.getBaseClassDependencyCount=e.getDependencies=void 0;var i=n(96),o=n(12),a=n(20),s=n(9),u=n(45);Object.defineProperty(e,"getFunctionName",{enumerable:!0,get:function(){return u.getFunctionName}});var c=n(97);function f(t,e,n,i){var s=t.getConstructorMetadata(n),u=s.compilerGeneratedMetadata;if(void 0===u){var f=o.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(f)}var d=s.userGeneratedMetadata,p=Object.keys(d),m=0===n.length&&p.length>0,b=p.length>n.length,y=function(t,e,n,r,i){for(var o=[],a=0;a<i;a++){var s=h(a,t,e,n,r);null!==s&&o.push(s)}return o}(i,e,u,d,m||b?p.length:n.length),v=function t(e,n){for(var i=e.getPropertiesMetadata(n),o=[],s=Object.keys(i),u=0,f=s;u<f.length;u++){var h=f[u],d=i[h],p=l(i[h]),m=p.targetName||h,b=p.inject||p.multiInject,y=new c.Target(a.TargetTypeEnum.ClassProperty,m,b);y.metadata=d,o.push(y)}var v=Object.getPrototypeOf(n.prototype).constructor;if(v!==Object){var g=t(e,v);o=r(r([],o),g)}return o}(t,n);return r(r([],y),v)}function h(t,e,n,r,s){var u=s[t.toString()]||[],f=l(u),h=!0!==f.unmanaged,d=r[t],p=f.inject||f.multiInject;if((d=p||d)instanceof i.LazyServiceIdentifer&&(d=d.unwrap()),h){if(!e&&(d===Object||d===Function||void 0===d)){var m=o.MISSING_INJECT_ANNOTATION+" argument "+t+" in class "+n+".";throw new Error(m)}var b=new c.Target(a.TargetTypeEnum.ConstructorArgument,f.targetName,d);return b.metadata=u,b}return null}function l(t){var e={};return t.forEach((function(t){e[t.key.toString()]=t.value})),{inject:e[s.INJECT_TAG],multiInject:e[s.MULTI_INJECT_TAG],targetName:e[s.NAME_TAG],unmanaged:e[s.UNMANAGED_TAG]}}e.getDependencies=function(t,e){return f(t,u.getFunctionName(e),e,!1)},e.getBaseClassDependencyCount=function t(e,n){var r=Object.getPrototypeOf(n.prototype).constructor;if(r!==Object){var i=f(e,u.getFunctionName(r),r,!0),o=i.map((function(t){return t.metadata.filter((function(t){return t.key===s.UNMANAGED_TAG}))})),a=[].concat.apply([],o).length,c=i.length-a;return c>0?c:t(e,r)}return 0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.QueryableString=void 0;var r=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}();e.QueryableString=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Request=void 0;var r=n(28),i=function(){function t(t,e,n,i,o){this.id=r.id(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();e.Request=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.resolve=void 0;var r=n(12),i=n(20),o=n(95),a=n(45),s=n(180),u=function(t,e,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(r.CIRCULAR_DEPENDENCY_IN_FACTORY(t,e.toString())):n}},c=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,o=e.childRequests,f=e.target&&e.target.isArray(),h=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(f&&h)return o.map((function(e){return c(t)(e)}));var l=null;if(!e.target.isOptional()||0!==n.length){var d=n[0],p=d.scope===i.BindingScopeEnum.Singleton,m=d.scope===i.BindingScopeEnum.Request;if(p&&d.activated)return d.cache;if(m&&null!==t&&t.has(d.id))return t.get(d.id);if(d.type===i.BindingTypeEnum.ConstantValue)l=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Function)l=d.cache,d.activated=!0;else if(d.type===i.BindingTypeEnum.Constructor)l=d.implementationType;else if(d.type===i.BindingTypeEnum.DynamicValue&&null!==d.dynamicValue)l=u("toDynamicValue",d.serviceIdentifier,(function(){return d.dynamicValue(e.parentContext)}));else if(d.type===i.BindingTypeEnum.Factory&&null!==d.factory)l=u("toFactory",d.serviceIdentifier,(function(){return d.factory(e.parentContext)}));else if(d.type===i.BindingTypeEnum.Provider&&null!==d.provider)l=u("toProvider",d.serviceIdentifier,(function(){return d.provider(e.parentContext)}));else{if(d.type!==i.BindingTypeEnum.Instance||null===d.implementationType){var b=a.getServiceIdentifierAsString(e.serviceIdentifier);throw new Error(r.INVALID_BINDING_TYPE+" "+b)}l=s.resolveInstance(d.implementationType,o,c(t))}return"function"==typeof d.onActivation&&(l=d.onActivation(e.parentContext,l)),p&&(d.cache=l,d.activated=!0),m&&null!==t&&!t.has(d.id)&&t.set(d.id,l),l}}};e.resolve=function(t){return c(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}},function(t,e,n){"use strict";var r=this&&this.__spreadArray||function(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t};Object.defineProperty(e,"__esModule",{value:!0}),e.resolveInstance=void 0;var i=n(12),o=n(20),a=n(9);e.resolveInstance=function(t,e,n){var s,u,c=null;if(e.length>0){var f=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n);u=f,c=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===o.TargetTypeEnum.ClassProperty})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value();var o=i[n];t[r]=o})),t}(c=new((s=t).bind.apply(s,r([void 0],u))),e,n)}else c=new t;return function(t,e){if(Reflect.hasMetadata(a.POST_CONSTRUCT,t)){var n=Reflect.getMetadata(a.POST_CONSTRUCT,t);try{e[n.value]()}catch(e){throw new Error(i.POST_CONSTRUCT_ERROR(t.name,e.message))}}}(t,c),c}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingToSyntax=void 0;var r=n(12),i=n(20),o=n(182),a=n(98),s=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=i.BindingTypeEnum.Instance,this._binding.implementationType=t,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+r.INVALID_TO_SELF_VALUE);var t=this._binding.serviceIdentifier;return this.to(t)},t.prototype.toConstantValue=function(t){return this._binding.type=i.BindingTypeEnum.ConstantValue,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=i.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=i.BindingTypeEnum.Constructor,this._binding.implementationType=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw new Error(r.INVALID_FUNCTION_BINDING);var e=this.toConstantValue(t);return this._binding.type=i.BindingTypeEnum.Function,this._binding.scope=i.BindingScopeEnum.Singleton,e},t.prototype.toAutoFactory=function(t){return this._binding.type=i.BindingTypeEnum.Factory,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=i.BindingTypeEnum.Provider,this._binding.provider=t,this._binding.scope=i.BindingScopeEnum.Singleton,new a.BindingWhenOnSyntax(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}();e.BindingToSyntax=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInWhenOnSyntax=void 0;var r=n(183),i=n(61),o=n(62),a=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding),this._bindingInSyntax=new r.BindingInSyntax(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}();e.BindingInWhenOnSyntax=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BindingInSyntax=void 0;var r=n(20),i=n(98),o=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=r.BindingScopeEnum.Request,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=r.BindingScopeEnum.Singleton,new i.BindingWhenOnSyntax(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=r.BindingScopeEnum.Transient,new i.BindingWhenOnSyntax(this._binding)},t}();e.BindingInSyntax=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ContainerSnapshot=void 0;var r=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}();e.ContainerSnapshot=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Lookup=void 0;var r=n(12),i=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw new Error(r.NULL_ARGUMENT);if(null==e)throw new Error(r.NULL_ARGUMENT);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);var e=this._map.get(t);if(void 0!==e)return e;throw new Error(r.KEY_NOT_FOUND)},t.prototype.remove=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);if(!this._map.delete(t))throw new Error(r.KEY_NOT_FOUND)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw new Error(r.NULL_ARGUMENT);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}();e.Lookup=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AsyncContainerModule=e.ContainerModule=void 0;var r=n(28),i=function(t){this.id=r.id(),this.registry=t};e.ContainerModule=i;var o=function(t){this.id=r.id(),this.registry=t};e.AsyncContainerModule=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.injectable=void 0;var r=n(12),i=n(9);e.injectable=function(){return function(t){if(Reflect.hasOwnMetadata(i.PARAM_TYPES,t))throw new Error(r.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(i.DESIGN_PARAM_TYPES,t)||[];return Reflect.defineMetadata(i.PARAM_TYPES,e,t),t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tagged=void 0;var r=n(16),i=n(23);e.tagged=function(t,e){return function(n,o,a){var s=new r.Metadata(t,e);"number"==typeof a?i.tagParameter(n,o,a,s):i.tagProperty(n,o,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.named=void 0;var r=n(9),i=n(16),o=n(23);e.named=function(t){return function(e,n,a){var s=new i.Metadata(r.NAMED_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,s):o.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.optional=void 0;var r=n(9),i=n(16),o=n(23);e.optional=function(){return function(t,e,n){var a=new i.Metadata(r.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(t,e,n,a):o.tagProperty(t,e,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.unmanaged=void 0;var r=n(9),i=n(16),o=n(23);e.unmanaged=function(){return function(t,e,n){var a=new i.Metadata(r.UNMANAGED_TAG,!0);o.tagParameter(t,e,n,a)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiInject=void 0;var r=n(9),i=n(16),o=n(23);e.multiInject=function(t){return function(e,n,a){var s=new i.Metadata(r.MULTI_INJECT_TAG,t);"number"==typeof a?o.tagParameter(e,n,a,s):o.tagProperty(e,n,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.targetName=void 0;var r=n(9),i=n(16),o=n(23);e.targetName=function(t){return function(e,n,a){var s=new i.Metadata(r.NAME_TAG,t);o.tagParameter(e,n,a,s)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.postConstruct=void 0;var r=n(12),i=n(9),o=n(16);e.postConstruct=function(){return function(t,e,n){var a=new o.Metadata(i.POST_CONSTRUCT,e);if(Reflect.hasOwnMetadata(i.POST_CONSTRUCT,t.constructor))throw new Error(r.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(i.POST_CONSTRUCT,a,t.constructor)}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.multiBindToService=void 0;e.multiBindToService=function(t){return function(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return n.forEach((function(n){return t.bind(n).toService(e)}))}}}},function(t,e,n){var r=n(4).Buffer,i=n(102),o=n(107),a=n(52),s=n(156),u=n(54);function c(t,e){return r.from(t,e).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function f(t){var e=t.header,n=t.payload,r=t.secret||t.privateKey,i=t.encoding,a=o(e.alg),f=function(t,e,n){n=n||"utf8";var r=c(s(t),"binary"),i=c(s(e),n);return u.format("%s.%s",r,i)}(e,n,i),h=a.sign(f,r);return u.format("%s.%s",f,h)}function h(t){var e=t.secret||t.privateKey||t.key,n=new i(e);this.readable=!0,this.header=t.header,this.encoding=t.encoding,this.secret=this.privateKey=this.key=n,this.payload=new i(t.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}u.inherits(h,a),h.prototype.sign=function(){try{var t=f({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",t),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},h.sign=f,t.exports=h},function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),a=r[0],s=r[1],u=new o(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),f=0,h=s>0?a-4:a;for(n=0;n<h;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=255&e;2===s&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,u[f++]=255&e);1===s&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,u[f++]=e>>8&255,u[f++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,s=n-i;a<s;a+=16383)o.push(f(t,a,a+16383>s?s:a+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],i[a.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var i,o,a=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){
|
|
11
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
12
|
+
e.read=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,f=-7,h=n?i-1:0,l=n?-1:1,d=t[e+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+t[e+h],h+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+t[e+h],h+=l,f-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,f=(1<<c)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=f?(s=0,a=f):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[n+d]=255&a,d+=p,a/=256,c-=8);t[n+d-p]|=128*m}},function(t,e){},function(t,e,n){"use strict";var r=n(4).Buffer,i=n(201);t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,n,i,o=r.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,n=o,i=s,e.copy(n,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(t.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,e){},function(t,e,n){(function(t){var r=void 0!==t&&t||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},e.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(203),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(10))},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var r,i,o,a,s,u=1,c={},f=!1,h=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?r=function(t){e.nextTick((function(){p(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){p(t.data)},r=function(t){o.port2.postMessage(t)}):h&&"onreadystatechange"in h.createElement("script")?(i=h.documentElement,r=function(t){var e=h.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,i.removeChild(e),e=null},i.appendChild(e)}):r=function(t){setTimeout(p,0,t)}:(a="setImmediate$"+Math.random()+"$",s=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(a)&&p(+e.data.slice(a.length))},t.addEventListener?t.addEventListener("message",s,!1):t.attachEvent("onmessage",s),r=function(e){t.postMessage(a+e,"*")}),l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[u]=i,r(u),u++},l.clearImmediate=d}function d(t){delete c[t]}function p(t){if(f)setTimeout(p,0,t);else{var e=c[t];if(e){f=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{d(t),f=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(10),n(7))},function(t,e,n){"use strict";t.exports=o;var r=n(106),i=Object.create(n(46));function o(t){if(!(this instanceof o))return new o(t);r.call(this,t)}i.inherits=n(5),i.inherits(o,r),o.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){t.exports=n(65)},function(t,e,n){t.exports=n(30)},function(t,e,n){t.exports=n(64).Transform},function(t,e,n){t.exports=n(64).PassThrough},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e,n){"use strict";var r=n(6).Buffer,i=n(6).SlowBuffer;function o(t,e){if(!r.isBuffer(t)||!r.isBuffer(e))return!1;if(t.length!==e.length)return!1;for(var n=0,i=0;i<t.length;i++)n|=t[i]^e[i];return 0===n}t.exports=o,o.install=function(){r.prototype.equal=i.prototype.equal=function(t){return o(this,t)}};var a=r.prototype.equal,s=i.prototype.equal;o.restore=function(){r.prototype.equal=a,i.prototype.equal=s}},function(t,e,n){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=n(35),e.createHash=e.Hash=n(47),e.createHmac=e.Hmac=n(117);var r=n(226),i=Object.keys(r),o=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(i);e.getHashes=function(){return o};var a=n(120);e.pbkdf2=a.pbkdf2,e.pbkdf2Sync=a.pbkdf2Sync;var s=n(228);e.Cipher=s.Cipher,e.createCipher=s.createCipher,e.Cipheriv=s.Cipheriv,e.createCipheriv=s.createCipheriv,e.Decipher=s.Decipher,e.createDecipher=s.createDecipher,e.Decipheriv=s.Decipheriv,e.createDecipheriv=s.createDecipheriv,e.getCiphers=s.getCiphers,e.listCiphers=s.listCiphers;var u=n(243);e.DiffieHellmanGroup=u.DiffieHellmanGroup,e.createDiffieHellmanGroup=u.createDiffieHellmanGroup,e.getDiffieHellman=u.getDiffieHellman,e.createDiffieHellman=u.createDiffieHellman,e.DiffieHellman=u.DiffieHellman;var c=n(250);e.createSign=c.createSign,e.Sign=c.Sign,e.createVerify=c.createVerify,e.Verify=c.Verify,e.createECDH=n(291);var f=n(294);e.publicEncrypt=f.publicEncrypt,e.privateEncrypt=f.privateEncrypt,e.publicDecrypt=f.publicDecrypt,e.privateDecrypt=f.privateDecrypt;var h=n(298);e.randomFill=h.randomFill,e.randomFillSync=h.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,e,n){
|
|
13
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
14
|
+
var r=n(6),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},function(t,e,n){(e=t.exports=n(109)).Stream=e,e.Readable=e,e.Writable=n(113),e.Duplex=n(38),e.Transform=n(114),e.PassThrough=n(219),e.finished=n(68),e.pipeline=n(220)},function(t,e){},function(t,e,n){"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=n(6).Buffer,s=n(216).inspect,u=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,n,c;return e=t,(n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,n,r,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,a.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,n),c&&o(e,c),t}()},function(t,e){},function(t,e,n){"use strict";(function(e){var r;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(68),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var n=t[l].read();null!==n&&(t[f]=null,t[a]=null,t[s]=null,e(d(n,!1)))}}function m(t){e.nextTick(p,t)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(r={get stream(){return this[l]},next:function(){var t=this,n=this[u];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise((function(n,r){e.nextTick((function(){t[u]?r(t[u]):n(d(void 0,!0))}))}));var r,i=this[f];if(i)r=new Promise(function(t,e){return function(n,r){t.then((function(){e[c]?n(d(void 0,!0)):e[h](n,r)}),r)}}(i,this));else{var o=this[l].read();if(null!==o)return Promise.resolve(d(o,!1));r=new Promise(this[h])}return this[f]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,n){t[l].destroy(null,(function(t){t?n(t):e(d(void 0,!0))}))}))})),r),b);t.exports=function(t){var e,n=Object.create(y,(i(e={},l,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var r=n[l].read();r?(n[f]=null,n[a]=null,n[s]=null,t(d(r,!1))):(n[a]=t,n[s]=e)},writable:!0}),e));return n[f]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[s];return null!==e&&(n[f]=null,n[a]=null,n[s]=null,e(t)),void(n[u]=t)}var r=n[a];null!==r&&(n[f]=null,n[a]=null,n[s]=null,r(d(void 0,!0))),n[c]=!0})),t.on("readable",m.bind(null,n)),n}}).call(this,n(7))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,n){"use strict";t.exports=i;var r=n(114);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(37)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";var r;var i=n(36).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===r&&(r=n(68)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function c(t){t()}function f(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=h(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,n){var o=n<e.length-1;return u(t,o,n>0,(function(t){r||(r=t),t&&a.forEach(c),o||(a.forEach(c),i(r))}))}));return e.reduce(f)}},function(t,e,n){var r=n(5),i=n(39),o=n(4).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<30|t>>>2}function f(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,h=0;h<16;++h)n[h]=t.readInt32BE(4*h);for(;h<80;++h)n[h]=n[h-3]^n[h-8]^n[h-14]^n[h-16];for(var l=0;l<80;++l){var d=~~(l/20),p=0|((e=r)<<5|e>>>27)+f(d,i,o,s)+u+n[l]+a[d];u=s,s=o,o=c(i),i=r,r=p}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,n){var r=n(5),i=n(39),o=n(4).Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}function c(t){return t<<5|t>>>27}function f(t){return t<<30|t>>>2}function h(t,e,n,r){return 0===t?e&n|~e&r:2===t?e&n|e&r|n&r:e^n^r}r(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,n=this._w,r=0|this._a,i=0|this._b,o=0|this._c,s=0|this._d,u=0|this._e,l=0;l<16;++l)n[l]=t.readInt32BE(4*l);for(;l<80;++l)n[l]=(e=n[l-3]^n[l-8]^n[l-14]^n[l-16])<<1|e>>>31;for(var d=0;d<80;++d){var p=~~(d/20),m=c(r)+h(p,i,o,s)+u+n[d]+a[p]|0;u=s,s=o,o=f(i),i=r,r=m}this._a=r+this._a|0,this._b=i+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=u+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=u},function(t,e,n){var r=n(5),i=n(115),o=n(39),a=n(4).Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}r(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=u},function(t,e,n){var r=n(5),i=n(116),o=n(39),a=n(4).Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}r(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,n,r){t.writeInt32BE(e,r),t.writeInt32BE(n,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},t.exports=u},function(t,e,n){"use strict";var r=n(5),i=n(4).Buffer,o=n(24),a=i.alloc(128);function s(t,e){o.call(this,"digest"),"string"==typeof e&&(e=i.from(e)),this._alg=t,this._key=e,e.length>64?e=t(e):e.length<64&&(e=i.concat([e,a],64));for(var n=this._ipad=i.allocUnsafe(64),r=this._opad=i.allocUnsafe(64),s=0;s<64;s++)n[s]=54^e[s],r[s]=92^e[s];this._hash=[n]}r(s,o),s.prototype._update=function(t){this._hash.push(t)},s.prototype._final=function(){var t=this._alg(i.concat(this._hash));return this._alg(i.concat([this._opad,t]))},t.exports=s},function(t,e,n){t.exports=n(119)},function(t,e,n){(function(e){var r,i,o=n(4).Buffer,a=n(121),s=n(122),u=n(123),c=n(124),f=e.crypto&&e.crypto.subtle,h={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},l=[];function d(){return i||(i=e.process&&e.process.nextTick?e.process.nextTick:e.queueMicrotask?e.queueMicrotask:e.setImmediate?e.setImmediate:e.setTimeout)}function p(t,e,n,r,i){return f.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return f.deriveBits({name:"PBKDF2",salt:e,iterations:n,hash:{name:i}},t,r<<3)})).then((function(t){return o.from(t)}))}t.exports=function(t,n,i,m,b,y){"function"==typeof b&&(y=b,b=void 0);var v=h[(b=b||"sha1").toLowerCase()];if(v&&"function"==typeof e.Promise){if(a(i,m),t=c(t,s,"Password"),n=c(n,s,"Salt"),"function"!=typeof y)throw new Error("No callback provided to pbkdf2");!function(t,e){t.then((function(t){d()((function(){e(null,t)}))}),(function(t){d()((function(){e(t)}))}))}(function(t){if(e.process&&!e.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==l[t])return l[t];var n=p(r=r||o.alloc(8),r,10,128,t).then((function(){return!0})).catch((function(){return!1}));return l[t]=n,n}(v).then((function(e){return e?p(t,n,i,m,v):u(t,n,i,m,b)})),y)}else d()((function(){var e;try{e=u(t,n,i,m,b)}catch(t){return y(t)}y(null,e)}))}}).call(this,n(10))},function(t,e,n){var r=n(229),i=n(72),o=n(73),a=n(242),s=n(56);function u(t,e,n){if(t=t.toLowerCase(),o[t])return i.createCipheriv(t,e,n);if(a[t])return new r({key:e,iv:n,mode:t});throw new TypeError("invalid suite type")}function c(t,e,n){if(t=t.toLowerCase(),o[t])return i.createDecipheriv(t,e,n);if(a[t])return new r({key:e,iv:n,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}e.createCipher=e.Cipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");n=8*a[t].key,r=a[t].iv}var i=s(e,!1,n,r);return u(t,i.key,i.iv)},e.createCipheriv=e.Cipheriv=u,e.createDecipher=e.Decipher=function(t,e){var n,r;if(t=t.toLowerCase(),o[t])n=o[t].key,r=o[t].iv;else{if(!a[t])throw new TypeError("invalid suite type");n=8*a[t].key,r=a[t].iv}var i=s(e,!1,n,r);return c(t,i.key,i.iv)},e.createDecipheriv=e.Decipheriv=c,e.listCiphers=e.getCiphers=function(){return Object.keys(a).concat(i.getCiphers())}},function(t,e,n){var r=n(24),i=n(230),o=n(5),a=n(4).Buffer,s={"des-ede3-cbc":i.CBC.instantiate(i.EDE),"des-ede3":i.EDE,"des-ede-cbc":i.CBC.instantiate(i.EDE),"des-ede":i.EDE,"des-cbc":i.CBC.instantiate(i.DES),"des-ecb":i.DES};function u(t){r.call(this);var e,n=t.mode.toLowerCase(),i=s[n];e=t.decrypt?"decrypt":"encrypt";var o=t.key;a.isBuffer(o)||(o=a.from(o)),"des-ede"!==n&&"des-ede-cbc"!==n||(o=a.concat([o,o.slice(0,8)]));var u=t.iv;a.isBuffer(u)||(u=a.from(u)),this._des=i.create({key:o,iv:u,type:e})}s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=u,o(u,r),u.prototype._update=function(t){return a.from(this._des.update(t))},u.prototype._final=function(){return a.from(this._des.final())}},function(t,e,n){"use strict";e.utils=n(125),e.Cipher=n(71),e.DES=n(126),e.CBC=n(231),e.EDE=n(232)},function(t,e,n){"use strict";var r=n(14),i=n(5),o={};function a(t){r.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;e<this.iv.length;e++)this.iv[e]=t[e]}e.instantiate=function(t){function e(e){t.call(this,e),this._cbcInit()}i(e,t);for(var n=Object.keys(o),r=0;r<n.length;r++){var a=n[r];e.prototype[a]=o[a]}return e.create=function(t){return new e(t)},e},o._cbcInit=function(){var t=new a(this.options.iv);this._cbcState=t},o._update=function(t,e,n,r){var i=this._cbcState,o=this.constructor.super_.prototype,a=i.iv;if("encrypt"===this.type){for(var s=0;s<this.blockSize;s++)a[s]^=t[e+s];o._update.call(this,a,0,n,r);for(s=0;s<this.blockSize;s++)a[s]=n[r+s]}else{o._update.call(this,t,e,n,r);for(s=0;s<this.blockSize;s++)n[r+s]^=a[s];for(s=0;s<this.blockSize;s++)a[s]=t[e+s]}}},function(t,e,n){"use strict";var r=n(14),i=n(5),o=n(71),a=n(126);function s(t,e){r.equal(e.length,24,"Invalid key length");var n=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[a.create({type:"encrypt",key:n}),a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:o})]:[a.create({type:"decrypt",key:o}),a.create({type:"encrypt",key:i}),a.create({type:"decrypt",key:n})]}function u(t){o.call(this,t);var e=new s(this.type,this.options.key);this._edeState=e}i(u,o),t.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,n,r){var i=this._edeState;i.ciphers[0]._update(t,e,n,r),i.ciphers[1]._update(n,r,n,r),i.ciphers[2]._update(n,r,n,r)},u.prototype._pad=a.prototype._pad,u.prototype._unpad=a.prototype._unpad},function(t,e,n){var r=n(73),i=n(130),o=n(4).Buffer,a=n(131),s=n(24),u=n(55),c=n(56);function f(t,e,n){s.call(this),this._cache=new l,this._cipher=new u.AES(e),this._prev=o.from(n),this._mode=t,this._autopadding=!0}n(5)(f,s),f.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get();)n=this._mode.encrypt(this,e),r.push(n);return o.concat(r)};var h=o.alloc(16,16);function l(){this.cache=o.allocUnsafe(0)}function d(t,e,n){var s=r[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof n&&(n=o.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===s.type?new a(s.module,e,n):"auth"===s.type?new i(s.module,e,n):new f(s.module,e,n)}f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},l.prototype.add=function(t){this.cache=o.concat([this.cache,t])},l.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},l.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),n=-1;++n<t;)e.writeUInt8(t,n);return o.concat([this.cache,e])},e.createCipheriv=d,e.createCipher=function(t,e){var n=r[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=c(e,!1,n.key,n.iv);return d(t,i.key,i.iv)}},function(t,e){e.encrypt=function(t,e){return t._cipher.encryptBlock(e)},e.decrypt=function(t,e){return t._cipher.decryptBlock(e)}},function(t,e,n){var r=n(48);e.encrypt=function(t,e){var n=r(e,t._prev);return t._prev=t._cipher.encryptBlock(n),t._prev},e.decrypt=function(t,e){var n=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return r(i,n)}},function(t,e,n){var r=n(4).Buffer,i=n(48);function o(t,e,n){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=r.concat([t._prev,n?e:a]),a}e.encrypt=function(t,e,n){for(var i,a=r.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=r.allocUnsafe(0)),!(t._cache.length<=e.length)){a=r.concat([a,o(t,e,n)]);break}i=t._cache.length,a=r.concat([a,o(t,e.slice(0,i),n)]),e=e.slice(i)}return a}},function(t,e,n){var r=n(4).Buffer;function i(t,e,n){var i=t._cipher.encryptBlock(t._prev)[0]^e;return t._prev=r.concat([t._prev.slice(1),r.from([n?e:i])]),i}e.encrypt=function(t,e,n){for(var o=e.length,a=r.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],n);return a}},function(t,e,n){var r=n(4).Buffer;function i(t,e,n){for(var r,i,a=-1,s=0;++a<8;)r=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^r))>>a%8,t._prev=o(t._prev,n?r:i);return s}function o(t,e){var n=t.length,i=-1,o=r.allocUnsafe(t.length);for(t=r.concat([t,r.from([e])]);++i<n;)o[i]=t[i]<<1|t[i+1]>>7;return o}e.encrypt=function(t,e,n){for(var o=e.length,a=r.allocUnsafe(o),s=-1;++s<o;)a[s]=i(t,e[s],n);return a}},function(t,e,n){(function(t){var r=n(48);function i(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}e.encrypt=function(e,n){for(;e._cache.length<n.length;)e._cache=t.concat([e._cache,i(e)]);var o=e._cache.slice(0,n.length);return e._cache=e._cache.slice(n.length),r(n,o)}}).call(this,n(6).Buffer)},function(t,e,n){var r=n(4).Buffer,i=r.alloc(16,0);function o(t){var e=r.allocUnsafe(16);return e.writeUInt32BE(t[0]>>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e<t.length;)this.state[e]^=t[e];this._multiply()},a.prototype._multiply=function(){for(var t,e,n,r=[(t=this.h).readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)],i=[0,0,0,0],a=-1;++a<128;){for(0!=(this.state[~~(a/8)]&1<<7-a%8)&&(i[0]^=r[0],i[1]^=r[1],i[2]^=r[2],i[3]^=r[3]),n=0!=(1&r[3]),e=3;e>0;e--)r[e]=r[e]>>>1|(1&r[e-1])<<31;r[0]=r[0]>>>1,n&&(r[0]=r[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=r.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(r.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},t.exports=a},function(t,e,n){var r=n(130),i=n(4).Buffer,o=n(73),a=n(131),s=n(24),u=n(55),c=n(56);function f(t,e,n){s.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(e),this._prev=i.from(n),this._mode=t,this._autopadding=!0}function h(){this.cache=i.allocUnsafe(0)}function l(t,e,n){var s=o[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=i.from(n)),"GCM"!==s.mode&&n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);if("string"==typeof e&&(e=i.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);return"stream"===s.type?new a(s.module,e,n,!0):"auth"===s.type?new r(s.module,e,n,!0):new f(s.module,e,n)}n(5)(f,s),f.prototype._update=function(t){var e,n;this._cache.add(t);for(var r=[];e=this._cache.get(this._autopadding);)n=this._mode.decrypt(this,e),r.push(n);return i.concat(r)},f.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function(t){var e=t[15];if(e<1||e>16)throw new Error("unable to decrypt data");var n=-1;for(;++n<e;)if(t[n+(16-e)]!==e)throw new Error("unable to decrypt data");if(16===e)return;return t.slice(0,16-e)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},f.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},h.prototype.add=function(t){this.cache=i.concat([this.cache,t])},h.prototype.get=function(t){var e;if(t){if(this.cache.length>16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},e.createDecipher=function(t,e){var n=o[t.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var r=c(e,!1,n.key,n.iv);return l(t,r.key,r.iv)},e.createDecipheriv=l},function(t,e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}},function(t,e,n){(function(t){var r=n(132),i=n(248),o=n(249);var a={binary:!0,hex:!0,base64:!0};e.DiffieHellmanGroup=e.createDiffieHellmanGroup=e.getDiffieHellman=function(e){var n=new t(i[e].prime,"hex"),r=new t(i[e].gen,"hex");return new o(n,r)},e.createDiffieHellman=e.DiffieHellman=function e(n,i,s,u){return t.isBuffer(i)||void 0===a[i]?e(n,"binary",i,s):(i=i||"binary",u=u||"binary",s=s||new t([2]),t.isBuffer(s)||(s=new t(s,u)),"number"==typeof n?new o(r(n,s),s,!0):(t.isBuffer(n)||(n=new t(n,i)),new o(n,s,!0)))}}).call(this,n(6).Buffer)},function(t,e){},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(246).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:f[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new b).mulp(t,e,n)}function b(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},b.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},b.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},b.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},b.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},b.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},b.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(g,v),g.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},w.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},i(S,w),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e){},function(t,e){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,e,n){(function(e){var r=n(133),i=new(n(134)),o=new r(24),a=new r(11),s=new r(10),u=new r(3),c=new r(7),f=n(132),h=n(35);function l(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this._pub=new r(t),this}function d(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this._priv=new r(t),this}t.exports=m;var p={};function m(t,e,n){this.setGenerator(e),this.__prime=new r(t),this._prime=r.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,n?(this.setPublicKey=l,this.setPrivateKey=d):this._primeCode=8}function b(t,n){var r=new e(t.toArray());return n?r.toString(n):r}Object.defineProperty(m.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(t,e){var n=e.toString("hex"),r=[n,t.toString(16)].join("_");if(r in p)return p[r];var h,l=0;if(t.isEven()||!f.simpleSieve||!f.fermatTest(t)||!i.test(t))return l+=1,l+="02"===n||"05"===n?8:4,p[r]=l,l;switch(i.test(t.shrn(1))||(l+=2),n){case"02":t.mod(o).cmp(a)&&(l+=8);break;case"05":(h=t.mod(s)).cmp(u)&&h.cmp(c)&&(l+=8);break;default:l+=4}return p[r]=l,l}(this.__prime,this.__gen)),this._primeCode}}),m.prototype.generateKeys=function(){return this._priv||(this._priv=new r(h(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},m.prototype.computeSecret=function(t){var n=(t=(t=new r(t)).toRed(this._prime)).redPow(this._priv).fromRed(),i=new e(n.toArray()),o=this.getPrime();if(i.length<o.length){var a=new e(o.length-i.length);a.fill(0),i=e.concat([a,i])}return i},m.prototype.getPublicKey=function(t){return b(this._pub,t)},m.prototype.getPrivateKey=function(t){return b(this._priv,t)},m.prototype.getPrime=function(t){return b(this.__prime,t)},m.prototype.getGenerator=function(t){return b(this._gen,t)},m.prototype.setGenerator=function(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this.__gen=t,this._gen=new r(t),this}}).call(this,n(6).Buffer)},function(t,e,n){var r=n(75).Buffer,i=n(47),o=n(251),a=n(41),s=n(259),u=n(290),c=n(119);function f(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){o.Writable.call(this);var e=c[t];if(!e)throw new Error("Unknown message digest");this._hash=i(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){return new f(t)}function d(t){return new h(t)}Object.keys(c).forEach((function(t){c[t].id=r.from(c[t].id,"hex"),c[t.toLowerCase()]=c[t]})),a(f,o.Writable),f.prototype._write=function(t,e,n){this._hash.update(t),n()},f.prototype.update=function(t,e){return"string"==typeof t&&(t=r.from(t,e)),this._hash.update(t),this},f.prototype.sign=function(t,e){this.end();var n=this._hash.digest(),r=s(n,t,this._hashType,this._signType,this._tag);return e?r.toString(e):r},a(h,o.Writable),h.prototype._write=function(t,e,n){this._hash.update(t),n()},h.prototype.update=function(t,e){return"string"==typeof t&&(t=r.from(t,e)),this._hash.update(t),this},h.prototype.verify=function(t,e,n){"string"==typeof e&&(e=r.from(e,n)),this.end();var i=this._hash.digest();return u(e,i,t,this._signType,this._tag)},t.exports={Sign:l,Verify:d,createSign:l,createVerify:d}},function(t,e,n){(e=t.exports=n(135)).Stream=e,e.Readable=e,e.Writable=n(139),e.Duplex=n(42),e.Transform=n(140),e.PassThrough=n(257),e.finished=n(76),e.pipeline=n(258)},function(t,e){},function(t,e,n){"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=n(6).Buffer,s=n(254).inspect,u=s&&s.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,n,c;return e=t,(n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return a.alloc(0);for(var e,n,r,i=a.allocUnsafe(t>>>0),o=this.head,s=0;o;)e=o.data,n=i,r=s,a.prototype.copy.call(e,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,o=t>i.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=a.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:u,value:function(t,e){return s(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}])&&o(e.prototype,n),c&&o(e,c),t}()},function(t,e){},function(t,e,n){"use strict";(function(e){var r;function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(76),a=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),c=Symbol("ended"),f=Symbol("lastPromise"),h=Symbol("handlePromise"),l=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[a];if(null!==e){var n=t[l].read();null!==n&&(t[f]=null,t[a]=null,t[s]=null,e(d(n,!1)))}}function m(t){e.nextTick(p,t)}var b=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(r={get stream(){return this[l]},next:function(){var t=this,n=this[u];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(d(void 0,!0));if(this[l].destroyed)return new Promise((function(n,r){e.nextTick((function(){t[u]?r(t[u]):n(d(void 0,!0))}))}));var r,i=this[f];if(i)r=new Promise(function(t,e){return function(n,r){t.then((function(){e[c]?n(d(void 0,!0)):e[h](n,r)}),r)}}(i,this));else{var o=this[l].read();if(null!==o)return Promise.resolve(d(o,!1));r=new Promise(this[h])}return this[f]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var t=this;return new Promise((function(e,n){t[l].destroy(null,(function(t){t?n(t):e(d(void 0,!0))}))}))})),r),b);t.exports=function(t){var e,n=Object.create(y,(i(e={},l,{value:t,writable:!0}),i(e,a,{value:null,writable:!0}),i(e,s,{value:null,writable:!0}),i(e,u,{value:null,writable:!0}),i(e,c,{value:t._readableState.endEmitted,writable:!0}),i(e,h,{value:function(t,e){var r=n[l].read();r?(n[f]=null,n[a]=null,n[s]=null,t(d(r,!1))):(n[a]=t,n[s]=e)},writable:!0}),e));return n[f]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[s];return null!==e&&(n[f]=null,n[a]=null,n[s]=null,e(t)),void(n[u]=t)}var r=n[a];null!==r&&(n[f]=null,n[a]=null,n[s]=null,r(d(void 0,!0))),n[c]=!0})),t.on("readable",m.bind(null,n)),n}}).call(this,n(7))},function(t,e){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,e,n){"use strict";t.exports=i;var r=n(140);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(41)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},function(t,e,n){"use strict";var r;var i=n(40).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(t){if(t)throw t}function u(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var s=!1;t.on("close",(function(){s=!0})),void 0===r&&(r=n(76)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);s=!0,o()}));var u=!1;return function(e){if(!s&&!u)return u=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function c(t){t()}function f(t,e){return t.pipe(e)}function h(t){return t.length?"function"!=typeof t[t.length-1]?s:t.pop():s}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r,i=h(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new o("streams");var a=e.map((function(t,n){var o=n<e.length-1;return u(t,o,n>0,(function(t){r||(r=t),t&&a.forEach(c),o||(a.forEach(c),i(r))}))}));return e.reduce(f)}},function(t,e,n){var r=n(75).Buffer,i=n(117),o=n(77),a=n(79).ec,s=n(78),u=n(58),c=n(152);function f(t,e,n,o){if((t=r.from(t.toArray())).length<e.byteLength()){var a=r.alloc(e.byteLength()-t.length);t=r.concat([a,t])}var s=n.length,u=function(t,e){t=(t=h(t,e)).mod(e);var n=r.from(t.toArray());if(n.length<e.byteLength()){var i=r.alloc(e.byteLength()-n.length);n=r.concat([i,n])}return n}(n,e),c=r.alloc(s);c.fill(1);var f=r.alloc(s);return f=i(o,f).update(c).update(r.from([0])).update(t).update(u).digest(),c=i(o,f).update(c).digest(),{k:f=i(o,f).update(c).update(r.from([1])).update(t).update(u).digest(),v:c=i(o,f).update(c).digest()}}function h(t,e){var n=new s(t),r=(t.length<<3)-e.bitLength();return r>0&&n.ishrn(r),n}function l(t,e,n){var o,a;do{for(o=r.alloc(0);8*o.length<t.bitLength();)e.v=i(n,e.k).update(e.v).digest(),o=r.concat([o,e.v]);a=h(o,t),e.k=i(n,e.k).update(e.v).update(r.from([0])).digest(),e.v=i(n,e.k).update(e.v).digest()}while(-1!==a.cmp(t));return a}function d(t,e,n,r){return t.toRed(s.mont(n)).redPow(e).fromRed().mod(r)}t.exports=function(t,e,n,i,p){var m=u(e);if(m.curve){if("ecdsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");return function(t,e){var n=c[e.curve.join(".")];if(!n)throw new Error("unknown curve "+e.curve.join("."));var i=new a(n).keyFromPrivate(e.privateKey).sign(t);return r.from(i.toDER())}(t,m)}if("dsa"===m.type){if("dsa"!==i)throw new Error("wrong private key type");return function(t,e,n){var i,o=e.params.priv_key,a=e.params.p,u=e.params.q,c=e.params.g,p=new s(0),m=h(t,u).mod(u),b=!1,y=f(o,u,t,n);for(;!1===b;)i=l(u,y,n),p=d(c,i,a,u),0===(b=i.invm(u).imul(m.add(o.mul(p))).mod(u)).cmpn(0)&&(b=!1,p=new s(0));return function(t,e){t=t.toArray(),e=e.toArray(),128&t[0]&&(t=[0].concat(t));128&e[0]&&(e=[0].concat(e));var n=[48,t.length+e.length+4,2,t.length];return n=n.concat(t,[2,e.length],e),r.from(n)}(p,b)}(t,m,n)}if("rsa"!==i&&"ecdsa/rsa"!==i)throw new Error("wrong private key type");t=r.concat([p,t]);for(var b=m.modulus.byteLength(),y=[0,1];t.length+y.length+1<b;)y.push(255);y.push(0);for(var v=-1;++v<t.length;)y.push(t[v]);return o(y,m)},t.exports.getKey=f,t.exports.makeKey=l},function(t,e){},function(t){t.exports=JSON.parse('{"_args":[["elliptic@6.5.4","/home/ankit/development/sunbird-mobile-sdk"]],"_development":true,"_from":"elliptic@6.5.4","_id":"elliptic@6.5.4","_inBundle":false,"_integrity":"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==","_location":"/elliptic","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"elliptic@6.5.4","name":"elliptic","escapedName":"elliptic","rawSpec":"6.5.4","saveSpec":null,"fetchSpec":"6.5.4"},"_requiredBy":["/browserify-sign","/create-ecdh"],"_resolved":"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz","_spec":"6.5.4","_where":"/home/ankit/development/sunbird-mobile-sdk","author":{"name":"Fedor Indutny","email":"fedor@indutny.com"},"bugs":{"url":"https://github.com/indutny/elliptic/issues"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},"description":"EC cryptography","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"files":["lib"],"homepage":"https://github.com/indutny/elliptic","keywords":["EC","Elliptic","curve","Cryptography"],"license":"MIT","main":"lib/elliptic.js","name":"elliptic","repository":{"type":"git","url":"git+ssh://git@github.com/indutny/elliptic.git"},"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","test":"npm run lint && npm run unit","unit":"istanbul test _mocha --reporter=spec test/index.js","version":"grunt dist && git add dist/"},"version":"6.5.4"}')},function(t,e){},function(t,e,n){"use strict";var r=n(15),i=n(21),o=n(80),a=n(57),s=r.assert;function u(t){a.call(this,"short",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,n,r){a.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(e,16),this.y=new i(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(t,e,n,r){a.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(e,16),this.y=new i(n,16),this.z=new i(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,a),t.exports=u,u.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new i(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new i(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],s(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:n,basis:t.basis?t.basis.map((function(t){return{a:new i(t.a,16),b:new i(t.b,16)}})):this._getEndoBasis(n)}}},u.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:i.mont(t),n=new i(2).toRed(e).redInvm(),r=n.redNeg(),o=new i(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(o).fromRed(),r.redSub(o).fromRed()]},u.prototype._getEndoBasis=function(t){for(var e,n,r,o,a,s,u,c,f,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=t,d=this.n.clone(),p=new i(1),m=new i(0),b=new i(0),y=new i(1),v=0;0!==l.cmpn(0);){var g=d.div(l);c=d.sub(g.mul(l)),f=b.sub(g.mul(p));var _=y.sub(g.mul(m));if(!r&&c.cmp(h)<0)e=u.neg(),n=p,r=c.neg(),o=f;else if(r&&2==++v)break;u=c,d=l,l=c,b=p,p=f,y=m,m=_}a=c.neg(),s=f;var E=r.sqr().add(o.sqr());return a.sqr().add(s.sqr()).cmp(E)>=0&&(a=e,s=n),r.negative&&(r=r.neg(),o=o.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:r,b:o},{a:a,b:s}]},u.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var o=r.fromRed().isOdd();return(e&&!o||!e&&o)&&(r=r.redNeg()),this.point(t,r)},u.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),f=0;f<2*o;f++)r[f]=null,i[f]=null;return c},o(c,a.BasePoint),u.prototype.point=function(t,e,n){return new c(this,t,e,n)},u.prototype.pointFromJSON=function(t,e){return c.fromJSON(this,t,e)},c.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new i(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,a.BasePoint),u.prototype.jpoint=function(t,e,n){return new f(this,t,e,n)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),f=c.redMul(s),h=r.redMul(c),l=u.redSqr().redIAdd(f).redISub(h).redISub(h),d=u.redMul(h.redISub(l)).redISub(o.redMul(f)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(l,d,p)},f.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),f=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(f).redISub(f),l=s.redMul(f.redISub(h)).redISub(i.redMul(c)),d=this.z.redMul(a);return this.curve.jpoint(h,l,d)},f.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var f=o.redSqr(),h=c.redSqr(),l=h.redSqr(),d=f.redAdd(f).redIAdd(f).redIAdd(r.redMul(u)),p=o.redMul(h),m=d.redSqr().redISub(p.redAdd(p)),b=p.redISub(m),y=d.redMul(b);y=y.redIAdd(y).redISub(l);var v=c.redMul(s);e+1<t&&(u=u.redMul(l)),o=m,s=v,c=y}return this.curve.jpoint(o,c.redMul(i),s)},f.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},f.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var f=this.x.redSqr(),h=this.y.redSqr(),l=h.redSqr(),d=this.x.redAdd(h).redSqr().redISub(f).redISub(l);d=d.redIAdd(d);var p=f.redAdd(f).redIAdd(f),m=p.redSqr(),b=l.redIAdd(l);b=(b=b.redIAdd(b)).redIAdd(b),t=m.redISub(d).redISub(d),e=p.redMul(d.redISub(t)).redISub(b),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},f.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var f=this.z.redSqr(),h=this.y.redSqr(),l=this.x.redMul(h),d=this.x.redSub(f).redMul(this.x.redAdd(f));d=d.redAdd(d).redIAdd(d);var p=l.redIAdd(l),m=(p=p.redIAdd(p)).redAdd(p);t=d.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(f);var b=h.redSqr();b=(b=(b=b.redIAdd(b)).redIAdd(b)).redIAdd(b),e=d.redMul(p.redISub(t)).redISub(b)}return this.curve.jpoint(t,e,n)},f.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),f=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(f),l=a.redSqr();l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=s.redMul(h).redISub(l),p=n.redAdd(n).redMul(r);return this.curve.jpoint(f,d,p)},f.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),f=e.redMul(c);f=(f=f.redIAdd(f)).redIAdd(f);var h=this.x.redMul(s).redISub(f);h=(h=h.redIAdd(h)).redIAdd(h);var l=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));l=(l=(l=l.redIAdd(l)).redIAdd(l)).redIAdd(l);var d=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,l,d)},f.prototype.mul=function(t,e){return t=new i(t,e),this.curve._wnafMul(this,t)},f.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},f.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(t,e,n){"use strict";var r=n(21),i=n(80),o=n(57),a=n(15);function s(t){o.call(this,"mont",t),this.a=new r(t.a,16).toRed(this.red),this.b=new r(t.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function u(t,e,n){o.BasePoint.call(this,t,"projective"),null===e&&null===n?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(e,16),this.z=new r(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(s,o),t.exports=s,s.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),r=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e);return 0===r.redSqrt().redSqr().cmp(r)},i(u,o.BasePoint),s.prototype.decodePoint=function(t,e){return this.point(a.toArray(t,e),1)},s.prototype.point=function(t,e){return new u(this,t,e)},s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},u.prototype.precompute=function(){},u.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},u.fromJSON=function(t,e){return new u(t,e[0],e[1]||t.one)},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},u.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),n=t.redSub(e),r=t.redMul(e),i=n.redMul(e.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},u.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(n),a=i.redMul(r),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},u.prototype.mul=function(t){for(var e=t.clone(),n=this,r=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(n=n.diffAdd(r,this),r=r.dbl()):(r=n.diffAdd(r,this),n=n.dbl());return r},u.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},u.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},u.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(t,e,n){"use strict";var r=n(15),i=n(21),o=n(80),a=n(57),s=r.assert;function u(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,a.call(this,"edwards",t),this.a=new i(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function c(t,e,n,r,o){a.BasePoint.call(this,t,"projective"),null===e&&null===n&&null===r?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(e,16),this.y=new i(n,16),this.z=r?new i(r,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(u,a),t.exports=u,u.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},u.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},u.prototype.jpoint=function(t,e,n,r){return this.point(t,e,n,r)},u.prototype.pointFromX=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=r.redMul(o.redInvm()),s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");var u=s.fromRed().isOdd();return(e&&!u||!e&&u)&&(s=s.redNeg()),this.point(t,s)},u.prototype.pointFromY=function(t,e){(t=new i(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr(),r=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=r.redMul(o.redInvm());if(0===a.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var s=a.redSqrt();if(0!==s.redSqr().redSub(a).cmp(this.zero))throw new Error("invalid point");return s.fromRed().isOdd()!==e&&(s=s.redNeg()),this.point(s,t)},u.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),r=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return 0===r.cmp(i)},o(c,a.BasePoint),u.prototype.pointFromJSON=function(t){return c.fromJSON(this,t)},u.prototype.point=function(t,e,n,r){return new c(this,t,e,n,r)},c.fromJSON=function(t,e){return new c(t,e[0],e[1],e[2])},c.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=r.redAdd(e),a=o.redSub(n),s=r.redSub(e),u=i.redMul(a),c=o.redMul(s),f=i.redMul(s),h=a.redMul(o);return this.curve.point(u,c,h,f)},c.prototype._projDbl=function(){var t,e,n,r,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),u=this.y.redSqr();if(this.curve.twisted){var c=(r=this.curve._mulA(s)).redAdd(u);this.zOne?(t=a.redSub(s).redSub(u).redMul(c.redSub(this.curve.two)),e=c.redMul(r.redSub(u)),n=c.redSqr().redSub(c).redSub(c)):(i=this.z.redSqr(),o=c.redSub(i).redISub(i),t=a.redSub(s).redISub(u).redMul(o),e=c.redMul(r.redSub(u)),n=c.redMul(o))}else r=s.redAdd(u),i=this.curve._mulC(this.z).redSqr(),o=r.redSub(i).redSub(i),t=this.curve._mulC(a.redISub(r)).redMul(o),e=this.curve._mulC(r).redMul(s.redISub(u)),n=r.redMul(o);return this.curve.point(t,e,n)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),r=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=n.redSub(e),a=i.redSub(r),s=i.redAdd(r),u=n.redAdd(e),c=o.redMul(a),f=s.redMul(u),h=o.redMul(u),l=a.redMul(s);return this.curve.point(c,f,l,h)},c.prototype._projAdd=function(t){var e,n,r=this.z.redMul(t.z),i=r.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),c=i.redAdd(s),f=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=r.redMul(u).redMul(f);return this.curve.twisted?(e=r.redMul(c).redMul(a.redSub(this.curve._mulA(o))),n=u.redMul(c)):(e=r.redMul(c).redMul(a.redSub(o)),n=this.curve._mulC(u).redMul(c)),this.curve.point(h,e,n)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)},c.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var n=t.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(r),0===this.x.cmp(e))return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},function(t,e,n){"use strict";e.sha1=n(267),e.sha224=n(268),e.sha256=n(144),e.sha384=n(269),e.sha512=n(145)},function(t,e,n){"use strict";var r=n(17),i=n(49),o=n(143),a=r.rotl32,s=r.sum32,u=r.sum32_5,c=o.ft_1,f=i.BlockHash,h=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}r.inherits(l,f),t.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],f=this.h[2],l=this.h[3],d=this.h[4];for(r=0;r<n.length;r++){var p=~~(r/20),m=u(a(i,5),c(p,o,f,l),d,n[r],h[p]);d=l,l=f,f=a(o,30),o=i,i=m}this.h[0]=s(this.h[0],i),this.h[1]=s(this.h[1],o),this.h[2]=s(this.h[2],f),this.h[3]=s(this.h[3],l),this.h[4]=s(this.h[4],d)},l.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"big"):r.split32(this.h,"big")}},function(t,e,n){"use strict";var r=n(17),i=n(144);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}},function(t,e,n){"use strict";var r=n(17),i=n(145);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}r.inherits(o,i),t.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}},function(t,e,n){"use strict";var r=n(17),i=n(49),o=r.rotl32,a=r.sum32,s=r.sum32_3,u=r.sum32_4,c=i.BlockHash;function f(){if(!(this instanceof f))return new f;c.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function h(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function l(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function d(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}r.inherits(f,c),e.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],c=this.h[3],f=this.h[4],v=n,g=r,_=i,E=c,M=f,w=0;w<80;w++){var S=a(o(u(n,h(w,r,i,c),t[p[w]+e],l(w)),b[w]),f);n=f,f=c,c=o(i,10),i=r,r=S,S=a(o(u(v,h(79-w,g,_,E),t[m[w]+e],d(w)),y[w]),M),v=M,M=E,E=o(_,10),_=g,g=S}S=s(this.h[1],i,E),this.h[1]=s(this.h[2],c,M),this.h[2]=s(this.h[3],f,v),this.h[3]=s(this.h[4],n,g),this.h[4]=s(this.h[0],r,_),this.h[0]=S},f.prototype._digest=function(t){return"hex"===t?r.toHex32(this.h,"little"):r.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],m=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],b=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],y=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(t,e,n){"use strict";var r=n(17),i=n(14);function o(t,e,n){if(!(this instanceof o))return new o(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(e,n))}t.exports=o,o.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},o.prototype.update=function(t,e){return this.inner.update(t,e),this},o.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,e){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,e,n){"use strict";var r=n(21),i=n(274),o=n(15),a=n(81),s=n(74),u=o.assert,c=n(275),f=n(276);function h(t){if(!(this instanceof h))return new h(t);"string"==typeof t&&(u(Object.prototype.hasOwnProperty.call(a,t),"Unknown curve "+t),t=a[t]),t instanceof a.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=h,h.prototype.keyPair=function(t){return new c(this,t)},h.prototype.keyFromPrivate=function(t,e){return c.fromPrivate(this,t,e)},h.prototype.keyFromPublic=function(t,e){return c.fromPublic(this,t,e)},h.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||s(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new r(2));;){var a=new r(e.generate(n));if(!(a.cmp(o)>0))return a.iaddn(1),this.keyFromPrivate(a)}},h.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},h.prototype.sign=function(t,e,n,o){"object"==typeof n&&(o=n,n=null),o||(o={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new r(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),u=t.toArray("be",a),c=new i({hash:this.hash,entropy:s,nonce:u,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new r(1)),l=0;;l++){var d=o.k?o.k(l):new r(c.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(h)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var m=p.getX(),b=m.umod(this.n);if(0!==b.cmpn(0)){var y=d.invm(this.n).mul(b.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==m.cmp(b)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),v^=1),new f({r:b,s:y,recoveryParam:v})}}}}}},h.prototype.verify=function(t,e,n,i){t=this._truncateToN(new r(t,16)),n=this.keyFromPublic(n,i);var o=(e=new f(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,u=a.invm(this.n),c=u.mul(t).umod(this.n),h=u.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,n.getPublic(),h)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,n.getPublic(),h)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},h.prototype.recoverPubKey=function(t,e,n,i){u((3&n)===n,"The recovery param is more than two bits"),e=new f(e,i);var o=this.n,a=new r(t),s=e.r,c=e.s,h=1&n,l=n>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),h):this.curve.pointFromX(s,h);var d=e.r.invm(o),p=o.sub(a).mul(d).umod(o),m=c.mul(d).umod(o);return this.g.mulAdd(p,s,m)},h.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new f(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")}},function(t,e,n){"use strict";var r=n(82),i=n(141),o=n(14);function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),n=i.toArray(t.nonce,t.nonceEnc||"hex"),r=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}t.exports=a,a.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new r.hmac(this.hash,this.K)},a.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=i.toArray(t,e),n=i.toArray(n,r),o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},a.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=i.toArray(n,r||"hex"),this._update(n));for(var o=[];o.length<t;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,t);return this._update(n),this._reseed++,i.encode(a,e)}},function(t,e,n){"use strict";var r=n(21),i=n(15).assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}t.exports=o,o.fromPublic=function(t,e,n){return e instanceof o?e:new o(t,{pub:e,pubEnc:n})},o.fromPrivate=function(t,e,n){return e instanceof o?e:new o(t,{priv:e,privEnc:n})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new r(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.validate()||i(t.validate(),"public point not validated"),t.mul(this.priv).getX()},o.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,e,n){"use strict";var r=n(21),i=n(15),o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new r(t.r,16),this.s=new r(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(){this.place=0}function u(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function c(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function f(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}t.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var n=new s;if(48!==t[n.place++])return!1;var o=u(t,n);if(!1===o)return!1;if(o+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var a=u(t,n);if(!1===a)return!1;var c=t.slice(n.place,a+n.place);if(n.place+=a,2!==t[n.place++])return!1;var f=u(t,n);if(!1===f)return!1;if(t.length!==f+n.place)return!1;var h=t.slice(n.place,f+n.place);if(0===c[0]){if(!(128&c[1]))return!1;c=c.slice(1)}if(0===h[0]){if(!(128&h[1]))return!1;h=h.slice(1)}return this.r=new r(c),this.s=new r(h),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=c(e),n=c(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];f(r,e.length),(r=r.concat(e)).push(2),f(r,n.length);var o=r.concat(n),a=[48];return f(a,o.length),a=a.concat(o),i.encode(a,t)}},function(t,e,n){"use strict";var r=n(82),i=n(81),o=n(15),a=o.assert,s=o.parseBytes,u=n(278),c=n(279);function f(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof f))return new f(t);t=i[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=r.sha512}t.exports=f,f.prototype.sign=function(t,e){t=s(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),i=this.g.mul(r),o=this.encodePoint(i),a=this.hashInt(o,n.pubBytes(),t).mul(n.priv()),u=r.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},f.prototype.verify=function(t,e,n){t=s(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),r.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(r.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return o.intFromLE(t.digest()).umod(this.curve.n)},f.prototype.keyFromPublic=function(t){return u.fromPublic(this,t)},f.prototype.keyFromSecret=function(t){return u.fromSecret(this,t)},f.prototype.makeSignature=function(t){return t instanceof c?t:new c(this,t)},f.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},f.prototype.decodePoint=function(t){var e=(t=o.parseBytes(t)).length-1,n=t.slice(0,e).concat(-129&t[e]),r=0!=(128&t[e]),i=o.intFromLE(n);return this.curve.pointFromY(i,r)},f.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},f.prototype.decodeInt=function(t){return o.intFromLE(t)},f.prototype.isPoint=function(t){return t instanceof this.pointClass}},function(t,e,n){"use strict";var r=n(15),i=r.assert,o=r.parseBytes,a=r.cachedProperty;function s(t,e){this.eddsa=t,this._secret=o(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=o(e.pub)}s.fromPublic=function(t,e){return e instanceof s?e:new s(t,{pub:e})},s.fromSecret=function(t,e){return e instanceof s?e:new s(t,{secret:e})},s.prototype.secret=function(){return this._secret},a(s,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),a(s,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),a(s,"privBytes",(function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,r=e.slice(0,t.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r})),a(s,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),a(s,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),a(s,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),s.prototype.sign=function(t){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},s.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},s.prototype.getSecret=function(t){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),t)},s.prototype.getPublic=function(t){return r.encode(this.pubBytes(),t)},t.exports=s},function(t,e,n){"use strict";var r=n(21),i=n(15),o=i.assert,a=i.cachedProperty,s=i.parseBytes;function u(t,e){this.eddsa=t,"object"!=typeof e&&(e=s(e)),Array.isArray(e)&&(e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),o(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof r&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}a(u,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),a(u,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),a(u,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),a(u,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),u.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},u.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},t.exports=u},function(t,e,n){"use strict";var r=n(146);e.certificate=n(287);var i=r.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));e.RSAPrivateKey=i;var o=r.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));e.RSAPublicKey=o;var a=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}));e.PublicKey=a;var s=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),u=r.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())}));e.PrivateKey=u;var c=r.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));e.EncryptedPrivateKey=c;var f=r.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));e.DSAPrivateKey=f,e.DSAparam=r.define("DSAparam",(function(){this.int()}));var h=r.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(l),this.key("publicKey").optional().explicit(1).bitstr())}));e.ECPrivateKey=h;var l=r.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));e.signature=r.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(t,e){},function(t,e,n){"use strict";const r=n(148),i=n(150),o=n(5);function a(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new a(t,e)},a.prototype._createNamed=function(t){const e=this.name;function n(t){this._initNamed(t,e)}return o(n,t),n.prototype._initNamed=function(e,n){t.call(this,e,n)},new n(this)},a.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i[t])),this.decoders[t]},a.prototype.decode=function(t,e,n){return this._getDecoder(e).decode(t,n)},a.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r[t])),this.encoders[t]},a.prototype.encode=function(t,e,n){return this._getEncoder(e).encode(t,n)}},function(t,e,n){"use strict";const r=n(5),i=n(149);function o(t){i.call(this,t),this.enc="pem"}r(o,i),t.exports=o,o.prototype.encode=function(t,e){const n=i.prototype.encode.call(this,t).toString("base64"),r=["-----BEGIN "+e.label+"-----"];for(let t=0;t<n.length;t+=64)r.push(n.slice(t,t+64));return r.push("-----END "+e.label+"-----"),r.join("\n")}},function(t,e,n){"use strict";const r=n(5),i=n(83).Buffer,o=n(151);function a(t){o.call(this,t),this.enc="pem"}r(a,o),t.exports=a,a.prototype.decode=function(t,e){const n=t.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/;let s=-1,u=-1;for(let t=0;t<n.length;t++){const e=n[t].match(a);if(null!==e&&e[2]===r){if(-1!==s){if("END"!==e[1])break;u=t;break}if("BEGIN"!==e[1])break;s=t}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+r);const c=n.slice(s+1,u).join("");c.replace(/[^a-z0-9+/=]+/gi,"");const f=i.from(c,"base64");return o.prototype.decode.call(this,f,e)}},function(t,e,n){"use strict";const r=e;r.Reporter=n(85).Reporter,r.DecoderBuffer=n(50).DecoderBuffer,r.EncoderBuffer=n(50).EncoderBuffer,r.Node=n(84)},function(t,e,n){"use strict";const r=e;r._reverse=function(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const r=t[n];e[r]=n})),e},r.der=n(86)},function(t,e,n){"use strict";var r=n(146),i=r.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),o=r.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),a=r.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),s=r.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())})),u=r.define("RelativeDistinguishedName",(function(){this.setof(o)})),c=r.define("RDNSequence",(function(){this.seqof(u)})),f=r.define("Name",(function(){this.choice({rdnSequence:this.use(c)})})),h=r.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))})),l=r.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),d=r.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(f),this.key("validity").use(h),this.key("subject").use(f),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())})),p=r.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(d),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())}));t.exports=p},function(t){t.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')},function(t,e,n){var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,o=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=n(56),s=n(72),u=n(4).Buffer;t.exports=function(t,e){var n,c=t.toString(),f=c.match(r);if(f){var h="aes"+f[1],l=u.from(f[2],"hex"),d=u.from(f[3].replace(/[\r\n]/g,""),"base64"),p=a(e,l.slice(0,8),parseInt(f[1],10)).key,m=[],b=s.createDecipheriv(h,p,l);m.push(b.update(d)),m.push(b.final()),n=u.concat(m)}else{var y=c.match(o);n=u.from(y[2].replace(/[\r\n]/g,""),"base64")}return{tag:c.match(i)[1],data:n}}},function(t,e,n){var r=n(75).Buffer,i=n(78),o=n(79).ec,a=n(58),s=n(152);function u(t,e){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(e)>=e)throw new Error("invalid sig")}t.exports=function(t,e,n,c,f){var h=a(n);if("ec"===h.type){if("ecdsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=s[n.data.algorithm.curve.join(".")];if(!r)throw new Error("unknown curve "+n.data.algorithm.curve.join("."));var i=new o(r),a=n.data.subjectPrivateKey.data;return i.verify(e,t,a)}(t,e,h)}if("dsa"===h.type){if("dsa"!==c)throw new Error("wrong public key type");return function(t,e,n){var r=n.data.p,o=n.data.q,s=n.data.g,c=n.data.pub_key,f=a.signature.decode(t,"der"),h=f.s,l=f.r;u(h,o),u(l,o);var d=i.mont(r),p=h.invm(o);return 0===s.toRed(d).redPow(new i(e).mul(p).mod(o)).fromRed().mul(c.toRed(d).redPow(l.mul(p).mod(o)).fromRed()).mod(r).mod(o).cmp(l)}(t,e,h)}if("rsa"!==c&&"ecdsa/rsa"!==c)throw new Error("wrong public key type");e=r.concat([f,e]);for(var l=h.modulus.byteLength(),d=[1],p=0;e.length+d.length+2<l;)d.push(255),p++;d.push(0);for(var m=-1;++m<e.length;)d.push(e[m]);d=r.from(d);var b=i.mont(h.modulus);t=(t=new i(t).toRed(b)).redPow(new i(h.publicExponent)),t=r.from(t.fromRed().toArray());var y=p<8?1:0;for(l=Math.min(t.length,d.length),t.length!==d.length&&(y=1),m=-1;++m<l;)y|=t[m]^d[m];return 0===y}},function(t,e,n){(function(e){var r=n(79),i=n(292);t.exports=function(t){return new a(t)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(t){this.curveType=o[t],this.curveType||(this.curveType={name:t}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}function s(t,n,r){Array.isArray(t)||(t=t.toArray());var i=new e(t);if(r&&i.length<r){var o=new e(r-i.length);o.fill(0),i=e.concat([o,i])}return n?i.toString(n):i}o.p224=o.secp224r1,o.p256=o.secp256r1=o.prime256v1,o.p192=o.secp192r1=o.prime192v1,o.p384=o.secp384r1,o.p521=o.secp521r1,a.prototype.generateKeys=function(t,e){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,e)},a.prototype.computeSecret=function(t,n,r){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),s(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},a.prototype.getPublicKey=function(t,e){var n=this.keys.getPublic("compressed"===e,!0);return"hybrid"===e&&(n[n.length-1]%2?n[0]=7:n[0]=6),s(n,t)},a.prototype.getPrivateKey=function(t){return s(this.keys.getPrivate(),t)},a.prototype.setPublicKey=function(t,n){return n=n||"utf8",e.isBuffer(t)||(t=new e(t,n)),this.keys._importPublic(t),this},a.prototype.setPrivateKey=function(t,n){n=n||"utf8",e.isBuffer(t)||(t=new e(t,n));var r=new i(t);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this}}).call(this,n(6).Buffer)},function(t,e,n){(function(t){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n(293).Buffer}catch(t){}function s(t,e){var n=t.charCodeAt(e);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function u(t,e,n){var r=s(t,n);return n-1>=e&&(r|=s(t,n-1)<<4),r}function c(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,n):(this._parseBase(t,e,i),"le"===n&&this._initArray(this.toArray(),e,n)))},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=u(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,u=0,f=n;f<s;f+=r)u=c(t,f,f+r,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){var h=1;for(u=c(t,f,t.length,e),f=0;f<a;f++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],l=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var f=u>>>26,h=67108863&u,l=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=l;d++){var p=c-d|0;f+=(a=(i=0|t.words[p])*(o=0|e.words[d])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|f}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!==(o=s>>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var c=h[t],d=l[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?m+n:f[c-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),f=this.clone();if(u){for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!f.isZero();s++)a=f.andln(255),f.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,f=0|a[0],h=8191&f,l=f>>>13,d=0|a[1],p=8191&d,m=d>>>13,b=0|a[2],y=8191&b,v=b>>>13,g=0|a[3],_=8191&g,E=g>>>13,M=0|a[4],w=8191&M,S=M>>>13,O=0|a[5],A=8191&O,T=O>>>13,N=0|a[6],C=8191&N,I=N>>>13,R=0|a[7],P=8191&R,L=R>>>13,D=0|a[8],j=8191&D,k=D>>>13,U=0|a[9],x=8191&U,B=U>>>13,F=0|s[0],V=8191&F,q=F>>>13,Y=0|s[1],G=8191&Y,H=Y>>>13,z=0|s[2],K=8191&z,W=z>>>13,X=0|s[3],J=8191&X,Z=X>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,ft=0|s[8],ht=8191&ft,lt=ft>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;n.negative=t.negative^e.negative,n.length=19;var bt=(c+(r=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,q))+Math.imul(l,V)|0))<<13)|0;c=((o=Math.imul(l,q))+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(p,V),i=(i=Math.imul(p,q))+Math.imul(m,V)|0,o=Math.imul(m,q);var yt=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(l,G)|0))<<13)|0;c=((o=o+Math.imul(l,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,V),i=(i=Math.imul(y,q))+Math.imul(v,V)|0,o=Math.imul(v,q),r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,W)|0)+Math.imul(l,K)|0))<<13)|0;c=((o=o+Math.imul(l,W)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(_,V),i=(i=Math.imul(_,q))+Math.imul(E,V)|0,o=Math.imul(E,q),r=r+Math.imul(y,G)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,K)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,W)|0;var gt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Z)|0)+Math.imul(l,J)|0))<<13)|0;c=((o=o+Math.imul(l,Z)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(w,V),i=(i=Math.imul(w,q))+Math.imul(S,V)|0,o=Math.imul(S,q),r=r+Math.imul(_,G)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,H)|0,r=r+Math.imul(y,K)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,W)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Z)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,Z)|0;var _t=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(l,$)|0))<<13)|0;c=((o=o+Math.imul(l,tt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(A,V),i=(i=Math.imul(A,q))+Math.imul(T,V)|0,o=Math.imul(T,q),r=r+Math.imul(w,G)|0,i=(i=i+Math.imul(w,H)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,H)|0,r=r+Math.imul(_,K)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(E,K)|0,o=o+Math.imul(E,W)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,Z)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,Z)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Et=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(l,nt)|0))<<13)|0;c=((o=o+Math.imul(l,rt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(C,V),i=(i=Math.imul(C,q))+Math.imul(I,V)|0,o=Math.imul(I,q),r=r+Math.imul(A,G)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(w,K)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(S,K)|0,o=o+Math.imul(S,W)|0,r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Z)|0)+Math.imul(E,J)|0,o=o+Math.imul(E,Z)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var Mt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(l,ot)|0))<<13)|0;c=((o=o+Math.imul(l,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(P,V),i=(i=Math.imul(P,q))+Math.imul(L,V)|0,o=Math.imul(L,q),r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,H)|0)+Math.imul(I,G)|0,o=o+Math.imul(I,H)|0,r=r+Math.imul(A,K)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,W)|0,r=r+Math.imul(w,J)|0,i=(i=i+Math.imul(w,Z)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,Z)|0,r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(E,$)|0,o=o+Math.imul(E,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var wt=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(l,ut)|0))<<13)|0;c=((o=o+Math.imul(l,ct)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(j,V),i=(i=Math.imul(j,q))+Math.imul(k,V)|0,o=Math.imul(k,q),r=r+Math.imul(P,G)|0,i=(i=i+Math.imul(P,H)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(C,K)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,W)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,Z)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Z)|0,r=r+Math.imul(w,$)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,tt)|0,r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(E,nt)|0,o=o+Math.imul(E,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var St=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,lt)|0)+Math.imul(l,ht)|0))<<13)|0;c=((o=o+Math.imul(l,lt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(x,V),i=(i=Math.imul(x,q))+Math.imul(B,V)|0,o=Math.imul(B,q),r=r+Math.imul(j,G)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,r=r+Math.imul(P,K)|0,i=(i=i+Math.imul(P,W)|0)+Math.imul(L,K)|0,o=o+Math.imul(L,W)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Z)|0)+Math.imul(I,J)|0,o=o+Math.imul(I,Z)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(w,nt)|0,i=(i=i+Math.imul(w,rt)|0)+Math.imul(S,nt)|0,o=o+Math.imul(S,rt)|0,r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(E,ot)|0,o=o+Math.imul(E,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,lt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,lt)|0;var Ot=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(l,pt)|0))<<13)|0;c=((o=o+Math.imul(l,mt)|0)+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(x,G),i=(i=Math.imul(x,H))+Math.imul(B,G)|0,o=Math.imul(B,H),r=r+Math.imul(j,K)|0,i=(i=i+Math.imul(j,W)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,W)|0,r=r+Math.imul(P,J)|0,i=(i=i+Math.imul(P,Z)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,Z)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(S,ot)|0,o=o+Math.imul(S,at)|0,r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(E,ut)|0,o=o+Math.imul(E,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,lt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,lt)|0;var At=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(x,K),i=(i=Math.imul(x,W))+Math.imul(B,K)|0,o=Math.imul(B,W),r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,Z)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,Z)|0,r=r+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(C,nt)|0,i=(i=i+Math.imul(C,rt)|0)+Math.imul(I,nt)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ct)|0)+Math.imul(S,ut)|0,o=o+Math.imul(S,ct)|0,r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,lt)|0)+Math.imul(E,ht)|0,o=o+Math.imul(E,lt)|0;var Tt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(x,J),i=(i=Math.imul(x,Z))+Math.imul(B,J)|0,o=Math.imul(B,Z),r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(P,nt)|0,i=(i=i+Math.imul(P,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,lt)|0)+Math.imul(S,ht)|0,o=o+Math.imul(S,lt)|0;var Nt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(E,pt)|0))<<13)|0;c=((o=o+Math.imul(E,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(x,$),i=(i=Math.imul(x,tt))+Math.imul(B,$)|0,o=Math.imul(B,tt),r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(k,nt)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(P,ot)|0,i=(i=i+Math.imul(P,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ct)|0)+Math.imul(I,ut)|0,o=o+Math.imul(I,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,lt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,lt)|0;var Ct=(c+(r=r+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((o=o+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(x,nt),i=(i=Math.imul(x,rt))+Math.imul(B,nt)|0,o=Math.imul(B,rt),r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,r=r+Math.imul(P,ut)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,lt)|0)+Math.imul(I,ht)|0,o=o+Math.imul(I,lt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(x,ot),i=(i=Math.imul(x,at))+Math.imul(B,ot)|0,o=Math.imul(B,at),r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ct)|0,r=r+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,lt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,lt)|0;var Rt=(c+(r=r+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((o=o+Math.imul(I,mt)|0)+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(x,ut),i=(i=Math.imul(x,ct))+Math.imul(B,ut)|0,o=Math.imul(B,ct),r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,lt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,lt)|0;var Pt=(c+(r=r+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,r=Math.imul(x,ht),i=(i=Math.imul(x,lt))+Math.imul(B,ht)|0,o=Math.imul(B,lt);var Lt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((o=o+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863;var Dt=(c+(r=Math.imul(x,pt))|0)+((8191&(i=(i=Math.imul(x,mt))+Math.imul(B,pt)|0))<<13)|0;return c=((o=Math.imul(B,mt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,u[0]=bt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=_t,u[5]=Et,u[6]=Mt,u[7]=wt,u[8]=St,u[9]=Ot,u[10]=At,u[11]=Tt,u[12]=Nt,u[13]=Ct,u[14]=It,u[15]=Rt,u[16]=Pt,u[17]=Lt,u[18]=Dt,0!==c&&(u[19]=c,n.length++),n};function m(t,e,n){return(new b).mulp(t,e,n)}function b(t,e){this.x=t,this.y=e}Math.imul||(p=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var f=o-c,h=(0|t.words[f])*(0|e.words[c]),l=67108863&h;s=67108863&(l=l+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(l>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):m(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},b.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},b.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},b.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),f=0;f<i;f+=s)for(var h=u,l=c,d=0;d<a;d++){var p=n[f+d],m=r[f+d],b=n[f+d+a],y=r[f+d+a],v=h*b-l*y;y=h*y+l*b,b=v,n[f+d]=p+b,r[f+d]=m+y,n[f+d+a]=p-b,r[f+d+a]=m-y,d!==s&&(v=u*h-c*l,l=u*l+c*h,h=v)}},b.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},b.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},b.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},b.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},b.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},b.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),f=new Array(r),h=new Array(r),l=n.words;l.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,f,h,r,i);for(var d=0;d<r;d++){var p=s[d]*f[d]-u[d]*h[d];u[d]=s[d]*h[d]+u[d]*f[d],s[d]=p}return this.conjugate(s,u,r),this.transform(s,u,l,o,r,i),this.conjugate(l,o,r),this.normalize13b(l,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(0!==f||c>=i);c--){var h=0|this.words[c];this.words[c]=f<<26-o|h>>>o,f=h&s}return u&&0!==f&&(u.words[u.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n)&&!!(this.words[n]&i)},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!==(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var f=r.clone()._ishlnsubmul(i,1,u);0===f.negative&&(r=f,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var l=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(l=Math.min(l/a|0,67108863),r._ishlnsubmul(i,l,h);0!==r.negative;)l--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=l)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var f=n.clone(),h=e.clone();!e.isZero();){for(var l=0,d=1;0==(e.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(e.iushrn(l);l-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(f),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(f),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,f=1;0==(e.words[0]&f)&&c<26;++c,f<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,l=1;0==(n.words[0]&l)&&h<26;++h,l<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new w(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var y={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function g(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(g,v),g.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},g.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(_,v),i(E,v),i(M,v),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(y[t])return y[t];var e;if("k256"===t)e=new g;else if("p224"===t)e=new _;else if("p192"===t)e=new E;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return y[t]=e,e},w.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},w.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},w.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},w.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,c).cmp(u);)f.redIAdd(u);for(var h=this.pow(f,i),l=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=a;0!==d.cmp(s);){for(var m=d,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b<p);var y=this.pow(h,new o(1).iushln(p-b-1));l=l.redMul(y),h=y.redSqr(),d=d.redMul(h),p=b}return l},w.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},w.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],f=u-1;f>=0;f--){var h=c>>f&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===f)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},i(S,w),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(32)(t))},function(t,e){},function(t,e,n){e.publicEncrypt=n(295),e.privateDecrypt=n(297),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}},function(t,e,n){var r=n(58),i=n(35),o=n(47),a=n(153),s=n(154),u=n(87),c=n(155),f=n(77),h=n(4).Buffer;t.exports=function(t,e,n){var l;l=t.padding?t.padding:n?1:4;var d,p=r(t);if(4===l)d=function(t,e){var n=t.modulus.byteLength(),r=e.length,c=o("sha1").update(h.alloc(0)).digest(),f=c.length,l=2*f;if(r>n-l-2)throw new Error("message too long");var d=h.alloc(n-r-l-2),p=n-f-1,m=i(f),b=s(h.concat([c,d,h.alloc(1,1),e],p),a(m,p)),y=s(m,a(b,f));return new u(h.concat([h.alloc(1),y,b],n))}(p,e);else if(1===l)d=function(t,e,n){var r,o=e.length,a=t.modulus.byteLength();if(o>a-11)throw new Error("message too long");r=n?h.alloc(a-o-3,255):function(t){var e,n=h.allocUnsafe(t),r=0,o=i(2*t),a=0;for(;r<t;)a===o.length&&(o=i(2*t),a=0),(e=o[a++])&&(n[r++]=e);return n}(a-o-3);return new u(h.concat([h.from([0,n?1:2]),r,h.alloc(1),e],a))}(p,e,n);else{if(3!==l)throw new Error("unknown padding");if((d=new u(e)).cmp(p.modulus)>=0)throw new Error("data too long for modulus")}return n?f(d,p):c(d,p)}},function(t,e){},function(t,e,n){var r=n(58),i=n(153),o=n(154),a=n(87),s=n(77),u=n(47),c=n(155),f=n(4).Buffer;t.exports=function(t,e,n){var h;h=t.padding?t.padding:n?1:4;var l,d=r(t),p=d.modulus.byteLength();if(e.length>p||new a(e).cmp(d.modulus)>=0)throw new Error("decryption error");l=n?c(new a(e),d):s(e,d);var m=f.alloc(p-l.length);if(l=f.concat([m,l],p),4===h)return function(t,e){var n=t.modulus.byteLength(),r=u("sha1").update(f.alloc(0)).digest(),a=r.length;if(0!==e[0])throw new Error("decryption error");var s=e.slice(1,a+1),c=e.slice(a+1),h=o(s,i(c,a)),l=o(c,i(h,n-a-1));if(function(t,e){t=f.from(t),e=f.from(e);var n=0,r=t.length;t.length!==e.length&&(n++,r=Math.min(t.length,e.length));var i=-1;for(;++i<r;)n+=t[i]^e[i];return n}(r,l.slice(0,a)))throw new Error("decryption error");var d=a;for(;0===l[d];)d++;if(1!==l[d++])throw new Error("decryption error");return l.slice(d)}(d,l);if(1===h)return function(t,e,n){var r=e.slice(0,2),i=2,o=0;for(;0!==e[i++];)if(i>=e.length){o++;break}var a=e.slice(2,i-1);("0002"!==r.toString("hex")&&!n||"0001"!==r.toString("hex")&&n)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,l,n);if(3===h)return l;throw new Error("unknown padding")}},function(t,e,n){"use strict";(function(t,r){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=n(4),a=n(35),s=o.Buffer,u=o.kMaxLength,c=t.crypto||t.msCrypto,f=Math.pow(2,32)-1;function h(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>f||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function l(t,e,n){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>f||t<0)throw new TypeError("size must be a uint32");if(t+e>n||t>u)throw new RangeError("buffer too small")}function d(t,e,n,i){if(r.browser){var o=t.buffer,s=new Uint8Array(o,e,n);return c.getRandomValues(s),i?void r.nextTick((function(){i(null,t)})):t}if(!i)return a(n).copy(t,e),t;a(n,(function(n,r){if(n)return i(n);r.copy(t,e),i(null,t)}))}c&&c.getRandomValues||!r.browser?(e.randomFill=function(e,n,r,i){if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof n)i=n,n=0,r=e.length;else if("function"==typeof r)i=r,r=e.length-n;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return h(n,e.length),l(r,n,e.length),d(e,n,r,i)},e.randomFillSync=function(e,n,r){void 0===n&&(n=0);if(!(s.isBuffer(e)||e instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');h(n,e.length),void 0===r&&(r=e.length-n);return l(r,n,e.length),d(e,n,r)}):(e.randomFill=i,e.randomFillSync=i)}).call(this,n(10),n(7))},function(t,e,n){"use strict";var r=n(4).Buffer,i=n(300);function o(t){if(r.isBuffer(t))return t;if("string"==typeof t)return r.from(t,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function a(t,e,n){for(var r=0;e+r<n&&0===t[e+r];)++r;return t[e+r]>=128&&--r,r}t.exports={derToJose:function(t,e){t=o(t);var n=i(e),a=n+1,s=t.length,u=0;if(48!==t[u++])throw new Error('Could not find expected "seq"');var c=t[u++];if(129===c&&(c=t[u++]),s-u<c)throw new Error('"seq" specified length of "'+c+'", only "'+(s-u)+'" remaining');if(2!==t[u++])throw new Error('Could not find expected "int" for "r"');var f=t[u++];if(s-u-2<f)throw new Error('"r" specified length of "'+f+'", only "'+(s-u-2)+'" available');if(a<f)throw new Error('"r" specified length of "'+f+'", max of "'+a+'" is acceptable');var h=u;if(u+=f,2!==t[u++])throw new Error('Could not find expected "int" for "s"');var l=t[u++];if(s-u!==l)throw new Error('"s" specified length of "'+l+'", expected "'+(s-u)+'"');if(a<l)throw new Error('"s" specified length of "'+l+'", max of "'+a+'" is acceptable');var d=u;if((u+=l)!==s)throw new Error('Expected to consume entire buffer, but "'+(s-u)+'" bytes remain');var p=n-f,m=n-l,b=r.allocUnsafe(p+f+m+l);for(u=0;u<p;++u)b[u]=0;t.copy(b,u,h+Math.max(-p,0),h+f);for(var y=u=n;u<y+m;++u)b[u]=0;return t.copy(b,u,d+Math.max(-m,0),d+l),b=(b=b.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(t,e){t=o(t);var n=i(e),s=t.length;if(s!==2*n)throw new TypeError('"'+e+'" signatures must be "'+2*n+'" bytes, saw "'+s+'"');var u=a(t,0,n),c=a(t,n,t.length),f=n-u,h=n-c,l=2+f+1+1+h,d=l<128,p=r.allocUnsafe((d?2:3)+l),m=0;return p[m++]=48,d?p[m++]=l:(p[m++]=129,p[m++]=255&l),p[m++]=2,p[m++]=f,u<0?(p[m++]=0,m+=t.copy(p,m,0,n)):m+=t.copy(p,m,u,n),p[m++]=2,p[m++]=h,c<0?(p[m++]=0,t.copy(p,m,n)):t.copy(p,m,n+c),p}}},function(t,e,n){"use strict";function r(t){return(t/8|0)+(t%8==0?0:1)}var i={ES256:r(256),ES384:r(384),ES512:r(521)};t.exports=function(t){var e=i[t];if(e)return e;throw new Error('Unknown algorithm "'+t+'"')}},function(t,e,n){var r=n(4).Buffer,i=n(102),o=n(107),a=n(52),s=n(156),u=n(54),c=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function f(t){if(function(t){return"[object Object]"===Object.prototype.toString.call(t)}(t))return t;try{return JSON.parse(t)}catch(t){return}}function h(t){var e=t.split(".",1)[0];return f(r.from(e,"base64").toString("binary"))}function l(t){return t.split(".")[2]}function d(t){return c.test(t)&&!!h(t)}function p(t,e,n){if(!e){var r=new Error("Missing algorithm parameter for jws.verify");throw r.code="MISSING_ALGORITHM",r}var i=l(t=s(t)),a=function(t){return t.split(".",2).join(".")}(t);return o(e).verify(a,i,n)}function m(t,e){if(e=e||{},!d(t=s(t)))return null;var n=h(t);if(!n)return null;var i=function(t,e){e=e||"utf8";var n=t.split(".")[1];return r.from(n,"base64").toString(e)}(t);return("JWT"===n.typ||e.json)&&(i=JSON.parse(i,e.encoding)),{header:n,payload:i,signature:l(t)}}function b(t){var e=(t=t||{}).secret||t.publicKey||t.key,n=new i(e);this.readable=!0,this.algorithm=t.algorithm,this.encoding=t.encoding,this.secret=this.publicKey=this.key=n,this.signature=new i(t.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}u.inherits(b,a),b.prototype.verify=function(){try{var t=p(this.signature.buffer,this.algorithm,this.key.buffer),e=m(this.signature.buffer,this.encoding);return this.emit("done",t,e),this.emit("data",t),this.emit("end"),this.readable=!1,t}catch(t){this.readable=!1,this.emit("error",t),this.emit("close")}},b.decode=m,b.isValid=d,b.verify=p,t.exports=b},function(t,e,n){var r=n(59),i=n(157),o=n(158),a=n(100),s=n(159),u=n(160),c=n(63),f=["RS256","RS384","RS512","ES256","ES384","ES512"],h=["RS256","RS384","RS512"],l=["HS256","HS384","HS512"];u&&(f.splice(3,0,"PS256","PS384","PS512"),h.splice(3,0,"PS256","PS384","PS512")),t.exports=function(t,e,n,u){var d;if("function"!=typeof n||u||(u=n,n={}),n||(n={}),n=Object.assign({},n),d=u||function(t,e){if(t)throw t;return e},n.clockTimestamp&&"number"!=typeof n.clockTimestamp)return d(new r("clockTimestamp must be a number"));if(void 0!==n.nonce&&("string"!=typeof n.nonce||""===n.nonce.trim()))return d(new r("nonce must be a non-empty string"));var p=n.clockTimestamp||Math.floor(Date.now()/1e3);if(!t)return d(new r("jwt must be provided"));if("string"!=typeof t)return d(new r("jwt must be a string"));var m,b=t.split(".");if(3!==b.length)return d(new r("jwt malformed"));try{m=a(t,{complete:!0})}catch(t){return d(t)}if(!m)return d(new r("invalid token"));var y,v=m.header;if("function"==typeof e){if(!u)return d(new r("verify must be called asynchronous if secret or public key is provided as a callback"));y=e}else y=function(t,n){return n(null,e)};return y(v,(function(e,a){if(e)return d(new r("error in secret or public key callback: "+e.message));var u,y=""!==b[2].trim();if(!y&&a)return d(new r("jwt signature is required"));if(y&&!a)return d(new r("secret or public key must be provided"));if(y||n.algorithms||(n.algorithms=["none"]),n.algorithms||(n.algorithms=~a.toString().indexOf("BEGIN CERTIFICATE")||~a.toString().indexOf("BEGIN PUBLIC KEY")?f:~a.toString().indexOf("BEGIN RSA PUBLIC KEY")?h:l),!~n.algorithms.indexOf(m.header.alg))return d(new r("invalid algorithm"));try{u=c.verify(t,m.header.alg,a)}catch(t){return d(t)}if(!u)return d(new r("invalid signature"));var g=m.payload;if(void 0!==g.nbf&&!n.ignoreNotBefore){if("number"!=typeof g.nbf)return d(new r("invalid nbf value"));if(g.nbf>p+(n.clockTolerance||0))return d(new i("jwt not active",new Date(1e3*g.nbf)))}if(void 0!==g.exp&&!n.ignoreExpiration){if("number"!=typeof g.exp)return d(new r("invalid exp value"));if(p>=g.exp+(n.clockTolerance||0))return d(new o("jwt expired",new Date(1e3*g.exp)))}if(n.audience){var _=Array.isArray(n.audience)?n.audience:[n.audience];if(!(Array.isArray(g.aud)?g.aud:[g.aud]).some((function(t){return _.some((function(e){return e instanceof RegExp?e.test(t):e===t}))})))return d(new r("jwt audience invalid. expected: "+_.join(" or ")))}if(n.issuer&&("string"==typeof n.issuer&&g.iss!==n.issuer||Array.isArray(n.issuer)&&-1===n.issuer.indexOf(g.iss)))return d(new r("jwt issuer invalid. expected: "+n.issuer));if(n.subject&&g.sub!==n.subject)return d(new r("jwt subject invalid. expected: "+n.subject));if(n.jwtid&&g.jti!==n.jwtid)return d(new r("jwt jwtid invalid. expected: "+n.jwtid));if(n.nonce&&g.nonce!==n.nonce)return d(new r("jwt nonce invalid. expected: "+n.nonce));if(n.maxAge){if("number"!=typeof g.iat)return d(new r("iat required when maxAge is specified"));var E=s(n.maxAge,g.iat);if(void 0===E)return d(new r('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(p>=E+(n.clockTolerance||0))return d(new o("maxAge exceeded",new Date(1e3*E)))}if(!0===n.complete){var M=m.signature;return d(null,{header:v,payload:g,signature:M})}return d(null,g)}))}},function(t,e){var n=1e3,r=6e4,i=60*r,o=24*i;function a(t,e,n,r){var i=e>=1.5*n;return Math.round(t/n)+" "+r+(i?"s":"")}t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return function(t){if((t=String(t)).length>100)return;var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(t);if("number"===s&&isFinite(t))return e.long?function(t){var e=Math.abs(t);if(e>=o)return a(t,e,o,"day");if(e>=i)return a(t,e,i,"hour");if(e>=r)return a(t,e,r,"minute");if(e>=n)return a(t,e,n,"second");return t+" ms"}(t):function(t){var e=Math.abs(t);if(e>=o)return Math.round(t/o)+"d";if(e>=i)return Math.round(t/i)+"h";if(e>=r)return Math.round(t/r)+"m";if(e>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){(function(n){var r;e=t.exports=K,r="object"==typeof n&&n.env&&n.env.NODE_DEBUG&&/\bsemver\b/i.test(n.env.NODE_DEBUG)?function(){var t=Array.prototype.slice.call(arguments,0);t.unshift("SEMVER"),console.log.apply(console,t)}:function(){},e.SEMVER_SPEC_VERSION="2.0.0";var i=Number.MAX_SAFE_INTEGER||9007199254740991,o=e.re=[],a=e.src=[],s=0,u=s++;a[u]="0|[1-9]\\d*";var c=s++;a[c]="[0-9]+";var f=s++;a[f]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var h=s++;a[h]="("+a[u]+")\\.("+a[u]+")\\.("+a[u]+")";var l=s++;a[l]="("+a[c]+")\\.("+a[c]+")\\.("+a[c]+")";var d=s++;a[d]="(?:"+a[u]+"|"+a[f]+")";var p=s++;a[p]="(?:"+a[c]+"|"+a[f]+")";var m=s++;a[m]="(?:-("+a[d]+"(?:\\."+a[d]+")*))";var b=s++;a[b]="(?:-?("+a[p]+"(?:\\."+a[p]+")*))";var y=s++;a[y]="[0-9A-Za-z-]+";var v=s++;a[v]="(?:\\+("+a[y]+"(?:\\."+a[y]+")*))";var g=s++,_="v?"+a[h]+a[m]+"?"+a[v]+"?";a[g]="^"+_+"$";var E="[v=\\s]*"+a[l]+a[b]+"?"+a[v]+"?",M=s++;a[M]="^"+E+"$";var w=s++;a[w]="((?:<|>)?=?)";var S=s++;a[S]=a[c]+"|x|X|\\*";var O=s++;a[O]=a[u]+"|x|X|\\*";var A=s++;a[A]="[v=\\s]*("+a[O]+")(?:\\.("+a[O]+")(?:\\.("+a[O]+")(?:"+a[m]+")?"+a[v]+"?)?)?";var T=s++;a[T]="[v=\\s]*("+a[S]+")(?:\\.("+a[S]+")(?:\\.("+a[S]+")(?:"+a[b]+")?"+a[v]+"?)?)?";var N=s++;a[N]="^"+a[w]+"\\s*"+a[A]+"$";var C=s++;a[C]="^"+a[w]+"\\s*"+a[T]+"$";var I=s++;a[I]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var R=s++;a[R]="(?:~>?)";var P=s++;a[P]="(\\s*)"+a[R]+"\\s+",o[P]=new RegExp(a[P],"g");var L=s++;a[L]="^"+a[R]+a[A]+"$";var D=s++;a[D]="^"+a[R]+a[T]+"$";var j=s++;a[j]="(?:\\^)";var k=s++;a[k]="(\\s*)"+a[j]+"\\s+",o[k]=new RegExp(a[k],"g");var U=s++;a[U]="^"+a[j]+a[A]+"$";var x=s++;a[x]="^"+a[j]+a[T]+"$";var B=s++;a[B]="^"+a[w]+"\\s*("+E+")$|^$";var F=s++;a[F]="^"+a[w]+"\\s*("+_+")$|^$";var V=s++;a[V]="(\\s*)"+a[w]+"\\s*("+E+"|"+a[A]+")",o[V]=new RegExp(a[V],"g");var q=s++;a[q]="^\\s*("+a[A]+")\\s+-\\s+("+a[A]+")\\s*$";var Y=s++;a[Y]="^\\s*("+a[T]+")\\s+-\\s+("+a[T]+")\\s*$";var G=s++;a[G]="(<|>)?=?\\s*\\*";for(var H=0;H<35;H++)r(H,a[H]),o[H]||(o[H]=new RegExp(a[H]));function z(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof K)return t;if("string"!=typeof t)return null;if(t.length>256)return null;if(!(e.loose?o[M]:o[g]).test(t))return null;try{return new K(t,e)}catch(t){return null}}function K(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof K){if(t.loose===e.loose)return t;t=t.version}else if("string"!=typeof t)throw new TypeError("Invalid Version: "+t);if(t.length>256)throw new TypeError("version is longer than 256 characters");if(!(this instanceof K))return new K(t,e);r("SemVer",t,e),this.options=e,this.loose=!!e.loose;var n=t.trim().match(e.loose?o[M]:o[g]);if(!n)throw new TypeError("Invalid Version: "+t);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((function(t){if(/^[0-9]+$/.test(t)){var e=+t;if(e>=0&&e<i)return e}return t})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}e.parse=z,e.valid=function(t,e){var n=z(t,e);return n?n.version:null},e.clean=function(t,e){var n=z(t.trim().replace(/^[=v]+/,""),e);return n?n.version:null},e.SemVer=K,K.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},K.prototype.toString=function(){return this.version},K.prototype.compare=function(t){return r("SemVer.compare",this.version,this.options,t),t instanceof K||(t=new K(t,this.options)),this.compareMain(t)||this.comparePre(t)},K.prototype.compareMain=function(t){return t instanceof K||(t=new K(t,this.options)),X(this.major,t.major)||X(this.minor,t.minor)||X(this.patch,t.patch)},K.prototype.comparePre=function(t){if(t instanceof K||(t=new K(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;var e=0;do{var n=this.prerelease[e],i=t.prerelease[e];if(r("prerelease compare",e,n,i),void 0===n&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===n)return-1;if(n!==i)return X(n,i)}while(++e)},K.prototype.inc=function(t,e){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e),this.inc("pre",e);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",e),this.inc("pre",e);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var n=this.prerelease.length;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);-1===n&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+t)}return this.format(),this.raw=this.version,this},e.inc=function(t,e,n,r){"string"==typeof n&&(r=n,n=void 0);try{return new K(t,n).inc(e,r).version}catch(t){return null}},e.diff=function(t,e){if($(t,e))return null;var n=z(t),r=z(e);if(n.prerelease.length||r.prerelease.length){for(var i in n)if(("major"===i||"minor"===i||"patch"===i)&&n[i]!==r[i])return"pre"+i;return"prerelease"}for(var i in n)if(("major"===i||"minor"===i||"patch"===i)&&n[i]!==r[i])return i},e.compareIdentifiers=X;var W=/^[0-9]+$/;function X(t,e){var n=W.test(t),r=W.test(e);return n&&r&&(t=+t,e=+e),n&&!r?-1:r&&!n?1:t<e?-1:t>e?1:0}function J(t,e,n){return new K(t,n).compare(new K(e,n))}function Z(t,e,n){return J(t,e,n)>0}function Q(t,e,n){return J(t,e,n)<0}function $(t,e,n){return 0===J(t,e,n)}function tt(t,e,n){return 0!==J(t,e,n)}function et(t,e,n){return J(t,e,n)>=0}function nt(t,e,n){return J(t,e,n)<=0}function rt(t,e,n,r){var i;switch(e){case"===":"object"==typeof t&&(t=t.version),"object"==typeof n&&(n=n.version),i=t===n;break;case"!==":"object"==typeof t&&(t=t.version),"object"==typeof n&&(n=n.version),i=t!==n;break;case"":case"=":case"==":i=$(t,n,r);break;case"!=":i=tt(t,n,r);break;case">":i=Z(t,n,r);break;case">=":i=et(t,n,r);break;case"<":i=Q(t,n,r);break;case"<=":i=nt(t,n,r);break;default:throw new TypeError("Invalid operator: "+e)}return i}function it(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof it){if(t.loose===!!e.loose)return t;t=t.value}if(!(this instanceof it))return new it(t,e);r("comparator",t,e),this.options=e,this.loose=!!e.loose,this.parse(t),this.semver===ot?this.value="":this.value=this.operator+this.semver.version,r("comp",this)}e.rcompareIdentifiers=function(t,e){return X(e,t)},e.major=function(t,e){return new K(t,e).major},e.minor=function(t,e){return new K(t,e).minor},e.patch=function(t,e){return new K(t,e).patch},e.compare=J,e.compareLoose=function(t,e){return J(t,e,!0)},e.rcompare=function(t,e,n){return J(e,t,n)},e.sort=function(t,n){return t.sort((function(t,r){return e.compare(t,r,n)}))},e.rsort=function(t,n){return t.sort((function(t,r){return e.rcompare(t,r,n)}))},e.gt=Z,e.lt=Q,e.eq=$,e.neq=tt,e.gte=et,e.lte=nt,e.cmp=rt,e.Comparator=it;var ot={};function at(t,e){if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),t instanceof at)return t.loose===!!e.loose&&t.includePrerelease===!!e.includePrerelease?t:new at(t.raw,e);if(t instanceof it)return new at(t.value,e);if(!(this instanceof at))return new at(t,e);if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=t,this.set=t.split(/\s*\|\|\s*/).map((function(t){return this.parseRange(t.trim())}),this).filter((function(t){return t.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+t);this.format()}function st(t){return!t||"x"===t.toLowerCase()||"*"===t}function ut(t,e,n,r,i,o,a,s,u,c,f,h,l){return((e=st(n)?"":st(r)?">="+n+".0.0":st(i)?">="+n+"."+r+".0":">="+e)+" "+(s=st(u)?"":st(c)?"<"+(+u+1)+".0.0":st(f)?"<"+u+"."+(+c+1)+".0":h?"<="+u+"."+c+"."+f+"-"+h:"<="+s)).trim()}function ct(t,e,n){for(var i=0;i<t.length;i++)if(!t[i].test(e))return!1;if(n||(n={}),e.prerelease.length&&!n.includePrerelease){for(i=0;i<t.length;i++)if(r(t[i].semver),t[i].semver!==ot&&t[i].semver.prerelease.length>0){var o=t[i].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}function ft(t,e,n){try{e=new at(e,n)}catch(t){return!1}return e.test(t)}function ht(t,e,n,r){var i,o,a,s,u;switch(t=new K(t,r),e=new at(e,r),n){case">":i=Z,o=nt,a=Q,s=">",u=">=";break;case"<":i=Q,o=et,a=Z,s="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ft(t,e,r))return!1;for(var c=0;c<e.set.length;++c){var f=e.set[c],h=null,l=null;if(f.forEach((function(t){t.semver===ot&&(t=new it(">=0.0.0")),h=h||t,l=l||t,i(t.semver,h.semver,r)?h=t:a(t.semver,l.semver,r)&&(l=t)})),h.operator===s||h.operator===u)return!1;if((!l.operator||l.operator===s)&&o(t,l.semver))return!1;if(l.operator===u&&a(t,l.semver))return!1}return!0}it.prototype.parse=function(t){var e=this.options.loose?o[B]:o[F],n=t.match(e);if(!n)throw new TypeError("Invalid comparator: "+t);this.operator=n[1],"="===this.operator&&(this.operator=""),n[2]?this.semver=new K(n[2],this.options.loose):this.semver=ot},it.prototype.toString=function(){return this.value},it.prototype.test=function(t){return r("Comparator.test",t,this.options.loose),this.semver===ot||("string"==typeof t&&(t=new K(t,this.options)),rt(t,this.operator,this.semver,this.options))},it.prototype.intersects=function(t,e){if(!(t instanceof it))throw new TypeError("a Comparator is required");var n;if(e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1}),""===this.operator)return n=new at(t.value,e),ft(this.value,n,e);if(""===t.operator)return n=new at(this.value,e),ft(t.semver,n,e);var r=!(">="!==this.operator&&">"!==this.operator||">="!==t.operator&&">"!==t.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==t.operator&&"<"!==t.operator),o=this.semver.version===t.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==t.operator&&"<="!==t.operator),s=rt(this.semver,"<",t.semver,e)&&(">="===this.operator||">"===this.operator)&&("<="===t.operator||"<"===t.operator),u=rt(this.semver,">",t.semver,e)&&("<="===this.operator||"<"===this.operator)&&(">="===t.operator||">"===t.operator);return r||i||o&&a||s||u},e.Range=at,at.prototype.format=function(){return this.range=this.set.map((function(t){return t.join(" ").trim()})).join("||").trim(),this.range},at.prototype.toString=function(){return this.range},at.prototype.parseRange=function(t){var e=this.options.loose;t=t.trim();var n=e?o[Y]:o[q];t=t.replace(n,ut),r("hyphen replace",t),t=t.replace(o[V],"$1$2$3"),r("comparator trim",t,o[V]),t=(t=(t=t.replace(o[P],"$1~")).replace(o[k],"$1^")).split(/\s+/).join(" ");var i=e?o[B]:o[F],a=t.split(" ").map((function(t){return function(t,e){return r("comp",t,e),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){r("caret",t,e),e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1});var n=e.loose?o[x]:o[U];return t.replace(n,(function(e,n,i,o,a){var s;return r("caret",t,e,n,i,o,a),st(n)?s="":st(i)?s=">="+n+".0.0 <"+(+n+1)+".0.0":st(o)?s="0"===n?">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0":">="+n+"."+i+".0 <"+(+n+1)+".0.0":a?(r("replaceCaret pr",a),"-"!==a.charAt(0)&&(a="-"+a),s="0"===n?"0"===i?">="+n+"."+i+"."+o+a+" <"+n+"."+i+"."+(+o+1):">="+n+"."+i+"."+o+a+" <"+n+"."+(+i+1)+".0":">="+n+"."+i+"."+o+a+" <"+(+n+1)+".0.0"):(r("no pr"),s="0"===n?"0"===i?">="+n+"."+i+"."+o+" <"+n+"."+i+"."+(+o+1):">="+n+"."+i+"."+o+" <"+n+"."+(+i+1)+".0":">="+n+"."+i+"."+o+" <"+(+n+1)+".0.0"),r("caret return",s),s}))}(t,e)})).join(" ")}(t,e),r("caret",t),t=function(t,e){return t.trim().split(/\s+/).map((function(t){return function(t,e){e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1});var n=e.loose?o[D]:o[L];return t.replace(n,(function(e,n,i,o,a){var s;return r("tilde",t,e,n,i,o,a),st(n)?s="":st(i)?s=">="+n+".0.0 <"+(+n+1)+".0.0":st(o)?s=">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0":a?(r("replaceTilde pr",a),"-"!==a.charAt(0)&&(a="-"+a),s=">="+n+"."+i+"."+o+a+" <"+n+"."+(+i+1)+".0"):s=">="+n+"."+i+"."+o+" <"+n+"."+(+i+1)+".0",r("tilde return",s),s}))}(t,e)})).join(" ")}(t,e),r("tildes",t),t=function(t,e){return r("replaceXRanges",t,e),t.split(/\s+/).map((function(t){return function(t,e){t=t.trim(),e&&"object"==typeof e||(e={loose:!!e,includePrerelease:!1});var n=e.loose?o[C]:o[N];return t.replace(n,(function(e,n,i,o,a,s){r("xRange",t,e,n,i,o,a,s);var u=st(i),c=u||st(o),f=c||st(a);return"="===n&&f&&(n=""),u?e=">"===n||"<"===n?"<0.0.0":"*":n&&f?(c&&(o=0),f&&(a=0),">"===n?(n=">=",c?(i=+i+1,o=0,a=0):f&&(o=+o+1,a=0)):"<="===n&&(n="<",c?i=+i+1:o=+o+1),e=n+i+"."+o+"."+a):c?e=">="+i+".0.0 <"+(+i+1)+".0.0":f&&(e=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0"),r("xRange return",e),e}))}(t,e)})).join(" ")}(t,e),r("xrange",t),t=function(t,e){return r("replaceStars",t,e),t.trim().replace(o[G],"")}(t,e),r("stars",t),t}(t,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(a=a.filter((function(t){return!!t.match(i)}))),a=a.map((function(t){return new it(t,this.options)}),this)},at.prototype.intersects=function(t,e){if(!(t instanceof at))throw new TypeError("a Range is required");return this.set.some((function(n){return n.every((function(n){return t.set.some((function(t){return t.every((function(t){return n.intersects(t,e)}))}))}))}))},e.toComparators=function(t,e){return new at(t,e).set.map((function(t){return t.map((function(t){return t.value})).join(" ").trim().split(" ")}))},at.prototype.test=function(t){if(!t)return!1;"string"==typeof t&&(t=new K(t,this.options));for(var e=0;e<this.set.length;e++)if(ct(this.set[e],t,this.options))return!0;return!1},e.satisfies=ft,e.maxSatisfying=function(t,e,n){var r=null,i=null;try{var o=new at(e,n)}catch(t){return null}return t.forEach((function(t){o.test(t)&&(r&&-1!==i.compare(t)||(i=new K(r=t,n)))})),r},e.minSatisfying=function(t,e,n){var r=null,i=null;try{var o=new at(e,n)}catch(t){return null}return t.forEach((function(t){o.test(t)&&(r&&1!==i.compare(t)||(i=new K(r=t,n)))})),r},e.validRange=function(t,e){try{return new at(t,e).range||"*"}catch(t){return null}},e.ltr=function(t,e,n){return ht(t,e,"<",n)},e.gtr=function(t,e,n){return ht(t,e,">",n)},e.outside=ht,e.prerelease=function(t,e){var n=z(t,e);return n&&n.prerelease.length?n.prerelease:null},e.intersects=function(t,e,n){return t=new at(t,n),e=new at(e,n),t.intersects(e)},e.coerce=function(t){if(t instanceof K)return t;if("string"!=typeof t)return null;var e=t.match(o[I]);return null==e?null:z((e[1]||"0")+"."+(e[2]||"0")+"."+(e[3]||"0"))}}).call(this,n(7))},function(t,e,n){(function(e){var r=n(159),i=n(160),o=n(63),a=n(306),s=n(307),u=n(308),c=n(309),f=n(310),h=n(311),l=n(312),d=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];i&&d.splice(3,0,"PS256","PS384","PS512");var p={expiresIn:{isValid:function(t){return u(t)||h(t)&&t},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(t){return u(t)||h(t)&&t},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(t){return h(t)||Array.isArray(t)},message:'"audience" must be a string or array'},algorithm:{isValid:a.bind(null,d),message:'"algorithm" must be a valid string enum value'},header:{isValid:f,message:'"header" must be an object'},encoding:{isValid:h,message:'"encoding" must be a string'},issuer:{isValid:h,message:'"issuer" must be a string'},subject:{isValid:h,message:'"subject" must be a string'},jwtid:{isValid:h,message:'"jwtid" must be a string'},noTimestamp:{isValid:s,message:'"noTimestamp" must be a boolean'},keyid:{isValid:h,message:'"keyid" must be a string'},mutatePayload:{isValid:s,message:'"mutatePayload" must be a boolean'}},m={iat:{isValid:c,message:'"iat" should be a number of seconds'},exp:{isValid:c,message:'"exp" should be a number of seconds'},nbf:{isValid:c,message:'"nbf" should be a number of seconds'}};function b(t,e,n,r){if(!f(n))throw new Error('Expected "'+r+'" to be a plain object.');Object.keys(n).forEach((function(i){var o=t[i];if(o){if(!o.isValid(n[i]))throw new Error(o.message)}else if(!e)throw new Error('"'+i+'" is not allowed in "'+r+'"')}))}var y={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},v=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];t.exports=function(t,n,i,a){"function"==typeof i?(a=i,i={}):i=i||{};var s="object"==typeof t&&!e.isBuffer(t),u=Object.assign({alg:i.algorithm||"HS256",typ:s?"JWT":void 0,kid:i.keyid},i.header);function c(t){if(a)return a(t);throw t}if(!n&&"none"!==i.algorithm)return c(new Error("secretOrPrivateKey must have a value"));if(void 0===t)return c(new Error("payload is required"));if(s){try{!function(t){b(m,!0,t,"payload")}(t)}catch(t){return c(t)}i.mutatePayload||(t=Object.assign({},t))}else{var f=v.filter((function(t){return void 0!==i[t]}));if(f.length>0)return c(new Error("invalid "+f.join(",")+" option for "+typeof t+" payload"))}if(void 0!==t.exp&&void 0!==i.expiresIn)return c(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==t.nbf&&void 0!==i.notBefore)return c(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(t){b(p,!1,t,"options")}(i)}catch(t){return c(t)}var h=t.iat||Math.floor(Date.now()/1e3);if(i.noTimestamp?delete t.iat:s&&(t.iat=h),void 0!==i.notBefore){try{t.nbf=r(i.notBefore,h)}catch(t){return c(t)}if(void 0===t.nbf)return c(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==i.expiresIn&&"object"==typeof t){try{t.exp=r(i.expiresIn,h)}catch(t){return c(t)}if(void 0===t.exp)return c(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(y).forEach((function(e){var n=y[e];if(void 0!==i[e]){if(void 0!==t[n])return c(new Error('Bad "options.'+e+'" option. The payload already has an "'+n+'" property.'));t[n]=i[e]}}));var d=i.encoding||"utf8";if("function"!=typeof a)return o.sign({header:u,payload:t,secret:n,encoding:d});a=a&&l(a),o.createSign({header:u,privateKey:n,payload:t,encoding:d}).once("error",a).once("done",(function(t){a(null,t)}))}}).call(this,n(6).Buffer)},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=/^(?:0|[1-9]\d*)$/,s=parseInt;function u(t){return t!=t}function c(t,e){return function(t,e){for(var n=-1,r=t?t.length:0,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}(e,(function(e){return t[e]}))}var f,h,l=Object.prototype,d=l.hasOwnProperty,p=l.toString,m=l.propertyIsEnumerable,b=(f=Object.keys,h=Object,function(t){return f(h(t))}),y=Math.max;function v(t,e){var n=E(t)||function(t){return function(t){return S(t)&&M(t)}(t)&&d.call(t,"callee")&&(!m.call(t,"callee")||"[object Arguments]"==p.call(t))}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var o in t)!e&&!d.call(t,o)||i&&("length"==o||_(o,r))||n.push(o);return n}function g(t){if(n=(e=t)&&e.constructor,r="function"==typeof n&&n.prototype||l,e!==r)return b(t);var e,n,r,i=[];for(var o in Object(t))d.call(t,o)&&"constructor"!=o&&i.push(o);return i}function _(t,e){return!!(e=null==e?9007199254740991:e)&&("number"==typeof t||a.test(t))&&t>-1&&t%1==0&&t<e}var E=Array.isArray;function M(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}(t.length)&&!function(t){var e=w(t)?p.call(t):"";return"[object Function]"==e||"[object GeneratorFunction]"==e}(t)}function w(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function S(t){return!!t&&"object"==typeof t}t.exports=function(t,e,a,f){var h;t=M(t)?t:(h=t)?c(h,function(t){return M(t)?v(t):g(t)}(h)):[],a=a&&!f?function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||S(t)&&"[object Symbol]"==p.call(t)}(t))return NaN;if(w(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=w(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var a=i.test(t);return a||o.test(t)?s(t.slice(2),a?2:8):r.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),a=e%1;return e==e?a?e-a:e:0}(a):0;var l=t.length;return a<0&&(a=y(l+a,0)),function(t){return"string"==typeof t||!E(t)&&S(t)&&"[object String]"==p.call(t)}(t)?a<=l&&t.indexOf(e,a)>-1:!!l&&function(t,e,n){if(e!=e)return function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}(t,u,n);for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,a)>-1}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return!0===t||!1===t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Boolean]"==n.call(t)}},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,s=Object.prototype.toString;function u(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=function(t){return"number"==typeof t&&t==function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(u(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=u(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var c=i.test(t);return c||o.test(t)?a(t.slice(2),c?2:8):r.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),c=e%1;return e==e?c?e-c:e:0}(t)}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return"number"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Number]"==n.call(t)}},function(t,e){var n,r,i=Function.prototype,o=Object.prototype,a=i.toString,s=o.hasOwnProperty,u=a.call(Object),c=o.toString,f=(n=Object.getPrototypeOf,r=Object,function(t){return n(r(t))});t.exports=function(t){if(!function(t){return!!t&&"object"==typeof t}(t)||"[object Object]"!=c.call(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t))return!1;var e=f(t);if(null===e)return!0;var n=s.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==u}},function(t,e){var n=Object.prototype.toString,r=Array.isArray;t.exports=function(t){return"string"==typeof t||!r(t)&&function(t){return!!t&&"object"==typeof t}(t)&&"[object String]"==n.call(t)}},function(t,e){var n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,s=Object.prototype.toString;function u(t,e){var u;if("function"!=typeof e)throw new TypeError("Expected a function");return t=function(t){var e=function(t){if(!t)return 0===t?t:0;if((t=function(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==s.call(t)}(t))return NaN;if(c(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=c(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var u=i.test(t);return u||o.test(t)?a(t.slice(2),u?2:8):r.test(t)?NaN:+t}(t))===1/0||t===-1/0){return 17976931348623157e292*(t<0?-1:1)}return t==t?t:0}(t),u=e%1;return e==e?u?e-u:e:0}(t),function(){return--t>0&&(u=e.apply(this,arguments)),t<=1&&(e=void 0),u}}function c(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=function(t){return u(2,t)}},function(t,e,n){"use strict";var r=n(314),i=n(161),o=n(90),a=Object.prototype.hasOwnProperty,s={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},u=Array.isArray,c=String.prototype.split,f=Array.prototype.push,h=function(t,e){f.apply(t,u(e)?e:[e])},l=Date.prototype.toISOString,d=o.default,p={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:i.encode,encodeValuesOnly:!1,format:d,formatter:o.formatters[d],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},m={},b=function t(e,n,o,a,s,f,l,d,b,y,v,g,_,E,M,w){for(var S,O=e,A=w,T=0,N=!1;void 0!==(A=A.get(m))&&!N;){var C=A.get(e);if(T+=1,void 0!==C){if(C===T)throw new RangeError("Cyclic object value");N=!0}void 0===A.get(m)&&(T=0)}if("function"==typeof d?O=d(n,O):O instanceof Date?O=v(O):"comma"===o&&u(O)&&(O=i.maybeMap(O,(function(t){return t instanceof Date?v(t):t}))),null===O){if(s)return l&&!E?l(n,p.encoder,M,"key",g):n;O=""}if("string"==typeof(S=O)||"number"==typeof S||"boolean"==typeof S||"symbol"==typeof S||"bigint"==typeof S||i.isBuffer(O)){if(l){var I=E?n:l(n,p.encoder,M,"key",g);if("comma"===o&&E){for(var R=c.call(String(O),","),P="",L=0;L<R.length;++L)P+=(0===L?"":",")+_(l(R[L],p.encoder,M,"value",g));return[_(I)+(a&&u(O)&&1===R.length?"[]":"")+"="+P]}return[_(I)+"="+_(l(O,p.encoder,M,"value",g))]}return[_(n)+"="+_(String(O))]}var D,j=[];if(void 0===O)return j;if("comma"===o&&u(O))D=[{value:O.length>0?O.join(",")||null:void 0}];else if(u(d))D=d;else{var k=Object.keys(O);D=b?k.sort(b):k}for(var U=a&&u(O)&&1===O.length?n+"[]":n,x=0;x<D.length;++x){var B=D[x],F="object"==typeof B&&void 0!==B.value?B.value:O[B];if(!f||null!==F){var V=u(O)?"function"==typeof o?o(U,B):U:U+(y?"."+B:"["+B+"]");w.set(e,T);var q=r();q.set(m,w),h(j,t(F,V,o,a,s,f,l,d,b,y,v,g,_,E,M,q))}}return j};t.exports=function(t,e){var n,i=t,c=function(t){if(!t)return p;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||p.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=o.default;if(void 0!==t.format){if(!a.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var r=o.formatters[n],i=p.filter;return("function"==typeof t.filter||u(t.filter))&&(i=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:p.addQueryPrefix,allowDots:void 0===t.allowDots?p.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:p.charsetSentinel,delimiter:void 0===t.delimiter?p.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:p.encode,encoder:"function"==typeof t.encoder?t.encoder:p.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:p.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:p.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:p.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:p.strictNullHandling}}(e);"function"==typeof c.filter?i=(0,c.filter)("",i):u(c.filter)&&(n=c.filter);var f,l=[];if("object"!=typeof i||null===i)return"";f=e&&e.arrayFormat in s?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var d=s[f];if(e&&"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var m="comma"===d&&e&&e.commaRoundTrip;n||(n=Object.keys(i)),c.sort&&n.sort(c.sort);for(var y=r(),v=0;v<n.length;++v){var g=n[v];c.skipNulls&&null===i[g]||h(l,b(i[g],g,d,m,c.strictNullHandling,c.skipNulls,c.encode?c.encoder:null,c.filter,c.sort,c.allowDots,c.serializeDate,c.format,c.formatter,c.encodeValuesOnly,c.charset,y))}var _=l.join(c.delimiter),E=!0===c.addQueryPrefix?"?":"";return c.charsetSentinel&&("iso-8859-1"===c.charset?E+="utf8=%26%2310003%3B&":E+="utf8=%E2%9C%93&"),_.length>0?E+_:""}},function(t,e,n){"use strict";var r=n(88),i=n(319),o=n(321),a=r("%TypeError%"),s=r("%WeakMap%",!0),u=r("%Map%",!0),c=i("WeakMap.prototype.get",!0),f=i("WeakMap.prototype.set",!0),h=i("WeakMap.prototype.has",!0),l=i("Map.prototype.get",!0),d=i("Map.prototype.set",!0),p=i("Map.prototype.has",!0),m=function(t,e){for(var n,r=t;null!==(n=r.next);r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n};t.exports=function(){var t,e,n,r={assert:function(t){if(!r.has(t))throw new a("Side channel does not contain "+o(t))},get:function(r){if(s&&r&&("object"==typeof r||"function"==typeof r)){if(t)return c(t,r)}else if(u){if(e)return l(e,r)}else if(n)return function(t,e){var n=m(t,e);return n&&n.value}(n,r)},has:function(r){if(s&&r&&("object"==typeof r||"function"==typeof r)){if(t)return h(t,r)}else if(u){if(e)return p(e,r)}else if(n)return function(t,e){return!!m(t,e)}(n,r);return!1},set:function(r,i){s&&r&&("object"==typeof r||"function"==typeof r)?(t||(t=new s),f(t,r,i)):u?(e||(e=new u),d(e,r,i)):(n||(n={key:{},next:null}),function(t,e,n){var r=m(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}}(n,r,i))}};return r}},function(t,e,n){"use strict";var r="undefined"!=typeof Symbol&&Symbol,i=n(316);t.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},function(t,e,n){"use strict";t.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(t,e,n){"use strict";var r="Function.prototype.bind called on incompatible ",i=Array.prototype.slice,o=Object.prototype.toString;t.exports=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==o.call(e))throw new TypeError(r+e);for(var n,a=i.call(arguments,1),s=function(){if(this instanceof n){var r=e.apply(this,a.concat(i.call(arguments)));return Object(r)===r?r:this}return e.apply(t,a.concat(i.call(arguments)))},u=Math.max(0,e.length-a.length),c=[],f=0;f<u;f++)c.push("$"+f);if(n=Function("binder","return function ("+c.join(",")+"){ return binder.apply(this,arguments); }")(s),e.prototype){var h=function(){};h.prototype=e.prototype,n.prototype=new h,h.prototype=null}return n}},function(t,e,n){"use strict";var r=n(89);t.exports=r.call(Function.call,Object.prototype.hasOwnProperty)},function(t,e,n){"use strict";var r=n(88),i=n(320),o=i(r("String.prototype.indexOf"));t.exports=function(t,e){var n=r(t,!!e);return"function"==typeof n&&o(t,".prototype.")>-1?i(n):n}},function(t,e,n){"use strict";var r=n(89),i=n(88),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),s=i("%Reflect.apply%",!0)||r.call(a,o),u=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),f=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(t){c=null}t.exports=function(t){var e=s(r,a,arguments);if(u&&c){var n=u(e,"length");n.configurable&&c(e,"length",{value:1+f(0,t.length-(arguments.length-1))})}return e};var h=function(){return s(r,o,arguments)};c?c(t.exports,"apply",{value:h}):t.exports.apply=h},function(t,e,n){var r="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=r&&i&&"function"==typeof i.get?i.get:null,a=r&&Map.prototype.forEach,s="function"==typeof Set&&Set.prototype,u=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=s&&u&&"function"==typeof u.get?u.get:null,f=s&&Set.prototype.forEach,h="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,l="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,d="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,b=Function.prototype.toString,y=String.prototype.match,v=String.prototype.slice,g=String.prototype.replace,_=String.prototype.toUpperCase,E=String.prototype.toLowerCase,M=RegExp.prototype.test,w=Array.prototype.concat,S=Array.prototype.join,O=Array.prototype.slice,A=Math.floor,T="function"==typeof BigInt?BigInt.prototype.valueOf:null,N=Object.getOwnPropertySymbols,C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,I="function"==typeof Symbol&&"object"==typeof Symbol.iterator,R="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===I||"symbol")?Symbol.toStringTag:null,P=Object.prototype.propertyIsEnumerable,L=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function D(t,e){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||M.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var r=t<0?-A(-t):A(t);if(r!==t){var i=String(r),o=v.call(e,i.length+1);return g.call(i,n,"$&_")+"."+g.call(g.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return g.call(e,n,"$&_")}var j=n(322),k=j.custom,U=q(k)?k:null;function x(t,e,n){var r="double"===(n.quoteStyle||e)?'"':"'";return r+t+r}function B(t){return g.call(String(t),/"/g,""")}function F(t){return!("[object Array]"!==H(t)||R&&"object"==typeof t&&R in t)}function V(t){return!("[object RegExp]"!==H(t)||R&&"object"==typeof t&&R in t)}function q(t){if(I)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!C)return!1;try{return C.call(t),!0}catch(t){}return!1}t.exports=function t(e,n,r,i){var s=n||{};if(G(s,"quoteStyle")&&"single"!==s.quoteStyle&&"double"!==s.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(G(s,"maxStringLength")&&("number"==typeof s.maxStringLength?s.maxStringLength<0&&s.maxStringLength!==1/0:null!==s.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!G(s,"customInspect")||s.customInspect;if("boolean"!=typeof u&&"symbol"!==u)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(G(s,"indent")&&null!==s.indent&&"\t"!==s.indent&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(G(s,"numericSeparator")&&"boolean"!=typeof s.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var m=s.numericSeparator;if(void 0===e)return"undefined";if(null===e)return"null";if("boolean"==typeof e)return e?"true":"false";if("string"==typeof e)return function t(e,n){if(e.length>n.maxStringLength){var r=e.length-n.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return t(v.call(e,0,n.maxStringLength),n)+i}return x(g.call(g.call(e,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,K),"single",n)}(e,s);if("number"==typeof e){if(0===e)return 1/0/e>0?"0":"-0";var _=String(e);return m?D(e,_):_}if("bigint"==typeof e){var M=String(e)+"n";return m?D(e,M):M}var A=void 0===s.depth?5:s.depth;if(void 0===r&&(r=0),r>=A&&A>0&&"object"==typeof e)return F(e)?"[Array]":"[Object]";var N=function(t,e){var n;if("\t"===t.indent)n="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;n=S.call(Array(t.indent+1)," ")}return{base:n,prev:S.call(Array(e+1),n)}}(s,r);if(void 0===i)i=[];else if(z(i,e)>=0)return"[Circular]";function k(e,n,o){if(n&&(i=O.call(i)).push(n),o){var a={depth:s.depth};return G(s,"quoteStyle")&&(a.quoteStyle=s.quoteStyle),t(e,a,r+1,i)}return t(e,s,r+1,i)}if("function"==typeof e&&!V(e)){var Y=function(t){if(t.name)return t.name;var e=y.call(b.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(e),$=Q(e,k);return"[Function"+(Y?": "+Y:" (anonymous)")+"]"+($.length>0?" { "+S.call($,", ")+" }":"")}if(q(e)){var tt=I?g.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):C.call(e);return"object"!=typeof e||I?tt:W(tt)}if(function(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(e)){for(var et="<"+E.call(String(e.nodeName)),nt=e.attributes||[],rt=0;rt<nt.length;rt++)et+=" "+nt[rt].name+"="+x(B(nt[rt].value),"double",s);return et+=">",e.childNodes&&e.childNodes.length&&(et+="..."),et+="</"+E.call(String(e.nodeName))+">"}if(F(e)){if(0===e.length)return"[]";var it=Q(e,k);return N&&!function(t){for(var e=0;e<t.length;e++)if(z(t[e],"\n")>=0)return!1;return!0}(it)?"["+Z(it,N)+"]":"[ "+S.call(it,", ")+" ]"}if(function(t){return!("[object Error]"!==H(t)||R&&"object"==typeof t&&R in t)}(e)){var ot=Q(e,k);return"cause"in Error.prototype||!("cause"in e)||P.call(e,"cause")?0===ot.length?"["+String(e)+"]":"{ ["+String(e)+"] "+S.call(ot,", ")+" }":"{ ["+String(e)+"] "+S.call(w.call("[cause]: "+k(e.cause),ot),", ")+" }"}if("object"==typeof e&&u){if(U&&"function"==typeof e[U]&&j)return j(e,{depth:A-r});if("symbol"!==u&&"function"==typeof e.inspect)return e.inspect()}if(function(t){if(!o||!t||"object"!=typeof t)return!1;try{o.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(e)){var at=[];return a.call(e,(function(t,n){at.push(k(n,e,!0)+" => "+k(t,e))})),J("Map",o.call(e),at,N)}if(function(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{o.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(e)){var st=[];return f.call(e,(function(t){st.push(k(t,e))})),J("Set",c.call(e),st,N)}if(function(t){if(!h||!t||"object"!=typeof t)return!1;try{h.call(t,h);try{l.call(t,l)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(e))return X("WeakMap");if(function(t){if(!l||!t||"object"!=typeof t)return!1;try{l.call(t,l);try{h.call(t,h)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(e))return X("WeakSet");if(function(t){if(!d||!t||"object"!=typeof t)return!1;try{return d.call(t),!0}catch(t){}return!1}(e))return X("WeakRef");if(function(t){return!("[object Number]"!==H(t)||R&&"object"==typeof t&&R in t)}(e))return W(k(Number(e)));if(function(t){if(!t||"object"!=typeof t||!T)return!1;try{return T.call(t),!0}catch(t){}return!1}(e))return W(k(T.call(e)));if(function(t){return!("[object Boolean]"!==H(t)||R&&"object"==typeof t&&R in t)}(e))return W(p.call(e));if(function(t){return!("[object String]"!==H(t)||R&&"object"==typeof t&&R in t)}(e))return W(k(String(e)));if(!function(t){return!("[object Date]"!==H(t)||R&&"object"==typeof t&&R in t)}(e)&&!V(e)){var ut=Q(e,k),ct=L?L(e)===Object.prototype:e instanceof Object||e.constructor===Object,ft=e instanceof Object?"":"null prototype",ht=!ct&&R&&Object(e)===e&&R in e?v.call(H(e),8,-1):ft?"Object":"",lt=(ct||"function"!=typeof e.constructor?"":e.constructor.name?e.constructor.name+" ":"")+(ht||ft?"["+S.call(w.call([],ht||[],ft||[]),": ")+"] ":"");return 0===ut.length?lt+"{}":N?lt+"{"+Z(ut,N)+"}":lt+"{ "+S.call(ut,", ")+" }"}return String(e)};var Y=Object.prototype.hasOwnProperty||function(t){return t in this};function G(t,e){return Y.call(t,e)}function H(t){return m.call(t)}function z(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}function K(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+_.call(e.toString(16))}function W(t){return"Object("+t+")"}function X(t){return t+" { ? }"}function J(t,e,n,r){return t+" ("+e+") {"+(r?Z(n,r):S.call(n,", "))+"}"}function Z(t,e){if(0===t.length)return"";var n="\n"+e.prev+e.base;return n+S.call(t,","+n)+"\n"+e.prev}function Q(t,e){var n=F(t),r=[];if(n){r.length=t.length;for(var i=0;i<t.length;i++)r[i]=G(t,i)?e(t[i],t):""}var o,a="function"==typeof N?N(t):[];if(I){o={};for(var s=0;s<a.length;s++)o["$"+a[s]]=a[s]}for(var u in t)G(t,u)&&(n&&String(Number(u))===u&&u<t.length||I&&o["$"+u]instanceof Symbol||(M.call(/[^\w$]/,u)?r.push(e(u,t)+": "+e(t[u],t)):r.push(u+": "+e(t[u],t))));if("function"==typeof N)for(var c=0;c<a.length;c++)P.call(t,a[c])&&r.push("["+e(a[c])+"]: "+e(t[a[c]],t));return r}},function(t,e){},function(t,e,n){"use strict";var r=n(161),i=Object.prototype.hasOwnProperty,o=Array.isArray,a={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},u=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},c=function(t,e,n,r){if(t){var o=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/g,s=n.depth>0&&/(\[[^[\]]*])/.exec(o),c=s?o.slice(0,s.index):o,f=[];if(c){if(!n.plainObjects&&i.call(Object.prototype,c)&&!n.allowPrototypes)return;f.push(c)}for(var h=0;n.depth>0&&null!==(s=a.exec(o))&&h<n.depth;){if(h+=1,!n.plainObjects&&i.call(Object.prototype,s[1].slice(1,-1))&&!n.allowPrototypes)return;f.push(s[1])}return s&&f.push("["+o.slice(s.index)+"]"),function(t,e,n,r){for(var i=r?e:u(e,n),o=t.length-1;o>=0;--o){var a,s=t[o];if("[]"===s&&n.parseArrays)a=[].concat(i);else{a=n.plainObjects?Object.create(null):{};var c="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,f=parseInt(c,10);n.parseArrays||""!==c?!isNaN(f)&&s!==c&&String(f)===c&&f>=0&&n.parseArrays&&f<=n.arrayLimit?(a=[])[f]=i:"__proto__"!==c&&(a[c]=i):a={0:i}}i=a}return i}(f,e,n,r)}};t.exports=function(t,e){var n=function(t){if(!t)return a;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?a.charset:t.charset;return{allowDots:void 0===t.allowDots?a.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:a.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:a.comma,decoder:"function"==typeof t.decoder?t.decoder:a.decoder,delimiter:"string"==typeof t.delimiter||r.isRegExp(t.delimiter)?t.delimiter:a.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:a.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling}}(e);if(""===t||null==t)return n.plainObjects?Object.create(null):{};for(var f="string"==typeof t?function(t,e){var n,c={},f=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,h=e.parameterLimit===1/0?void 0:e.parameterLimit,l=f.split(e.delimiter,h),d=-1,p=e.charset;if(e.charsetSentinel)for(n=0;n<l.length;++n)0===l[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===l[n]?p="utf-8":"utf8=%26%2310003%3B"===l[n]&&(p="iso-8859-1"),d=n,n=l.length);for(n=0;n<l.length;++n)if(n!==d){var m,b,y=l[n],v=y.indexOf("]="),g=-1===v?y.indexOf("="):v+1;-1===g?(m=e.decoder(y,a.decoder,p,"key"),b=e.strictNullHandling?null:""):(m=e.decoder(y.slice(0,g),a.decoder,p,"key"),b=r.maybeMap(u(y.slice(g+1),e),(function(t){return e.decoder(t,a.decoder,p,"value")}))),b&&e.interpretNumericEntities&&"iso-8859-1"===p&&(b=s(b)),y.indexOf("[]=")>-1&&(b=o(b)?[b]:b),i.call(c,m)?c[m]=r.combine(c[m],b):c[m]=b}return c}(t,n):t,h=n.plainObjects?Object.create(null):{},l=Object.keys(f),d=0;d<l.length;++d){var p=l[d],m=c(p,f[p],n,"string"==typeof t);h=r.merge(h,m,n)}return!0===n.allowSparse?h:r.compact(h)}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var i=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,i=n;return[i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],"-",i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]],i[t[r++]]].join("")}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(18),i=function(){function t(t){this.table={},this.nElements=0,this.toStr=t||r.defaultToString}return t.prototype.getValue=function(t){var e=this.table["$"+this.toStr(t)];if(!r.isUndefined(e))return e.value},t.prototype.setValue=function(t,e){if(!r.isUndefined(t)&&!r.isUndefined(e)){var n,i="$"+this.toStr(t),o=this.table[i];return r.isUndefined(o)?(this.nElements++,n=void 0):n=o.value,this.table[i]={key:t,value:e},n}},t.prototype.remove=function(t){var e="$"+this.toStr(t),n=this.table[e];if(!r.isUndefined(n))return delete this.table[e],this.nElements--,n.value},t.prototype.keys=function(){var t=[];for(var e in this.table)if(r.has(this.table,e)){var n=this.table[e];t.push(n.key)}return t},t.prototype.values=function(){var t=[];for(var e in this.table)if(r.has(this.table,e)){var n=this.table[e];t.push(n.value)}return t},t.prototype.forEach=function(t){for(var e in this.table)if(r.has(this.table,e)){var n=this.table[e];if(!1===t(n.key,n.value))return}},t.prototype.containsKey=function(t){return!r.isUndefined(this.getValue(t))},t.prototype.clear=function(){this.table={},this.nElements=0},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){var t="{";return this.forEach((function(e,n){t+="\n\t"+e+" : "+n})),t+"\n}"},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(18),i=n(163),o=function(){function t(){this.firstNode=null,this.lastNode=null,this.nElements=0}return t.prototype.add=function(t,e){if(r.isUndefined(e)&&(e=this.nElements),e<0||e>this.nElements||r.isUndefined(t))return!1;var n=this.createNode(t);if(0===this.nElements||null===this.lastNode)this.firstNode=n,this.lastNode=n;else if(e===this.nElements)this.lastNode.next=n,this.lastNode=n;else if(0===e)n.next=this.firstNode,this.firstNode=n;else{var i=this.nodeAtIndex(e-1);if(null===i)return!1;n.next=i.next,i.next=n}return this.nElements++,!0},t.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},t.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},t.prototype.elementAtIndex=function(t){var e=this.nodeAtIndex(t);if(null!==e)return e.element},t.prototype.indexOf=function(t,e){var n=e||r.defaultEquals;if(r.isUndefined(t))return-1;for(var i=this.firstNode,o=0;null!==i;){if(n(i.element,t))return o;o++,i=i.next}return-1},t.prototype.contains=function(t,e){return this.indexOf(t,e)>=0},t.prototype.remove=function(t,e){var n=e||r.defaultEquals;if(this.nElements<1||r.isUndefined(t))return!1;for(var i=null,o=this.firstNode;null!==o;){if(n(o.element,t))return null===i?(this.firstNode=o.next,o===this.lastNode&&(this.lastNode=null)):o===this.lastNode?(this.lastNode=i,i.next=o.next,o.next=null):(i.next=o.next,o.next=null),this.nElements--,!0;i=o,o=o.next}return!1},t.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},t.prototype.equals=function(e,n){var i=n||r.defaultEquals;return e instanceof t&&(this.size()===e.size()&&this.equalsAux(this.firstNode,e.firstNode,i))},t.prototype.equalsAux=function(t,e,n){for(;null!==t&&null!==e;){if(!n(t.element,e.element))return!1;t=t.next,e=e.next}return!0},t.prototype.removeElementAtIndex=function(t){if(!(t<0||t>=this.nElements||null===this.firstNode||null===this.lastNode)){var e;if(1===this.nElements)e=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var n=this.nodeAtIndex(t-1);null===n?(e=this.firstNode.element,this.firstNode=this.firstNode.next):n.next===this.lastNode&&(e=this.lastNode.element,this.lastNode=n),null!==n&&null!==n.next&&(e=n.next.element,n.next=n.next.next)}return this.nElements--,e}},t.prototype.forEach=function(t){for(var e=this.firstNode;null!==e&&!1!==t(e.element);)e=e.next},t.prototype.reverse=function(){for(var t=null,e=this.firstNode,n=null;null!==e;)n=e.next,e.next=t,t=e,e=n;n=this.firstNode,this.firstNode=this.lastNode,this.lastNode=n},t.prototype.toArray=function(){for(var t=[],e=this.firstNode;null!==e;)t.push(e.element),e=e.next;return t},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){return i.toString(this.toArray())},t.prototype.nodeAtIndex=function(t){if(t<0||t>=this.nElements)return null;if(t===this.nElements-1)return this.lastNode;for(var e=this.firstNode,n=0;n<t&&null!==e;n++)e=e.next;return e},t.prototype.createNode=function(t){return{element:t,next:null}},t}();e.default=o},function(t,e){function n(t,e){if(!t)throw new Error(e||"AssertionError")}n.notEqual=function(t,e,r){n(t!=e,r)},n.notOk=function(t,e){n(!t,e)},n.equal=function(t,e,r){n(t==e,r)},n.ok=n,t.exports=n},function(t,e,n){"use strict";n.r(e),n.d(e,"DbConstants",(function(){return N})),n.d(e,"Migration",(function(){return C})),n.d(e,"DbService",(function(){return I})),n.d(e,"DeviceRegisterServiceImpl",(function(){return Pt})),n.d(e,"HttpRequestType",(function(){return P.CsHttpRequestType})),n.d(e,"ResponseCode",(function(){return P.CsHttpResponseCode})),n.d(e,"HttpSerializer",(function(){return P.CsHttpSerializer})),n.d(e,"Request",(function(){return P.CsRequest})),n.d(e,"Response",(function(){return P.CsResponse})),n.d(e,"NetworkError",(function(){return P.CsNetworkError})),n.d(e,"HttpClientError",(function(){return P.CsHttpClientError})),n.d(e,"HttpServerError",(function(){return P.CsHttpServerError})),n.d(e,"JWTokenType",(function(){return T})),n.d(e,"JWTUtil",(function(){return X})),n.d(e,"ApiServiceImpl",(function(){return wt})),n.d(e,"TelemetryDecorator",(function(){return Lt})),n.d(e,"Actor",(function(){return Ht})),n.d(e,"Context",(function(){return zt})),n.d(e,"DeviceSpecification",(function(){return Kt})),n.d(e,"Etags",(function(){return Wt})),n.d(e,"ExData",(function(){return Xt})),n.d(e,"GameData",(function(){return Jt})),n.d(e,"CorrelationData",(function(){return Zt})),n.d(e,"Rollup",(function(){return Qt})),n.d(e,"Visit",(function(){return $t})),n.d(e,"ProducerData",(function(){return te})),n.d(e,"Search",(function(){return ee})),n.d(e,"TelemetryObject",(function(){return ne})),n.d(e,"ProcessedEventModel",(function(){return re})),n.d(e,"AuditState",(function(){return Ft})),n.d(e,"SunbirdTelemetry",(function(){return Vt})),n.d(e,"ObjectType",(function(){return at})),n.d(e,"Mode",(function(){return st})),n.d(e,"LogType",(function(){return ut})),n.d(e,"LogLevel",(function(){return ct})),n.d(e,"ShareDirection",(function(){return ft})),n.d(e,"ShareType",(function(){return ht})),n.d(e,"ShareItemType",(function(){return lt})),n.d(e,"LogMessage",(function(){return xt})),n.d(e,"InteractType",(function(){return Dt})),n.d(e,"InteractSubType",(function(){return jt})),n.d(e,"TelemetryErrorCode",(function(){return kt})),n.d(e,"ErrorType",(function(){return Ut})),n.d(e,"TelemetryInteractRequest",(function(){return oe})),n.d(e,"TelemetryErrorRequest",(function(){return ae})),n.d(e,"TelemetryInterruptRequest",(function(){return se})),n.d(e,"TelemetryImpressionRequest",(function(){return ue})),n.d(e,"TelemetryStartRequest",(function(){return ce})),n.d(e,"TelemetrySummaryRequest",(function(){return fe})),n.d(e,"TelemetryEndRequest",(function(){return he})),n.d(e,"TelemetryFeedbackRequest",(function(){return le})),n.d(e,"TelemetryLogRequest",(function(){return de})),n.d(e,"TelemetryShareRequest",(function(){return pe})),n.d(e,"TelemetryAutoSyncModes",(function(){return ie})),n.d(e,"SignInError",(function(){return ge})),n.d(e,"AuthEventType",(function(){return me})),n.d(e,"WebviewLoginSessionProvider",(function(){return tm})),n.d(e,"WebviewManualMergeSessionProvider",(function(){return im})),n.d(e,"WebviewAutoMergeSessionProvider",(function(){return Xp})),n.d(e,"WebviewRunnerError",(function(){return gn})),n.d(e,"InterruptError",(function(){return am})),n.d(e,"NoInappbrowserSessionAssertionFailError",(function(){return En})),n.d(e,"ParamNotCapturedError",(function(){return wn})),n.d(e,"NativeGoogleSessionProvider",(function(){return cm})),n.d(e,"NativeAppleSessionProvider",(function(){return dm})),n.d(e,"WebviewStateSessionProvider",(function(){return vm})),n.d(e,"NativeKeycloakSessionProvider",(function(){return Em})),n.d(e,"NativeCustomBrowserSessionProvider",(function(){return Sm})),n.d(e,"CourseServiceImpl",(function(){return No})),n.d(e,"UpdateContentStateTarget",(function(){return oo})),n.d(e,"CourseEnrollmentType",(function(){return ao})),n.d(e,"CourseBatchStatus",(function(){return so})),n.d(e,"CertificateAlreadyDownloaded",(function(){return Ro})),n.d(e,"FrameworkServiceImpl",(function(){return Da})),n.d(e,"FrameworkCategoryCode",(function(){return Co})),n.d(e,"FrameworkCategoryCodesGroup",(function(){return ka})),n.d(e,"FrameworkUtilServiceImpl",(function(){return za})),n.d(e,"TrackingEnabled",(function(){return Sr.TrackingEnabled})),n.d(e,"ContentDeleteStatus",(function(){return Rn})),n.d(e,"SortOrder",(function(){return Pn})),n.d(e,"MarkerType",(function(){return Ln})),n.d(e,"SearchType",(function(){return Dn})),n.d(e,"ChildContents",(function(){return jn})),n.d(e,"State",(function(){return kn})),n.d(e,"MimeType",(function(){return Un})),n.d(e,"Visibility",(function(){return xn})),n.d(e,"ContentStatus",(function(){return Bn})),n.d(e,"ContentEncoding",(function(){return Fn})),n.d(e,"ContentDisposition",(function(){return Vn})),n.d(e,"FileExtension",(function(){return qn})),n.d(e,"ContentImportStatus",(function(){return Yn})),n.d(e,"ContentErrorCode",(function(){return Gn})),n.d(e,"ErrorCode",(function(){return Hn})),n.d(e,"FileName",(function(){return zn})),n.d(e,"ContentEventType",(function(){return Kn})),n.d(e,"ContentMapper",(function(){return Rr})),n.d(e,"UserFeedCategory",(function(){return Gr.UserFeedCategory})),n.d(e,"UserFeedStatus",(function(){return Gr.UserFeedStatus})),n.d(e,"ProfileType",(function(){return Br})),n.d(e,"ProfileSource",(function(){return Fr})),n.d(e,"ProfileSession",(function(){return zr})),n.d(e,"ContentAccess",(function(){return Kr})),n.d(e,"ContentAccessStatus",(function(){return Hr})),n.d(e,"ProfileServiceImpl",(function(){return ea})),n.d(e,"NoActiveSessionError",(function(){return ra})),n.d(e,"NoProfileFoundError",(function(){return oa})),n.d(e,"GroupMembershipType",(function(){return Om.GroupMembershipType})),n.d(e,"GroupMemberRole",(function(){return Om.GroupMemberRole})),n.d(e,"GroupEntityStatus",(function(){return Om.GroupEntityStatus})),n.d(e,"GroupSessionDeprecated",(function(){return kd})),n.d(e,"NoGroupFoundError",(function(){return xd})),n.d(e,"NoActiveGroupSessionError",(function(){return Fd})),n.d(e,"PageName",(function(){return ja})),n.d(e,"SunbirdSdk",(function(){return qp})),n.d(e,"EventNamespace",(function(){return $})),n.d(e,"ErrorEventType",(function(){return tt})),n.d(e,"SystemSettingsServiceImpl",(function(){return Xc})),n.d(e,"SummarizerServiceImpl",(function(){return Vi})),n.d(e,"ContentCache",(function(){return qi})),n.d(e,"ReportDetailPerUser",(function(){return Yi})),n.d(e,"SummarizerHandler",(function(){return Gi})),n.d(e,"SummarizerQueries",(function(){return Hi})),n.d(e,"SummaryTelemetryEventHandler",(function(){return ko})),n.d(e,"CachedItemRequestSourceFrom",(function(){return Wr})),n.d(e,"StorageDestination",(function(){return _c})),n.d(e,"StorageEventType",(function(){return Ec})),n.d(e,"ExistingContentAction",(function(){return Mc})),n.d(e,"TransferFailedDuplicateContentError",(function(){return tf})),n.d(e,"TransferFailedError",(function(){return nf})),n.d(e,"NotificationType",(function(){return Rh})),n.d(e,"NotificationStatus",(function(){return Ph})),n.d(e,"CodePUshExperimentServiceImpl",(function(){return Gl})),n.d(e,"FaqServiceImpl",(function(){return Xl})),n.d(e,"ArchiveObjectType",(function(){return al})),n.d(e,"ExportAssertionError",(function(){return Zl})),n.d(e,"InvalidRequestError",(function(){return $l})),n.d(e,"ObjectNotFoundError",(function(){return ed})),n.d(e,"FetchSegmentationTagHandler",(function(){return rp})),n.d(e,"FetchSegmentationCommandHandler",(function(){return ip})),n.d(e,"StoreSegmentationTagHandler",(function(){return op})),n.d(e,"StoreSegmentationCommandHandler",(function(){return ap})),n.d(e,"SegmentationServiceImpl",(function(){return fp})),n.d(e,"DebuggingDurationHandler",(function(){return pp})),n.d(e,"DebuggingServiceImpl",(function(){return _p})),n.d(e,"CertificateServiceImpl",(function(){return Bp})),n.d(e,"DownloadEventType",(function(){return Jr})),n.d(e,"DownloadStatus",(function(){return Zr})),n.d(e,"PlayerServiceImpl",(function(){return Bf})),n.d(e,"NetworkStatus",(function(){return Lr})),n.d(e,"ValidationError",(function(){return Ui}));var r="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r&&r,i="URLSearchParams"in r,o="Symbol"in r&&"iterator"in Symbol,a="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in r,u="ArrayBuffer"in r;if(u)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(t){return t&&c.indexOf(Object.prototype.toString.call(t))>-1};function h(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function m(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function b(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function y(t){var e=new FileReader,n=b(e);return e.readAsArrayBuffer(t),n}function v(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:a&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&a&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=v(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||f(t))?this._bodyArrayBuffer=v(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},a&&(this.blob=function(){var t=m(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=m(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(y)}),this.text=function(){var t,e,n,r=m(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=b(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(M)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=h(t),e=l(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},p.prototype.delete=function(t){delete this.map[h(t)]},p.prototype.get=function(t){return t=h(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(h(t))},p.prototype.set=function(t,e){this.map[h(t)]=l(e)},p.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),d(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),d(t)},o&&(p.prototype[Symbol.iterator]=p.prototype.entries);var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(t,e){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(e=e||{}).body;if(t instanceof E){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),_.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function M(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function w(t,e){if(!(this instanceof w))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},g.call(E.prototype),g.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var S=[301,302,303,307,308];w.redirect=function(t,e){if(-1===S.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})};var O=r.DOMException;try{new O}catch(t){(O=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),O.prototype.constructor=O}function A(t,e){return new Promise((function(n,i){var o=new E(t,e);if(o.signal&&o.signal.aborted)return i(new O("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,r={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");var i="response"in s?s.response:s.responseText;setTimeout((function(){n(new w(i,r))}),0)},s.onerror=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){i(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){i(new O("Aborted","AbortError"))}),0)},s.open(o.method,function(t){try{return""===t&&r.location.href?r.location.href:t}catch(e){return t}}(o.url),!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&(a?s.responseType="blob":u&&o.headers.get("Content-Type")&&-1!==o.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof p?o.headers.forEach((function(t,e){s.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){s.setRequestHeader(t,l(e.headers[t]))})),o.signal&&(o.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",c)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}A.polyfill=!0,r.fetch||(r.fetch=A,r.Headers=p,r.Request=E,r.Response=w);var T,N=function(){function t(){}return t.DATE_TYPE="DATE",t.TEXT_TYPE="TEXT",t.INT_TYPE="INTEGER",t.REAL_TYPE="REAL",t.COMMA_SEP=",",t.SPACE=" ",t.MAX_NUM_OF_EVENTS=1e3,t.MAX_NUM_OF_PROCESSED_EVENTS=1,t.ERROR="DB_ERROR",t.BLOB_TYPE="BLOB",t.NOT_NULL="NOT NULL",t.NULL="NULL",t}(),C=function(){function t(t,e){this.targetDbVersion=e,this.migrationNumber=t}return t.prototype.required=function(t,e){return t<this.targetDbVersion&&this.targetDbVersion<=e},t}(),I=function(){},R=n(2),P=n(8),L=n(92);!function(t){t.HS256="HS256"}(T||(T={}));var D,j,k,U,x,B,F,V,q,Y,G,H,z,K,W,X=function(){function t(){}return t.createJWToken=function(t,e,n){return void 0===n&&(n=T.HS256),L.sign(t,e,{algorithm:n})},t.getJWTPayload=function(t){return L.decode(t,{json:!0})},t}(),J=n(1),Z={HTTP_SERVICE:Symbol.for("CS_HTTP_SERVICE"),GROUP_SERVICE:Symbol.for("CS_GROUP_SERVICE"),COURSE_SERVICE:Symbol.for("CS_COURSE_SERVICE"),USER_SERVICE:Symbol.for("CS_USER_SERVICE"),DISCUSSION_SERVICE:Symbol.for("CS_DISCUSSION_SERVICE"),CONTENT_SERVICE:Symbol.for("CS_CONTENT_SERVICE"),NOTIFICATION_SERVICE_V2:Symbol.for("CS_NOTIFICATION_SERVICE"),CERTIFICATE_SERVICE:Symbol.for("CS_CERTIFICATE_SERVICE")},Q={CONTAINER:Symbol.for("CONTAINER"),DB_VERSION:Symbol.for("DB_VERSION"),DB_MIGRATION_LIST:Symbol.for("DB_MIGRATION_LIST"),SDK_CONFIG:Symbol.for("SDK_CONFIG"),DEVICE_INFO:Symbol.for("DEVICE_INFO"),SHARED_PREFERENCES:Symbol.for("SHARED_PREFERENCES"),EVENTS_BUS_SERVICE:Symbol.for("EVENTS_BUS_SERVICE"),DB_SERVICE:Symbol.for("DB_SERVICE"),APP_INFO:Symbol.for("APP_INFO"),API_SERVICE:Symbol.for("API_SERVICE"),AUTH_SERVICE:Symbol.for("AUTH_SERVICE"),FILE_SERVICE:Symbol.for("FILE_SERVICE"),SYSTEM_SETTINGS_SERVICE:Symbol.for("SYSTEM_SETTINGS_SERVICE"),FRAMEWORK_SERVICE:Symbol.for("FRAMEWORK_SERVICE"),PROFILE_SERVICE:Symbol.for("PROFILE_SERVICE"),GROUP_SERVICE:Symbol.for("GROUP_SERVICE"),GROUP_SERVICE_DEPRECATED:Symbol.for("GROUP_SERVICE_DEPRECATED"),ZIP_SERVICE:Symbol.for("ZIP_SERVICE"),TELEMETRY_SERVICE:Symbol.for("TELEMETRY_SERVICE"),CONTENT_FEEDBACK_SERVICE:Symbol.for("CONTENT_FEEDBACK_SERVICE"),FORM_SERVICE:Symbol.for("FORM_SERVICE"),PAGE_ASSEMBLE_SERVICE:Symbol.for("PAGE_ASSEMBLE_SERVICE"),FRAMEWORK_UTIL_SERVICE:Symbol.for("FRAMEWORK_UTIL_SERVICE"),DOWNLOAD_SERVICE:Symbol.for("DOWNLOAD_SERVICE"),CONTENT_SERVICE:Symbol.for("CONTENT_SERVICE"),COURSE_SERVICE:Symbol.for("COURSE_SERVICE"),SUMMARIZER_SERVICE:Symbol.for("SUMMARIZER_SERVICE"),PLAYER_SERVICE:Symbol.for("PLAYER_SERVICE"),CACHED_ITEM_STORE:Symbol.for("CACHED_ITEM_STORE"),KEY_VALUE_STORE:Symbol.for("KEY_VALUE_STORE"),TELEMETRY_DECORATOR:Symbol.for("TELEMETRY_DECORATOR"),STORAGE_SERVICE:Symbol.for("STORAGE_SERVICE"),NOTIFICATION_SERVICE:Symbol.for("NOTIFICATION_SERVICE"),ERROR_LOGGER_SERVICE:Symbol.for("ERROR_LOGGER_SERVICE"),NETWORKINFO_SERVICE:Symbol.for("NETWORKINFO_SERVICE"),SEARCH_HISTORY_SERVICE:Symbol.for("SEARCH_HISTORY_SERVICE"),CODEPUSH_EXPERIMENT_SERVICE:Symbol.for("CODEPUSH_EXPERIMENT_SERVICE"),FAQ_SERVICE:Symbol.for("FAQ_SERVICE"),DEVICE_REGISTER_SERVICE:Symbol.for("DEVICE_REGISTER_SERVICE"),CONTENT_RATING_SERVICE:Symbol.for("CONTENT_RATING_SERVICE"),ARCHIVE_SERVICE:Symbol.for("ARCHIVE_SERVICE"),NETWORK_QUEUE:Symbol.for("NETWORK_QUEUE"),CLASS_ROOM_SERVICE:Symbol.for("CLASS_ROOM_SERVICE"),DISCUSSION_SERVICE:Symbol.for("DISCUSSION_SERVICE"),SEGMENTATION_SERVICE:Symbol.for("SEGMENTATION_SERVICE"),DEBUGGING_SERVICE:Symbol.for("DEBUGGING_SERVICE"),NOTIFICATION_SERVICE_V2:Symbol.for("NOTIFICATION_SERVICE_V2"),CERTIFICATE_SERVICE:Symbol.for("CERTIFICATE_SERVICE")};!function(t){t.KEY_FIRST_ACCESS_TIMESTAMP="first_access_timestamp"}(D||(D={})),function(t){t.KEY_API_TOKEN="api_bearer_token_v2"}(j||(j={})),function(t){t.KEY_OAUTH_SESSION="oauth_token"}(k||(k={})),function(t){t.KEY_GROUP_SESSION="group_session"}(U||(U={})),function(t){t.KEY_USER_SESSION="session"}(x||(x={})),function(t){t.KEY_ACTIVE_CHANNEL_ID="channelId",t.KEY_ACTIVE_CHANNEL_ACTIVE_FRAMEWORK_ID="sunbirdcurrent_framework_id"}(B||(B={})),function(t){t.KEY_TO_DOWNLOAD_LIST="to_download_list"}(F||(F={})),function(t){t.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL="is_update_size_on_device_successful",t.KEY_CONTENT_DELETE_REQUEST_LIST="content_delete_request_list",t.KEY_LAST_MODIFIED="last_modified",t.UPDATE_CONTENT_STATE="update_content_state",t.COURSE_CONTEXT="sunbirdcontent_context"}(V||(V={})),function(t){t.KEY_STORAGE_DESTINATION="storage_destination",t.KEY_TO_TRANSFER_LIST="to_transfer_list"}(q||(q={})),function(t){t.KEY_ERROR_LOG_LAST_SYNCED_TIME_STAMP="error_log_last_synced_time_stamp"}(Y||(Y={})),function(t){t.DEPLOYMENT_KEY="deployment_key"}(G||(G={})),function(t){t.DEFAULT_DEPLOYMENT_KEY="default_deployment_key",t.EXPERIMENT_KEY="experiment_key",t.EXPERIMENT_APP_VERSION="emperiment_app_version"}(H||(H={})),function(t){t.DEVICE_LOCATION="device_location_new"}(z||(z={})),function(t){t.KEY_LAST_SYNCED_TIME_STAMP="telemetry_last_synced_time_stamp",t.KEY_AUTO_SYNC_MODE="telemetry_auto_sync_mode"}(K||(K={})),function(t){t.KEY_ORGANISATION_ID="page_assemble_organisation_id"}(W||(W={}));var $,tt,et=n(11),nt=n.n(et),rt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},it=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ot=function(){function t(t,e,n){this.config=t,this.apiService=e,this.deviceInfo=n}return t.prototype.refreshAuthToken=function(){return Object(J.from)(this.getBearerTokenFromKongV2())},t.prototype.getMobileDeviceConsumerKey=function(){return this.config.api_authentication.producerId+"-"+this.deviceInfo.getDeviceID()},t.prototype.buildGetMobileDeviceConsumerSecretAPIRequest=function(e){return(new P.CsRequest.Builder).withPath(e).withType(P.CsHttpRequestType.POST).withHeaders({"Content-Encoding":"gzip",Authorization:"Bearer "+this.generateMobileAppConsumerBearerToken()}).withBody({id:t.ID,ver:t.VERSION,ts:et().format(),request:{key:this.getMobileDeviceConsumerKey()}}).build()},t.prototype.getBearerTokenFromKongV2=function(){return rt(this,void 0,void 0,(function(){var t,e=this;return it(this,(function(n){return t="/api/api-manager/v2/consumer/"+this.config.api_authentication.mobileAppConsumer+"/credential/register",[2,this.apiService.fetch(this.buildGetMobileDeviceConsumerSecretAPIRequest(t)).toPromise().then((function(t){return t.body.result.token})).catch((function(t){if(!P.CsNetworkError.isInstance(t)){var n="/api/api-manager/v1/consumer/"+e.config.api_authentication.mobileAppConsumer+"/credential/register";if(t.response.responseCode===P.CsHttpResponseCode.HTTP_KONG_FAILURE){var r=t.response.headers,i=r?r.location:n;return e.getBearerTokenFromFallback(i||n)}return e.getBearerTokenFromFallback(n)}throw t}))]}))}))},t.prototype.getBearerTokenFromFallback=function(t){return rt(this,void 0,void 0,(function(){var e=this;return it(this,(function(n){return[2,this.apiService.fetch(this.buildGetMobileDeviceConsumerSecretAPIRequest(t)).toPromise().then((function(t){var n=t.body.result;return n.token?n.token:X.createJWToken({iss:e.getMobileDeviceConsumerKey()},n.secret,T.HS256)})).catch((function(){}))]}))}))},t.prototype.generateMobileAppConsumerBearerToken=function(){var t=this.config.api_authentication.mobileAppKey,e=this.config.api_authentication.mobileAppSecret;return X.createJWToken({iss:t},e,T.HS256)},t.VERSION="1.0",t.ID="ekstep.genie.device.register",t}();!function(t){t.AUTH="AUTH",t.TELEMETRY="TELEMETRY",t.DOWNLOADS="DOWNLOADS",t.CONTENT="CONTENT",t.ERROR="ERROR",t.STORAGE="STORAGE"}($||($={})),function(t){t.HTTP_SERVER_ERROR="HTTP_SERVER_ERROR",t.HTTP_CLIENT_ERROR="HTTP_CLIENT_ERROR",t.AUTH_TOKEN_REFRESH_ERROR="AUTH_TOKEN_REFRESH_ERROR",t.PLANNED_MAINTENANCE_PERIOD="PLANNED_MAINTENANCE_PERIOD"}(tt||(tt={}));var at,st,ut,ct,ft,ht,lt,dt=n(0),pt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},mt=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},bt=function(){function t(t,e,n,r){this.sharedPreferences=t,this.apiConfig=e,this.deviceInfo=n,this.apiService=r,this.apiTokenHandler=new ot(this.apiConfig,this.apiService,this.deviceInfo)}return t.prototype.interceptResponse=function(t,e){var n=this;return e.responseCode===P.CsHttpResponseCode.HTTP_UNAUTHORISED&&"Unauthorized"===e.body.message||e.responseCode===P.CsHttpResponseCode.HTTP_FORBIDDEN?this.apiTokenHandler.refreshAuthToken().pipe(Object(dt.tap)((function(t){return pt(n,void 0,void 0,(function(){return mt(this,(function(e){switch(e.label){case 0:return[4,this.sharedPreferences.putString(j.KEY_API_TOKEN,t).toPromise()];case 1:return e.sent(),[2]}}))}))})),Object(dt.mergeMap)((function(){return n.apiService.fetch(t)}))):Object(J.of)(e)},t}(),yt=function(){function t(t,e){this.apiService=t,this.authService=e}return t.prototype.interceptResponse=function(t,e){var n=this;return e.responseCode!==P.CsHttpResponseCode.HTTP_UNAUTHORISED||e.body.message?Object(J.of)(e):this.invokeRefreshSessionTokenApi().pipe(Object(dt.mergeMap)((function(){return n.apiService.fetch(t)})))},t.prototype.invokeRefreshSessionTokenApi=function(){return this.authService.refreshSession()},t}(),vt=n(3),gt=n(51),_t=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Et=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mt=function(t,e){return function(n,r){e(n,r,t)}},wt=function(){function t(t,e,n,r,i,o){this.container=t,this.sdkConfig=e,this.deviceInfo=n,this.sharedPreferences=r,this.eventsBusService=i,this.httpService=o,this.hasEmittedPlannedMaintenanceErrorEvent=!1,this.defaultRequestInterceptors=[],this.defaultResponseInterceptors=[],this.apiConfig=this.sdkConfig.apiConfig,this.apiConfig.debugMode&&(this.defaultRequestInterceptors=[new gt.CsRequestLoggerInterceptor],this.defaultResponseInterceptors=[new gt.CsResponseLoggerInterceptor])}var e;return e=t,Object.defineProperty(t.prototype,"bearerTokenRefreshInterceptor",{get:function(){return this._bearerTokenRefreshInterceptor||(this._bearerTokenRefreshInterceptor=new bt(this.container.get(Q.SHARED_PREFERENCES),this.container.get(Q.SDK_CONFIG).apiConfig,this.container.get(Q.DEVICE_INFO),this.container.get(Q.API_SERVICE))),this._bearerTokenRefreshInterceptor},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"userTokenRefreshInterceptor",{get:function(){return this._userTokenRefreshInterceptor||(this._userTokenRefreshInterceptor=new yt(this.container.get(Q.API_SERVICE),this.container.get(Q.AUTH_SERVICE))),this._userTokenRefreshInterceptor},enumerable:!0,configurable:!0}),t.prototype.onInit=function(){var t=this;return this.sharedPreferences.addListener(j.KEY_API_TOKEN,(function(t){vt.CsModule.instance.config.core.api.authentication.bearerToken=t||void 0,vt.CsModule.instance.updateConfig(vt.CsModule.instance.config)})),this.sharedPreferences.getString(j.KEY_API_TOKEN).pipe(Object(dt.mergeMap)((function(e){return e?(vt.CsModule.instance.config.core.api.authentication.bearerToken=e,vt.CsModule.instance.updateConfig(vt.CsModule.instance.config),Object(J.of)(void 0)):new ot(t.apiConfig,t,t.deviceInfo).refreshAuthToken().pipe(Object(dt.mergeMap)((function(e){return t.sharedPreferences.putString(j.KEY_API_TOKEN,e)})),Object(dt.catchError)((function(){return Object(J.of)(void 0)})))})))},t.prototype.fetch=function(t){var n=this;if(this.defaultRequestInterceptors.forEach((function(e){-1===t.requestInterceptors.indexOf(e)&&t.requestInterceptors.push(e)})),this.defaultResponseInterceptors.forEach((function(e){-1===t.responseInterceptors.indexOf(e)&&t.responseInterceptors.push(e)})),t.withBearerToken){var r=t.responseInterceptors.indexOf(this.bearerTokenRefreshInterceptor);-1===r?t.responseInterceptors.push(this.bearerTokenRefreshInterceptor):t.responseInterceptors.splice(r,1)}if(t.withUserToken){var i=t.responseInterceptors.indexOf(this.userTokenRefreshInterceptor);-1===i?t.responseInterceptors.push(this.userTokenRefreshInterceptor):t.responseInterceptors.splice(i,1)}return this.httpService.fetch(t).pipe(Object(dt.catchError)((function(t){return P.CsHttpServerError.isInstance(t)?(n.eventsBusService.emit({namespace:$.ERROR,event:{type:tt.HTTP_SERVER_ERROR,payload:t}}),t.response.responseCode===e.PLANNED_MAINTENANCE_ERROR_CODE&&(n.hasEmittedPlannedMaintenanceErrorEvent||(n.hasEmittedPlannedMaintenanceErrorEvent=!0,n.eventsBusService.emit({namespace:$.ERROR,event:{type:tt.PLANNED_MAINTENANCE_PERIOD,payload:t}})))):P.CsHttpClientError.isInstance(t)&&n.eventsBusService.emit({namespace:$.ERROR,event:{type:tt.HTTP_CLIENT_ERROR,payload:t}}),Object(J.throwError)(t)})))},t.prototype.setDefaultRequestInterceptors=function(t){this.defaultRequestInterceptors=t,this.apiConfig.debugMode&&this.defaultRequestInterceptors.push(new gt.CsRequestLoggerInterceptor)},t.prototype.setDefaultResponseInterceptors=function(t){this.defaultResponseInterceptors=t,this.apiConfig.debugMode&&this.defaultResponseInterceptors.push(new gt.CsResponseLoggerInterceptor)},t.PLANNED_MAINTENANCE_ERROR_CODE=531,t=e=_t([Object(R.injectable)(),Mt(0,Object(R.inject)(Q.CONTAINER)),Mt(1,Object(R.inject)(Q.SDK_CONFIG)),Mt(2,Object(R.inject)(Q.DEVICE_INFO)),Mt(3,Object(R.inject)(Q.SHARED_PREFERENCES)),Mt(4,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),Mt(5,Object(R.inject)(Z.HTTP_SERVICE)),Et("design:paramtypes",[R.Container,Object,Object,Object,Object,Object])],t)}(),St=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ot=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},At=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Tt=function(){function t(t,e,n,r,i,o,a){this.sdkConfig=t,this.deviceInfo=e,this.sharedPreferences=n,this.frameworkService=r,this.appInfoService=i,this.apiService=o,this.getDeviceProfileHandler=a,this.deviceRegisterConfig=this.sdkConfig.deviceRegisterConfig,this.apiConfig=this.sdkConfig.apiConfig}return t.prototype.handle=function(t){return this.registerDevice(t)},t.prototype.registerDevice=function(e){var n=this;return Object(J.zip)(this.deviceInfo.getDeviceSpec(),this.frameworkService.getActiveChannelId(),this.appInfoService.getFirstAccessTimestamp(),this.sharedPreferences.getString(z.DEVICE_LOCATION)).pipe(Object(dt.mergeMap)((function(r){return Ot(n,void 0,void 0,(function(){var n,i,o,a,s,u,c,f=this;return At(this,(function(h){switch(h.label){case 0:if(n=r[0],i=r[1],o=r[2],a=r[3],(e=St({},e||{},{dspec:n,channel:i,fcmToken:this.deviceRegisterConfig.fcmToken,producer:this.apiConfig.api_authentication.producerId,first_access:Number(o)})).userDeclaredLocation||!a)return[3,4];if(e.userDeclaredLocation=JSON.parse(a),e.userDeclaredLocation.declaredOffline)return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,this.getDeviceProfileHandler.handle().toPromise()];case 2:return(s=h.sent()).userDeclaredLocation&&s.userDeclaredLocation.state&&s.userDeclaredLocation.district||(delete e.userDeclaredLocation,this.sharedPreferences.putString(z.DEVICE_LOCATION,"").toPromise()),[3,4];case 3:return u=h.sent(),console.error(u),delete e.userDeclaredLocation,[3,4];case 4:return e.userDeclaredLocation&&delete e.userDeclaredLocation.declaredOffline,c=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.deviceRegisterConfig.apiPath+t.DEVICE_REGISTER_ENDPOINT+"/"+this.deviceInfo.getDeviceID()).withBearerToken(!0).withBody({request:e}).build(),[2,this.apiService.fetch(c).pipe(Object(dt.map)((function(t){return t.body})),Object(dt.tap)((function(){e.userDeclaredLocation&&f.sharedPreferences.putString(z.DEVICE_LOCATION,JSON.stringify(e.userDeclaredLocation)).toPromise()}))).toPromise()]}}))}))})))},t.DEVICE_REGISTER_ENDPOINT="/register",t}(),Nt=function(){function t(t,e,n){this.sdkConfig=t,this.deviceInfo=e,this.apiService=n,this.deviceRegisterConfig=this.sdkConfig.deviceRegisterConfig,this.apiConfig=this.sdkConfig.apiConfig}return t.prototype.handle=function(){return this.fetchFromServer()},t.prototype.fetchFromServer=function(){return this.apiService.fetch((new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.deviceRegisterConfig.apiPath+t.GET_DEVICE_PROFILE_ENDPOINT+"/"+this.deviceInfo.getDeviceID()).withBearerToken(!0).build()).pipe(Object(dt.map)((function(t){return t.body.result})))},t.GET_DEVICE_PROFILE_ENDPOINT="/profile",t}(),Ct=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},It=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rt=function(t,e){return function(n,r){e(n,r,t)}},Pt=function(){function t(t,e,n,r,i,o){this.sdkConfig=t,this.deviceInfo=e,this.sharedPreferences=n,this.frameworkService=r,this.appInfoService=i,this.apiService=o,this.getDeviceProfileHandler=new Nt(this.sdkConfig,this.deviceInfo,this.apiService),this.deviceRegisterHandler=new Tt(this.sdkConfig,this.deviceInfo,this.sharedPreferences,this.frameworkService,this.appInfoService,this.apiService,this.getDeviceProfileHandler)}return t.prototype.registerDevice=function(t){return this.deviceRegisterHandler.handle(t)},t.prototype.getDeviceProfile=function(){return this.getDeviceProfileHandler.handle()},t=Ct([Object(R.injectable)(),Rt(0,Object(R.inject)(Q.SDK_CONFIG)),Rt(1,Object(R.inject)(Q.DEVICE_INFO)),Rt(2,Object(R.inject)(Q.SHARED_PREFERENCES)),Rt(3,Object(R.inject)(Q.FRAMEWORK_SERVICE)),Rt(4,Object(R.inject)(Q.APP_INFO)),Rt(5,Object(R.inject)(Q.API_SERVICE)),It("design:paramtypes",[Object,Object,Object,Object,Object,Object])],t)}(),Lt=function(){};!function(t){t.NOTIFICATION="notification",t.USER="User",t.GROUP="Group",t.CONTENT="Content",t.QUESTION="Question"}(at||(at={})),function(t){t.PLAY="play"}(st||(st={})),function(t){t.NOTIFICATION="notification"}(ut||(ut={})),function(t){t.TRACE="TRACE",t.DEBUG="DEBUG",t.INFO="INFO",t.WARN="WARN",t.ERROR="ERROR",t.FATAL="FATAL"}(ct||(ct={})),function(t){t.IN="In",t.OUT="Out"}(ft||(ft={})),function(t){t.FILE="File",t.MESSAGE="Message",t.LINK="Link"}(ht||(ht={})),function(t){t.CONTENT="CONTENT",t.EXPLODEDCONTENT="EXPLODEDCONTENT",t.TELEMETRY="TELEMETRY",t.PROFILE="PROFILE"}(lt||(lt={}));var Dt,jt,kt,Ut,xt=function(){this.RECEIVED="Received",this.DISPLAYED="Displayed"};!function(t){t.TOUCH="TOUCH",t.OTHER="OTHER"}(Dt||(Dt={})),function(t){t.NETWORK_SPEED="network-speed",t.SUBTYPE_SPINE="spine",t.ONLINE="online",t.FULL="full",t.CONTENT_VARIANT="content-variant-download",t.DEVICE_TIME_OFFSET_FOUND="device-time-offset-found",t.CONTENT_DOWNLOAD_INITIATE="ContentDownload-Initiate",t.CONTENT_DOWNLOAD_SUCCESS="ContentDownload-Success",t.CONTENT_DOWNLOAD_CANCEL="ContentDownload-Cancel"}(jt||(jt={})),function(t){t.ERR_DOWNLOAD_FAILED="ERR_DOWNLOAD_FAILED"}(kt||(kt={})),function(t){t.SYSTEM="SYSTEM"}(Ut||(Ut={}));var Bt,Ft,Vt,qt=function(){function t(){}return t.toFixed=function(t){return Number(t.toFixed(2))},t.parseInt=function(t){return t?parseInt(t,10):0},t.round=function(t){return Number(Math.round(parseFloat(t+"e4"))+"e-4")},t}(),Yt=(Bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},function(t,e){function n(){this.constructor=t}Bt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),Gt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ht=function(){function t(){this.type=t.TYPE_USER}return t.TYPE_SYSTEM="System",t.TYPE_USER="User",t}(),zt=function(){},Kt=function(){this.os="",this.make="",this.id="",this.mem=-1,this.idisk=-1,this.edisk=-1,this.scrn=-1,this.cpu="",this.sims=-1,this.cap=[]},Wt=function(){},Xt=function(){},Jt=function(){},Zt=function(){},Qt=function(){},$t=function(){},te=function(){function t(){}return t.prototype.ProducerData=function(){this.id="",this.pid="",this.ver=""},t}(),ee=function(){},ne=function(){function t(t,e,n){this.id=t,this.type=e,this.version=n}return t.prototype.setRollup=function(t){this.rollup=t},t}(),re=function(){};!function(t){t.AUDIT_CREATED="Created",t.AUDIT_UPDATED="Updated",t.AUDIT_DELETED="Deleted"}(Ft||(Ft={})),function(t){var e=function(){function t(e){this.ver=t.TELEMETRY_VERSION,this.eid=e,this.ets=Date.now(),this.actor=new Ht,this.context=new zt,this.edata={}}return t.TELEMETRY_VERSION="3.0",t}();t.Telemetry=e;var n=function(t){function e(n,r,i,o,a,s,u,c,f,h,l){void 0===u&&(u=""),void 0===c&&(c=""),void 0===f&&(f=""),void 0===h&&(h={}),void 0===l&&(l=[]);var d=t.call(this,e.EID)||this;return d.edata=Gt({},n?{type:n}:{},i?{duration:i}:{},o?{pageid:o}:{},r?{mode:r}:{},a?{summaryList:a}:{}),d.context.cdata=l,d.context.env=s,d.object=new ne(u,c,f),d.object.rollup=h,d}return Yt(e,t),e.EID="END",e}(e);t.End=n;var r=function(t){function e(n,r,i,o,a,s,u,c,f,h,l,d){void 0===n&&(n=""),void 0===c&&(c=""),void 0===f&&(f=""),void 0===h&&(h=""),void 0===l&&(l={}),void 0===d&&(d=[]);var p=t.call(this,e.EID)||this;return p.edata=Gt({},n?{type:n}:{type:""},r?{dspec:r}:{},i?{loc:i}:{},o?{mode:o}:{},a?{mode:o}:{},s?{pageid:s}:{}),p.context.cdata=d,p.context.env=u,p.object=new ne(c,f,h),p.object.rollup=l||{},p}return Yt(e,t),e.EID="START",e}(e);t.Start=r;var i=function(t){function e(n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y,v){void 0===p&&(p=[]),void 0===m&&(m=""),void 0===b&&(b=""),void 0===y&&(y=""),void 0===v&&(v={});var g=t.call(this,e.EID)||this;return g.edata=Gt({type:n,starttime:r,endtime:i,timespent:o,pageviews:a,interactions:s},c?{mode:c}:{},f?{envsummary:f}:{},h?{eventsummary:h}:{},l?{pagesummary:l}:{},d?{extra:d}:{}),g.context.cdata=p,g.context.env=u,g.object=new ne(m,b,y),g.object.rollup=v||{},g}return Yt(e,t),e.EID="SUMMARY",e}(e);t.Summary=i;var o=function(t){function e(n,r,i,o,a,s,u,c,f,h,l,d){void 0===c&&(c=""),void 0===f&&(f=""),void 0===h&&(h=""),void 0===l&&(l={}),void 0===d&&(d=[]);var p=t.call(this,e.EID)||this;return p.edata=Gt({type:n},{subtype:r},i?{id:i}:{},o?{pageid:o}:{},{extra:Gt({},a?{pos:a}:{},s?{values:[s]}:{})}),p.context.cdata=d,p.context.env=u,p.object=new ne(c,f,h),p.object.rollup=l||{},p}return Yt(e,t),e.EID="INTERACT",e}(e);t.Interact=o;var a=function(t){function e(n,r,i,o,a,s,u,c,f,h){void 0===s&&(s=""),void 0===u&&(u=""),void 0===c&&(c=""),void 0===f&&(f={}),void 0===h&&(h=[]);var l=t.call(this,e.EID)||this;return l.edata=Gt({},n?{type:n}:{type:""},r?{subtype:r}:{},i?{pageid:i}:{},i?{uri:i}:{},o?{visits:o}:{}),l.context.cdata=h,l.context.env=a,l.object=new ne(s||"",u||"",c||""),l.object.rollup=f||{},l}return Yt(e,t),e.EID="IMPRESSION",e}(e);t.Impression=a;var s=function(t){function e(n,r,i,o,a,s,u){var c=t.call(this,e.EID)||this;c.edata=Gt({},n?{type:n}:{type:""},r?{level:r}:{},i?{message:i}:{},o?{pageid:o}:{},a?{params:a}:{}),c.context.env=s;var f=new Ht;return f.type=u,c.actor=f,c}return Yt(e,t),e.EID="LOG",e}(e);t.Log=s;var u=function(t){function e(n,r,i,o){var a=t.call(this,e.EID)||this;return a.edata=Gt({},n?{err:n}:{},r?{errtype:r}:{},i?{stacktrace:i}:{},o?{pageid:o}:{}),a}return Yt(e,t),e.EID="ERROR",e}(e);t.Error=u;var c=function(t){function e(n,r){var i=t.call(this,e.EID)||this;return i.edata=Gt({type:n},r?{pageid:r}:{}),i}return Yt(e,t),e.EID="INTERRUPT",e}(e);t.Interrupt=c;var f=function(t){function e(n,r,i,o,a,s,u,c){void 0===o&&(o=[]),void 0===a&&(a=""),void 0===s&&(s=""),void 0===u&&(u=""),void 0===c&&(c=new Qt);var f=t.call(this,e.EID)||this;return f.edata=Gt({},n?{dir:n}:{},r?{type:r}:{},i?{items:i}:{}),f.context.cdata=o,f.object=new ne(a||"",s||"",u||""),f.object.rollup=c,f}return Yt(e,t),e.prototype.addItem=function(t,e,n,r,i,o){var a={};if(a.origin=e,a.id=n,a.type=this.capitalize(t.valueOf()),t.valueOf()===lt.CONTENT.valueOf()||t.valueOf()===lt.EXPLODEDCONTENT.valueOf()){a.ver=r.toString();var s=[],u={};u.transfers=qt.parseInt(i),u.size=o,s.push(u),a.params=s}var c={};c.id=e,c.type="Device",a.origin=c,this.edata.items.push(a)},e.prototype.capitalize=function(t){return t.charAt(0).toUpperCase()+t.slice(1)},e.EID="SHARE",e}(e);t.Share=f;var h=function(t){function e(n,r,i,o,a,s,u,c){void 0===o&&(o=""),void 0===a&&(a=""),void 0===s&&(s="");var f=t.call(this,e.EID)||this;return f.edata=Gt({},n?{rating:n}:{},u?{commentid:u}:{},c?{commenttxt:c}:{},r?{comments:r}:{}),f.context.env=i,f.object=new ne(o,a,s),f.object.rollup={},f}return Yt(e,t),e.EID="FEEDBACK",e}(e);t.Feedback=h;var l=function(t){function e(n,r,i,o,a,s,u,c,f,h){void 0===s&&(s=""),void 0===u&&(u=""),void 0===c&&(c=""),void 0===f&&(f=[]),void 0===h&&(h={});var l=t.call(this,e.EID)||this;return l.edata=Gt({state:i},o?{props:o}:{},{type:a}),l.context.cdata=f,l.context.env=n,l.object=new ne(s,u,c),l.object.rollup=h||{},l.actor=r,l}return Yt(e,t),e.EID="AUDIT",e}(e);t.Audit=l}(Vt||(Vt={}));var ie,oe=function(){this.pos=[]},ae=function(){},se=function(){},ue=function(){},ce=function(){},fe=function(){},he=function(){},le=function(){},de=function(){},pe=function(){this.items=[]};!function(t){t.OFF="OFF",t.OVER_WIFI="OVER_WIFI",t.ALWAYS_ON="ALWAYS_ON"}(ie||(ie={}));var me,be=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ye=function(t){function e(n,r){var i=t.call(this,n)||this;return i._code=r,Object.setPrototypeOf(i,e.prototype),i}return be(e,t),Object.defineProperty(e.prototype,"code",{get:function(){return this._code},enumerable:!0,configurable:!0}),e}(Error),ve=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ge=function(t){function e(n){var r=t.call(this,n,"SIGN_IN_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return ve(e,t),e}(ye);!function(t){t.AUTO_MIGRATE_SUCCESS="AUTO_MIGRATE_SUCCESS",t.AUTO_MIGRATE_FAIL="AUTO_MIGRATE_FAIL"}(me||(me={}));var _e,Ee,Me,we,Se,Oe,Ae,Te,Ne,Ce,Ie,Re,Pe,Le,De,je,ke,Ue,xe,Be,Fe,Ve,qe,Ye,Ge,He,ze,Ke,We,Xe,Je,Ze,Qe,$e,tn,en,nn,rn,on,an,sn,un,cn,fn,hn,ln,dn,pn,mn,bn,yn=n(19),vn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gn=function(t){function e(n,r){var i=t.call(this,n,r)||this;return Object.setPrototypeOf(i,e.prototype),i}return vn(e,t),e}(ye),_n=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),En=function(t){function e(e){var n=t.call(this,e,"NO_INAPPBROWSER_SESSION_ASSERTION_FAIL")||this;return Object.setPrototypeOf(n,gn.prototype),n}return _n(e,t),e}(gn),Mn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),wn=function(t){function e(n){var r=t.call(this,n,"PARAM_NOT_CAPTURED")||this;return Object.setPrototypeOf(r,e.prototype),r}return Mn(e,t),e}(gn),Sn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},On=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},An=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Tn=function(){function t(){this.extras={},this.captured={}}return t.buildUrl=function(t,e,n){return""+t+e+"?"+yn.stringify(n)},t.prototype.resetInAppBrowserEventListeners=function(){var t=this;if(!this.inAppBrowser)throw new En("InAppBrowser Session not found when resetInAppBrowserEventListeners()");var e=function(e){n.inAppBrowser.listeners.hasOwnProperty(e)&&(n.inAppBrowser.listeners[e].forEach((function(n){t.inAppBrowser.ref.removeEventListener(e,n)})),n.inAppBrowser.listeners[e].clear())},n=this;for(var r in this.inAppBrowser.listeners)e(r)},t.prototype.launchWebview=function(e){var n=e.host,r=e.path,i=e.params;return On(this,void 0,void 0,(function(){var e,o=this;return An(this,(function(a){return this.inAppBrowser={ref:cordova.InAppBrowser.open(t.buildUrl(n,r,i),"_blank","zoom=no,clearcache=yes,clearsessioncache=yes,cleardata=yes"),listeners:{loadstart:new Set,exit:new Set}},e=function(){o.resetInAppBrowserEventListeners(),o.inAppBrowser=void 0},this.inAppBrowser.listeners.exit.add(e),this.inAppBrowser.ref.addEventListener("exit",e),[2]}))}))},t.prototype.closeWebview=function(){return On(this,void 0,void 0,(function(){return An(this,(function(t){if(!this.inAppBrowser)throw new En("InAppBrowser Session not found");return this.inAppBrowser.ref.close(),[2]}))}))},t.prototype.any=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return J.race.apply(void 0,t).pipe(Object(dt.take)(1)).toPromise()},t.prototype.all=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return J.zip.apply(void 0,t).pipe(Object(dt.take)(1),Object(dt.mapTo)(void 0)).toPromise()},t.prototype.launchCustomTab=function(e){var n=this,r=e.host,i=e.path,o=e.params,a=e.extraParams,s=t.buildUrl(r,i,o);return new Promise((function(t,e){customtabs.isAvailable((function(){customtabs.launch(s,(function(e){n.captured=Sn({},n.captured,yn.parse(e)),t()}),(function(t){e(t)}))}),(function(){customtabs.launchInBrowser(s,a,(function(e){n.captured=Sn({},n.captured,yn.parse(e)),t()}),(function(t){e(t)}))}))}))},t.prototype.capture=function(t){var e=this,n=t.host,r=t.path,i=t.params;if(!this.inAppBrowser)throw new En("InAppBrowser Session not found");return new Promise((function(t){var o=function(a){if(a.url){var s=new URL(a.url);s.origin===n&&function(t){return t.pathname===r}(s)&&function(t){return i.map((function(t){return t})).every((function(e){return"false"===e.exists?!t.searchParams.has(e.key):e.match?t.searchParams.has(e.key)&&t.searchParams.get(e.key)===e.match:t.searchParams.has(e.key)}))}(s)&&(e.captured=Sn({},e.captured,i.reduce((function(t,e){return t[e.resolveTo]=s.searchParams.get(e.key),t}),{})),e.extras={},i.map((function(t){return t.key})).forEach((function(t){return s.searchParams.delete(t)})),s.searchParams.forEach((function(t,n){e.extras[n]=t})),e.inAppBrowser&&(e.inAppBrowser.listeners.loadstart.delete(o),e.inAppBrowser.ref.removeEventListener("loadstart",o)),t())}};e.inAppBrowser&&(e.inAppBrowser.listeners.loadstart.add(o),e.inAppBrowser.ref.addEventListener("loadstart",o))}))},t.prototype.resolveCaptured=function(t){return On(this,void 0,void 0,(function(){return An(this,(function(e){if(!this.captured[t])throw new wn(t+" was not captured");return[2,this.captured[t]]}))}))},t.prototype.clearCapture=function(){return On(this,void 0,void 0,(function(){return An(this,(function(t){return this.captured={},[2]}))}))},t.prototype.redirectTo=function(e){var n=e.host,r=e.path,i=e.params;return On(this,void 0,void 0,(function(){return An(this,(function(e){if(!this.inAppBrowser)throw new En("InAppBrowser Session not found");return this.inAppBrowser.ref.executeScript({code:"(() => {\n window.location.href = `"+t.buildUrl(n,r,i)+"`;\n })()"}),[2]}))}))},t.prototype.success=function(){return On(this,void 0,void 0,(function(){return An(this,(function(t){return[2,Sn({},this.captured)]}))}))},t.prototype.fail=function(){return On(this,void 0,void 0,(function(){return An(this,(function(t){throw Sn({},this.captured)}))}))},t.prototype.getCaptureExtras=function(){return On(this,void 0,void 0,(function(){return An(this,(function(t){return[2,Sn({},this.extras)]}))}))},t}();(Ee=_e||(_e={}))._ID="_id",Ee.TABLE_NAME="telemetry",Ee.COLUMN_NAME_EVENT_TYPE="event_type",Ee.COLUMN_NAME_EVENT="event",Ee.COLUMN_NAME_TIMESTAMP="timestamp",Ee.COLUMN_NAME_PRIORITY="priority",Ee.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Ee.TABLE_NAME+" ("+Ee._ID+N.SPACE+" INTEGER PRIMARY KEY,"+Ee.COLUMN_NAME_EVENT_TYPE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ee.COLUMN_NAME_EVENT+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ee.COLUMN_NAME_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ee.COLUMN_NAME_PRIORITY+N.SPACE+N.INT_TYPE+" )"},Ee.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Ee.TABLE_NAME},(we=Me||(Me={}))._ID="_id",we.TABLE_NAME="processed_telemetry",we.COLUMN_NAME_MSG_ID="msg_id",we.COLUMN_NAME_DATA="data",we.COLUMN_NAME_NUMBER_OF_EVENTS="event_count",we.COLUMN_NAME_PRIORITY="priority",we.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+we.TABLE_NAME+" ("+we._ID+" INTEGER PRIMARY KEY,"+we.COLUMN_NAME_MSG_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+we.COLUMN_NAME_DATA+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+we.COLUMN_NAME_NUMBER_OF_EVENTS+N.SPACE+N.INT_TYPE+N.COMMA_SEP+we.COLUMN_NAME_PRIORITY+N.SPACE+N.INT_TYPE+" )"},we.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+we.TABLE_NAME},(Oe=Se||(Se={}))._ID="_id",Oe.TABLE_NAME="event_priority",Oe.COLUMN_NAME_EVENT="event",Oe.COLUMN_NAME_PRIORITY="priority",Oe.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Oe.TABLE_NAME+" ("+Oe._ID+" INTEGER PRIMARY KEY,"+Oe.COLUMN_NAME_EVENT+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Oe.COLUMN_NAME_PRIORITY+N.SPACE+N.INT_TYPE+" )"},Oe.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Oe.TABLE_NAME},(Te=Ae||(Ae={}))._ID="_id",Te.TABLE_NAME="telemetry_tags",Te.COLUMN_NAME_NAME="name",Te.COLUMN_NAME_HASH="hash",Te.COLUMN_NAME_DESCRIPTION="description",Te.COLUMN_NAME_START_DATE="start_date",Te.COLUMN_NAME_END_DATE="end_date",Te.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Te.TABLE_NAME+" ("+Te._ID+" INTEGER PRIMARY KEY,"+Te.COLUMN_NAME_NAME+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Te.COLUMN_NAME_HASH+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Te.COLUMN_NAME_DESCRIPTION+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Te.COLUMN_NAME_START_DATE+N.SPACE+N.DATE_TYPE+N.COMMA_SEP+Te.COLUMN_NAME_END_DATE+N.SPACE+N.DATE_TYPE+" )"},Te.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Te.TABLE_NAME},(Ce=Ne||(Ne={}))._ID="_id",Ce.TABLE_NAME="meta_data",Ce.COLUMN_NAME_MSG_ID="key",Ce.COLUMN_NAME_DATA="value",Ce.getCreateEntry=function(){return"CREATE TABLE "+Ce.TABLE_NAME+" ("+Ce._ID+" INTEGER PRIMARY KEY,"+Ce.COLUMN_NAME_MSG_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ce.COLUMN_NAME_DATA+N.SPACE+N.TEXT_TYPE+" )"},Ce.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Ce.TABLE_NAME},(Re=Ie||(Ie={}))._ID="_id",Re.TABLE_NAME="profiles",Re.COLUMN_NAME_UID="uid",Re.COLUMN_NAME_HANDLE="handle",Re.COLUMN_NAME_AVATAR="avatar",Re.COLUMN_NAME_AGE="age",Re.COLUMN_NAME_GENDER="gender",Re.COLUMN_NAME_STANDARD="standard",Re.COLUMN_NAME_LANGUAGE="language",Re.COLUMN_NAME_DAY="day",Re.COLUMN_NAME_MONTH="month",Re.COLUMN_NAME_IS_GROUP_USER="is_group_user",Re.COLUMN_NAME_CREATED_AT="created_at",Re.COLUMN_NAME_MEDIUM="medium",Re.COLUMN_NAME_BOARD="board",Re.COLUMN_NAME_PROFILE_IMAGE="profile_image",Re.COLUMN_NAME_SUBJECT="subject",Re.COLUMN_NAME_PROFILE_TYPE="profile_type",Re.COLUMN_NAME_GRADE="grade",Re.COLUMN_NAME_SYLLABUS="syllabus",Re.COLUMN_NAME_SOURCE="source",Re.COLUMN_NAME_GRADE_VALUE="grade_value",Re.COLUMN_VALUE="value",Re.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Re.TABLE_NAME+"("+Re._ID+N.SPACE+"INTEGER PRIMARY KEY,"+Re.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" UNIQUE NOT NULL"+N.COMMA_SEP+Re.COLUMN_NAME_HANDLE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_AVATAR+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_AGE+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_GENDER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_STANDARD+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_LANGUAGE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_DAY+N.SPACE+N.INT_TYPE+" NOT NULL DEFAULT -1"+N.COMMA_SEP+Re.COLUMN_NAME_MONTH+N.SPACE+N.INT_TYPE+" NOT NULL DEFAULT -1"+N.COMMA_SEP+Re.COLUMN_NAME_IS_GROUP_USER+N.SPACE+N.INT_TYPE+" NOT NULL DEFAULT 0"+N.COMMA_SEP+Re.COLUMN_NAME_CREATED_AT+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_MEDIUM+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_BOARD+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_SUBJECT+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_PROFILE_IMAGE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_PROFILE_TYPE+N.SPACE+N.TEXT_TYPE+' DEFAULT "teacher"'+N.COMMA_SEP+Re.COLUMN_NAME_GRADE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_SYLLABUS+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_NAME_SOURCE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Re.COLUMN_VALUE+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+Re.COLUMN_NAME_GRADE_VALUE+N.SPACE+N.TEXT_TYPE+")"},Re.deleteTable=function(){return"DROP TABLE IF EXISTS "+Re.TABLE_NAME},Re.getAlterEntryForProfileSyllabus=function(){return"ALTER TABLE "+Re.TABLE_NAME+" ADD COLUMN "+N.SPACE+Re.COLUMN_NAME_SYLLABUS+N.TEXT_TYPE+" DEFAULT '';"},(Le=Pe||(Pe={}))._ID="_id",Le.TABLE_NAME="users",Le.COLUMN_NAME_UID="uid",Le.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Le.TABLE_NAME+" ("+Le._ID+" INTEGER PRIMARY KEY,"+Le.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" )"},Le.deleteTable=function(){return"DROP TABLE IF EXISTS "+Le.TABLE_NAME},(je=De||(De={})).TABLE_NAME="group_profile",je._ID="_id",je.COLUMN_NAME_UID="uid",je.COLUMN_NAME_GID="gid",je.COLUMN_NAME_EPOCH_TIMESTAMP="epoch_timestamp",je.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+je.TABLE_NAME+" ("+je._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+je.COLUMN_NAME_GID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+je.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+je.COLUMN_NAME_EPOCH_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+"UNIQUE ("+je.COLUMN_NAME_GID+N.COMMA_SEP+je.COLUMN_NAME_UID+") ON CONFLICT REPLACE)"},je.deleteTable=function(){return"DROP TABLE IF EXISTS"+je.TABLE_NAME},(Ue=ke||(ke={})).TABLE_NAME="groups",Ue._ID="_id",Ue.COLUMN_NAME_GID="gid",Ue.COLUMN_NAME_NAME="name",Ue.COLUMN_NAME_SYLLABUS="syllabus",Ue.COLUMN_NAME_GRADE="grade",Ue.COLUMN_NAME_GRADE_VALUE="grade_value",Ue.COLUMN_NAME_CREATED_AT="created_at",Ue.COLUMN_NAME_UPDATED_AT="updated_at",Ue.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Ue.TABLE_NAME+" ("+Ue._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+Ue.COLUMN_NAME_GID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ue.COLUMN_NAME_NAME+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ue.COLUMN_NAME_SYLLABUS+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+Ue.COLUMN_NAME_GRADE+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+Ue.COLUMN_NAME_GRADE_VALUE+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+Ue.COLUMN_NAME_CREATED_AT+" INTEGER"+N.COMMA_SEP+Ue.COLUMN_NAME_UPDATED_AT+" INTEGER )"},Ue.deleteTable=function(){return"DROP TABLE IF EXISTS"+Ue.TABLE_NAME},(Be=xe||(xe={}))._ID="_id",Be.TABLE_NAME="imported_metadata",Be.COLUMN_NAME_IMPORTED_ID="imported_id",Be.COLUMN_NAME_DEVICE_ID="device_id",Be.COLUMN_NAME_COUNT="count",Be.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Be.TABLE_NAME+" ("+Be._ID+" INTEGER PRIMARY KEY,"+Be.COLUMN_NAME_IMPORTED_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Be.COLUMN_NAME_DEVICE_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Be.COLUMN_NAME_COUNT+N.SPACE+N.INT_TYPE+" )"},Be.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Be.TABLE_NAME},(Ve=Fe||(Fe={}))._ID="_id",Ve.TABLE_NAME="learner_assessments",Ve.COLUMN_NAME_UID="uid",Ve.COLUMN_NAME_CONTENT_ID="content_id",Ve.COLUMN_NAME_QID="qid",Ve.COLUMN_NAME_Q_INDEX="qindex",Ve.COLUMN_NAME_CORRECT="correct",Ve.COLUMN_NAME_SCORE="score",Ve.COLUMN_NAME_MAX_SCORE="max_score",Ve.COLUMN_NAME_TIME_SPENT="time_spent",Ve.COLUMN_NAME_RES="res",Ve.COLUMN_NAME_TIMESTAMP="timestamp",Ve.COLUMN_NAME_Q_DESC="qdesc",Ve.COLUMN_NAME_Q_TITLE="qtitle",Ve.COLUMN_NAME_HIERARCHY_DATA="h_data",Ve.COLUMN_NAME_TOTAL_TS="total_ts",Ve.COLUMN_NAME_MARKS="marks",Ve.COLUMN_NAME_COUNT="occurence_count",Ve.COLUMN_NAME_TOTAL_MAX_SCORE="sum_max_score",Ve.COLUMN_NAME_USERS_COUNT="users_count",Ve.COLUMN_NAME_HANDLE="handle",Ve.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Ve.TABLE_NAME+" ("+Ve._ID+" INTEGER PRIMARY KEY,"+Ve.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+Ve.COLUMN_NAME_CONTENT_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_QID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_Q_INDEX+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_CORRECT+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_SCORE+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_MAX_SCORE+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_TIME_SPENT+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_RES+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_Q_DESC+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_Q_TITLE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ve.COLUMN_NAME_HIERARCHY_DATA+N.SPACE+N.TEXT_TYPE+" DEFAULT '' )"},Ve.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Ve.TABLE_NAME},(Ye=qe||(qe={}))._ID="_id",Ye.TABLE_NAME="learner_content_summary",Ye.COLUMN_NAME_UID="uid",Ye.COLUMN_NAME_CONTENT_ID="content_id",Ye.COLUMN_NAME_AVG_TS="avg_ts",Ye.COLUMN_NAME_SESSIONS="sessions",Ye.COLUMN_NAME_TOTAL_TS="total_ts",Ye.COLUMN_NAME_LAST_UPDATED_ON="last_updated_on",Ye.COLUMN_NAME_HIERARCHY_DATA="h_data",Ye.COLUMN_NAME_NO_OF_QUESTIONS="no_of_questions",Ye.COLUMN_NAME_CORRECT_ANSWERS="correct_answers",Ye.COLUMN_NAME_TOTAL_TIME_SPENT="total_time_spent",Ye.COLUMN_NAME_TOTAL_MAX_SCORE="total_max_score",Ye.COLUMN_NAME_TOTAL_SCORE="total_score",Ye.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Ye.TABLE_NAME+" ("+Ye._ID+" INTEGER PRIMARY KEY,"+Ye.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+Ye.COLUMN_NAME_CONTENT_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ye.COLUMN_NAME_AVG_TS+N.SPACE+N.REAL_TYPE+N.COMMA_SEP+Ye.COLUMN_NAME_SESSIONS+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ye.COLUMN_NAME_TOTAL_TS+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ye.COLUMN_NAME_LAST_UPDATED_ON+N.SPACE+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ye.COLUMN_NAME_HIERARCHY_DATA+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+" UNIQUE ("+Ye.COLUMN_NAME_UID+N.SPACE+N.COMMA_SEP+Ye.COLUMN_NAME_CONTENT_ID+N.COMMA_SEP+Ye.COLUMN_NAME_HIERARCHY_DATA+") ON CONFLICT REPLACE )"},Ye.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Ye.TABLE_NAME},function(t){t.TABLE_NAME="group_profile",t._ID="_id",t.COLUMN_NAME_UID="uid",t.COLUMN_NAME_GID="gid",t.COLUMN_NAME_EPOCH_TIMESTAMP="epoch_timestamp",t.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+t.TABLE_NAME+" ("+t._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+t.COLUMN_NAME_GID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_EPOCH_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+"UNIQUE ("+t.COLUMN_NAME_GID+N.COMMA_SEP+t.COLUMN_NAME_UID+") ON CONFLICT REPLACE)"},t.deleteTable=function(){return"DROP TABLE IF EXISTS"+t.TABLE_NAME}}(Ge||(Ge={})),function(t){t.TABLE_NAME="groups",t._ID="_id",t.COLUMN_NAME_GID="gid",t.COLUMN_NAME_NAME="name",t.COLUMN_NAME_SYLLABUS="syllabus",t.COLUMN_NAME_GRADE="grade",t.COLUMN_NAME_GRADE_VALUE="grade_value",t.COLUMN_NAME_CREATED_AT="created_at",t.COLUMN_NAME_UPDATED_AT="updated_at",t.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+t.TABLE_NAME+" ("+t._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+t.COLUMN_NAME_GID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_NAME+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_SYLLABUS+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+t.COLUMN_NAME_GRADE+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+t.COLUMN_NAME_GRADE_VALUE+N.SPACE+N.TEXT_TYPE+' DEFAULT ""'+N.COMMA_SEP+t.COLUMN_NAME_CREATED_AT+" INTEGER"+N.COMMA_SEP+t.COLUMN_NAME_UPDATED_AT+" INTEGER )"},t.deleteTable=function(){return"DROP TABLE IF EXISTS"+t.TABLE_NAME}}(He||(He={})),(Ke=ze||(ze={}))._ID="_id",Ke.TABLE_NAME="partners",Ke.COLUMN_NAME_PARTNER_ID="partnerID",Ke.COLUMN_NAME_KEY="publicKey",Ke.COLUMN_NAME_KEY_ID="publicKeyID",Ke.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Ke.TABLE_NAME+" ("+Ke._ID+" INTEGER PRIMARY KEY,"+Ke.COLUMN_NAME_PARTNER_ID+N.SPACE+N.TEXT_TYPE+" UNIQUE NOT NULL"+N.COMMA_SEP+Ke.COLUMN_NAME_KEY+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+Ke.COLUMN_NAME_KEY_ID+N.SPACE+N.INT_TYPE+" NOT NULL )"},Ke.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Ke.TABLE_NAME},(Xe=We||(We={})).TABLE_NAME="content",Xe._ID="_id",Xe.COLUMN_NAME_IDENTIFIER="identifier",Xe.COLUMN_NAME_SERVER_DATA="server_data",Xe.COLUMN_NAME_LOCAL_DATA="local_data",Xe.COLUMN_NAME_MIME_TYPE="mime_type",Xe.COLUMN_NAME_PATH="path",Xe.COLUMN_NAME_INDEX="search_index",Xe.COLUMN_NAME_VISIBILITY="visibility",Xe.COLUMN_NAME_SERVER_LAST_UPDATED_ON="server_last_updated_on",Xe.COLUMN_NAME_LOCAL_LAST_UPDATED_ON="local_last_updated_on",Xe.COLUMN_NAME_MANIFEST_VERSION="manifest_version",Xe.COLUMN_NAME_REF_COUNT="ref_count",Xe.COLUMN_NAME_CONTENT_STATE="content_state",Xe.COLUMN_NAME_CONTENT_TYPE="content_type",Xe.COLUMN_NAME_AUDIENCE="audience",Xe.COLUMN_NAME_PRAGMA="pragma",Xe.COLUMN_NAME_UID="uid",Xe.COLUMN_NAME_SIZE_ON_DEVICE="size_on_device",Xe.COLUMN_NAME_BOARD="board",Xe.COLUMN_NAME_MEDIUM="medium",Xe.COLUMN_NAME_GRADE="grade",Xe.COLUMN_NAME_DIALCODES="dialcodes",Xe.COLUMN_NAME_CHILD_NODES="child_nodes",Xe.COLUMN_NAME_PRIMARY_CATEGORY="primary_category",Xe.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Xe.TABLE_NAME+" ("+Xe._ID+" INTEGER PRIMARY KEY,"+Xe.COLUMN_NAME_IDENTIFIER+N.SPACE+N.TEXT_TYPE+" UNIQUE NOT NULL"+N.COMMA_SEP+Xe.COLUMN_NAME_SERVER_DATA+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_LOCAL_DATA+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_MIME_TYPE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_PATH+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_INDEX+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_VISIBILITY+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_SERVER_LAST_UPDATED_ON+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_LOCAL_LAST_UPDATED_ON+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_REF_COUNT+N.SPACE+N.INT_TYPE+" NOT NULL DEFAULT 1"+N.COMMA_SEP+Xe.COLUMN_NAME_CONTENT_STATE+N.SPACE+N.INT_TYPE+" NOT NULL DEFAULT 2"+N.COMMA_SEP+Xe.COLUMN_NAME_CONTENT_TYPE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_AUDIENCE+N.SPACE+N.TEXT_TYPE+" DEFAULT 'Learner'"+N.COMMA_SEP+Xe.COLUMN_NAME_SIZE_ON_DEVICE+N.SPACE+N.INT_TYPE+" NOT NULL DEFAULT 0"+N.COMMA_SEP+Xe.COLUMN_NAME_PRAGMA+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+Xe.COLUMN_NAME_BOARD+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+Xe.COLUMN_NAME_MEDIUM+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+Xe.COLUMN_NAME_GRADE+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+Xe.COLUMN_NAME_MANIFEST_VERSION+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Xe.COLUMN_NAME_DIALCODES+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+Xe.COLUMN_NAME_CHILD_NODES+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+Xe.COLUMN_NAME_PRIMARY_CATEGORY+N.SPACE+N.TEXT_TYPE+" DEFAULT '' )"},Xe.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+Xe.TABLE_NAME},Xe.getAlterEntryForContentSize=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_SIZE_ON_DEVICE+N.INT_TYPE+" NOT NULL DEFAULT 0;"},Xe.getAlterEntryForPragma=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_PRAGMA+N.TEXT_TYPE+" DEFAULT '';"},Xe.getAlterEntryForBoard=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_BOARD+" TEXT DEFAULT ''"},Xe.getAlterEntryForMedium=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_MEDIUM+" TEXT DEFAULT ''"},Xe.getAlterEntryForGrade=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_GRADE+" TEXT DEFAULT ''"},Xe.getAlterEntryForDialCode=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_DIALCODES+" TEXT DEFAULT ''"},Xe.getAlterEntryForChildNodes=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_CHILD_NODES+" TEXT DEFAULT ''"},Xe.getAlterEntryForPrimaryCategory=function(){return"ALTER TABLE "+Xe.TABLE_NAME+" ADD COLUMN "+Xe.COLUMN_NAME_PRIMARY_CATEGORY+" TEXT DEFAULT ''"},(Ze=Je||(Je={}))._ID="_id",Ze.TABLE_NAME="content_access",Ze.COLUMN_NAME_UID="uid",Ze.COLUMN_NAME_CONTENT_IDENTIFIER="identifier",Ze.COLUMN_NAME_EPOCH_TIMESTAMP="epoch_timestamp",Ze.COLUMN_NAME_STATUS="status",Ze.COLUMN_NAME_CONTENT_TYPE="content_type",Ze.COLUMN_NAME_LEARNER_STATE="learner_state",Ze.COLUMN_NAME_PRIMARY_CATEGORY="primary_category",Ze.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Ze.TABLE_NAME+" ("+Ze._ID+" INTEGER PRIMARY KEY,"+Ze.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+Ze.COLUMN_NAME_CONTENT_IDENTIFIER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ze.COLUMN_NAME_EPOCH_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ze.COLUMN_NAME_STATUS+N.SPACE+N.INT_TYPE+N.COMMA_SEP+Ze.COLUMN_NAME_CONTENT_TYPE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Ze.COLUMN_NAME_LEARNER_STATE+N.SPACE+N.BLOB_TYPE+" )"},Ze.deleteTable=function(){return"DROP TABLE IF EXISTS "+Ze.TABLE_NAME},Ze.getAlterEntryForPrimaryCategory=function(){return"ALTER TABLE "+Ze.TABLE_NAME+" ADD COLUMN "+Ze.COLUMN_NAME_PRIMARY_CATEGORY+" TEXT DEFAULT ''"},($e=Qe||(Qe={}))._ID="_id",$e.TABLE_NAME="feedback",$e.COLUMN_NAME_CONTENT_ID="identifier",$e.COLUMN_NAME_UID="uid",$e.COLUMN_NAME_RATING="rating",$e.COLUMN_NAME_COMMENTS="comments",$e.COLUMN_NAME_CREATED_AT="createdAt",$e.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+$e.TABLE_NAME+" ("+$e._ID+" INTEGER PRIMARY KEY,"+$e.COLUMN_NAME_CONTENT_ID+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+$e.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+$e.COLUMN_NAME_RATING+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+$e.COLUMN_NAME_COMMENTS+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+$e.COLUMN_NAME_CREATED_AT+N.SPACE+N.INT_TYPE+" )"},$e.deleteTable=function(){return"DROP TABLE IF EXISTS "+$e.TABLE_NAME},(en=tn||(tn={}))._ID="_id",en.TABLE_NAME="content_marker",en.COLUMN_NAME_UID="uid",en.COLUMN_NAME_CONTENT_IDENTIFIER="identifier",en.COLUMN_NAME_EPOCH_TIMESTAMP="epoch_timestamp",en.COLUMN_NAME_DATA="data",en.COLUMN_NAME_EXTRA_INFO="extra_info",en.COLUMN_NAME_MARKER="marker",en.COLUMN_NAME_MIME_TYPE="mime_type",en.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+en.TABLE_NAME+" ("+en._ID+" INTEGER PRIMARY KEY,"+en.COLUMN_NAME_UID+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+en.COLUMN_NAME_CONTENT_IDENTIFIER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+en.COLUMN_NAME_EPOCH_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+en.COLUMN_NAME_DATA+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+en.COLUMN_NAME_EXTRA_INFO+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+en.COLUMN_NAME_MIME_TYPE+N.SPACE+N.TEXT_TYPE+" DEFAULT ''"+N.COMMA_SEP+en.COLUMN_NAME_MARKER+N.SPACE+N.INT_TYPE+" )"},en.deleteTable=function(){return"DROP TABLE IF EXISTS "+en.TABLE_NAME},en.getAlterEntryForMimeType=function(){return"ALTER TABLE "+en.TABLE_NAME+" ADD COLUMN "+en.COLUMN_NAME_MIME_TYPE+" TEXT DEFAULT ''"},(rn=nn||(nn={}))._ID="_id",rn.TABLE_NAME="notifications",rn.COLUMN_NAME_MESSAGE_ID="message_id",rn.COLUMN_NAME_EXPIRY_TIME="expiry_time",rn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME="display_time",rn.COLUMN_NAME_NOTIFICATION_RECEIVED_AT="received_at",rn.COLUMN_NAME_NOTIFICATION_JSON="notification_json",rn.COLUMN_NAME_IS_READ="is_read",rn.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+rn.TABLE_NAME+" ("+rn._ID+" INTEGER PRIMARY KEY,"+rn.COLUMN_NAME_MESSAGE_ID+N.SPACE+N.INT_TYPE+N.COMMA_SEP+rn.COLUMN_NAME_EXPIRY_TIME+N.SPACE+N.INT_TYPE+N.COMMA_SEP+rn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+N.SPACE+N.INT_TYPE+N.COMMA_SEP+rn.COLUMN_NAME_NOTIFICATION_RECEIVED_AT+N.SPACE+N.INT_TYPE+N.COMMA_SEP+rn.COLUMN_NAME_NOTIFICATION_JSON+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+rn.COLUMN_NAME_IS_READ+N.SPACE+N.INT_TYPE+" )"},rn.deleteTable=function(){return"DROP TABLE IF EXISTS "+rn.TABLE_NAME},(an=on||(on={}))._ID="_id",an.TABLE_NAME="no_sql",an.COLUMN_NAME_KEY="key",an.COLUMN_NAME_VALUE="value",an.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+an.TABLE_NAME+" ("+an._ID+" INTEGER PRIMARY KEY,"+an.COLUMN_NAME_KEY+N.SPACE+N.TEXT_TYPE+" NOT NULL"+N.COMMA_SEP+an.COLUMN_NAME_VALUE+N.SPACE+N.TEXT_TYPE+" )"},an.getDeleteEntry=function(){return"DROP TABLE IF EXISTS "+an.TABLE_NAME},(un=sn||(sn={})).TABLE_NAME="error_stack",un._ID="_id",un.COLUMN_NAME_APP_VERSION="app_version",un.COLUMN_NAME_PAGE_ID="page_id",un.COLUMN_NAME_TIME_STAMP="time_stamp",un.COLUMN_NAME_ERROR_LOG="error_log",un.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+un.TABLE_NAME+" ("+un._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+un.COLUMN_NAME_APP_VERSION+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+un.COLUMN_NAME_PAGE_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+un.COLUMN_NAME_TIME_STAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+un.COLUMN_NAME_ERROR_LOG+N.SPACE+N.TEXT_TYPE+" )"},un.deleteTable=function(){return"DROP TABLE IF EXISTS"+un.TABLE_NAME},(fn=cn||(cn={})).TABLE_NAME="search_history",fn._ID="_id",fn.COLUMN_NAME_USER_ID="uid",fn.COLUMN_NAME_QUERY="query",fn.COLUMN_NAME_TIME_STAMP="time_stamp",fn.COLUMN_NAME_NAMESPACE="namespace",fn.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+fn.TABLE_NAME+" ("+fn._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+fn.COLUMN_NAME_USER_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+fn.COLUMN_NAME_QUERY+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+fn.COLUMN_NAME_TIME_STAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+fn.COLUMN_NAME_NAMESPACE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+"UNIQUE ("+fn.COLUMN_NAME_USER_ID+N.COMMA_SEP+fn.COLUMN_NAME_QUERY+") ON CONFLICT REPLACE )"},fn.deleteTable=function(){return"DROP TABLE IF EXISTS"+fn.TABLE_NAME},(ln=hn||(hn={})).TABLE_NAME="course_assessment",ln._ID="_id",ln.COLUMN_NAME_ASSESSMENT_EVENT="assessment_event",ln.COLUMN_NAME_CREATED_AT="created_at",ln.COLUMN_NAME_USER_ID="user_id",ln.COLUMN_NAME_CONTENT_ID="content_id",ln.COLUMN_NAME_COURSE_ID="course_id",ln.COLUMN_NAME_BATCH_ID="batch_id",ln.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS"+N.SPACE+ln.TABLE_NAME+N.SPACE+"("+ln._ID+N.SPACE+"INTEGER PRIMARY KEY,"+ln.COLUMN_NAME_ASSESSMENT_EVENT+N.SPACE+N.TEXT_TYPE+","+ln.COLUMN_NAME_CREATED_AT+N.SPACE+N.INT_TYPE+","+ln.COLUMN_NAME_USER_ID+N.SPACE+N.TEXT_TYPE+","+ln.COLUMN_NAME_CONTENT_ID+N.SPACE+N.TEXT_TYPE+","+ln.COLUMN_NAME_COURSE_ID+N.SPACE+N.TEXT_TYPE+","+ln.COLUMN_NAME_BATCH_ID+N.SPACE+N.TEXT_TYPE+")"},ln.deleteTable=function(){return"DROP TABLE IF EXISTS"+ln.TABLE_NAME},function(t){t.TABLE_NAME="network_queue",t._ID="_id",t.COLUMN_NAME_MSG_ID="msg_id",t.COLUMN_NAME_PRIORITY="priority",t.COLUMN_NAME_TIMESTAMP="timestamp",t.COLUMN_NAME_DATA="data",t.COLUMN_NAME_REQUEST="request",t.COLUMN_NAME_NUMBER_OF_ITEM="item_count",t.COLUMN_NAME_CONFIG="config",t.COLUMN_NAME_TYPE="type",t.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+t.TABLE_NAME+" ("+t._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+t.COLUMN_NAME_MSG_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_PRIORITY+N.SPACE+N.INT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_TIMESTAMP+N.SPACE+N.INT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_DATA+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_NUMBER_OF_ITEM+N.SPACE+N.INT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_CONFIG+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_TYPE+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+t.COLUMN_NAME_REQUEST+N.SPACE+N.TEXT_TYPE+")"},t.deleteTable=function(){return"DROP TABLE IF EXISTS"+t.TABLE_NAME};var e=function(){function e(){}return e.networkQueueRequestToEntry=function(e){var n;return(n={})[t.COLUMN_NAME_MSG_ID]=e.msgId,n[t.COLUMN_NAME_PRIORITY]=e.priority,n[t.COLUMN_NAME_TIMESTAMP]=e.ts,n[t.COLUMN_NAME_DATA]=e.data,n[t.COLUMN_NAME_NUMBER_OF_ITEM]=e.itemCount,n[t.COLUMN_NAME_CONFIG]=e.config,n[t.COLUMN_NAME_TYPE]=e.type,n[t.COLUMN_NAME_REQUEST]=e.networkRequest.toJSON(),n},e}();t.Mapper=e}(dn||(dn={})),function(t){t.TELEMETRY="telemetry",t.COURSE_PROGRESS="course_progress",t.COURSE_ASSESMENT="course_assesment"}(pn||(pn={})),(bn=mn||(mn={})).TABLE_NAME="player_data",bn._ID="_id",bn.COLUMN_NAME_USER_ID="user_id",bn.COLUMN_PARENT_IDENTIFIER="parent_identifier",bn.COLUMN_IDENTIFIER="identifier",bn.COLUMN_PLAYER_CONFIG="player_config",bn.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+bn.TABLE_NAME+" ("+bn._ID+" INTEGER PRIMARY KEY"+N.COMMA_SEP+bn.COLUMN_NAME_USER_ID+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+bn.COLUMN_PARENT_IDENTIFIER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+bn.COLUMN_IDENTIFIER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+bn.COLUMN_PLAYER_CONFIG+N.SPACE+N.TEXT_TYPE+")"},bn.deleteTable=function(){return"DROP TABLE IF EXISTS "+bn.TABLE_NAME},bn.getAlterEntryForPlayerConfig=function(){return"ALTER TABLE "+bn.TABLE_NAME+" ADD COLUMN "+bn.COLUMN_PLAYER_CONFIG+" TEXT DEFAULT ''"};var Nn,Cn,In=function(){function t(){}return t.mapPlayerDbEntryToPlayer=function(t){return{userId:t[mn.COLUMN_NAME_USER_ID],parentId:t[mn.COLUMN_PARENT_IDENTIFIER],contentId:t[mn.COLUMN_IDENTIFIER],saveState:t[mn.COLUMN_PLAYER_CONFIG]}},t.mapPlayerStateToPlayerDbEntry=function(t,e,n,r){var i;return(i={})[mn.COLUMN_NAME_USER_ID]=t,i[mn.COLUMN_PARENT_IDENTIFIER]=e,i[mn.COLUMN_IDENTIFIER]=n,i[mn.COLUMN_PLAYER_CONFIG]=r,i},t}();(Cn=Nn||(Nn={}))._ID="_id",Cn.TABLE_NAME="certificate_public_key",Cn.COLUMN_NAME_IDENTIFIER="identifier",Cn.COLUMN_NAME_PUBLIC_KEY="public_key",Cn.COLUMN_NAME_ALGORITHM="alg",Cn.COLUMN_NAME_OWNER="owner",Cn.COLUMN_NAME_EXPIRY_TIME="expiry_time",Cn.getCreateEntry=function(){return"CREATE TABLE IF NOT EXISTS "+Cn.TABLE_NAME+" ("+Cn._ID+" INTEGER PRIMARY KEY,"+Cn.COLUMN_NAME_IDENTIFIER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Cn.COLUMN_NAME_PUBLIC_KEY+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Cn.COLUMN_NAME_ALGORITHM+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Cn.COLUMN_NAME_OWNER+N.SPACE+N.TEXT_TYPE+N.COMMA_SEP+Cn.COLUMN_NAME_EXPIRY_TIME+N.SPACE+N.INT_TYPE+" )"},Cn.deleteTable=function(){return"DROP TABLE IF EXISTS "+Cn.TABLE_NAME};var Rn,Pn,Ln,Dn,jn,kn,Un,xn,Bn,Fn,Vn,qn,Yn,Gn,Hn,zn,Kn,Wn=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Xn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Jn=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Zn=function(t){function e(){return t.call(this,1,16)||this}return Wn(e,t),e.prototype.apply=function(t){return Xn(this,void 0,void 0,(function(){return Jn(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this.queries().map((function(e){return t.execute(e).toPromise()})))];case 1:return e.sent(),[2]}}))}))},e.prototype.queries=function(){return[_e.getCreateEntry(),Me.getCreateEntry(),Ae.getCreateEntry(),Se.getCreateEntry(),Pe.getCreateEntry(),Ie.getCreateEntry(),xe.getCreateEntry(),ze.getCreateEntry(),We.getCreateEntry(),Fe.getCreateEntry(),qe.getCreateEntry(),Je.getCreateEntry(),Qe.getCreateEntry(),nn.getCreateEntry(),He.getCreateEntry(),Ge.getCreateEntry(),on.getCreateEntry(),tn.getCreateEntry(),sn.getCreateEntry(),cn.getCreateEntry(),hn.getCreateEntry(),dn.getCreateEntry(),mn.getCreateEntry(),Nn.getCreateEntry()]},e}(C),Qn=function(){function t(){this.query=""}return t.prototype.where=function(e){return this.query+=e.trim(),new t.WhereDecorator(this)},t.prototype.build=function(){return this.query},t.ConstraintDecorator=function(){function t(t){this.queryBuilder=t}return t.prototype.and=function(){return this.queryBuilder.query+=" AND ",this.queryBuilder},t.prototype.or=function(){return this.queryBuilder.query+=" OR ",this.queryBuilder},t.prototype.end=function(){return this.queryBuilder},t}(),t.WhereDecorator=function(){function e(t){this.queryBuilder=t}return e.prototype.args=function(e){var n=this;return e.forEach((function(t){n.interpolate(t)})),new t.ConstraintDecorator(this.queryBuilder)},e.prototype.interpolate=function(t){isNaN(t)&&(t='"'+t+'"'),this.queryBuilder.query=this.queryBuilder.query.replace("?",t)},e}(),t}(),$n=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},tr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},er=function(t,e){return function(n,r){e(n,r,t)}},nr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},rr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ir=function(){function t(t,e,n){this.sdkConfig=t,this.dBVersion=e,this.appMigrationList=n,this.context=this.sdkConfig.dbConfig}return t.prototype.update=function(t){return new J.Observable((function(e){db.update(t.table,t.selection||"",t.selectionArgs||[],t.modelJson,t.useExternalDb||!1,(function(t){e.next(t),e.complete()}),(function(t){e.error(t)}))}))},t.prototype.init=function(){return nr(this,void 0,void 0,(function(){var t=this;return rr(this,(function(e){return[2,new Promise((function(e){db.init(t.context.dbName,t.dBVersion,[],(function(e){return nr(t,void 0,void 0,(function(){return rr(this,(function(t){switch(t.label){case 0:return"onCreate"!==e.method?[3,2]:[4,this.onCreate()];case 1:return t.sent(),[3,4];case 2:return"onUpgrade"!==e.method?[3,4]:[4,this.onUpgrade(e.oldVersion,e.newVersion)];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))})),t.hasInitialized().subscribe((function(){e()}))}))]}))}))},t.prototype.hasInitialized=function(){return this.execute("DROP TABLE IF EXISTS dummy_init_table")},t.prototype.delete=function(t){var e="\n DELETE FROM "+t.table+"\n WHERE "+(new Qn).where(t.selection).args(t.selectionArgs).end().build()+"\n ";return new J.Observable((function(n){db.execute(e,t.useExternalDb||!1,(function(t){n.next(t),n.complete()}),(function(t){n.error(t)}))}))},t.prototype.onCreate=function(){return nr(this,void 0,void 0,(function(){return rr(this,(function(t){return[2,(new Zn).apply(this)]}))}))},t.prototype.onUpgrade=function(t,e){return nr(this,void 0,void 0,(function(){var n,r,i,o;return rr(this,(function(a){switch(a.label){case 0:n=0,r=this.appMigrationList,a.label=1;case 1:return n<r.length?(i=r[n],o=void 0,o=i instanceof C?i:i(),console.log("Migration",o),o.required(t,e)?[4,o.apply(this)]:[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.execute=function(t,e){return new J.Observable((function(n){db.execute(t,e||!1,(function(t){n.next(t),n.complete()}),(function(t){n.error(t)}))}))},t.prototype.read=function(t){return new J.Observable((function(e){db.read(!!t.distinct,t.table,t.columns||[],t.selection||"",t.selectionArgs||[],t.groupBy||"",t.having||"",t.orderBy||"",t.limit||"",t.useExternalDb||!1,(function(t){e.next(t),e.complete()}),(function(t){e.error(t)}))}))},t.prototype.insert=function(t){return new J.Observable((function(e){db.insert(t.table,t.modelJson,t.useExternalDb||!1,(function(t){e.next(t),e.complete()}),(function(t){e.error(t)}))}))},t.prototype.beginTransaction=function(){db.beginTransaction()},t.prototype.endTransaction=function(t,e){db.endTransaction(t,e||!1)},t.prototype.copyDatabase=function(t){return new J.Observable((function(e){db.copyDatabase(t,(function(t){e.next(t),e.complete()}),(function(t){e.error(t)}))}))},t.prototype.open=function(t){return new Promise((function(e,n){db.open(t,(function(t){e()}),(function(t){n()}))}))},t=$n([Object(R.injectable)(),er(0,Object(R.inject)(Q.SDK_CONFIG)),er(1,Object(R.inject)(Q.DB_VERSION)),er(2,Object(R.inject)(Q.DB_MIGRATION_LIST)),tr("design:paramtypes",[Object,Number,Array])],t)}(),or=n(164),ar=function(){function t(){}return t.generateUniqueId=function(){return or()},t}(),sr=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},ur=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cr=function(t,e){return function(n,r){e(n,r,t)}},fr=function(){function t(t,e,n,r){this.sdkConfig=t,this.deviceInfo=e,this.appInfo=n,this.codePushExperimentService=r,this.apiConfig=this.sdkConfig.apiConfig}return t.prototype.decorate=function(t,e,n,r,i,o,a){void 0===r&&(r=0);var s=e.uid,u=e.sid;return t.ets+=r,t.mid||(t.mid=ar.generateUniqueId()),s?this.patchActor(t,s):this.patchActor(t,""),this.patchContext(t,u,i,o,a),t.context.cdata=t.context.cdata.concat([{id:e.managedSession?e.managedSession.sid:e.sid,type:"UserSession"}]),t},t.prototype.patchActor=function(t,e){t.actor||(t.actor=new Ht);var n=t.actor;n.id||(n.id=e),n.type||(n.type=Ht.TYPE_USER)},t.prototype.patchContext=function(t,e,n,r,i){t.context||(t.context=new zt),t.context=this.buildContext(e,n,t.context,r,i)},t.prototype.patchPData=function(t){t.pdata||(t.pdata=new te);var e=t.pdata;e.id||(e.id=this.apiConfig.api_authentication.producerId);var n=e.pid;n?e.pid=n:this.apiConfig.api_authentication.producerUniqueId?e.pid=this.apiConfig.api_authentication.producerUniqueId:e.pid="sunbird.android",e.ver||(e.ver=this.appInfo.getVersionName())},t.prototype.prepare=function(t,e){return{event:JSON.stringify(t),event_type:t.eid,timestamp:Date.now(),priority:1}},t.prototype.buildContext=function(t,e,n,r,i){n.channel=e,this.patchPData(n),n.env||(n.env="app");var o=this.codePushExperimentService.getExperimentKey();return"string"==typeof o&&(n.pdata.pid=n.pdata.pid+"-"+o),n.sid=t,n.did=this.deviceInfo.getDeviceID(),e!==this.apiConfig.api_authentication.channelId&&(n.rollup={l1:e}),n.cdata=n.cdata?n.cdata.concat(r||[]):r||[],n.cdata=n.cdata?n.cdata.concat(i||[]):i||[],n},t=sr([Object(R.injectable)(),cr(0,Object(R.inject)(Q.SDK_CONFIG)),cr(1,Object(R.inject)(Q.DEVICE_INFO)),cr(2,Object(R.inject)(Q.APP_INFO)),cr(3,Object(R.inject)(Q.CODEPUSH_EXPERIMENT_SERVICE)),ur("design:paramtypes",[Object,Object,Object,Object])],t)}(),hr=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),lr=function(t){function e(n){var r=t.call(this,n,"INVALID_INPUT_FOR_SYNC_PREPROCESSOR")||this;return Object.setPrototypeOf(r,e.prototype),r}return hr(e,t),e}(ye),dr=n(25),pr=function(){function t(){}return t.prototype.process=function(t){if("string"!=typeof t)throw new lr('StringToGzippedString expects input of type "string"');return Object(dr.gzip)(t,{to:"string"})},t}(),mr=function(){function t(){}return t.prototype.process=function(t){if("object"!=typeof t)throw new lr('TelemetryEntriesToStringPreprocessor expects input of type "object"');return JSON.stringify(t)},t}(),br=function(){function t(){}return Object.defineProperty(t,"log",{get:function(){return qp.instance.telemetryService},enumerable:!0,configurable:!0}),t}(),yr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},vr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},gr=function(){function t(t,e){this.networkQueue=t,this.sdkConfig=e}return t.prototype.handle=function(t){var e=this;return this.networkQueue.enqueue(new _r(this.sdkConfig).generateNetworkQueueRequest(pn.COURSE_PROGRESS,{request:t},ar.generateUniqueId(),t.contents?t.contents.length:0,!0),!0).pipe(Object(dt.mergeMap)((function(){return new J.Observable((function(t){sbsync.onSyncSucces((function(n){return yr(e,void 0,void 0,(function(){var e,r;return vr(this,(function(i){return e=n.courseProgressResponse,r=n.course_progress_error,e?t.next(e):r&&t.error(r),t.complete(),[2]}))}))}),(function(n){return yr(e,void 0,void 0,(function(){return vr(this,(function(e){return t.error(n),[2]}))}))}))}))})))},t.UPDATE_CONTENT_STATE_ENDPOINT="/content/state/update",t}(),_r=function(){function t(t){this.config=t}return t.prototype.generateNetworkQueueRequest=function(t,e,n,r,i){var o,a;if(t===pn.TELEMETRY){var s=e.split("").map((function(t){return t.charCodeAt(0)}));o=new Uint8Array(s),a=(new P.CsRequest.Builder).withSerializer(P.CsHttpSerializer.RAW).withHost(this.config.telemetryConfig.host).withType(P.CsHttpRequestType.POST).withPath(this.config.telemetryConfig.apiPath+wr.TELEMETRY_ENDPOINT).withHeaders({"Content-Type":"application/json","Content-Encoding":"gzip"}).withBody(o).withBearerToken(!0).build()}else o=e,a=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.PATCH).withPath(this.config.courseServiceConfig.apiPath+gr.UPDATE_CONTENT_STATE_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody(o).build();return{msgId:n,data:t===pn.TELEMETRY?e:JSON.stringify(e),networkRequest:a,priority:t===pn.TELEMETRY?2:1,itemCount:r,type:t,config:JSON.stringify({shouldPublishResult:i}),ts:Date.now()}},t}(),Er=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Mr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},wr=function(){function t(t,e,n,r,i,o,a,s,u){this.dbService=t,this.sdkConfig=e,this.deviceInfo=n,this.sharedPreferences=r,this.appInfoService=i,this.deviceRegisterService=o,this.keyValueStore=a,this.apiService=s,this.networkQueue=u,this.preprocessors=[new mr,new pr],this.telemetryConfig=this.sdkConfig.telemetryConfig,this.apiConfig=this.sdkConfig.apiConfig}return t.prototype.resetDeviceRegisterTTL=function(){return Object(J.zip)(this.keyValueStore.setValue(t.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,""),this.keyValueStore.setValue(t.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,"")).pipe(Object(dt.mapTo)(void 0))},t.prototype.handle=function(t){var e=this,n=t.ignoreSyncThreshold,r=t.ignoreAutoSyncMode,i=!(!n||!r);return this.registerDevice().pipe(Object(dt.catchError)((function(){return n=!0,Object(J.of)(void 0)})),Object(dt.mergeMap)((function(){return e.hasTelemetryThresholdCrossed().pipe(Object(dt.mergeMap)((function(t){return t||n?Object(J.defer)((function(){return Er(e,void 0,void 0,(function(){var t,e,n;return Mr(this,(function(r){switch(r.label){case 0:return[4,this.sharedPreferences.getString(K.KEY_AUTO_SYNC_MODE).toPromise()];case 1:switch(r.sent()){case ie.OFF:return[2,{syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0,error:new Error("AUTO_SYNC_MODE: "+ie.OFF)}];case ie.OVER_WIFI:if(navigator.connection.type!==Connection.WIFI)return[2,{syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0,error:new Error("AUTO_SYNC_MODE: "+ie.OVER_WIFI)}];break;case ie.ALWAYS_ON:}t={syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0},r.label=2;case 2:return r.trys.push([2,4,,5]),[4,this.processEventsBatch(i).toPromise()];case 3:return e=r.sent(),t={syncedEventCount:t.syncedEventCount+e,syncTime:Date.now(),syncedFileSize:0},[3,5];case 4:return n=r.sent(),t={syncedEventCount:t.syncedEventCount,syncTime:Date.now(),syncedFileSize:0,error:n},[3,5];case 5:if(e&&!t.error)return[3,2];r.label=6;case 6:return[2,t]}}))}))})):Object(J.of)({syncedEventCount:0,syncTime:Date.now(),syncedFileSize:0})})))})))},t.prototype.processEventsBatch=function(t){var e=this;return this.fetchEvents().pipe(Object(dt.mergeMap)((function(n){return e.processEvents(n).pipe(Object(dt.mergeMap)((function(r){return e.persistinNetworkQueue(r,r.processedEventsSize,t).pipe(Object(dt.mergeMap)((function(){return e.deleteEvents(n)})),Object(dt.mapTo)(n.length))})))})))},t.prototype.registerDevice=function(){var e=this;return Object(J.zip)(this.keyValueStore.getValue(t.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY),this.keyValueStore.getValue(t.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY)).pipe(Object(dt.mergeMap)((function(n){var r=n[0],i=n[1];if(r&&i){var o="false"===i?t.REGISTER_API_FAILURE_TTL:t.REGISTER_API_SUCCESS_TTL;if(Math.abs(parseInt(r,10)-Date.now())<o)return Object(J.of)(void 0)}return e.deviceRegisterService.registerDevice().pipe(Object(dt.tap)((function(n){return Er(e,void 0,void 0,(function(){var e,r,i,o,a=this;return Mr(this,(function(s){switch(s.label){case 0:return n.result.actions.forEach((function(t){"experiment"===t.type&&t.key&&a.sharedPreferences.putString(G.DEPLOYMENT_KEY,t.data.key).toPromise()})),e=new Date(n.ts).getTime(),r=Date.now(),i=e-r,(o=Math.abs(i)>this.telemetryConfig.telemetryLogMinAllowedOffset?i:0)?[4,br.log.interact({type:Dt.OTHER,subType:jt.DEVICE_TIME_OFFSET_FOUND,env:"sdk",pageId:"sdk",id:"sdk",valueMap:{deviceTime:r,offsetTime:o}}).toPromise()]:[3,3];case 1:return s.sent(),[4,this.keyValueStore.setValue(t.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY,o+"").toPromise()];case 2:s.sent(),s.label=3;case 3:return[2]}}))}))})),Object(dt.mergeMap)((function(){return Object(J.zip)(e.keyValueStore.setValue(t.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,Date.now()+""),e.keyValueStore.setValue(t.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,"true")).pipe(Object(dt.mapTo)(void 0))})),Object(dt.catchError)((function(n){return Object(J.zip)(e.keyValueStore.setValue(t.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY,Date.now()+""),e.keyValueStore.setValue(t.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY,"false")).pipe(Object(dt.mergeMap)((function(){throw console.error(n),new Error("Device Registration Failed")})))})))})))},t.prototype.hasTelemetryThresholdCrossed=function(){var t=this;return this.dbService.execute("\n SELECT count(*) as COUNT FROM "+_e.TABLE_NAME).pipe(Object(dt.map)((function(e){return!!(e&&e[0]&&e[0].COUNT>=t.telemetryConfig.telemetrySyncThreshold)})))},t.prototype.fetchEvents=function(){return this.dbService.execute("\n SELECT * FROM "+_e.TABLE_NAME+"\n WHERE "+_e.COLUMN_NAME_PRIORITY+" = (SELECT MIN ("+_e.COLUMN_NAME_PRIORITY+")\n FROM "+_e.TABLE_NAME+")\n ORDER BY "+_e.COLUMN_NAME_TIMESTAMP+"\n LIMIT "+this.telemetryConfig.telemetrySyncBandwidth)},t.prototype.processEvents=function(t){if(!t.length)return Object(J.of)({processedEventsSize:0});var e=ar.generateUniqueId();return Object(J.of)({processedEvents:this.preprocessors.reduce((function(t,e){return e.process(t)}),{id:"ekstep.telemetry",ver:"1.0",ts:nt()().format("YYYY-MM-DDTHH:mm:ss[Z]"),events:t.map((function(t){return JSON.parse(t[_e.COLUMN_NAME_EVENT])})),params:{did:this.deviceInfo.getDeviceID(),msgid:e,key:"",requesterId:""}}),processedEventsSize:t.length,messageId:e})},t.prototype.persistinNetworkQueue=function(t,e,n){var r=t.processedEvents,i=t.messageId;return r?this.networkQueue.enqueue(new _r(this.sdkConfig).generateNetworkQueueRequest(pn.TELEMETRY,r,i,e,n),!0).pipe(Object(dt.mapTo)(void 0)):Object(J.of)(void 0)},t.prototype.deleteEvents=function(t){return t.length?this.dbService.execute("\n DELETE FROM "+_e.TABLE_NAME+"\n WHERE "+_e._ID+" IN ("+t.map((function(t){return t[_e._ID]})).join(",")+")\n "):Object(J.of)(void 0)},t.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY="telemetry_log_min_allowed_offset_key",t.LAST_SYNCED_DEVICE_REGISTER_ATTEMPT_TIME_STAMP_KEY="last_synced_device_register_attempt_time_stamp",t.LAST_SYNCED_DEVICE_REGISTER_IS_SUCCESSFUL_KEY="last_synced_device_register_is_successful",t.TELEMETRY_ENDPOINT="/telemetry",t.REGISTER_API_SUCCESS_TTL=864e5,t.REGISTER_API_FAILURE_TTL=36e5,t}(),Sr=n(33);!function(t){t[t.NOT_FOUND=-1]="NOT_FOUND",t[t.DELETED_SUCCESSFULLY=1]="DELETED_SUCCESSFULLY"}(Rn||(Rn={})),function(t){t.ASC="asc",t.DESC="desc"}(Pn||(Pn={})),function(t){t[t.NOTHING=0]="NOTHING",t[t.PREVIEWED=1]="PREVIEWED",t[t.BOOKMARKED=2]="BOOKMARKED"}(Ln||(Ln={})),function(t){t.SEARCH="search",t.FILTER="filter"}(Dn||(Dn={})),function(t){t[t.ALL=0]="ALL",t[t.DOWNLOADED=1]="DOWNLOADED",t[t.SPINE=2]="SPINE"}(jn||(jn={})),function(t){t[t.SEEN_BUT_NOT_AVAILABLE=0]="SEEN_BUT_NOT_AVAILABLE",t[t.ONLY_SPINE=1]="ONLY_SPINE",t[t.ARTIFACT_AVAILABLE=2]="ARTIFACT_AVAILABLE"}(kn||(kn={})),function(t){t.APK="application/vnd.android.package-archive",t.ECML="application/vnd.ekstep.ecml-archive",t.HTML="application/vnd.ekstep.html-archive",t.COLLECTION="application/vnd.ekstep.content-collection",t.H5P="application/vnd.ekstep.h5p-archive",t.VIDEO="video/mp4",t.YOUTUBE="video/x-youtube",t.WEBM="video/webm",t.QUESTION="application/vnd.sunbird.question",t.QUESTION_SET="application/vnd.sunbird.questionset",t.EPUB="application/epub",t.ZIP="application/zip",t.TXT="text/plain",t.ECAR="application/ecar",t.EPAR="application/epar"}(Un||(Un={})),function(t){t.DEFAULT="Default",t.PARENT="Parent"}(xn||(xn={})),function(t){t.LIVE="Live",t.DRAFT="Draft"}(Bn||(Bn={})),function(t){t.GZIP="gzip",t.IDENTITY="identity"}(Fn||(Fn={})),function(t){t.ATTACHMENT="attachment",t.INLINE="inline",t.ONLINE="online"}(Vn||(Vn={})),function(t){t.CONTENT="ecar",t.PROFILE="epar",t.TELEMETRY="gsa"}(qn||(qn={})),function(t){t[t.NOT_FOUND=-1]="NOT_FOUND",t[t.ENQUEUED_FOR_DOWNLOAD=0]="ENQUEUED_FOR_DOWNLOAD",t[t.DOWNLOAD_STARTED=1]="DOWNLOAD_STARTED",t[t.DOWNLOAD_FAILED=2]="DOWNLOAD_FAILED",t[t.DOWNLOAD_COMPLETED=3]="DOWNLOAD_COMPLETED",t[t.IMPORT_STARTED=4]="IMPORT_STARTED",t[t.IMPORT_FAILED=5]="IMPORT_FAILED",t[t.NOT_COMPATIBLE=6]="NOT_COMPATIBLE",t[t.CONTENT_EXPIRED=7]="CONTENT_EXPIRED",t[t.ALREADY_EXIST=8]="ALREADY_EXIST",t[t.IMPORT_COMPLETED=100]="IMPORT_COMPLETED"}(Yn||(Yn={})),function(t){t.NO_DATA_FOUND="NO_DATA_FOUND",t.INVALID_FILE="INVALID_FILE",t.ECAR_NOT_FOUND="ECAR_NOT_FOUND",t.IMPORT_FAILED_DEVICE_MEMORY_FULL="IMPORT_FAILED_DEVICE_MEMORY_FULL",t.IMPORT_FAILED_EXTRACT_ECAR="IMPORT_FAILED_EXTRACTION",t.IMPORT_FAILED_MANIFEST_FILE_NOT_FOUND="IMPORT_FAILED_MANIFEST_FILE_NOT_FOUND",t.IMPORT_FAILED_UNSUPPORTED_MANIFEST="IMPORT_FAILED_UNSUPPORTED_MANIFEST",t.IMPORT_FAILED_NO_CONTENT_METADATA="IMPORT_FAILED_NO_CONTENT_METADATA",t.DUPLICATE_CONTENT="DUPLICATE_CONTENT",t.IMPORT_FILE_EXIST="IMPORT_FILE_EXIST",t.ECAR_CLEANUP_FAILED="ECAR_CLEANUP_FAILED",t.EXPORT_FAILED_COPY_ASSET="EXPORT_FAILED_COPY_ASSET",t.EXPORT_FAILED_MEMORY_NOT_SUFFICIENT="EXPORT_FAILED_MEMORY_NOT_SUFFICIENT",t.EXPORT_FAILED_WRITING_MANIFEST="EXPORT_FAILED_WRITE_MANIFEST",t.EXPORT_FAILED_ECAR_BUNDLE="EXPORT_FAILED_ECAR_BUNDLE",t.EXPORT_FAILED_NOTHING_TO_EXPORT="EXPORT_FAILED_NOTHING_TO_EXPORT",t.EXPORT_FAILED_DELETING_ECAR="EXPORT_FAILED_DELETING_ECAR"}(Gn||(Gn={})),function(t){t.EXPORT_FAILED="EXPORT_FAILED",t.IMPORT_FAILED="IMPORT_FAILED"}(Hn||(Hn={})),function(t){t.MANIFEST="manifest.json",t.HIERARCHY="hierarchy.json"}(zn||(zn={})),function(t){t.UPDATE="UPDATE",t.IMPORT_COMPLETED="IMPORT_COMPLETED",t.IMPORT_PROGRESS="IMPORT_PROGRESS",t.SERVER_CONTENT_DATA="SERVER_CONTENT_DATA",t.COURSE_STATE_UPDATED="COURSE_STATE_UPDATED",t.CONTENT_EXTRACT_COMPLETED="CONTENT_EXTRACT_COMPLETED"}(Kn||(Kn={}));var Or,Ar=function(){function t(){}return t.joinPreservingQuotes=function(t){return t.map((function(t){return"'"+t+"'"})).join(",")},t.isEmpty=function(t){return!t||0===t.length},t.contains=function(t,e){return t&&-1!==t.indexOf(e)},t.deDupe=function(t){return t.filter((function(t,e,n){return n.indexOf(t)===e}))},t}(),Tr=n(26),Nr=n(27),Cr=function(){function t(){}return t.isAvailableLocally=function(t){return t===kn.ARTIFACT_AVAILABLE},t.isUpdateAvailable=function(t,e){var n=-1,r=-1;return t&&t.pkgVersion&&(r=parseFloat(t.pkgVersion)),e&&e.pkgVersion&&(n=parseFloat(e.pkgVersion)),r>0&&n>0&&r>n},t.hasChildren=function(t){return!!t&&("string"==typeof t&&(t=JSON.parse(t)),t&&t.children)},t.getContentRollup=function(t,e){var n,r,i,o;if(e&&0!==e.length)for(var a=0;a<e.length;a++)if(0===a)n=e[a].identifier;else if(1===a)r=e[a].identifier;else if(2===a)i=e[a].identifier;else{if(3!==a)break;o=e[a].identifier}else n=t;return{l1:n,l2:r,l3:i,l4:o}},t.getChildContentsIdentifiers=function(t){var e=[],n=("string"==typeof t?JSON.parse(t):t).children;return n&&n.length&&n.forEach((function(t){e.push(t.identifier)})),e},t.getFirstPartOfThePathNameOnLastDelimiter=function(t){var e=t.lastIndexOf("/");if(e>0&&e<t.length)return t.substring(0,e)},t.hasPreRequisites=function(t){return JSON.parse(t).pre_requisites},t.readVisibility=function(t){var e=t.visibility;return e||xn.DEFAULT},t.isCompatible=function(t,e){return e>=t.minCompatibilityLevel&&e<=t.maxCompatibilityLevel},t.readCompatibilityLevel=function(t){var e=t.compatibilityLevel;return e||this.defaultCompatibilityLevel},t.isDraftContent=function(t){return t&&t===Bn.DRAFT.valueOf()},t.isExpired=function(t){if(t){var e=new Date(t).getTime();if((new Date).getTime()>e)return!0}return!1},t.isDuplicateCheckRequired=function(t,e){return t&&0===e},t.isImportFileExist=function(e,n){if(!e||!n)return!1;var r=!1,i=e[We.COLUMN_NAME_IDENTIFIER],o=n.identifier,a=e[We.COLUMN_NAME_VISIBILITY],s=t.readVisibility(n);return i===o&&a===s&&(r=this.readPkgVersion(JSON.parse(e[We.COLUMN_NAME_LOCAL_DATA]))>=this.readPkgVersion(n)),r},t.readPkgVersion=function(t){return t.pkgVersion},t.readContentType=function(t){var e=t.contentType;return e&&(e=e.toLowerCase()),e},t.readPrimaryCategory=function(t){var e=t.primaryCategory;return e=e?e.toLowerCase():Tr.CsPrimaryCategoryMapper.getPrimaryCategory(t.contentType.toLowerCase(),t.mimeType,t.resourceType).toLowerCase()},t.readPrimaryCategoryServer=function(t){var e=t.primaryCategory;return e=e||Tr.CsPrimaryCategoryMapper.getPrimaryCategory(t.contentType.toLowerCase(),t.mimeType,t.resourceType)},t.readAudience=function(t){var e=t.audience,n=[];return"string"==typeof e&&n.push(e),n&&n.length||n.push("Learner"),n.sort(),n.join(",")},t.readPragma=function(t){var e=t.pragma;return e||(e=[]),e.join(",")},t.doesContentExist=function(e,n,r,i){if(!e)return!1;var o=!1,a=e[We.COLUMN_NAME_IDENTIFIER],s=JSON.parse(e[We.COLUMN_NAME_LOCAL_DATA]);if(a===n){var u=!1;i?u=!(t.readPkgVersion(s)<r):t.readPkgVersion(s)<r&&(u=!0),o=!(u||!i&&e[We.COLUMN_NAME_CONTENT_STATE]!==kn.ARTIFACT_AVAILABLE.valueOf())}return o},t.getContentRootDir=function(t){return"ios"===window.device.platform.toLowerCase()?t.concat("content/"):t.concat("content")},t.addOrUpdateViralityMetadata=function(e,n){if(t.isContentMetadataAbsent(e)){(i={}).origin=n,i.transferCount=t.INITIAL_VALUE_FOR_TRANSFER_COUNT;var r={};r.virality=i,e.contentMetadata=r}else if(t.isContentMetadataPresentWithoutViralityMetadata(e)){(i={}).origin=n,i.transferCount=t.INITIAL_VALUE_FOR_TRANSFER_COUNT,e.contentMetaData.virality=i}else{var i;(i=e.contentMetaData.virality).transferCount=t.transferCount(i)+1}},t.addViralityMetadataIfMissing=function(e,n){e.contentMetaData||(e.contentMetaData={});var r=e.contentMetaData;r.virality||(r.virality={});var i=e.virality;i||(i={}),i.origin||(i.origin=n),i.transferCount||(i.transferCount=t.INITIAL_VALUE_FOR_TRANSFER_COUNT)},t.isInlineIdentity=function(t,e){return t&&e&&Vn.INLINE.valueOf()===t&&Fn.IDENTITY.valueOf()===e},t.isOnlineContent=function(t){var e=t.contentDisposition;return e&&Vn.ONLINE.valueOf()===e},t.addOrUpdateDialcodeMapping=function(t,e,n){var r;(r=t?JSON.parse(t):{}).hasOwnProperty("identifier")||(r.identifier=e);var i=new Set;return r.hasOwnProperty("rootNodes")&&r.forEach((function(t){i.add(t)})),i.add(n),r.rootNodes=i,JSON.stringify(r)},t.deDupe=function(t,e){return t.filter((function(t,n,r){return r.map((function(t){return t[e]})).indexOf(t[e])===n}))},t.getExportedFileName=function(e,n){var r,i="blank.ecar",o=0;e.length>0&&(r=e[0]);if(e.forEach((function(t){xn.DEFAULT.valueOf()===t[We.COLUMN_NAME_VISIBILITY]&&o++})),o>1&&"".concat((o-1).toString()),r){var a=JSON.parse(r[We.COLUMN_NAME_LOCAL_DATA]),s=a.name;s&&s.length>t.MAX_CONTENT_NAME&&(s=s.substring(0,t.MAX_CONTENT_NAME-3)+"...");var u=a.pkgVersion;i=n.toLowerCase()+"_"+s+"-v"+u+".ecar"}return i},t.readOriginFromContentMap=function(t){var e=t.contentMetadata,n=e&&e.virality;return n?n.origin:""},t.readTransferCountFromContentMap=function(t){var e=t.contentMetadata,n=e&&e.virality;return n?qt.parseInt(n.transferCount):0},t.readSizeFromContentMap=function(t){return t.size?t.size:""},t.getUidnIdentifierFiler=function(t,e){var n=t&&"uid = '"+t+"'",r=e&&"identifier = '"+e+"'",i="";return n&&r?i="WHERE ("+r+" AND "+n+")":r?i="WHERE ("+r+")":n&&(i="WHERE ("+n+")"),i},t.getBasePath=function(t){return t?t=-1!==t.indexOf("file://")?t.replace("file://",""):"file://".concat(t):""},t.getRollup=function(t,e){var n,r,i,o;if(e){var a=void 0;for(a=0;a<e.length;a++)switch(a){case 0:n=e[a].identifier;break;case 1:r=e[a].identifier;break;case 2:i=e[a].identifier;break;case 3:o=e[a].identifier}}else n=t;return{l1:n,l2:r,l3:i,l4:o}},t.addOrUpdateRefCount=function(t){return t<0&&(t=0),t},t.isNotUnit=function(t,e){return!(Un.COLLECTION.valueOf()===t&&xn.PARENT.valueOf()===e)},t.getContentAttribute=function(t){var e=[];if(t&&("string"==typeof t?e.push(t):e=t,e&&e.length)){e.sort();for(var n="",r=0;r<e.length;r++)n=r<e.length-1?n.concat("~",e[r]):n.concat("~",e[r],"~");return n.toLowerCase().trim()}return""},t.getFindAllContentsWithIdentifierQuery=function(t){var e=Ar.joinPreservingQuotes(t),n=" order by "+We.COLUMN_NAME_LOCAL_LAST_UPDATED_ON+" desc, "+We.COLUMN_NAME_SERVER_LAST_UPDATED_ON+" desc",r=" where "+We.COLUMN_NAME_IDENTIFIER+" in ("+e+") AND "+We.COLUMN_NAME_REF_COUNT+" > 0";return"select * from "+We.TABLE_NAME+" "+r+" "+n},t.getFindAllContentsQuery=function(){return"select * from "+We.TABLE_NAME+" where "+We.COLUMN_NAME_REF_COUNT+" > 0"},t.constructContentDBModel=function(e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b){var y;return(y={})[We.COLUMN_NAME_IDENTIFIER]=e,y[We.COLUMN_NAME_SERVER_DATA]="",y[We.COLUMN_NAME_PATH]=t.getBasePath(s),y[We.COLUMN_NAME_REF_COUNT]=u,y[We.COLUMN_NAME_CONTENT_STATE]=c,y[We.COLUMN_NAME_SIZE_ON_DEVICE]=l,y[We.COLUMN_NAME_MANIFEST_VERSION]=n,y[We.COLUMN_NAME_LOCAL_DATA]=r,y[We.COLUMN_NAME_MIME_TYPE]=i,y[We.COLUMN_NAME_CONTENT_TYPE]=o,y[We.COLUMN_NAME_VISIBILITY]=a,y[We.COLUMN_NAME_AUDIENCE]=f,y[We.COLUMN_NAME_PRAGMA]=h,y[We.COLUMN_NAME_LOCAL_LAST_UPDATED_ON]=et().format(),y[We.COLUMN_NAME_BOARD]=t.getContentAttribute(d),y[We.COLUMN_NAME_MEDIUM]=t.getContentAttribute(p),y[We.COLUMN_NAME_GRADE]=t.getContentAttribute(m),y[We.COLUMN_NAME_PRIMARY_CATEGORY]=b,y},t.getReferenceCount=function(t,e){var n;return t?(n=t[We.COLUMN_NAME_REF_COUNT],xn.DEFAULT.valueOf()===t[We.COLUMN_NAME_VISIBILITY]&&xn.DEFAULT.valueOf()===e||(n+=1)):n=1,n},t.getContentVisibility=function(t,e,n){var r;return"Library"===e?r=xn.PARENT.valueOf():t&&!xn.PARENT.valueOf()===t[We.COLUMN_NAME_VISIBILITY]&&(r=t[We.COLUMN_NAME_VISIBILITY]),r||n},t.getContentState=function(t,e){return t&&t[We.COLUMN_NAME_CONTENT_STATE]>e&&(e=t[We.COLUMN_NAME_CONTENT_STATE]),e},t.isFreeSpaceAvailable=function(t,e,n){var r=10240;return n>0&&(r=n),t>0&&t>e+r},t.transferCount=function(t){var e=t.transferCount;return parseInt(e,0)},t.isContentMetadataAbsent=function(t){return!Boolean(t.contentMetaData)},t.isContentMetadataPresentWithoutViralityMetadata=function(t){return!Boolean(t.contentMetaData.virality)},t.isTrackable=function(t){return t.trackable&&"string"==typeof t.trackable&&(t.trackable=JSON.parse(t.trackable)),t.trackable&&t.trackable.enabled?t.trackable.enabled===Sr.TrackingEnabled.YES?1:t.mimeType===Un.COLLECTION?0:-1:t.contentType.toLowerCase()===Nr.CsContentType.COURSE.toLowerCase()?1:t.mimeType===Un.COLLECTION?0:-1},t.getParseErrorObject=function(t){try{return JSON.parse(t)}catch(t){return}},t.defaultCompatibilityLevel=1,t.DEFAULT_PACKAGE_VERSION=-1,t.INITIAL_VALUE_FOR_TRANSFER_COUNT=0,t.MAX_CONTENT_NAME=30,t}(),Ir=n(34),Rr=function(){function t(){}return t.mapContentDataToContentDBEntry=function(t,e){var n,r,i,o;return e?o=JSON.stringify(t):(r=t.lastUpdatedOn,i=JSON.stringify(t)),(n={})[We.COLUMN_NAME_IDENTIFIER]=t.identifier,n[We.COLUMN_NAME_SERVER_DATA]=i,n[We.COLUMN_NAME_SERVER_LAST_UPDATED_ON]=r,n[We.COLUMN_NAME_MANIFEST_VERSION]=e,n[We.COLUMN_NAME_LOCAL_DATA]=o,n[We.COLUMN_NAME_MIME_TYPE]=t.mimeType,n[We.COLUMN_NAME_CONTENT_TYPE]=Cr.readContentType(t),n[We.COLUMN_NAME_VISIBILITY]=Cr.readVisibility(t),n[We.COLUMN_NAME_AUDIENCE]=Cr.readAudience(t),n[We.COLUMN_NAME_PRAGMA]=Cr.readPragma(t),n[We.COLUMN_NAME_PRIMARY_CATEGORY]=Cr.readPrimaryCategory(t),n},t.mapServerResponseToContent=function(t,e){var n,r;e?r=t:(t.lastUpdatedOn,n=t),!t.primaryCategory&&t.contentType&&t.mimeType&&(t.primaryCategory=Tr.CsPrimaryCategoryMapper.getPrimaryCategory(t.contentType.toLowerCase(),t.mimeType,t.resourceType));var i=t.primaryCategory?t.primaryCategory:t.contentType;return!t.trackable&&i&&i.toLowerCase()===Nr.CsContentType.COURSE.toLowerCase()&&(t.trackable={enabled:Ir.TrackingEnabled.YES}),t.trackable||(t.trackable={enabled:Ir.TrackingEnabled.NO}),{identifier:t.identifier,name:t.name,contentData:t,isUpdateAvailable:Cr.isUpdateAvailable(n,r),mimeType:t.mimeType,basePath:"",contentType:Cr.readContentType(t),primaryCategory:Cr.readPrimaryCategory(t),isAvailableLocally:!1,referenceCount:0,sizeOnDevice:0,lastUsedTime:0,lastUpdatedTime:0}},t.mapContentDBEntryToContent=function(t,e){var n,r,i=t[We.COLUMN_NAME_SERVER_DATA],o=t[We.COLUMN_NAME_LOCAL_DATA],a=i&&JSON.parse(i),s=o&&JSON.parse(o),u=t[We.COLUMN_NAME_IDENTIFIER],c=t[We.COLUMN_NAME_MIME_TYPE],f=(t[We.COLUMN_NAME_VISIBILITY],t[We.COLUMN_NAME_CONTENT_TYPE]),h=t[We.COLUMN_NAME_PRIMARY_CATEGORY],l=0;t.hasOwnProperty(Je.COLUMN_NAME_EPOCH_TIMESTAMP)&&(l=t[Je.COLUMN_NAME_EPOCH_TIMESTAMP]),t.hasOwnProperty(tn.COLUMN_NAME_DATA)&&(s||(s=JSON.parse(t[tn.COLUMN_NAME_DATA])),s&&(u=s.identifier,c=s.mimeType,r=s.resourceType,Cr.readVisibility(s),f=Cr.readContentType(s),h=Cr.readPrimaryCategory(s))),s&&(n=s),a&&(s&&Cr.isAvailableLocally(t[We.COLUMN_NAME_CONTENT_STATE])?(s.streamingUrl||(s.streamingUrl=a.streamingUrl),s.previewUrl||(s.previewUrl=a.previewUrl),a.me_totalRatingsCount&&(s.me_totalRatingsCount=a.me_totalRatingsCount),a.me_averageRating&&(s.me_averageRating=a.me_averageRating),s.size||(s.size=a.size),a.licenseDetails&&(s.licenseDetails=a.licenseDetails),a.forumId&&(s.forumId=a.forumId)):n=a);var d=0,p=t[We.COLUMN_NAME_LOCAL_LAST_UPDATED_ON];p&&(d=new Date(p).getTime());var m=Number(t[We.COLUMN_NAME_SIZE_ON_DEVICE]),b=m||Number(a?a.size:0);!n.trackable&&h&&h.toLowerCase()===Nr.CsContentType.COURSE.toLowerCase()&&(n.trackable={enabled:Ir.TrackingEnabled.YES}),n.trackable||(n.trackable={enabled:Ir.TrackingEnabled.NO}),r=n.resourceType,!n.primaryCategory&&f&&(n.primaryCategory=Tr.CsPrimaryCategoryMapper.getPrimaryCategory(f.toLowerCase(),c,r));var y=t[We.COLUMN_NAME_PATH]||"";return"string"==typeof n.originData&&(n.originData=Cr.getParseErrorObject(n.originData)),n.trackable&&"string"==typeof n.trackable&&(n.trackable=JSON.parse(n.trackable)),{identifier:u,name:n.name,contentData:n,isUpdateAvailable:Cr.isUpdateAvailable(a,s),mimeType:c,basePath:e?"/_app_file_"+y:y,primaryCategory:h,contentType:f,isAvailableLocally:Cr.isAvailableLocally(t[We.COLUMN_NAME_CONTENT_STATE]),referenceCount:Number(t[We.COLUMN_NAME_REF_COUNT])||0,sizeOnDevice:b,lastUsedTime:l||0,lastUpdatedTime:d}},t}(),Pr=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.open(t.sourceDBFilePath).then((function(){return e.dbService.read({table:Ne.TABLE_NAME,useExternalDb:!0}).toPromise()})).then((function(r){if(!r||!r.length)throw n.errorMesg=Hn.IMPORT_FAILED.valueOf(),n;var i={};r.forEach((function(t){i[t.key]=t.value})),t.metadata=i;var o=e.getImportTypes(i);if(o&&Ar.contains(o,"telemetry")){var a=i.export_id,s=i.did;return e.dbService.read({table:xe.TABLE_NAME,selection:xe.COLUMN_NAME_IMPORTED_ID+" = ?\n AND "+xe.COLUMN_NAME_DEVICE_ID+" = ?",selectionArgs:[a,s]}).toPromise()}throw n.errorMesg=Hn.IMPORT_FAILED.valueOf(),n})).then((function(e){if(e&&e.length)throw n.errorMesg=Hn.IMPORT_FAILED.valueOf(),n;return n.body=t,n}))},t.prototype.getImportTypes=function(t){var e=[];return t.hasOwnProperty("types")&&(e=t.types),e},t}();!function(t){t.SAVE="SAVE"}(Or||(Or={}));var Lr,Dr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},jr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},kr=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:Me.TABLE_NAME,useExternalDb:!0}).toPromise().then((function(t){return e.saveProccessedTelemetryToDB(t)})).then((function(){return n.body=t,n}))},t.prototype.saveProccessedTelemetryToDB=function(t){return Dr(this,void 0,void 0,(function(){var e=this;return jr(this,(function(n){return t.forEach((function(t){return Dr(e,void 0,void 0,(function(){return jr(this,(function(e){switch(e.label){case 0:return[4,this.dbService.insert({table:Me.TABLE_NAME,modelJson:t})];case 1:return e.sent(),[2]}}))}))})),[2]}))}))},t}(),Ur=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse,r=t.metadata.export_id,i=t.metadata.did,o={imported_id:r,device_id:i,count:t.metadata.events_count};return this.dbService.read({table:xe.TABLE_NAME,selection:xe.COLUMN_NAME_IMPORTED_ID+" = ? AND "+xe.COLUMN_NAME_DEVICE_ID+" = ?",selectionArgs:[r,i],limit:"1"}).toPromise().then((function(t){return t&&t.length?e.dbService.update({table:xe.TABLE_NAME,modelJson:o}).toPromise():e.dbService.insert({table:xe.TABLE_NAME,modelJson:o}).toPromise()})).then((function(){return n.body=t,n}))},t}(),xr=function(){function t(t,e){this.dbService=t,this.telemetryService=e}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:xe.TABLE_NAME}).toPromise().then((function(t){var n=[];t.forEach((function(t){var e={type:lt.TELEMETRY,origin:t[xe.COLUMN_NAME_DEVICE_ID],identifier:t[xe.COLUMN_NAME_IMPORTED_ID],pkgVersion:0,transferCount:0,size:""};n.push(e)}));var r={dir:ft.IN,type:ht.FILE.valueOf(),items:n,env:"sdk"};return e.telemetryService.share(r).toPromise()})).then((function(){return n.body=t,n}))},t}();!function(t){t.ONLINE="ONLINE",t.OFFLINE="OFFLINE"}(Lr||(Lr={}));var Br,Fr,Vr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},qr=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Yr=function(){function t(t,e){this.telemetryService=t,this.sharedPreferences=e,this.shouldSync=!1}return t.generateDownloadSpeedTelemetry=function(t){return Vr(this,void 0,void 0,(function(){var e,n,r;return qr(this,(function(i){switch(i.label){case 0:return[4,new Promise((function(t,e){downloadManager.fetchSpeedLog?downloadManager.fetchSpeedLog((function(e,n){return t(n)}),e):cordova.exec(t,e,"DownloadManagerPlugin","fetchSpeedLog",[])}))];case 1:return e=i.sent(),n={32:"0-32",64:"32-64",128:"64-128",256:"128-256",512:"256-512",1024:"512-1024",1536:"1024-1536",2048:"1536-2048",2560:"2048-2560",3072:"2560-3072",3584:"3072-3584",4096:"3584-above"},Object.keys(e.distributionInKBPS).length?(r={duration:t/1e3,totalKBDownloaded:e.totalKBdownloaded,distributionInKBPS:Object.keys(n).reduce((function(t,r){return e.distributionInKBPS[r]?t[n[r]]=e.distributionInKBPS[r]:t[n[r]]=0,t}),{})},[2,br.log.interact({type:Dt.OTHER,subType:jt.NETWORK_SPEED,env:"sdk",pageId:"sdk",id:"sdk",valueMap:r}).pipe(Object(dt.mapTo)(void 0)).toPromise()]):[2,void 0]}}))}))},t.prototype.getSyncMode=function(){return this.sharedPreferences.getString(K.KEY_AUTO_SYNC_MODE).pipe(Object(dt.map)((function(t){return t})))},t.prototype.setSyncMode=function(t){return this.sharedPreferences.putString(K.KEY_AUTO_SYNC_MODE,t)},t.prototype.start=function(e){var n=this;return this.shouldSync=!0,Object(J.interval)(e).pipe(Object(dt.tap)((function(n){n*e%t.DOWNLOAD_SPEED_TELEMETRY_SYNC_INTERVAL==0&&"ios"!==window.device.platform.toLowerCase()&&t.generateDownloadSpeedTelemetry(e)})),Object(dt.filter)((function(){return n.shouldSync})),Object(dt.tap)((function(){return n.telemetryService.sync().pipe(Object(dt.tap)((function(t){console.log("AUTO_SYNC_INVOKED_SYNC----------------------------------------------",t)})),Object(dt.catchError)((function(t){return console.error(t),Object(J.of)(void 0)}))).toPromise()})),Object(dt.mapTo)(void 0))},t.prototype.pause=function(){this.shouldSync=!1},t.prototype.continue=function(){this.shouldSync=!0},t.DOWNLOAD_SPEED_TELEMETRY_SYNC_INTERVAL=6e4,t}(),Gr=n(91);!function(t){t.STUDENT="student",t.TEACHER="teacher",t.ADMIN="administrator",t.PARENT="parent",t.OTHER="other",t.NONE="none"}(Br||(Br={})),function(t){t.SERVER="server",t.LOCAL="local"}(Fr||(Fr={}));var Hr,zr=function(t,e){this.uid=t,this.sid=ar.generateUniqueId(),this.createdTime=Date.now(),this.managedSession=e},Kr=function(){};!function(t){t[t.NOT_PLAYED=0]="NOT_PLAYED",t[t.PLAYED=1]="PLAYED"}(Hr||(Hr={}));var Wr,Xr=function(){function t(t,e){this.apiService=t,this.tenantServiceConfig=e,this.GET_TENANT_INFO_ENDPOINT="/info"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.tenantServiceConfig.tenantApiPath+this.GET_TENANT_INFO_ENDPOINT+"/"+t.slug).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result})))},t}();!function(t){t.SERVER="server",t.CACHE="cache"}(Wr||(Wr={}));var Jr,Zr,Qr=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},$r=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ti=function(){function t(t,e,n,r){this.cachedItemStore=t,this.keyValueStore=e,this.container=n,this.profileServiceConfig=r,this.USER_PROFILE_DETAILS_KEY_PREFIX="userProfileDetails"}return Object.defineProperty(t.prototype,"csUserService",{get:function(){return this.container.get(Z.USER_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.handle=function(t){var e=this;return t.from=t.from||Wr.CACHE,Object(J.of)(t.from).pipe(Object(dt.mergeMap)((function(n){return n===Wr.SERVER?e.fetchFromServer(t).pipe(Object(dt.tap)((function(t){return Qr(e,void 0,void 0,(function(){return $r(this,(function(e){return[2,this.keyValueStore.setValue(this.USER_PROFILE_DETAILS_KEY_PREFIX+"-"+t.id,JSON.stringify(t)).toPromise()]}))}))})),Object(dt.catchError)((function(){return e.fetchFromCache(t)}))):e.fetchFromCache(t)})))},t.prototype.fetchFromServer=function(t){return this.csUserService.getProfileDetails(t,{apiPath:this.profileServiceConfig.profileApiPath_V5})},t.prototype.fetchFromCache=function(t){var e=this;return this.cachedItemStore.getCached(t.userId,this.USER_PROFILE_DETAILS_KEY_PREFIX,this.USER_PROFILE_DETAILS_KEY_PREFIX,(function(){return e.fetchFromServer(t)}))},t}(),ei=function(){function t(){}return t.mapProfileDBEntryToProfile=function(t){return{uid:t[Ie.COLUMN_NAME_UID],handle:t[Ie.COLUMN_NAME_HANDLE],createdAt:t[Ie.COLUMN_NAME_CREATED_AT],medium:t[Ie.COLUMN_NAME_MEDIUM]?t[Ie.COLUMN_NAME_MEDIUM].split(","):[],board:t[Ie.COLUMN_NAME_BOARD]?t[Ie.COLUMN_NAME_BOARD].split(","):[],subject:t[Ie.COLUMN_NAME_SUBJECT]?t[Ie.COLUMN_NAME_SUBJECT].split(","):[],profileType:t[Ie.COLUMN_NAME_PROFILE_TYPE],grade:t[Ie.COLUMN_NAME_GRADE]?t[Ie.COLUMN_NAME_GRADE].split(","):[],syllabus:t[Ie.COLUMN_NAME_SYLLABUS]?t[Ie.COLUMN_NAME_SYLLABUS].split(","):[],source:t[Ie.COLUMN_NAME_SOURCE],gradeValue:t[Ie.COLUMN_NAME_GRADE_VALUE]&&JSON.parse(t[Ie.COLUMN_NAME_GRADE_VALUE])}},t.mapProfileToProfileDBEntry=function(t){var e;return(e={})[Ie.COLUMN_NAME_UID]=t.uid,e[Ie.COLUMN_NAME_HANDLE]=t.handle,e[Ie.COLUMN_NAME_CREATED_AT]=Number(t.createdAt),e[Ie.COLUMN_NAME_MEDIUM]=t.medium?t.medium.join(","):"",e[Ie.COLUMN_NAME_BOARD]=t.board?t.board.join(","):"",e[Ie.COLUMN_NAME_SUBJECT]=t.subject?t.subject.join(","):"",e[Ie.COLUMN_NAME_PROFILE_TYPE]=t.profileType,e[Ie.COLUMN_NAME_GRADE]=t.grade?t.grade.join(","):"",e[Ie.COLUMN_NAME_SYLLABUS]=t.syllabus?t.syllabus.join(","):"",e[Ie.COLUMN_NAME_SOURCE]=t.source,e[Ie.COLUMN_NAME_GRADE_VALUE]=t.gradeValue?JSON.stringify(t.gradeValue):"",e},t}(),ni=function(){function t(t,e){this.apiService=t,this.acceptTermsConditionApiConfig=e,this.GET_ACCEPT_TERM_CONDITIONS_ENDPOINT="/tnc/accept"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.acceptTermsConditionApiConfig.profileApiPath+this.GET_ACCEPT_TERM_CONDITIONS_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:t}).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return"SUCCESS"===t.body.result.response})))},t}(),ri=function(){function t(){}return t.mapDBEntryToContenetAccess=function(t){var e=t[Je.COLUMN_NAME_LEARNER_STATE];return{status:Number(t[Je.COLUMN_NAME_STATUS]),contentId:t[Je.COLUMN_NAME_CONTENT_IDENTIFIER],contentType:t[Je.COLUMN_NAME_CONTENT_TYPE],contentLearnerState:{learnerState:e&&JSON.parse(e)}}},t}(),ii=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oi=function(t){function e(n){var r=t.call(this,n,"INVALID_PROFILE_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return ii(e,t),e}(ye),ai=function(){function t(t,e){this.apiService=t,this.profileAlreadyInUseConfig=e,this.GET_PROFILE_ALREADY_IN_USE_ENDPOINT="/get"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.profileAlreadyInUseConfig.profileApiPath_V2+this.GET_PROFILE_ALREADY_IN_USE_ENDPOINT+"/"+t.type+"/"+t.key).withBearerToken(!0).withUserToken(!0).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result})))},t}(),si=function(){function t(t,e){this.apiService=t,this.otpServiceConfig=e,this.GET_GENERATE_OTP_ENDPOINT="/generate"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.otpServiceConfig.otpApiPath+this.GET_GENERATE_OTP_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:t}).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return"SUCCESS"===t.body.result.response})))},t}(),ui=function(){function t(t,e){this.apiService=t,this.optServiceConfig=e,this.GET_VERIFY_OTP_ENDPOINT="/verify"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.optServiceConfig.otpApiPath+this.GET_VERIFY_OTP_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:t}).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return"SUCCESS"===t.body.result.response})))},t}(),ci=function(){function t(){}return t.dirPathFromFilePath=function(t){return t.substring(0,t.lastIndexOf("/"))},t.fileNameFromFilePath=function(t){return t.substring(t.lastIndexOf("/")+1)},t.getAssetPath=function(){return"ios"===window.device.platform.toLowerCase()?cordova.file.applicationDirectory+"www/assets":t.ASSETS_PATH},t.ASSETS_PATH="file:///android_asset/www/assets",t}(),fi=function(){function t(t,e,n,r){this.apiService=t,this.profileServiceConfig=e,this.fileService=n,this.cachedItemStore=r,this.LOCATION_LOCAL_KEY="location-"}return t.prototype.handle=function(e){var n=this,r=e.filters.type;return e.filters.parentId&&(r=r+"_"+e.filters.parentId),this.cachedItemStore[e.from===Wr.SERVER?"get":"getCached"](r,this.LOCATION_LOCAL_KEY,"ttl_"+this.LOCATION_LOCAL_KEY,(function(){return n.fetchFromServer(e)}),(function(){return n.fetchFromFile(e)}),t.LOCATION_TTL)},t.prototype.fetchFromServer=function(e){var n=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.profileServiceConfig.searchLocationApiPath+t.GET_SEARCH_LOCATION_ENDPOINT).withBearerToken(!0).withUserToken(!1).withBody({request:e}).build();return this.apiService.fetch(n).pipe(Object(dt.map)((function(t){return t.body.result.response})))},t.prototype.fetchFromFile=function(t){var e=ci.getAssetPath()+this.profileServiceConfig.locationDirPath,n=t.filters.type;return t.filters.parentId&&(n=n+"-"+t.filters.parentId),n+=".json",Object(J.from)(this.fileService.readFileFromAssets(e.concat("/",n))).pipe(Object(dt.map)((function(t){return JSON.parse(t).result.response})))},t.GET_SEARCH_LOCATION_ENDPOINT="/location/search",t.LOCATION_TTL=864e5,t}(),hi=function(){function t(t){this.fileService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse,r="profiles_"+et().format("YYYYMMDDhhmmss")+".epar";return this.fileService.createDir(t.destinationFolder.concat("Profile"),!1).then((function(t){return e.fileService.createFile(t.nativeURL,r,!0)})).then((function(e){return t.destinationDBFilePath=e.nativeURL,n.body=t,n}))},t}(),li=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},di=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},pi=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){return li(this,void 0,void 0,(function(){var e;return di(this,(function(n){return e=new P.CsResponse,[2,this.dbService.copyDatabase(t.destinationDBFilePath).toPromise().then((function(n){return e.body=t,e})).then((function(){return e.body=t,e}))]}))}))},t}(),mi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},bi=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},yi=function(){function t(t,e,n){this.dbService=t,this.fileService=e,this.deviceInfo=n}return t.prototype.execute=function(t){return mi(this,void 0,void 0,(function(){var e,n,r=this;return bi(this,(function(i){return e=new P.CsResponse,n=this.generateMetaData(t.userIds,t.groupIds),[2,this.dbService.open(t.destinationDBFilePath).then((function(){return r.dbService.execute(Ne.getCreateEntry(),!0).toPromise()})).then((function(){return r.populateMetaData(n)})).then((function(){return e.body=t,e})).catch((function(t){throw console.log("error",t),e}))]}))}))},t.prototype.generateMetaData=function(t,e){var n={version:20};return n.types=JSON.stringify(["userprofile"]),n.did=this.deviceInfo.getDeviceID(),n.export_id=ar.generateUniqueId(),e||(e=[]),n.profiles_count=t.length+e.length,n},t.prototype.populateMetaData=function(t){return mi(this,void 0,void 0,(function(){var e=this;return bi(this,(function(n){return Object.keys(t).forEach((function(n){return mi(e,void 0,void 0,(function(){var e;return bi(this,(function(r){switch(r.label){case 0:return e={key:n,value:t[n]},[4,this.dbService.insert({table:Ne.TABLE_NAME,modelJson:e,useExternalDb:!0}).toPromise()];case 1:return r.sent(),[2]}}))}))})),[2]}))}))},t}(),vi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},gi=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},_i=function(){function t(t,e){this.dbService=t,this.fileService=e}return t.prototype.execute=function(t){return vi(this,void 0,void 0,(function(){var e,n=this;return gi(this,(function(r){return e=new P.CsResponse,[2,this.getAllTables().then((function(t){var e=t.map((function(t){return t.name}));return n.removeTables(e,n.getAllTablesToExclude())})).then((function(){return n.deleteUnwantedProfilesAndUsers(t.userIds)})).then((function(){return n.deleteUnwantedProfileSummary(t.userIds)})).then((function(){return n.deleteUnwantedGroups(t.groupIds)})).then((function(){return n.deleteUnwantedGroupProfiles(t.groupIds)})).then((function(){return n.keepAllFrameworknChannel()})).then((function(){return n.fileService.getMetaData(t.destinationDBFilePath)})).then((function(e){return t.size=e.size.toString(),n.populateMetaData({FILE_SIZE:e.size})})).then((function(){return n.fileService.removeFile(t.destinationDBFilePath.concat("-journal"))})).then((function(){return e.body=t,e})).catch((function(t){throw e.errorMesg=Hn.EXPORT_FAILED,e}))]}))}))},t.prototype.getAllTables=function(){return this.dbService.execute("SELECT name FROM sqlite_master WHERE type = 'table'",!0).toPromise()},t.prototype.getAllTablesToExclude=function(){return[Ne.TABLE_NAME,Pe.TABLE_NAME,Ie.TABLE_NAME,Fe.TABLE_NAME,qe.TABLE_NAME,He.TABLE_NAME,Ge.TABLE_NAME,on.TABLE_NAME]},t.prototype.removeTables=function(t,e){return vi(this,void 0,void 0,(function(){var n,r,i;return gi(this,(function(o){switch(o.label){case 0:n=0,r=t,o.label=1;case 1:return n<r.length?(i=r[n],Ar.contains(e,i)?[3,3]:[4,this.dbService.execute("DROP TABLE IF EXISTS "+i,!0).toPromise()]):[3,4];case 2:o.sent(),o.label=3;case 3:return n++,[3,1];case 4:return[2,!0]}}))}))},t.prototype.populateMetaData=function(t){return vi(this,void 0,void 0,(function(){var e=this;return gi(this,(function(n){return Object.keys(t).forEach((function(n){return vi(e,void 0,void 0,(function(){var e;return gi(this,(function(r){switch(r.label){case 0:return e={key:n,value:t[n]},[4,this.dbService.insert({table:Ne.TABLE_NAME,modelJson:e,useExternalDb:!0}).toPromise()];case 1:return r.sent(),[2]}}))}))})),[2]}))}))},t.prototype.deleteUnwantedProfilesAndUsers=function(t){return vi(this,void 0,void 0,(function(){var e,n,r,i,o,a,s;return gi(this,(function(u){switch(u.label){case 0:e=[],n=[],r=0,i=t,u.label=1;case 1:return r<i.length?(o=i[r],[4,this.dbService.read({table:Ie.TABLE_NAME,useExternalDb:!0,selection:Ie.COLUMN_NAME_UID+"=?",selectionArgs:[o],limit:"1"}).toPromise()]):[3,5];case 2:return(a=u.sent())&&a.length&&e.push(a[0][Ie.COLUMN_NAME_UID]),[4,this.dbService.read({table:Pe.TABLE_NAME,useExternalDb:!0,selection:Pe.COLUMN_NAME_UID+"=?",selectionArgs:[o],limit:"1"}).toPromise()];case 3:(s=u.sent())&&s.length&&n.push(s[0][Pe.COLUMN_NAME_UID]),u.label=4;case 4:return r++,[3,1];case 5:return[4,this.cleanTable(Ie.TABLE_NAME,Ie.COLUMN_NAME_UID,e)];case 6:return u.sent(),[4,this.cleanTable(Pe.TABLE_NAME,Pe.COLUMN_NAME_UID,e)];case 7:return u.sent(),[2]}}))}))},t.prototype.deleteUnwantedProfileSummary=function(t){return vi(this,void 0,void 0,(function(){return gi(this,(function(e){switch(e.label){case 0:return[4,this.cleanTable(Fe.TABLE_NAME,Fe.COLUMN_NAME_UID,t)];case 1:return e.sent(),[4,this.cleanTable(qe.TABLE_NAME,qe.COLUMN_NAME_UID,t)];case 2:return e.sent(),[2]}}))}))},t.prototype.deleteUnwantedGroups=function(t){return vi(this,void 0,void 0,(function(){var e,n,r,i,o;return gi(this,(function(a){switch(a.label){case 0:if(!t||!t.length)return[2];e=[],n=0,r=t,a.label=1;case 1:return n<r.length?(i=r[n],[4,this.dbService.read({table:He.TABLE_NAME,useExternalDb:!0,selection:He.COLUMN_NAME_GID+"=?",selectionArgs:[i],limit:"1"}).toPromise()]):[3,4];case 2:(o=a.sent())&&o.length&&e.push(o[0][Ge.COLUMN_NAME_GID]),a.label=3;case 3:return n++,[3,1];case 4:return[4,this.cleanTable(He.TABLE_NAME,He.COLUMN_NAME_GID,e)];case 5:return a.sent(),[2]}}))}))},t.prototype.deleteUnwantedGroupProfiles=function(t){return vi(this,void 0,void 0,(function(){var e,n,r,i,o;return gi(this,(function(a){switch(a.label){case 0:if(!t||!t.length)return[2];e=[],n=0,r=t,a.label=1;case 1:return n<r.length?(i=r[n],[4,this.dbService.read({table:Ge.TABLE_NAME,useExternalDb:!0,selection:Ge.COLUMN_NAME_GID+"=?",selectionArgs:[i],limit:"1"}).toPromise()]):[3,4];case 2:(o=a.sent())&&o.length&&e.push(o[0][Ie.COLUMN_NAME_UID]),a.label=3;case 3:return n++,[3,1];case 4:return[4,this.cleanTable(He.TABLE_NAME,He.COLUMN_NAME_GID,t)];case 5:return a.sent(),[2]}}))}))},t.prototype.keepAllFrameworknChannel=function(){return vi(this,void 0,void 0,(function(){var t,e,n=this;return gi(this,(function(r){switch(r.label){case 0:return t="SELECT * FROM "+on.TABLE_NAME+"\n WHERE "+on.COLUMN_NAME_KEY+" LIKE 'channel_details_key-%'\n OR "+on.COLUMN_NAME_KEY+" LIKE 'framework_details_key-%'\n OR "+on.COLUMN_NAME_KEY+" LIKE 'form-%'",[4,this.dbService.execute(t,!0).toPromise()];case 1:return e=r.sent(),[4,this.dbService.execute("DELETE FROM "+on.TABLE_NAME,!0)];case 2:return r.sent(),e.forEach((function(t){return vi(n,void 0,void 0,(function(){return gi(this,(function(e){switch(e.label){case 0:return[4,this.dbService.insert({table:on.TABLE_NAME,useExternalDb:!0,modelJson:t})];case 1:return e.sent(),[2]}}))}))})),[2]}}))}))},t.prototype.cleanTable=function(t,e,n){return vi(this,void 0,void 0,(function(){var r,i;return gi(this,(function(o){switch(o.label){case 0:return n&&n.length?(r=Ar.joinPreservingQuotes(n),i="DELETE FROM "+t+"\n WHERE "+e+" NOT IN("+r+")",[4,this.dbService.execute(i,!0).toPromise()]):[2];case 1:return o.sent(),[2]}}))}))},t}(),Ei=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=new P.CsResponse;return this.dbService.read({table:xe.TABLE_NAME}).toPromise().then((function(t){var e=[];t.forEach((function(t){var n={type:lt.PROFILE,origin:t[xe.COLUMN_NAME_DEVICE_ID],identifier:t[xe.COLUMN_NAME_IMPORTED_ID],pkgVersion:0,transferCount:0,size:""};e.push(n)}));var n={dir:ft.IN,type:ht.FILE.valueOf(),items:e,env:"sdk"};return br.log.share(n).toPromise()})).then((function(){return e.body=t,e}))},t}(),Mi=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=new P.CsResponse;return this.dbService.read({table:xe.TABLE_NAME}).toPromise().then((function(t){var e=[];t.forEach((function(t){var n={type:lt.PROFILE,origin:t[xe.COLUMN_NAME_DEVICE_ID],identifier:t[xe.COLUMN_NAME_IMPORTED_ID],pkgVersion:0,transferCount:0,size:""};e.push(n)}));var n={dir:ft.OUT,type:ht.FILE.valueOf(),items:e,env:"sdk"};return br.log.share(n).toPromise()})).then((function(){return e.body=t,e}))},t}(),wi=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.open(t.sourceDBFilePath).then((function(){return e.dbService.read({table:Ne.TABLE_NAME,useExternalDb:!0}).toPromise()})).then((function(r){if(!r||!r.length)throw n.errorMesg=Hn.IMPORT_FAILED.valueOf(),n;var i={};r.forEach((function(t){i[t.key]=t.value})),t.metadata=i;var o=e.getImportTypes(i);if(o&&!Ar.contains(o,"userprofile"))throw n.errorMesg=Hn.IMPORT_FAILED.valueOf(),n;return n.body=t,n}))},t.prototype.getImportTypes=function(t){var e=[];return t.hasOwnProperty("types")&&(e=JSON.parse(t.types)),e},t}(),Si=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Oi=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Ai=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:Pe.TABLE_NAME,useExternalDb:!0}).toPromise().then((function(n){return e.saveUsersToDb(t,n)})).then((function(){return n.body=t,n}))},t.prototype.saveUsersToDb=function(t,e){return Si(this,void 0,void 0,(function(){var t=this;return Oi(this,(function(n){return e.forEach((function(e){return Si(t,void 0,void 0,(function(){var t;return Oi(this,(function(n){switch(n.label){case 0:return delete e[Pe._ID],[4,this.dbService.read({table:Ie.TABLE_NAME,selection:Pe.COLUMN_NAME_UID+" = ?",selectionArgs:[e[Pe.COLUMN_NAME_UID]],limit:"1"}).toPromise()];case 1:return(t=n.sent())&&t.length?[3,3]:[4,this.dbService.insert({table:Pe.TABLE_NAME,modelJson:e}).toPromise()];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))})),[2]}))}))},t}(),Ti=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ni=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Ci=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:He.TABLE_NAME,useExternalDb:!0}).toPromise().then((function(n){return e.saveGroupsToDb(t,n)})).then((function(){return n.body=t,n}))},t.prototype.saveGroupsToDb=function(t,e){return Ti(this,void 0,void 0,(function(){var n,r,i=this;return Ni(this,(function(o){return n=0,r=0,e.forEach((function(t){return Ti(i,void 0,void 0,(function(){var e;return Ni(this,(function(i){switch(i.label){case 0:return[4,this.dbService.read({table:He.TABLE_NAME,selection:He.COLUMN_NAME_GID+" = ?",selectionArgs:[t[He.COLUMN_NAME_GID]],limit:"1"}).toPromise()];case 1:return(e=i.sent())&&e.length?[3,3]:(t[He.COLUMN_NAME_CREATED_AT]||(t[He.COLUMN_NAME_CREATED_AT]=Date.now()),[4,this.dbService.insert({table:He.TABLE_NAME,modelJson:t}).toPromise()]);case 2:return i.sent(),n++,[3,4];case 3:r++,i.label=4;case 4:return[2]}}))}))})),t.failed=t.failed?t.failed+r:r,t.imported=t.imported?t.imported+n:n,[2]}))}))},t}(),Ii=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ri=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Pi=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:Ge.TABLE_NAME,useExternalDb:!0}).toPromise().then((function(n){return e.saveGroupProfilesToDb(t,n)})).then((function(){return n.body=t,n}))},t.prototype.saveGroupProfilesToDb=function(t,e){return Ii(this,void 0,void 0,(function(){var t=this;return Ri(this,(function(n){return e.forEach((function(n){return Ii(t,void 0,void 0,(function(){var t;return Ri(this,(function(r){switch(r.label){case 0:return delete n[Ge._ID],[4,this.dbService.read({table:Ge.TABLE_NAME,selection:Ge.COLUMN_NAME_GID+" = ? AND "+Ge.COLUMN_NAME_UID+" = ?",selectionArgs:[e[Ge.COLUMN_NAME_GID],n[Ge.COLUMN_NAME_UID]],limit:"1"}).toPromise()];case 1:return(t=r.sent())&&t.length?[3,3]:[4,this.dbService.insert({table:Ge.TABLE_NAME,modelJson:n})];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))})),[2]}))}))},t}(),Li=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Di=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ji=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:on.TABLE_NAME,useExternalDb:!0}).toPromise().then((function(t){return e.saveNoSqlEntryToDb(t)})).then((function(){return n.body=t,n}))},t.prototype.saveNoSqlEntryToDb=function(t){return Li(this,void 0,void 0,(function(){var e=this;return Di(this,(function(n){return t.forEach((function(t){return Li(e,void 0,void 0,(function(){var e;return Di(this,(function(n){switch(n.label){case 0:return delete t[on._ID],[4,this.dbService.read({table:on.TABLE_NAME,selection:on.COLUMN_NAME_KEY+" = ?",selectionArgs:[t[on.COLUMN_NAME_KEY]],limit:"1"}).toPromise()];case 1:return(e=n.sent())&&e.length?[3,3]:[4,this.dbService.insert({table:on.TABLE_NAME,modelJson:t}).toPromise()];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))})),[2]}))}))},t}(),ki=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ui=function(t){function e(n){var r=t.call(this,n,"VALIDATION_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return ki(e,t),e}(ye),xi=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Bi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fi=function(t,e){return function(n,r){e(n,r,t)}},Vi=function(){function t(t,e,n,r,i,o){this.dbService=t,this.contenService=e,this.eventsBusService=n,this.courseService=r,this.sharedPreference=i,this.profileService=o,this.summarizerTelemetryHandler=new ko(this.courseService,this.sharedPreference,this,this.eventsBusService,this.contenService,this.profileService)}return t.prototype.onInit=function(){return this.eventsBusService.registerObserver({namespace:$.TELEMETRY,observer:this}),Object(J.of)(void 0)},t.prototype.getDetailsPerQuestion=function(t){var e=Hi.getQuetsionDetailsQuery(t.uids,t.contentId,t.qId);return this.dbService.execute(e).pipe(Object(dt.map)((function(t){return Gi.mapDBEntriesToQuestionDetails(t)})))},t.prototype.getLearnerAssessmentDetails=function(t){var e=Hi.getDetailReportsQuery(t.uids,t.contentId);return this.dbService.execute(e).pipe(Object(dt.map)((function(t){return Gi.mapDBEntriesToLearnerAssesmentDetails(t)})))},t.prototype.getReportByQuestions=function(t){var e=this,n=Hi.getQuestionReportsQuery(t.uids,t.contentId),r=Hi.getReportAccuracyQuery(t.uids,t.contentId);return this.dbService.execute(r).pipe(Object(dt.map)((function(t){return Gi.mapDBEntriesToAccuracy(t)})),Object(dt.mergeMap)((function(t){return e.dbService.execute(n).pipe(Object(dt.map)((function(e){return Gi.mapDBEntriesToQuestionReports(t,e)})))})))},t.prototype.getReportsByUser=function(t){var e=Hi.getReportsByUserQuery(t.uids,t.contentId);return this.dbService.execute(e).pipe(Object(dt.map)((function(t){return Gi.mapDBEntriesToUserReports(t)})))},t.prototype.getSummary=function(t){var e=this;if(!t.uids)throw new Ui("uids are mandatory");var n=Hi.getChildProgressQuery(t.uids);return this.getContentCache(t.uids).pipe(Object(dt.mergeMap)((function(t){return e.dbService.execute(n).pipe(Object(dt.map)((function(e){return Gi.mapDBEntriesToLearnerAssesmentSummary(e,t)})))})))},t.prototype.getContentCache=function(t){var e=this;if(this.contentMap&&Object.keys(this.contentMap).length)return Object(J.of)(this.contentMap);this.contentMap=new Map;var n={resourcesOnly:!0,primaryCategories:[],uid:t};return this.contenService.getContents(n).pipe(Object(dt.map)((function(t){return t.forEach((function(t){var n=new qi;n.name=t.contentData&&t.contentData.name,n.totalScore=t.contentData&&t.contentData.totalScore,n.lastUsedTime=t.lastUsedTime,n.identifier=t.identifier,e.contentMap.set(t.identifier,n)})),e.contentMap})))},t.prototype.saveLearnerAssessmentDetails=function(t){var e=this,n=Gi.mapTelemetryToLearnerAssesmentDetails(t),r=Gi.mapLearnerAssesmentDetailsToDbEntries(n),i=Hi.getFilterForLearnerAssessmentDetails(n.qid,n.uid,n.contentId,n.hierarchyData),o=Hi.getLearnerAssessmentsQuery(i);return this.dbService.execute(o).pipe(Object(dt.mergeMap)((function(t){return t&&t.length?e.dbService.update({table:Fe.TABLE_NAME,selection:Hi.getUpdateSelection(),selectionArgs:[n.uid,n.contentId,n.hierarchyData?n.hierarchyData:"",n.qid],modelJson:r}).pipe(Object(dt.map)((function(t){return t>0}))):n.qid?e.dbService.insert({table:Fe.TABLE_NAME,modelJson:r}).pipe(Object(dt.map)((function(t){return t>0}))):Object(J.of)(!1)})))},t.prototype.saveLearnerContentSummaryDetails=function(t){var e=this,n=Gi.mapTelemetryToContentSummaryDetails(t),r=Gi.mapContentSummaryDetailsToDbEntries(n);return this.dbService.read({table:qe.TABLE_NAME,selection:Hi.getLearnerSummaryReadSelection(n.hierarchyData),selectionArgs:[n.uid,n.contentId,n.hierarchyData]}).pipe(Object(dt.mergeMap)((function(t){return t&&t.length?(r.sessions=t[0][qe.COLUMN_NAME_SESSIONS]+1,r.avg_ts=qt.toFixed(n.timespent/n.sessions),r.total_ts=n.timespent,r.last_updated_on=n.timestamp,e.dbService.update({table:qe.TABLE_NAME,selection:Hi.getLearnerSummaryReadSelection(n.hierarchyData),selectionArgs:[n.uid,n.contentId,n.hierarchyData],modelJson:r}).pipe(Object(dt.map)((function(t){return t>0})))):(r.avg_ts=n.timespent,r.sessions=1,r.total_ts=n.timespent,r.last_updated_on=n.timestamp,e.dbService.insert({table:qe.TABLE_NAME,modelJson:r}).pipe(Object(dt.map)((function(t){return t>0}))))})))},t.prototype.deletePreviousAssessmentDetails=function(t,e){var n=this;return this.dbService.read({table:qe.TABLE_NAME,selection:qe.COLUMN_NAME_CONTENT_ID+" = ? AND "+qe.COLUMN_NAME_UID+" = ?",selectionArgs:[e,t]}).pipe(Object(dt.mergeMap)((function(r){return r&&r.length?n.dbService.delete({table:qe.TABLE_NAME,selection:qe.COLUMN_NAME_CONTENT_ID+" = ? AND "+qe.COLUMN_NAME_UID+" = ?",selectionArgs:[e,t]}):Object(J.of)(void 0)})),Object(dt.mergeMap)((function(){return n.dbService.read({table:Fe.TABLE_NAME,selection:Fe.COLUMN_NAME_CONTENT_ID+" = ? AND "+Fe.COLUMN_NAME_UID+" = ?",selectionArgs:[e,t]})})),Object(dt.mergeMap)((function(r){return r&&r.length?n.dbService.delete({table:Fe.TABLE_NAME,selection:Fe.COLUMN_NAME_CONTENT_ID+" = ? AND "+Fe.COLUMN_NAME_UID+" = ?",selectionArgs:[e,t]}):Object(J.of)(void 0)})))},t.prototype.onEvent=function(t){return t.type===Or.SAVE?this.summarizerTelemetryHandler.handle(t.payload):Object(J.of)(void 0)},t=xi([Object(R.injectable)(),Fi(0,Object(R.inject)(Q.DB_SERVICE)),Fi(1,Object(R.inject)(Q.CONTENT_SERVICE)),Fi(2,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),Fi(3,Object(R.inject)(Q.COURSE_SERVICE)),Fi(4,Object(R.inject)(Q.SHARED_PREFERENCES)),Fi(5,Object(R.inject)(Q.PROFILE_SERVICE)),Bi("design:paramtypes",[I,Object,Object,Object,Object,Object])],t)}(),qi=function(){},Yi=function(){this.reportDetailsList=[]},Gi=function(){function t(){}return t.mapLearnerAssesmentDetailsToDbEntries=function(t){var e;return(e={})[Fe.COLUMN_NAME_UID]=t.uid,e[Fe.COLUMN_NAME_CONTENT_ID]=t.contentId,e[Fe.COLUMN_NAME_QID]=t.qid,e[Fe.COLUMN_NAME_Q_INDEX]=t.qindex,e[Fe.COLUMN_NAME_CORRECT]=t.correct,e[Fe.COLUMN_NAME_SCORE]=t.score,e[Fe.COLUMN_NAME_TIME_SPENT]=t.timespent,e[Fe.COLUMN_NAME_RES]=t.res,e[Fe.COLUMN_NAME_TIMESTAMP]=t.timestamp,e[Fe.COLUMN_NAME_Q_DESC]=t.qdesc,e[Fe.COLUMN_NAME_Q_TITLE]=t.qtitle,e[Fe.COLUMN_NAME_MAX_SCORE]=t.maxScore,e[Fe.COLUMN_NAME_HIERARCHY_DATA]=t.hierarchyData,e},t.mapContentSummaryDetailsToDbEntries=function(t){var e;return(e={})[qe.COLUMN_NAME_UID]=t.uid,e[qe.COLUMN_NAME_CONTENT_ID]=t.contentId,e[qe.COLUMN_NAME_AVG_TS]=t.avgts,e[qe.COLUMN_NAME_TOTAL_TS]=t.totalts,e[qe.COLUMN_NAME_LAST_UPDATED_ON]=t.lastUpdated,e[Fe.COLUMN_NAME_HIERARCHY_DATA]=t.hierarchyData,e},t.mapDBEntriesToLearnerAssesmentSummary=function(t,e){return t.map((function(t){var n=e.get(t[qe.COLUMN_NAME_CONTENT_ID]);return{uid:t[qe.COLUMN_NAME_UID].toString(),contentId:t[qe.COLUMN_NAME_CONTENT_ID].toString(),noOfQuestions:qt.parseInt(t[qe.COLUMN_NAME_NO_OF_QUESTIONS]),correctAnswers:qt.parseInt(t[qe.COLUMN_NAME_CORRECT_ANSWERS]),totalTimespent:Number(t[qe.COLUMN_NAME_TOTAL_TIME_SPENT]),hierarchyData:t[qe.COLUMN_NAME_HIERARCHY_DATA].toString(),totalMaxScore:qt.toFixed(t[qe.COLUMN_NAME_TOTAL_MAX_SCORE]),totalScore:qt.toFixed(t[qe.COLUMN_NAME_TOTAL_SCORE]),totalQuestionsScore:n?n.totalScore:0,name:n?n.name:t[qe.COLUMN_NAME_CONTENT_ID]}}))},t.mapDBEntriesToLearnerAssesmentDetails=function(t){var e=new Map;return t.map((function(t){var n={uid:t[Fe.COLUMN_NAME_UID],contentId:t[Fe.COLUMN_NAME_CONTENT_ID],qid:t[Fe.COLUMN_NAME_QID],qindex:Number(t[Fe.COLUMN_NAME_Q_INDEX]),correct:qt.parseInt(t[Fe.COLUMN_NAME_CORRECT]),score:qt.toFixed(t[Fe.COLUMN_NAME_SCORE]),timespent:Number(t[Fe.COLUMN_NAME_TIME_SPENT]),res:t[Fe[Fe.COLUMN_NAME_RES]],timestamp:Number(t[Fe.COLUMN_NAME_TIMESTAMP]),qdesc:t[Fe.COLUMN_NAME_Q_DESC],qtitle:t[Fe.COLUMN_NAME_Q_TITLE],maxScore:qt.toFixed(t[Fe.COLUMN_NAME_MAX_SCORE]),hierarchyData:t[Fe.COLUMN_NAME_HIERARCHY_DATA],total_ts:Number(t[Fe.COLUMN_NAME_TOTAL_TS])},r=e.get(n.uid);void 0===r&&((r=new Yi).uid=n.uid,r.totalScore=0,r.maxTotalScore=0),r.reportDetailsList.push(n),r.totalScore+=n.score,r.totalTime=n.total_ts,r.maxTotalScore+=n.maxScore,r.totalScore=parseFloat(r.totalScore.toFixed(2)),e.set(n.uid,r)})),e},t.mapDBEntriesToQuestionReports=function(t,e){return e.map((function(e){var n=e[Fe.COLUMN_NAME_QID],r=0;return t.hasOwnProperty(n)&&(r=qt.parseInt(t[n])),{uid:e[Fe.COLUMN_NAME_UID],contentId:e[Fe.COLUMN_NAME_CONTENT_ID],qid:e[Fe.COLUMN_NAME_QID],qindex:Number(e[Fe.COLUMN_NAME_Q_INDEX]),correct:qt.parseInt(e[Fe.COLUMN_NAME_CORRECT]),score:qt.toFixed(e[Fe.COLUMN_NAME_SCORE]),timespent:Number(e[Fe.COLUMN_NAME_TIME_SPENT]),res:e[Fe[Fe.COLUMN_NAME_RES]],timestamp:Number(e[Fe.COLUMN_NAME_TIMESTAMP]),qdesc:e[Fe.COLUMN_NAME_Q_DESC],qtitle:e[Fe.COLUMN_NAME_Q_TITLE],maxScore:qt.toFixed(e[Fe.COLUMN_NAME_MAX_SCORE]),hierarchyData:e[Fe.COLUMN_NAME_HIERARCHY_DATA],total_ts:Number(e[Fe.COLUMN_NAME_TOTAL_TS]),marks:Number(e[Fe.COLUMN_NAME_MARKS]),occurenceCount:e[Fe.COLUMN_NAME_COUNT],sum_max_score:Number(e[Fe.COLUMN_NAME_TOTAL_MAX_SCORE]),correct_users_count:r}}))},t.mapDBEntriesToAccuracy=function(t){var e={};return t.map((function(t){e[t[Fe.COLUMN_NAME_QID]]=qt.parseInt(t[Fe.COLUMN_NAME_USERS_COUNT])})),e},t.mapDBEntriesToQuestionDetails=function(t){return t.map((function(t){return{uid:t.uid,time:Number(t.time),result:qt.round(t.result),max_score:qt.parseInt(t.max_score)}}))},t.mapDBEntriesToUserReports=function(t){return t.map((function(t){return{totalTimespent:Number(t[Fe.COLUMN_NAME_TOTAL_TS]),score:qt.toFixed(t[Fe.COLUMN_NAME_SCORE]),hData:t[Fe.COLUMN_NAME_HIERARCHY_DATA],contentId:t[Fe.COLUMN_NAME_CONTENT_ID],uid:t[Fe.COLUMN_NAME_UID],userName:t[Fe.COLUMN_NAME_HANDLE],timespent:Number(t[Fe.COLUMN_NAME_TIME_SPENT])}}))},t.mapTelemetryToContentSummaryDetails=function(t){var e=t.edata,n=(e.item,t.context.cdata);return{uid:t.actor.id,contentId:t.object.id,timespent:Number(e.duration),timestamp:t.ets,hierarchyData:this.getHierarchyData(n)}},t.mapTelemetryToLearnerAssesmentDetails=function(t){var e=t.edata,n=e.item,r=t.context.cdata;return{uid:t.actor.id,contentId:t.object.id,qid:n&&n.id,qindex:Number(e.index),correct:"Yes"===e.pass?1:0,score:Number(e.score),timespent:Number(e.duration),timestamp:t.ets,res:JSON.stringify(e.resvalues),qdesc:n&&n.desc,qtitle:n&&n.title,maxScore:n&&Number(n.maxscore),hierarchyData:this.getHierarchyData(r)}},t.getHierarchyData=function(t){return t&&t.forEach((function(t){if("Collection"===t.type||"TextBook"===t.type)return t.id})),""},t}(),Hi=function(){function t(){}return t.getChildProgressQuery=function(t){return"SELECT "+Fe.COLUMN_NAME_UID+", "+Fe.COLUMN_NAME_CONTENT_ID+",\n COUNT ("+Fe.COLUMN_NAME_QID+") AS no_of_questions,\n SUM ("+Fe.COLUMN_NAME_CORRECT+") AS correct_answers,\n SUM ("+Fe.COLUMN_NAME_TIME_SPENT+") AS total_time_spent, h_data ,\n SUM ("+Fe.COLUMN_NAME_MAX_SCORE+") AS total_max_score,\n SUM ("+Fe.COLUMN_NAME_SCORE+") AS total_score\n FROM "+Fe.TABLE_NAME+"\n WHERE "+Fe.COLUMN_NAME_UID+" IN ("+Ar.joinPreservingQuotes(t)+")\n GROUP BY "+Fe.COLUMN_NAME_CONTENT_ID+" "},t.getDetailReportsQuery=function(t,e){return"SELECT *, lcs."+qe.COLUMN_NAME_TOTAL_TS+"\n FROM "+Fe.TABLE_NAME+" la\n LEFT JOIN "+qe.TABLE_NAME+" lcs\n ON (la."+qe.COLUMN_NAME_UID+" = lcs."+Fe.COLUMN_NAME_UID+")\n AND la."+qe.COLUMN_NAME_CONTENT_ID+" = lcs."+Fe.COLUMN_NAME_CONTENT_ID+"\n WHERE la."+Fe.COLUMN_NAME_UID+" IN("+Ar.joinPreservingQuotes(t)+")\n AND la."+Fe.COLUMN_NAME_CONTENT_ID+"='"+e+"'"},t.getReportsByUserQuery=function(t,e){return"SELECT lcs."+qe.COLUMN_NAME_TOTAL_TS+",\n SUM ("+Fe.COLUMN_NAME_SCORE+") AS score,\n la."+Fe.COLUMN_NAME_HIERARCHY_DATA+",la."+Fe.COLUMN_NAME_CONTENT_ID+",\n la."+Fe.COLUMN_NAME_UID+",p."+Ie.COLUMN_NAME_HANDLE+",\n la."+Fe.COLUMN_NAME_TIME_SPENT+"\n FROM "+Fe.TABLE_NAME+" la\n LEFT JOIN "+qe.TABLE_NAME+" lcs\n ON (la."+qe.COLUMN_NAME_UID+" = lcs."+Fe.COLUMN_NAME_UID+")\n LEFT JOIN "+Ie.TABLE_NAME+" p\n ON (la."+Fe.COLUMN_NAME_UID+" = p."+Ie.COLUMN_NAME_UID+")\n WHERE la."+Fe.COLUMN_NAME_UID+" IN("+Ar.joinPreservingQuotes(t)+")\n AND la."+Fe.COLUMN_NAME_CONTENT_ID+"='"+e+"'\n GROUP BY la."+Fe.COLUMN_NAME_UID},t.getQuetsionDetailsQuery=function(t,e,n){return"SELECT "+Fe.COLUMN_NAME_UID+", "+Fe.COLUMN_NAME_TIME_SPENT+" as time,\n "+Fe.COLUMN_NAME_SCORE+" as result,\n "+Fe.COLUMN_NAME_MAX_SCORE+" as max_score\n FROM "+Fe.TABLE_NAME+"\n WHERE "+Fe.COLUMN_NAME_UID+" IN("+Ar.joinPreservingQuotes(t)+")\n AND "+Fe.COLUMN_NAME_CONTENT_ID+"='"+e+"'\n AND "+Fe.COLUMN_NAME_QID+"='"+n+"'"},t.getReportAccuracyQuery=function(t,e){return"SELECT "+Fe.COLUMN_NAME_QID+", COUNT (*) as users_count\n FROM "+Fe.TABLE_NAME+"\n WHERE "+Fe.COLUMN_NAME_UID+" IN("+Ar.joinPreservingQuotes(t)+")\n AND "+Fe.COLUMN_NAME_CONTENT_ID+"='"+e+"'\n AND "+Fe.COLUMN_NAME_SCORE+" > 0\n GROUP BY "+Fe.COLUMN_NAME_QID},t.getQuestionReportsQuery=function(t,e){return"SELECT *, SUM("+Fe.COLUMN_NAME_SCORE+") as marks,\n COUNT ("+Fe.COLUMN_NAME_Q_INDEX+") as occurence_count,\n SUM ("+Fe.COLUMN_NAME_MAX_SCORE+") as sum_max_score\n FROM "+Fe.TABLE_NAME+"\n WHERE "+Fe.COLUMN_NAME_UID+" IN("+Ar.joinPreservingQuotes(t)+")\n AND "+Fe.COLUMN_NAME_CONTENT_ID+"='"+e+"'\n GROUP BY "+Fe.COLUMN_NAME_QID},t.getFilterForLearnerAssessmentDetails=function(t,e,n,r){var i=Fe.COLUMN_NAME_QID+" = '"+t+"'";return"WHERE "+(Fe.COLUMN_NAME_UID+" = '"+e+"'")+" AND "+(Fe.COLUMN_NAME_CONTENT_ID+" = '"+n+"'")+" AND "+(Fe.COLUMN_NAME_HIERARCHY_DATA+" = '"+(r||"")+"'")+" "+(t?" AND "+i:"")},t.getLearnerAssessmentsQuery=function(t){return"SELECT * from "+Fe.TABLE_NAME+" "+t+"\n ORDER BY "+Fe.COLUMN_NAME_Q_INDEX},t.getUpdateSelection=function(){return Fe.COLUMN_NAME_UID+" = ? AND "+Fe.COLUMN_NAME_CONTENT_ID+" = ? AND "+Fe.COLUMN_NAME_HIERARCHY_DATA+" = ? AND "+Fe.COLUMN_NAME_QID+" = ? "},t.getLearnerSummaryReadSelection=function(t){return Fe.COLUMN_NAME_UID+" = ? AND "+Fe.COLUMN_NAME_CONTENT_ID+" = ? AND "+Fe.COLUMN_NAME_HIERARCHY_DATA+" = ? "},t}(),zi=function(){function t(t,e){this.apiService=t,this.courseServiceConfig=e,this.GET_BATCH_DETAILS_ENDPOINT="/batch/read/"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.courseServiceConfig.apiPath+this.GET_BATCH_DETAILS_ENDPOINT+t.batchId).withBearerToken(!0).withUserToken(!0).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result.response})))},t}(),Ki=function(){function t(t,e){this.apiService=t,this.courseServiceConfig=e,this.GET_COURSE_BATCHES="/batch/list?creatorDetails"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.courseServiceConfig.apiPath+this.GET_COURSE_BATCHES).withBearerToken(!0).withUserToken(!1).withBody({request:t}).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return Array.from(new Set(t.body.result.response.content))})))},t}(),Wi=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Xi=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Ji=function(){function t(t,e,n,r,i){this.keyValueStore=t,this.apiService=e,this.courseServiceConfig=n,this.sharedPreference=r,this.apiHandler=i,this.GET_ENROLLED_COURSES_ENDPOINT="/user/enrollment/list/",this.STORED_ENROLLED_COURSES_PREFIX="enrolledCourses"}return t.prototype.handle=function(t){var e=this;return this.keyValueStore.getValue(this.STORED_ENROLLED_COURSES_PREFIX+t.userId).pipe(Object(dt.mergeMap)((function(n){if(n){if(t.returnFreshCourses)return e.fetchFromServer(t).pipe(Object(dt.mergeMap)((function(n){return e.keyValueStore.setValue(e.STORED_ENROLLED_COURSES_PREFIX+t.userId,JSON.stringify(n)).pipe(Object(dt.mapTo)(n.result.courses),Object(dt.tap)((function(t){return Object(J.from)(e.updateLastPlayedContent(t))})))})),Object(dt.catchError)((function(){var t,e=JSON.parse(n),r=e.result;return t=r&&r.hasOwnProperty("courses")?r.courses:e.courses,Object(J.of)(t)})));var r=JSON.parse(n),i=r.result,o=void 0;return o=i&&i.hasOwnProperty("courses")?i.courses:r.courses,Object(J.of)(o)}return e.fetchFromServer(t).pipe(Object(dt.mergeMap)((function(n){return e.keyValueStore.setValue(e.STORED_ENROLLED_COURSES_PREFIX+t.userId,JSON.stringify(n)).pipe(Object(dt.mapTo)(n.result.courses),Object(dt.tap)((function(t){return Object(J.from)(e.updateLastPlayedContent(t))})))})))})))},t.prototype.updateLastPlayedContent=function(t){return Wi(this,void 0,void 0,(function(){var e,n,r,i,o;return Xi(this,(function(a){switch(a.label){case 0:e=0,n=t,a.label=1;case 1:return e<n.length?(r=n[e],i=No.LAST_READ_CONTENTID_PREFIX.concat("_").concat(r.userId).concat("_").concat(r.contentId).concat("_").concat(r.batchId),o=r.lastReadContentId,r.lastReadContentId?[4,this.sharedPreference.putString(i,o).toPromise()]:[3,3]):[3,4];case 2:a.sent(),a.label=3;case 3:return e++,[3,1];case 4:return[2,Promise.resolve(!0)]}}))}))},t.prototype.fetchFromServer=function(t){if(this.apiHandler)return this.apiHandler.handle(t);var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.courseServiceConfig.apiPath+this.GET_ENROLLED_COURSES_ENDPOINT+t.userId+"?orgdetails=orgName,email&fields=contentType,topic,name,channel,pkgVersion,primaryCategory,trackable&batchDetails=name,endDate,startDate,status,enrollmentType,createdBy,certificates").withBearerToken(!0).withUserToken(!0).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body})))},t}(),Zi=function(){function t(t,e){this.apiService=t,this.courseServiceConfig=e,this.ENROL_ENDPOINT="/enrol"}return t.prototype.handle=function(t){var e=this;delete t.batchStatus;var n=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.courseServiceConfig.apiPath+this.ENROL_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:t}).build();return this.apiService.fetch(n).pipe(Object(dt.map)((function(t){return"SUCCESS"===t.body.result.response})),Object(dt.tap)((function(){e.generateAuditTelemetry(t)})))},t.prototype.generateAuditTelemetry=function(t){var e=new Ht;e.id=t.userId,e.type=Ht.TYPE_USER;var n=[{type:"CourseId",id:t.courseId},{type:"BatchId",id:t.batchId},{type:"UserId",id:t.userId}],r={env:"course",actor:e,currentState:Ft.AUDIT_CREATED,updatedProperties:["courseId","userId","batchId"],objId:t.courseId,objType:"Course",rollUp:{l1:t.courseId},correlationData:n,type:"enrollment"};br.log.audit(r).toPromise()},t}(),Qi=function(){function t(t,e){this.apiService=t,this.unenrollCourseServiceApiConfig=e,this.GET_UNENROLL_COURSE_ENDPOINT="/unenrol"}return t.prototype.handle=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.unenrollCourseServiceApiConfig.apiPath+this.GET_UNENROLL_COURSE_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:t}).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return"SUCCESS"===t.body.result.response})))},t}(),$i=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},to=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},eo=function(){function t(t,e,n){this.apiService=t,this.courseServiceConfig=e,this.container=n}return Object.defineProperty(t.prototype,"csCourseService",{get:function(){return this.container.get(Z.COURSE_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentService",{get:function(){return this.container.get(Q.CONTENT_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.handle=function(t){var e=this;return delete t.returnRefreshedContentStates,Object(J.iif)((function(){return!t.contentIds||!t.contentIds.length}),Object(J.defer)((function(){return $i(e,void 0,void 0,(function(){var e;return to(this,(function(n){switch(n.label){case 0:return e=t,[4,this.contentService.getContentDetails({contentId:t.courseId}).toPromise().then((function(t){return t.contentData.leafNodes||[]}))];case 1:return e.contentIds=n.sent(),[2,this.fetchFromApi(t).toPromise()]}}))}))})),Object(J.defer)((function(){return e.fetchFromApi(t)})))},t.prototype.fetchFromApi=function(t){return t.contentIds&&!t.contentIds.length&&delete t.contentIds,this.csCourseService.getContentState(t).pipe(Object(dt.map)((function(t){return{contentList:t}})))},t}(),no=function(){function t(t,e){this.keyValueStore=t,this.offlineContentStateHandler=e}return t.prototype.updateEnrollCourses=function(e){var n=this,r=t.GET_ENROLLED_COURSES_KEY_PREFIX.concat(e.userId);return this.offlineContentStateHandler.getLocalContentStateResponse(e).pipe(Object(dt.mergeMap)((function(t){return n.keyValueStore.getValue(r).pipe(Object(dt.mergeMap)((function(i){if(i){var o=JSON.parse(i),a=o.result,s=void 0,u=(s=a&&a.hasOwnProperty("courses")?a.courses:o.courses).slice();return s.forEach((function(n){if(n.courseId===e.courseId&&n.batchId===e.batchId){var r=n;t.contentList.forEach((function(t){if(2===t.status){var e=n.contentsPlayedOffline;e||(e=[]),e.push(t.contentId),r.contentsPlayedOffline=Ar.deDupe(e)}}));var i=u.findIndex((function(t){return t.contentId===n.contentId&&t.batchId===n.batchId}));u.splice(i,1,r)}})),u&&u.length?(a&&a.hasOwnProperty("courses")?a.courses=u:o.courses=u,n.keyValueStore.setValue(r,JSON.stringify(o)).pipe(Object(dt.map)((function(){return t})))):Object(J.of)(t)}return Object(J.of)(t)})))})))},t.GET_ENROLLED_COURSES_KEY_PREFIX="enrolledCourses",t}(),ro=function(){function t(t){this.keyValueStore=t}return t.prototype.getLocalContentStateResponse=function(t){var e=No.GET_CONTENT_STATE_KEY_PREFIX.concat(t.userId,t.courseId);return this.keyValueStore.getValue(e).pipe(Object(dt.map)((function(t){var e={contentList:[]};if(t){var n=JSON.parse(t),r=n.result;return r&&r.hasOwnProperty("contentList")?(e.contentList=r.contentList,e):(e.contentList=n.contentList,e)}return e.contentList=e.contentList.map((function(t){return"string"==typeof t.score&&(t.score=void 0),t})),e})))},t.prototype.manipulateEnrolledCoursesResponseLocally=function(t){var e=this,n=No.GET_ENROLLED_COURSE_KEY_PREFIX.concat(t.userId);return this.keyValueStore.getValue(n).pipe(Object(dt.mergeMap)((function(r){if(r){var i=JSON.parse(r),o=i.result,a=void 0;if((a=o&&o.hasOwnProperty("courses")?o.courses:i.courses)&&a.length){var s=a.slice();return a.forEach((function(n){if(n.courseId===t.courseId&&n.batchId===t.batchId&&(n.contentsPlayedOffline&&n.contentsPlayedOffline.length||(n.contentsPlayedOffline=[]),1!==t.status&&(0===n.contentsPlayedOffline.length||n.contentsPlayedOffline.length>0&&!Ar.contains(n.contentsPlayedOffline,t.contentId)))){n.progress=n.progress?n.progress:0,n.progress=n.progress+1,n.completionPercentage=e.getCourseCompletionPercentage(n.leafNodesCount,n.progress);var r=n,i=r.contentsPlayedOffline;i||(i=[]),i.push(t.contentId),r.contentsPlayedOffline=i,r.progress=n.progress,r.completionPercentage=n.completionPercentage;var o=s.findIndex((function(t){return t.contentId===n.contentId||t.batchId===n.batchId}));s.splice(o,1,r)}})),s&&s.length?(o&&o.hasOwnProperty("courses")?o.courses=s:i.courses=s,e.keyValueStore.setValue(n,JSON.stringify(i))):Object(J.of)(!1)}return Object(J.of)(!1)}return Object(J.of)(!1)})))},t.prototype.manipulateGetContentStateResponseLocally=function(t){var e=this,n=No.GET_CONTENT_STATE_KEY_PREFIX.concat(t.userId,t.courseId);return this.keyValueStore.getValue(n).pipe(Object(dt.mergeMap)((function(r){if(r){var i={contentList:[]},o=JSON.parse(r),a=o.result;if(a&&a.hasOwnProperty("contentList")?i.contentList=a.contentList:i.contentList=o.contentList,i){var s,u=i.contentList;return u&&u.length?(u.forEach((function(n){n.contentId===t.contentId?n.status!==t.status&&(t.score=n.score,t.bestScore=n.bestScore,s=e.getContentState(t),u=u.filter((function(t){return t.contentId!==n.contentId}))):s=e.getContentState(t)})),s?(u.push(s),i.contentList=u,e.keyValueStore.setValue(n,JSON.stringify(i))):Object(J.of)(!1)):(s=e.getContentState(t),(u=[]).push(s),i.contentList=u,e.keyValueStore.setValue(n,JSON.stringify(i)))}return Object(J.of)(!1)}return Object(J.of)(!1)})))},t.prototype.getCourseCompletionPercentage=function(t,e){if(0===t||void 0===t)return 0;var n=e/t*100;return isNaN(n)?0:n>100?100:Math.floor(n)},t.prototype.getContentState=function(t){return{id:t.userId,userId:t.userId,courseId:t.courseId,contentId:t.contentId,batchId:t.batchId,result:t.result,grade:t.grade,score:t.score,bestScore:t.bestScore,status:t.status,progress:t.progress}},t}(),io=function(){function t(){}return t.getUpdateContentStateRequest=function(t){var e=[];return e.push(this.getRequestMap(t)),{userId:t.userId,contents:e}},t.getUpdateContentStateListRequest=function(t,e){var n=this,r=[];return e.forEach((function(t){r.push(n.getRequestMap(t))})),{userId:t,contents:r}},t.getRequestMap=function(t){var e={userId:t.userId,contentId:t.contentId,courseId:t.courseId,batchId:t.batchId,status:t.status,progress:t.progress};return t.result&&(e.result=t.result),t.grade&&(e.grade=t.grade),t.score&&(e.score=t.score),e},t}();!function(t){t.START="START",t.PROGRESS="PROGRESS",t.END="END"}(Jr||(Jr={})),function(t){t[t.STATUS_FAILED=16]="STATUS_FAILED",t[t.STATUS_PAUSED=4]="STATUS_PAUSED",t[t.STATUS_PENDING=1]="STATUS_PENDING",t[t.STATUS_RUNNING=2]="STATUS_RUNNING",t[t.STATUS_SUCCESSFUL=8]="STATUS_SUCCESSFUL"}(Zr||(Zr={}));var oo,ao,so,uo=n(165),co=function(){function t(){}return t.equals=function(t,e){var n=function(t){var e=0;for(var n in t)t.hasOwnProperty(n)&&e++;return e},r=function(t,e){if(typeof t!=typeof e)return!1;if("function"==typeof t)return t.toString()===e.toString();if(t instanceof Object&&e instanceof Object){if(n(t)!==n(e))return!1;for(var i in t)if(!r(t[i],e[i]))return!1;return!0}return t===e};return r(t,e)},t.getPropDiff=function(e,n){return Object.keys(e).reduce((function(r,i){return t.equals(e[i],n[i])||r.push(i),r}),[])},t.getTruthyProps=function(t){return Object.keys(t).filter((function(e){return!!t[e]}))},t.toOrderedString=function(t){return JSON.stringify(Object.keys(t).sort().reduce((function(e,n){return e[n]=t[n],e}),{}))},t.withDeeplyOrderedKeys=function(e){return Object.keys(e).sort().reduce((function(n,r){return"object"!=typeof e[r]||Array.isArray(e[r])?n[r]=e[r]:n[r]=t.withDeeplyOrderedKeys(e[r]),n}),{})},t}(),fo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ho=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},lo=function(){function t(t,e,n,r){this.courseService=t,this.sdkConfig=e,this.dbService=n,this.networkQueue=r,this.capturedAssessmentEvents={}}return t.prototype.handle=function(t){var e=this;return this.capturedAssessmentEvents=t,Object(J.from)(this.syncCapturedAssessmentEvents().then((function(){e.capturedAssessmentEvents={}})).then((function(){return e.syncPersistedAssessmentEvents()})).catch((function(t){Object.keys(e.capturedAssessmentEvents).forEach((function(t){var n=JSON.parse(t);e.capturedAssessmentEvents[t].forEach((function(t){2!==n.batchStatus&&e.persistAssessEvent(t,n).toPromise()}))}))}))).pipe(Object(dt.mapTo)(void 0))},t.prototype.invokeSyncApi=function(t){var e=this;return console.log("COURSE_ASSESSMENT_INVOKED_SYNC----------------------------------------------",t.assessments.map((function(t){return{assessmentTs:t.assessmentTs,userId:t.userId,contentId:t.contentId,courseId:t.courseId,batchId:t.batchId,attemptId:t.attemptId,events:t.events.length}}))),this.networkQueue.enqueue(new _r(this.sdkConfig).generateNetworkQueueRequest(pn.COURSE_ASSESMENT,{request:t},ar.generateUniqueId(),0,!0),!0).pipe(Object(dt.mergeMap)((function(){return new J.Observable((function(t){sbsync.onSyncSucces((function(n){return fo(e,void 0,void 0,(function(){var e,r;return ho(this,(function(i){return e=n.courseAssesmentResponse,r=n.course_assesment_error,e?t.next(e):r&&t.error(r),t.complete(),[2]}))}))}),(function(n){return fo(e,void 0,void 0,(function(){return ho(this,(function(e){return t.error(n),[2]}))}))}))}))}))).toPromise()},t.prototype.persistAssessEvent=function(t,e){var n;return this.dbService.insert({table:hn.TABLE_NAME,modelJson:(n={},n[hn.COLUMN_NAME_ASSESSMENT_EVENT]=JSON.stringify(t),n[hn.COLUMN_NAME_CONTENT_ID]=t.object.id,n[hn.COLUMN_NAME_CREATED_AT]=t.ets,n[hn.COLUMN_NAME_USER_ID]=e.userId,n[hn.COLUMN_NAME_COURSE_ID]=e.courseId,n[hn.COLUMN_NAME_BATCH_ID]=e.batchId,n)}).pipe(Object(dt.mapTo)(void 0))},t.prototype.syncCapturedAssessmentEvents=function(){return fo(this,void 0,void 0,(function(){var t,e=this;return ho(this,(function(n){return(t=Object.keys(this.capturedAssessmentEvents).reduce((function(t,n){var r=JSON.parse(n),i=e.capturedAssessmentEvents[n];t.userId||(t.userId=r.userId);var o={contentId:i[0].object.id,courseId:r.courseId,batchId:r.batchId,status:2};t.contents.find((function(t){return co.equals(t,o)}))||t.contents.push(o);var a=i.reduce((function(t,e){return e.ets<t?e.ets:t}),i[0].ets);return t.assessments.push({assessmentTs:a,userId:r.userId,contentId:i[0].object.id,courseId:r.courseId,batchId:r.batchId,attemptId:e.courseService.generateAssessmentAttemptId({courseId:r.courseId,batchId:r.batchId,contentId:i[0].object.id,userId:r.userId,date:a}),events:i}),t}),{userId:"",contents:[],assessments:[]})).userId&&t.contents.length&&t.assessments.length?[2,this.invokeSyncApi(t)]:[2]}))}))},t.prototype.syncPersistedAssessmentEvents=function(){return fo(this,void 0,void 0,(function(){var t=this;return ho(this,(function(e){return this.dbService.execute("\n SELECT\n "+hn.COLUMN_NAME_USER_ID+",\n "+hn.COLUMN_NAME_CONTENT_ID+",\n "+hn.COLUMN_NAME_COURSE_ID+",\n "+hn.COLUMN_NAME_BATCH_ID+",\n MIN("+hn.COLUMN_NAME_CREATED_AT+") as first_ts,\n GROUP_CONCAT("+hn.COLUMN_NAME_ASSESSMENT_EVENT+",',') as events\n FROM "+hn.TABLE_NAME+"\n GROUP BY\n "+hn.COLUMN_NAME_USER_ID+",\n "+hn.COLUMN_NAME_CONTENT_ID+",\n "+hn.COLUMN_NAME_COURSE_ID+",\n "+hn.COLUMN_NAME_BATCH_ID+"\n ORDER BY "+hn.COLUMN_NAME_CREATED_AT+"\n ").pipe(Object(dt.map)((function(t){return t.map((function(t){return{userId:t[hn.COLUMN_NAME_USER_ID],contentId:t[hn.COLUMN_NAME_CONTENT_ID],courseId:t[hn.COLUMN_NAME_COURSE_ID],batchId:t[hn.COLUMN_NAME_BATCH_ID],firstTs:t.first_ts,events:JSON.parse("["+t.events+"]")}}))})),Object(dt.mergeMap)((function(e){if(!e.length)return Object(J.of)(void 0);var n=e.reduce((function(e,n){var r=n.firstTs,i=n.userId,o=n.contentId,a=n.courseId,s=n.batchId,u=n.events;e.userId||(e.userId=i);var c={contentId:o,courseId:a,batchId:s,status:2};return e.contents.find((function(t){return co.equals(t,c)}))||e.contents.push(c),e.assessments.push({assessmentTs:r,userId:i,contentId:o,courseId:a,batchId:s,attemptId:t.courseService.generateAssessmentAttemptId({courseId:a,batchId:s,contentId:o,userId:i}),events:u}),e}),{userId:"",contents:[],assessments:[]});return t.invokeSyncApi(n)})),Object(dt.tap)((function(){return fo(t,void 0,void 0,(function(){return ho(this,(function(t){switch(t.label){case 0:return[4,this.dbService.execute("DELETE FROM "+hn.TABLE_NAME).toPromise()];case 1:return[2,t.sent()]}}))}))})),Object(dt.mapTo)(void 0)).toPromise(),[2]}))}))},t.UPDATE_CONTENT_STATE_ENDPOINT="/content/state/update",t}(),po=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},mo=function(){function t(t,e){this.apiService=t,this.cachedItemStore=e}return t.prototype.handle=function(e){var n=this;return this.cachedItemStore.get(e.userId,t.GET_LEARNER_CERTIFICATE_LOCAL_KEY,"ttl_"+t.GET_LEARNER_CERTIFICATE_LOCAL_KEY,(function(){return n.fetchFromServer(e)}))},t.prototype.fetchFromServer=function(e){var n=po({},e.size?{size:e.size}:null,{_source:["data.badge.issuer.name","pdfUrl","data.issuedOn","data.badge.name","related.courseId","related.Id"],query:{bool:{must:[{match_phrase:{"recipient.id":e.userId}}]}}}),r=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(t.CERTIFICATE_SEARCH_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:n}).build();return this.apiService.fetch(r).pipe(Object(dt.map)((function(t){return t.body.result.response})))},t.CERTIFICATE_SEARCH_ENDPOINT="/api/certreg/v1/certs/search",t.GET_LEARNER_CERTIFICATE_LOCAL_KEY="learner-certificate",t}(),bo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},yo=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},vo=function(){function t(t,e){this.keyValueStore=t,this.sharedPreference=e}return t.prototype.process=function(t){return bo(this,void 0,void 0,(function(){var e,n,r,i,o,a;return yo(this,(function(s){switch(s.label){case 0:return[4,this.getCourseContext().toPromise()];case 1:if(e=s.sent(),1,1!==e.batchStatus)return[3,5];n=function(e){var n,i,o,a,s,u;return yo(this,(function(c){switch(c.label){case 0:return n=JSON.parse(e),(i=t[e])?(o=No.GET_CONTENT_STATE_KEY_PREFIX.concat(n.userId,n.courseId),[4,r.keyValueStore.getValue(o).toPromise()]):[2,"continue"];case 1:return a=c.sent(),s=a?JSON.parse(a):{contentList:[]},u=i.reduce((function(t,e){try{var r=e.context.cdata.find((function(t){return"AttemptId"===t.type})).id,i=e.object.id,o=e.edata.item.maxscore,a=e.edata.score;if(t[i]){var u=t[i];u.attemptId=r,u.lastAttemptedOn=Date.now()+"",u.totalMaxScore+=o,u.totalScore+=a}else t[i]={attemptId:r,lastAttemptedOn:Date.now()+"",totalMaxScore:o,totalScore:a};s.contentList.find((function(t){return t.contentId===i}))||s.contentList.push({lastAccessTime:"2021-01-14 07:09:32:602+0000",contentId:i,progress:100,batchId:n.batchId,courseId:n.courseId,collectionId:n.courseId,lastCompletedTime:"2021-01-14 07:09:32:810+0000",status:2})}catch(t){console.error(t)}return t}),{}),s.contentList=s.contentList.map((function(t){return t.score&&t.score.length?u[t.contentId]?(t.score.push(u[t.contentId]),t.bestScore&&t.bestScore.totalScore<u[t.contentId].totalScore&&(t.bestScore=u[t.contentId]),t):t:(t.score=u[t.contentId]?[u[t.contentId]]:[],t.bestScore=t.score.reduce((function(t,e){return t?t.totalScore<e.totalScore?e:t:e}),void 0),t)})),console.log(s),[4,r.keyValueStore.setValue(o,JSON.stringify(s)).toPromise()];case 2:return c.sent(),[2]}}))},r=this,i=0,o=Object.keys(t),s.label=2;case 2:return i<o.length?(a=o[i],[5,n(a)]):[3,5];case 3:s.sent(),s.label=4;case 4:return i++,[3,2];case 5:return[2]}}))}))},t.prototype.getCourseContext=function(){return this.sharedPreference.getString(V.COURSE_CONTEXT).pipe(Object(dt.map)((function(t){return t?JSON.parse(t):{}})))},t}(),go=n(43),_o=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Eo=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Mo=function(){function t(t,e,n,r){this.profileService=t,this.fileService=e,this.keyValueStore=n,this.csCourseService=r}return t.prototype.isCertificateCached=function(t){var e=this;return Object(J.defer)((function(){return _o(e,void 0,void 0,(function(){var e;return Eo(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getCertificateFromCache(t)];case 1:return[2,!!n.sent()];case 2:return e=n.sent(),console.error(e),[2,!1];case 3:return[2]}}))}))}))},t.prototype.getCertificate=function(t){var e=this;return this.csCourseService.getSignedCourseCertificate(t.certificate.identifier).pipe(Object(dt.tap)((function(n){return _o(e,void 0,void 0,(function(){var e,r;return Eo(this,(function(i){switch(i.label){case 0:return r=(e=this.keyValueStore).setValue,[4,this.buildCertificatePersistenceId(t)];case 1:return[4,r.apply(e,[i.sent(),Object(dr.gzip)(n.printUri,{to:"string"})]).toPromise()];case 2:return i.sent(),[2]}}))}))})),Object(dt.map)((function(t){return t.printUri})),Object(dt.catchError)((function(n){return Object(J.defer)((function(){return _o(e,void 0,void 0,(function(){var e;return Eo(this,(function(r){switch(r.label){case 0:return[4,this.getCertificateFromCache(t)];case 1:if(e=r.sent())return[2,e];throw n}}))}))}))})))},t.prototype.downloadCertificate=function(t){var e=this,n=t.fileName,r=t.blob;return Object(J.defer)((function(){return _o(e,void 0,void 0,(function(){return Eo(this,(function(t){return[2,this.fileService.writeFile(cordova.file.externalDataDirectory,n,r,{replace:!0}).then((function(){return{path:""+cordova.file.externalDataDirectory+n}}))]}))}))}))},t.prototype.buildCertificatePersistenceId=function(t){return _o(this,void 0,void 0,(function(){var e,n;return Eo(this,(function(r){switch(r.label){case 0:return[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return e=r.sent(),n=e.managedSession?e.managedSession.uid:e.uid,[2,"certificate_"+t.certificate.identifier+"_"+t.courseId+"_"+n]}}))}))},t.prototype.getCertificateFromCache=function(t){return _o(this,void 0,void 0,(function(){var e,n,r;return Eo(this,(function(i){switch(i.label){case 0:return r=(n=this.keyValueStore).getValue,[4,this.buildCertificatePersistenceId(t)];case 1:return[4,r.apply(n,[i.sent()]).toPromise()];case 2:return[2,(e=i.sent())?Object(go.ungzip)(e,{to:"string"}):void 0]}}))}))},t}(),wo=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},So=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Oo=function(t,e){return function(n,r){e(n,r,t)}},Ao=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},To=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},No=function(){function t(t,e,n,r,i,o,a,s,u,c,f,h,l){this.sdkConfig=t,this.apiService=e,this.profileService=n,this.keyValueStore=r,this.dbService=i,this.sharedPreferences=o,this.appInfo=a,this.fileService=s,this.cachedItemStore=u,this.csCourseService=c,this.networkQueue=f,this.container=h,this.authService=l,this.capturedAssessmentEvents={},this.courseServiceConfig=this.sdkConfig.courseServiceConfig,this.profileServiceConfig=this.sdkConfig.profileServiceConfig,this.syncAssessmentEventsHandler=new lo(this,this.sdkConfig,this.dbService,this.networkQueue),this.offlineAssessmentScoreProcessor=new vo(this.keyValueStore,this.sharedPreferences)}var e;return e=t,Object.defineProperty(t.prototype,"certificateManager",{get:function(){return this._certificateManager||(this._certificateManager=new Mo(this.profileService,this.fileService,this.keyValueStore,this.csCourseService)),this._certificateManager},enumerable:!0,configurable:!0}),t.buildUrl=function(t,e,n){return""+t+e+"?"+yn.stringify(n)},t.prototype.getBatchDetails=function(t){return new zi(this.apiService,this.courseServiceConfig).handle(t)},t.prototype.updateContentState=function(t){var e=this;return t.target||(t.target=[oo.LOCAL,oo.SERVER]),Object(J.defer)((function(){return Ao(e,void 0,void 0,(function(){var e;return To(this,(function(n){switch(n.label){case 0:if(e=new ro(this.keyValueStore),!(t.target.indexOf(oo.SERVER)>-1))return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new gr(this.networkQueue,this.sdkConfig).handle(io.getUpdateContentStateRequest(t)).toPromise()];case 2:return n.sent(),[3,4];case 3:return n.sent(),[3,4];case 4:return t.target.indexOf(oo.LOCAL)>-1?[4,e.manipulateEnrolledCoursesResponseLocally(t).toPromise()]:[3,7];case 5:return n.sent(),[4,e.manipulateGetContentStateResponseLocally(t).toPromise()];case 6:n.sent(),n.label=7;case 7:return[2,!0]}}))}))}))},t.prototype.getCourseBatches=function(t){return new Ki(this.apiService,this.courseServiceConfig).handle(t)},t.prototype.getEnrolledCourses=function(t,e){return new Ji(this.keyValueStore,this.apiService,this.courseServiceConfig,this.sharedPreferences,e).handle(t)},t.prototype.getUserEnrolledCourses=function(t){var n=this,r=t.request,i=t.from;return this.cachedItemStore[i===Wr.SERVER?"get":"getCached"](r.userId+(r.filters?"_"+JSON.stringify(r.filters):""),e.USER_ENROLLMENT_LIST_KEY_PREFIX,"ttl_"+e.USER_ENROLLMENT_LIST_KEY_PREFIX,(function(){return n.csCourseService.getUserEnrolledCourses(r,{},{apiPath:"/api/course/v2",certRegistrationApiPath:""})}))},t.prototype.enrollCourse=function(t){var e=this;return new Zi(this.apiService,this.courseServiceConfig).handle(t).pipe(Object(dt.mergeMap)((function(n){if(n){var r={};return r.userId=t.userId,r.batchStatus=t.batchStatus,e.sharedPreferences.putString(V.COURSE_CONTEXT,JSON.stringify(r)).pipe(Object(dt.delay)(2e3),Object(dt.concatMap)((function(){return e.getEnrolledCourses({userId:t.userId,returnFreshCourses:!0})})),Object(dt.mapTo)(n))}return Object(J.of)(n)})))},t.prototype.getContentState=function(t){var n=this,r=e.GET_CONTENT_STATE_KEY_PREFIX.concat(t.userId,t.courseId),i=new ro(this.keyValueStore),o=new no(this.keyValueStore,i);return this.keyValueStore.getValue(r).pipe(Object(dt.mergeMap)((function(e){return!e||t.returnRefreshedContentStates?new eo(n.apiService,n.courseServiceConfig,n.container).handle(t).pipe(Object(dt.mergeMap)((function(e){return e?n.keyValueStore.setValue(r,JSON.stringify(e)).pipe(Object(dt.mergeMap)((function(){return i.getLocalContentStateResponse(t)})),Object(dt.mergeMap)((function(){return o.updateEnrollCourses(t)}))):Object(J.of)(void 0)})),Object(dt.catchError)((function(e){return i.getLocalContentStateResponse(t).pipe(Object(dt.mergeMap)((function(){return o.updateEnrollCourses(t)})))}))):i.getLocalContentStateResponse(t)})))},t.prototype.unenrollCourse=function(t){var e=this;return new Qi(this.apiService,this.courseServiceConfig).handle(t).pipe(Object(dt.delay)(2e3),Object(dt.concatMap)((function(){return e.getEnrolledCourses({userId:t.userId,returnFreshCourses:!0})})),Object(dt.mapTo)(!0))},t.prototype.downloadCurrentProfileCourseCertificate=function(t){var n=this;return Object(J.defer)((function(){return Ao(n,void 0,void 0,(function(){var e,n,r;return To(this,(function(i){switch(i.label){case 0:return[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return e=i.sent(),n=e.managedSession?e.managedSession.uid:e.uid,r="ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalRootDirectory,r+"Download/"+t.certificate.name+"_"+t.courseId+"_"+n+".pdf",[2,{userId:n}]}}))}))})).pipe(Object(dt.mergeMap)((function(r){var i=r.userId,o=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(e.CERTIFICATE_SIGN_ENDPOINT).withBearerToken(!0).withUserToken(!0).withBody({request:{pdfUrl:t.certificate.url}}).build();return n.apiService.fetch(o).pipe(Object(dt.map)((function(t){return{signedPdfUrl:t.body.result.signedUrl,userId:i}})))})),Object(dt.mergeMap)((function(e){var n=e.signedPdfUrl,r=e.userId,i={uri:n,title:t.certificate.token,description:"",mimeType:"application/pdf",visibleInDownloadsUi:!0,notificationVisibility:1,destinationInExternalPublicDir:{dirType:"Download",subPath:"/"+t.certificate.name+"_"+t.courseId+"_"+r+".pdf"},headers:[]};return new J.Observable((function(t){downloadManager.enqueue(i,(function(e,n){if(e)return t.error(e);t.next(n),t.complete()}))}))})),Object(dt.mergeMap)((function(t){return Object(J.interval)(1e3).pipe(Object(dt.mergeMap)((function(){return new J.Observable((function(e){downloadManager.query({ids:[t]},(function(t,n){return t||n[0].status===Zr.STATUS_FAILED?e.error(t||new Error("Unknown Error")):e.next(n[0])}))}))})),Object(dt.filter)((function(t){return t.status===Zr.STATUS_SUCCESSFUL})),Object(dt.take)(1))})),Object(dt.map)((function(t){return{path:t.localUri}})))},t.prototype.hasCapturedAssessmentEvent=function(t){var e=t.courseContext,n=co.toOrderedString(e);return!!this.capturedAssessmentEvents[n]},t.prototype.captureAssessmentEvent=function(t){var e=t.event,n=t.courseContext,r=co.toOrderedString(n);this.capturedAssessmentEvents[r]||(this.capturedAssessmentEvents[r]=[]),this.capturedAssessmentEvents[r].push(e)},t.prototype.syncAssessmentEvents=function(t){void 0===t&&(t={persistedOnly:!1});var e={};return t.persistedOnly||(e=this.capturedAssessmentEvents,this.resetCapturedAssessmentEvents()),this.offlineAssessmentScoreProcessor.process(e),this.syncAssessmentEventsHandler.handle(e)},t.prototype.resetCapturedAssessmentEvents=function(){this.capturedAssessmentEvents={}},t.prototype.generateAssessmentAttemptId=function(t){return uo([t.courseId,t.batchId,t.contentId,t.userId,t.date?t.date:Date.now()].join("-")).toString()},t.prototype.displayDiscussionForum=function(t){var n=this;return Object(J.defer)((function(){return Ao(n,void 0,void 0,(function(){var n,r;return To(this,(function(i){switch(i.label){case 0:return[4,this.authService.getSession().toPromise()];case 1:return(n=i.sent())?(r=n.managed_access_token||n.access_token,cordova.InAppBrowser.open(e.buildUrl(this.sdkConfig.apiConfig.host,e.DISCUSSION_FORUM_ENDPOINT,{access_token:r,returnTo:"/category/"+t.forumId}),"_blank","zoom=no,clearcache=yes,clearsessioncache=yes,cleardata=yes,hideurlbar=yes,hidenavigationbuttons=true"),[2,!0]):[2,!1]}}))}))}))},t.prototype.getLearnerCertificates=function(t){return new mo(this.apiService,this.cachedItemStore).handle(t)},t.prototype.syncCourseProgress=function(t){return this.csCourseService.updateContentState(t,{apiPath:"/api/course/v1"})},t.prototype.clearAssessments=function(){var t=this;return this.sharedPreferences.getString(V.COURSE_CONTEXT).pipe(Object(dt.map)((function(e){var n=e?JSON.parse(e):{};if(n){var r=co.toOrderedString(n);t.capturedAssessmentEvents[r]&&(t.capturedAssessmentEvents[r]=[])}})))},t.USER_ENROLLMENT_LIST_KEY_PREFIX="userEnrollmentList",t.GET_CONTENT_STATE_KEY_PREFIX="getContentState",t.GET_ENROLLED_COURSE_KEY_PREFIX="enrolledCourses",t.UPDATE_CONTENT_STATE_KEY_PREFIX="updateContentState",t.LAST_READ_CONTENTID_PREFIX="lastReadContentId",t.CERTIFICATE_SIGN_ENDPOINT="/api/certreg/v1/certs/download",t.DISCUSSION_FORUM_ENDPOINT="/discussions/auth/sunbird-oidc/callback",t=e=wo([Object(R.injectable)(),Oo(0,Object(R.inject)(Q.SDK_CONFIG)),Oo(1,Object(R.inject)(Q.API_SERVICE)),Oo(2,Object(R.inject)(Q.PROFILE_SERVICE)),Oo(3,Object(R.inject)(Q.KEY_VALUE_STORE)),Oo(4,Object(R.inject)(Q.DB_SERVICE)),Oo(5,Object(R.inject)(Q.SHARED_PREFERENCES)),Oo(6,Object(R.inject)(Q.APP_INFO)),Oo(7,Object(R.inject)(Q.FILE_SERVICE)),Oo(8,Object(R.inject)(Q.CACHED_ITEM_STORE)),Oo(9,Object(R.inject)(Z.COURSE_SERVICE)),Oo(10,Object(R.inject)(Q.NETWORK_QUEUE)),Oo(11,Object(R.inject)(Q.CONTAINER)),Oo(12,Object(R.inject)(Q.AUTH_SERVICE)),So("design:paramtypes",[Object,Object,Object,Object,I,Object,Object,Object,Object,Object,Object,R.Container,Object])],t)}();!function(t){t.LOCAL="LOCAL",t.SERVER="SERVER"}(oo||(oo={})),function(t){t.OPEN="open",t.INVITE_ONLY="invite-only"}(ao||(ao={})),function(t){t.NOT_STARTED="0",t.IN_PROGRESS="1",t.COMPLETED="2"}(so||(so={}));var Co,Io=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ro=function(t){function e(n,r){var i=t.call(this,n,"CERTIFICATE_ALREADY_DOWNLOADED")||this;return i.filePath=r,Object.setPrototypeOf(i,e.prototype),i}return Io(e,t),e}(ye),Po=n(166),Lo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Do=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},jo=function(){function t(t){this.contentService=t}return t.prototype.provide=function(e,n){var r=this;return e.objectType=t.getCategoryMapper(n),this.trackableSessionContentCache?Object(J.iif)((function(){return!!r.trackableSessionContentCache[e.contentId]}),Object(J.defer)((function(){return Object(J.of)(r.trackableSessionContentCache[e.contentId])})),Object(J.defer)((function(){return r.contentService.getContentDetails(e).pipe(Object(dt.tap)((function(t){return r.trackableSessionContentCache[e.contentId]=t})))}))):this.contentService.getContentDetails(e)},t.prototype.cache=function(t){this.trackableSessionContentCache&&(this.trackableSessionContentCache[t.identifier]=t)},t.prototype.init=function(){this.trackableSessionContentCache={}},t.prototype.dispose=function(){this.trackableSessionContentCache=void 0},t.getCategoryMapper=function(t){switch(t){case Nr.CsPrimaryCategory.PRACTICE_QUESTION_SET:return"QuestionSet";case"Multiple Choice Question":return"Question"}},t}(),ko=function(){function t(t,e,n,r,i,o){this.courseService=t,this.sharedPreference=e,this.summarizerService=n,this.eventBusService=r,this.contentService=i,this.profileService=o,this.currentUID=void 0,this.currentContentID=void 0,this.courseContext={},this.trackableSessionProxyContentProvider=new jo(this.contentService)}return t.checkPData=function(e){return null!=e&&null!==e.pid&&-1!==e.pid.indexOf(t.CONTENT_PLAYER_PID)},t.isContentTrackable=function(t){return!!t.contentData.trackable&&t.contentData.trackable.enabled===Ir.TrackingEnabled.YES},t.isCourseAssessmentContent=function(t){return t.primaryCategory&&t.primaryCategory.toLowerCase()===Nr.CsPrimaryCategory.COURSE_ASSESSMENT.toLowerCase()},t.prototype.updateContentState=function(e){var n=this;return this.getCourseContext().pipe(Object(dt.mergeMap)((function(r){var i=r.userId,o=r.courseId,a=r.batchId,s=0;r.hasOwnProperty("batchStatus")&&(s=r.batchStatus);if(1===s){var u=e.object.id;return n.checkStatusOfContent(i,o,a,u).pipe(Object(dt.mergeMap)((function(s){if("START"===e.eid&&0===s){var c={userId:i,contentId:u,courseId:o,batchId:a,status:1,progress:5};return n.courseService.updateContentState(c).pipe(Object(dt.mapTo)(void 0))}return"END"===e.eid&&0===s||"END"===e.eid&&1===s?n.trackableSessionProxyContentProvider.provide({contentId:e.object.id},e.object.type).pipe(Object(dt.mergeMap)((function(s){return n.validEndEvent(e,s,r).pipe(Object(dt.mergeMap)((function(r){if(r){var u=Po.CsContentProgressCalculator.calculate(e.edata.summary,s.mimeType),c={userId:i,contentId:s.identifier,courseId:o,batchId:a,status:100===u?2:1,progress:u,target:t.isCourseAssessmentContent(s)?[oo.LOCAL]:[oo.LOCAL,oo.SERVER]};return n.generateAuditTelemetry(i,o,a,s,e.object?e.object.rollup:{}),n.courseService.updateContentState(c).pipe(Object(dt.tap)((function(){n.eventBusService.emit({namespace:$.CONTENT,event:{type:Kn.COURSE_STATE_UPDATED,payload:{contentId:c.courseId}}})})),Object(dt.mapTo)(void 0))}return Object(J.of)(void 0)})))}))):Object(J.of)(void 0)})),Object(dt.tap)((function(){n.updateLastReadContentId(i,o,a,u).toPromise()})))}return Object(J.of)(void 0)})))},t.prototype.handle=function(e){var n=this;return Object(J.defer)((function(){return Lo(n,void 0,void 0,(function(){var n,r=this;return Do(this,(function(i){switch(i.label){case 0:return"START"!==e.eid?[3,4]:t.checkPData(e.context.pdata)?(this.courseService.resetCapturedAssessmentEvents(),[2,this.processOEStart(e).pipe(Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){return Do(this,(function(t){switch(t.label){case 0:return[4,this.summarizerService.saveLearnerAssessmentDetails(e).pipe(Object(dt.mapTo)(void 0)).toPromise()];case 1:return t.sent(),[2]}}))}))})),Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){var t=this;return Do(this,(function(n){switch(n.label){case 0:return[4,this.getCourseContext().pipe(Object(dt.mergeMap)((function(){return t.updateContentState(e)}))).toPromise()];case 1:return n.sent(),[2]}}))}))})),Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){return Do(this,(function(t){switch(t.label){case 0:return[4,this.markContentAsPlayed(e).toPromise()];case 1:return t.sent(),[2]}}))}))}))).toPromise()]):[3,1];case 1:return e.object&&e.object.id?[4,this.trackableSessionProxyContentProvider.provide({contentId:e.object.id},e.object.type).toPromise()]:[3,3];case 2:if(n=i.sent(),t.isContentTrackable(n))return this.trackableSessionProxyContentProvider.init(),this.trackableSessionProxyContentProvider.cache(n),[2,this.getCourseContext().pipe(Object(dt.mapTo)(void 0)).toPromise()];i.label=3;case 3:return[3,8];case 4:return"ASSESS"===e.eid&&t.checkPData(e.context.pdata)?[2,this.processOEAssess(e).pipe(Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){var t;return Do(this,(function(n){switch(n.label){case 0:return[4,this.getCourseContext().toPromise()];case 1:return t=n.sent(),e.context.cdata.find((function(t){return"AttemptId"===t.type}))&&t.userId&&t.courseId&&t.batchId?[4,this.courseService.captureAssessmentEvent({event:e,courseContext:t})]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))})),Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){return Do(this,(function(t){switch(t.label){case 0:return[4,this.summarizerService.saveLearnerAssessmentDetails(e).pipe(Object(dt.mapTo)(void 0)).toPromise()];case 1:return t.sent(),[2]}}))}))}))).toPromise()]:[3,5];case 5:return"END"!==e.eid?[3,8]:t.checkPData(e.context.pdata)?[2,this.processOEEnd(e).pipe(Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){return Do(this,(function(t){switch(t.label){case 0:return[4,this.summarizerService.saveLearnerContentSummaryDetails(e).pipe(Object(dt.mapTo)(void 0)).toPromise()];case 1:return t.sent(),[2]}}))}))})),Object(dt.tap)((function(){return Lo(r,void 0,void 0,(function(){var t=this;return Do(this,(function(n){switch(n.label){case 0:return[4,this.getCourseContext().pipe(Object(dt.mergeMap)((function(){return t.updateContentState(e)}))).toPromise()];case 1:return n.sent(),[2]}}))}))}))).toPromise()]:[3,6];case 6:return e.object&&e.object.id?[4,this.trackableSessionProxyContentProvider.provide({contentId:e.object.id},e.object.type).toPromise()]:[3,8];case 7:if(n=i.sent(),t.isContentTrackable(n))return this.trackableSessionProxyContentProvider.dispose(),[2,this.setCourseContextEmpty().toPromise()];i.label=8;case 8:return[2]}}))}))}))},t.prototype.setCourseContextEmpty=function(){return this.courseContext={},this.sharedPreference.putString(V.COURSE_CONTEXT,"")},t.prototype.validEndEvent=function(e,n,r){var i=this;return Object(J.defer)((function(){return Object(J.of)(void 0)})).pipe(Object(dt.delay)(2e3),Object(dt.map)((function(){return!(r&&(t.isCourseAssessmentContent(n)||n.contentType&&"onboardingresource"===n.contentType.toLowerCase()||n.primaryCategory&&"onboardingresource"===n.primaryCategory.toLowerCase())&&i.courseService.hasCapturedAssessmentEvent({courseContext:r}))&&(e.edata.summary&&!!e.edata.summary.find((function(t){return t.progress})))})),Object(dt.tap)((function(){return i.courseService.resetCapturedAssessmentEvents()})))},t.prototype.updateLastReadContentId=function(t,e,n,r){var i=No.LAST_READ_CONTENTID_PREFIX.concat("_").concat(t).concat("_").concat(e).concat("_").concat(n);return this.sharedPreference.putString(i,r)},t.prototype.markContentAsPlayed=function(t){var e=this,n=t.actor.id,r=t.object.id,i={contentId:r};return this.trackableSessionProxyContentProvider.provide(i,t.object.type).pipe(Object(dt.mergeMap)((function(t){var i={status:Hr.PLAYED,contentId:r,contentType:t.contentType||t.primaryCategory};return e.profileService.addContentAccess(i).pipe(Object(dt.mergeMap)((function(){var i={uid:n,contentId:r,data:JSON.stringify(t.contentData),marker:Ln.PREVIEWED,isMarked:!0,extraInfo:{}};return e.contentService.setContentMarker(i).pipe(Object(dt.mapTo)(!0))})))})))},t.prototype.getCourseContext=function(){return this.sharedPreference.getString(V.COURSE_CONTEXT).pipe(Object(dt.map)((function(t){return t?JSON.parse(t):{}})))},t.prototype.checkStatusOfContent=function(t,e,n,r){var i=this,o={userId:t,batchId:n,contentIds:[r],courseId:e};return this.courseService.getContentState(o).pipe(Object(dt.map)((function(t){var e=t&&t.contentList;return i.getStatus(e,r)})))},t.prototype.getStatus=function(t,e){void 0===t&&(t=[]);var n=t.find((function(t){return t.contentId===e}));return n&&n.status||0},t.prototype.processOEStart=function(t){return this.currentUID=t.actor.id,this.currentContentID=t.object.id,Object(J.of)(void 0)},t.prototype.processOEAssess=function(t){var e=this;return this.currentUID&&this.currentContentID&&this.currentUID.toLocaleLowerCase()===t.actor.id.toLocaleLowerCase()&&this.currentContentID.toLocaleLowerCase()===t.object.id.toLocaleLowerCase()?this.summarizerService.deletePreviousAssessmentDetails(this.currentUID,this.currentContentID).pipe(Object(dt.tap)((function(){e.currentUID=void 0,e.currentContentID=void 0})),Object(dt.mapTo)(void 0)):Object(J.of)(void 0)},t.prototype.processOEEnd=function(t){return Object(J.of)(void 0)},t.prototype.generateAuditTelemetry=function(t,e,n,r,i){var o=new Ht;o.id=t,o.type=Ht.TYPE_USER;var a=[{type:"CourseId",id:e||""},{type:"BatchId",id:n||""},{type:"UserId",id:t||""},{type:"ContentId",id:r.identifier||""}],s={env:"course",actor:o,currentState:Ft.AUDIT_UPDATED,updatedProperties:["progress"],objId:r.identifier,objType:r.contentData.contentType||"",objVer:r.contentData.pkgVersion||"",rollUp:i||{},correlationData:a,type:"content-progress"};br.log.audit(s).toPromise()},t.CONTENT_PLAYER_PID="contentplayer",t}(),Uo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},xo=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bo=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:Ie.TABLE_NAME,orderBy:Ie.COLUMN_NAME_HANDLE+" asc",useExternalDb:!0}).toPromise().then((function(t){var n=t.map((function(t){return t[Ie.COLUMN_NAME_UID]}));return e.deleteUnwantedAssesments(n)})).then((function(){return e.saveLearnerAssesmentDetails()})).then((function(){return e.saveLearnerSummary()})).then((function(){return n.body=t,n}))},t.prototype.deleteUnwantedAssesments=function(t){return Uo(this,void 0,void 0,(function(){var e,n,r;return xo(this,(function(i){switch(i.label){case 0:return e=Ar.joinPreservingQuotes(t),n="DELETE FROM "+Fe.TABLE_NAME+"\n WHERE "+Fe.COLUMN_NAME_UID+" NOT IN("+e+")",r="DELETE FROM "+qe.TABLE_NAME+"\n WHERE "+qe.COLUMN_NAME_UID+" NOT IN("+e+")",[4,this.dbService.execute(n,!0).toPromise()];case 1:return i.sent(),[4,this.dbService.execute(r,!0).toPromise()];case 2:return i.sent(),[2]}}))}))},t.prototype.saveLearnerAssesmentDetails=function(){return Uo(this,void 0,void 0,(function(){var t,e,n,r,i,o,a,s;return xo(this,(function(u){switch(u.label){case 0:return[4,this.dbService.read({table:Fe.TABLE_NAME,orderBy:""+Fe.COLUMN_NAME_Q_INDEX,useExternalDb:!0}).toPromise()];case 1:t=u.sent(),e=0,n=t,u.label=2;case 2:return e<n.length?(r=n[e],i=r,o=Hi.getFilterForLearnerAssessmentDetails(i[Fe.COLUMN_NAME_QID],i[Fe.COLUMN_NAME_UID],i[Fe.COLUMN_NAME_CONTENT_ID],i[Fe.COLUMN_NAME_HIERARCHY_DATA]),a=Hi.getLearnerAssessmentsQuery(o),[4,this.dbService.execute(a).toPromise()]):[3,8];case 3:return(s=u.sent())&&s.length?[4,this.dbService.update({table:Fe.TABLE_NAME,selection:Fe.COLUMN_NAME_CONTENT_ID+" = ?\n AND "+Fe.COLUMN_NAME_UID+" = ?\n AND "+Fe.COLUMN_NAME_QID+" = ?",selectionArgs:[i[Fe.COLUMN_NAME_CONTENT_ID],i[Fe.COLUMN_NAME_UID],i[Fe.COLUMN_NAME_QID]],modelJson:i}).toPromise()]:[3,5];case 4:return u.sent(),[3,7];case 5:return[4,this.dbService.insert({table:Fe.TABLE_NAME,modelJson:i}).toPromise()];case 6:u.sent(),u.label=7;case 7:return e++,[3,2];case 8:return[2]}}))}))},t.prototype.saveLearnerSummary=function(){return Uo(this,void 0,void 0,(function(){var t,e,n,r,i,o,a=this;return xo(this,(function(s){switch(s.label){case 0:return[4,this.dbService.read({table:qe.TABLE_NAME,useExternalDb:!0}).toPromise()];case 1:t=s.sent(),e=0,n=t,s.label=2;case 2:return e<n.length?(r=n[e],i=r,[4,this.dbService.read({table:qe.TABLE_NAME,selection:qe.COLUMN_NAME_CONTENT_ID+" = ? AND "+qe.COLUMN_NAME_UID+" = ?",selectionArgs:[i[Fe.COLUMN_NAME_CONTENT_ID],i[Fe.COLUMN_NAME_UID]]}).toPromise()]):[3,8];case 3:return(o=s.sent())&&o.length?[4,this.dbService.update({table:qe.TABLE_NAME,selection:qe.COLUMN_NAME_CONTENT_ID+" = ? AND "+qe.COLUMN_NAME_UID+" = ?",selectionArgs:[i[Fe.COLUMN_NAME_CONTENT_ID],i[Fe.COLUMN_NAME_UID]],modelJson:i}).toPromise()]:[3,5];case 4:return s.sent(),[3,7];case 5:return[4,this.dbService.insert({table:qe.TABLE_NAME,modelJson:i}).toPromise()];case 6:s.sent(),s.label=7;case 7:return e++,[3,2];case 8:return t.forEach((function(t){return Uo(a,void 0,void 0,(function(){var e,n,r;return xo(this,(function(i){switch(i.label){case 0:return e=Hi.getFilterForLearnerAssessmentDetails(t[Fe.COLUMN_NAME_QID],t[Fe.COLUMN_NAME_UID],t[Fe.COLUMN_NAME_CONTENT_ID],t[Fe.COLUMN_NAME_HIERARCHY_DATA]),n=Hi.getLearnerAssessmentsQuery(e),[4,this.dbService.execute(n).toPromise()];case 1:return(r=i.sent())&&r.length?[4,this.dbService.update({table:qe.TABLE_NAME,modelJson:r[0]}).toPromise()]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this.dbService.insert({table:qe.TABLE_NAME,modelJson:r[0]}).toPromise()];case 4:i.sent(),i.label=5;case 5:return[2]}}))}))})),[2]}}))}))},t}(),Fo=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse,r=t.metadata.export_id,i=t.metadata.did,o={imported_id:r,device_id:i,count:t.metadata.profiles_count};return this.dbService.read({table:xe.TABLE_NAME,selection:xe.COLUMN_NAME_IMPORTED_ID+" =? AND "+xe.COLUMN_NAME_DEVICE_ID+" = ?",selectionArgs:[r,i],limit:"1"}).toPromise().then((function(t){return t&&t.length?e.dbService.update({table:xe.TABLE_NAME,modelJson:o,selection:xe.COLUMN_NAME_IMPORTED_ID+" =? AND "+xe.COLUMN_NAME_DEVICE_ID+" =?",selectionArgs:[r,i]}).toPromise():e.dbService.insert({table:xe.TABLE_NAME,modelJson:o}).toPromise()})).then((function(){return n.body=t,n}))},t}(),Vo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},qo=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Yo=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.dbService.read({table:Ie.TABLE_NAME,orderBy:Ie.COLUMN_NAME_HANDLE+" asc",useExternalDb:!0}).toPromise().then((function(n){return e.saveProfilesToDb(t,n)})).then((function(){return n.body=t,n}))},t.prototype.saveProfilesToDb=function(t,e){return Vo(this,void 0,void 0,(function(){var n,r,i,o,a,s;return qo(this,(function(u){switch(u.label){case 0:n=0,r=0,i=0,o=e,u.label=1;case 1:return i<o.length?(a=o[i],[4,this.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[a[Ie.COLUMN_NAME_UID]],limit:"1"}).toPromise()]):[3,6];case 2:return(s=u.sent())&&s.length?[3,4]:(a[Ie.COLUMN_NAME_CREATED_AT]||(a[Ie.COLUMN_NAME_CREATED_AT]=(new Date).getTime()),delete a[Ie._ID],[4,this.dbService.insert({table:Ie.TABLE_NAME,modelJson:a}).toPromise()]);case 3:return u.sent(),n++,t.imported=n,[3,5];case 4:r++,t.failed=r,u.label=5;case 5:return i++,[3,1];case 6:return t.failed=r,t.imported=n,[2]}}))}))},t}(),Go=function(){function t(t,e){this.sdkConfig=t,this.apiService=e,this.profileServiceConfig=this.sdkConfig.profileServiceConfig,this.apiConfig=this.sdkConfig.apiConfig}return t.prototype.handle=function(t){return this.fetchFromServer(t)},t.prototype.fetchFromServer=function(e){console.log("Request",e);var n=(new P.CsRequest.Builder).withHost(this.apiConfig.host).withType(P.CsHttpRequestType.POST).withPath(this.profileServiceConfig.profileApiPath_V5+t.USER_MIGRATE).withBearerToken(!0).withUserToken(!0).withBody({request:e}).build();return this.apiService.fetch(n).pipe(Object(dt.map)((function(t){return console.log("sucees",t),t.body})))},t.USER_MIGRATE="/migrate",t}(),Ho=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},zo=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ko=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Wo=function(){function t(t,e,n,r,i,o,a,s){this.profileService=t,this.authService=e,this.profileServiceConfig=n,this.apiService=r,this.cachedItemStore=i,this.dbService=o,this.frameworkService=a,this.sharedPreferences=s,this.managedProfileAdded$=new J.Subject}return t.prototype.addManagedProfile=function(t){var e=this;return Object(J.defer)((function(){return zo(e,void 0,void 0,(function(){var e,n=this;return Ko(this,(function(r){switch(r.label){case 0:return[4,this.isLoggedInUser()];case 1:if(!r.sent())throw new ra("No active LoggedIn Session found");return[4,this.createManagedProfile(t)];case 2:return e=r.sent().uid,setTimeout((function(){n.managedProfileAdded$.next(!0)}),1e3),[2,{uid:e}]}}))}))}))},t.prototype.getManagedServerProfiles=function(e){var n=this;return this.managedProfileAdded$.pipe(Object(dt.startWith)(!1),Object(dt.mergeMap)((function(r){return Object(J.defer)((function(){return zo(n,void 0,void 0,(function(){var n,i,o,a=this;return Ko(this,(function(s){switch(s.label){case 0:return[4,this.isLoggedInUser()];case 1:if(!s.sent())throw new ra("No active LoggedIn Session found");return e.from!==Wr.SERVER&&(e.from=r?Wr.SERVER:Wr.CACHE),[4,this.profileService.getActiveSessionProfile({requiredFields:[]}).toPromise()];case 2:return n=s.sent(),i=n.serverProfile&&n.serverProfile.managedBy?n.serverProfile.managedBy:n.uid,o=function(){return Object(J.defer)((function(){return zo(a,void 0,void 0,(function(){var t,r,o;return Ko(this,(function(a){switch(a.label){case 0:return!n.serverProfile||n.serverProfile.managedBy?[3,1]:(r=n.serverProfile,[3,3]);case 1:return[4,this.profileService.getServerProfilesDetails({userId:n.serverProfile.managedBy,requiredFields:e.requiredFields}).toPromise()];case 2:r=a.sent(),a.label=3;case 3:return t=r,o=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.profileServiceConfig.profileApiPath+"/managed/"+i).withParameters({withTokens:"true",sortBy:"createdDate",order:"desc"}).withBearerToken(!0).withUserToken(!0).build(),[4,this.apiService.fetch(o).toPromise().then((function(e){return[t].concat(e.body.result.response.content.sort((function(t,e){return new Date(e.createdDate).getTime()-new Date(t.createdDate).getTime()})))}))];case 4:return[2,a.sent()]}}))}))})).pipe(Object(dt.tap)((function(t){return zo(a,void 0,void 0,(function(){var e,n,r,i,o;return Ko(this,(function(a){switch(a.label){case 0:return[4,this.dbService.execute("\n SELECT * from "+Ie.TABLE_NAME+"\n WHERE "+Ie.COLUMN_NAME_UID+"\n IN ("+Ar.joinPreservingQuotes(t.map((function(t){return t.id})))+")\n ").toPromise().then((function(t){return t.map((function(t){return ei.mapProfileDBEntryToProfile(t)}))}))];case 1:for(e=a.sent(),n=t.filter((function(t){return!e.find((function(e){return e.uid===t.id}))})),r=0,i=n;r<i.length;r++)o=i[r],this.persistManagedProfile(o);return[2]}}))}))})))},[2,this.cachedItemStore[e.from===Wr.SERVER?"get":"getCached"](i,t.MANGED_SERVER_PROFILES_LOCAL_KEY,"ttl_"+t.MANGED_SERVER_PROFILES_LOCAL_KEY,(function(){return o()})).toPromise()]}}))}))}))})))},t.prototype.switchSessionToManagedProfile=function(t){var e=this,n=t.uid;return Object(J.defer)((function(){return zo(e,void 0,void 0,(function(){var t,e,r,i,o,a,s,u=this;return Ko(this,(function(c){switch(c.label){case 0:return[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return t=c.sent(),e=Ho({},t),[4,br.log.end({type:"session",env:"sdk",mode:"switch-user",duration:Math.floor((Date.now()-(e.managedSession||e).createdTime)/1e3),correlationData:[{type:"InitiatorId",id:e.managedSession?e.managedSession.uid:e.uid},{type:"ManagedUserId",id:n}]}).toPromise()];case 2:return c.sent(),[4,function(){return zo(u,void 0,void 0,(function(){return Ko(this,(function(t){return[2,this.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[n]}).toPromise().then((function(t){return t&&t[0]&&ei.mapProfileDBEntryToProfile(t[0])}))]}))}))}()];case 3:if(!(r=c.sent()))throw new oa("No Profile found with uid="+n);if(r.source!==Fr.SERVER)throw new oa("No Server Profile found with uid="+n);return t.uid!==n?[3,6]:(t.managedSession=void 0,[4,this.authService.getSession().toPromise()]);case 4:return(i=c.sent()).managed_access_token=void 0,[4,this.authService.setSession(new(function(){function t(){}return t.prototype.provide=function(){return zo(this,void 0,void 0,(function(){return Ko(this,(function(t){return[2,i]}))}))},t}())).toPromise()];case 5:return c.sent(),[3,10];case 6:return t.managedSession=new zr(n),[4,this.getManagedServerProfiles({from:Wr.CACHE,requiredFields:[]}).pipe(Object(dt.take)(1)).toPromise()];case 7:return o=c.sent(),a=o.find((function(t){return t.id===n})),[4,this.authService.getSession().toPromise()];case 8:return(s=c.sent()).managed_access_token=a.managedToken,[4,this.authService.setSession(new(function(){function t(){}return t.prototype.provide=function(){return zo(this,void 0,void 0,(function(){return Ko(this,(function(t){return[2,s]}))}))},t}())).toPromise()];case 9:c.sent(),c.label=10;case 10:return[4,this.sharedPreferences.putString(x.KEY_USER_SESSION,JSON.stringify(t)).toPromise()];case 11:return c.sent(),br.log.start({type:"session",env:"sdk",mode:"switch-user",correlationData:[{type:"InitiatorId",id:e.managedSession?e.managedSession.uid:e.uid},{type:"ManagedUserId",id:t.managedSession?t.managedSession.uid:t.uid}]}).toPromise(),[2]}}))}))})).pipe(Object(dt.mergeMap)((function(){return e.authService.getSession().pipe(Object(dt.mergeMap)((function(t){return e.authService.setSession(new(function(){function e(){}return e.prototype.provide=function(){return zo(this,void 0,void 0,(function(){return Ko(this,(function(e){return[2,Ho({},t,{userToken:n})]}))}))},e}()))})))})),Object(dt.mergeMap)((function(){return zo(e,void 0,void 0,(function(){var t,e;return Ko(this,(function(r){switch(r.label){case 0:return[4,this.profileService.getServerProfilesDetails({userId:n,requiredFields:[]}).toPromise()];case 1:return t=r.sent(),e=t.rootOrg?t.rootOrg.hashTagId:t.rootOrgId,[2,this.frameworkService.setActiveChannelId(e).toPromise()]}}))}))})),Object(dt.mapTo)(void 0))},t.prototype.persistManagedProfile=function(e){return zo(this,void 0,void 0,(function(){return Ko(this,(function(n){return e.userId=e.id,e.rootOrg={hashTagId:e.rootOrgId},this.profileService.createProfile({uid:e.id,profileType:Br.STUDENT,source:Fr.SERVER,handle:e.firstName,board:e.framework&&e.framework.board||[],medium:e.framework&&e.framework.medium||[],grade:e.framework&&e.framework.gradeLevel||[],gradeValue:e.framework&&e.framework.gradeValue||"",subject:e.framework&&e.framework.subject||[],serverProfile:e},Fr.SERVER).toPromise(),this.cachedItemStore.getCached(e.id,t.USER_PROFILE_DETAILS_KEY_PREFIX,t.USER_PROFILE_DETAILS_KEY_PREFIX,(function(){return Object(J.of)(e)})).toPromise(),[2]}))}))},t.prototype.createManagedProfile=function(t){return zo(this,void 0,void 0,(function(){var e;return Ko(this,(function(n){switch(n.label){case 0:return[4,this.profileService.getActiveSessionProfile({requiredFields:[]}).toPromise()];case 1:if(n.sent().source!==Fr.SERVER)throw new ra("No active session available");return e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.profileServiceConfig.profileApiPath_V2+"/managed/create").withBearerToken(!0).withUserToken(!0).withBody({request:t}).build(),[4,this.apiService.fetch(e).toPromise().then((function(t){return{uid:t.body.result.userId}}))];case 2:return[2,n.sent()]}}))}))},t.prototype.isLoggedInUser=function(){return zo(this,void 0,void 0,(function(){return Ko(this,(function(t){switch(t.label){case 0:return[4,this.authService.getSession().toPromise()];case 1:return[2,!!t.sent()]}}))}))},t.MANGED_SERVER_PROFILES_LOCAL_KEY="managed_server_profiles-",t.USER_PROFILE_DETAILS_KEY_PREFIX="userProfileDetails",t}(),Xo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Jo=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Zo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qo=function(t,e){return function(n,r){e(n,r,t)}},$o=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ta=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ea=function(){function t(t,e,n,r,i,o,a,s,u,c,f,h){this.container=t,this.sdkConfig=e,this.dbService=n,this.apiService=r,this.cachedItemStore=i,this.keyValueStore=o,this.sharedPreferences=a,this.frameworkService=s,this.fileService=u,this.deviceInfo=c,this.authService=f,this.userService=h,this.apiConfig=this.sdkConfig.apiConfig,this.profileServiceConfig=this.sdkConfig.profileServiceConfig,this.managedProfileManager=new Wo(this,this.authService,this.sdkConfig.profileServiceConfig,this.apiService,this.cachedItemStore,this.dbService,this.frameworkService,this.sharedPreferences)}var e;return e=t,Object.defineProperty(t.prototype,"telemetryService",{get:function(){return this.container.get(Q.TELEMETRY_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.preInit=function(){var t=this;return this.sharedPreferences.getString(e.KEY_USER_SESSION).pipe(Object(dt.map)((function(t){return t&&JSON.parse(t)})),Object(dt.mergeMap)((function(e){if(!e){var n={uid:"",handle:"",profileType:Br.TEACHER,source:Fr.LOCAL};return t.createProfile(n).pipe(Object(dt.mergeMap)((function(e){return t.setActiveSessionForProfile(e.uid)})),Object(dt.mapTo)(void 0))}return e.managedSession?t.managedProfileManager.switchSessionToManagedProfile({uid:e.managedSession.uid}):t.setActiveSessionForProfile(e.uid).pipe(Object(dt.mapTo)(void 0))})))},t.prototype.checkServerProfileExists=function(t){return this.userService.checkUserExists(t.matching,t.captchaResponseToken?{token:t.captchaResponseToken,app:"1"}:void 0)},t.prototype.createProfile=function(t,e){var n=this;switch(void 0===e&&(e=Fr.LOCAL),e){case Fr.LOCAL:if(t.source!==Fr.LOCAL)throw new oi("Invalid value supplied for field 'source': "+t.source);if(t.serverProfile)throw new oi("Invalid value supplied for field 'serverProfile': "+t.serverProfile);t.uid=ar.generateUniqueId();break;case Fr.SERVER:if(t.source!==Fr.SERVER)throw new oi("Invalid value supplied for field 'source': "+t.source);if(!t.serverProfile)throw new oi("Invalid value supplied for field 'serverProfile': "+t.serverProfile);if(!t.uid)throw new oi("Invalid value supplied for field 'uid': "+t.uid)}return t.createdAt=Date.now(),this.dbService.insert({table:Ie.TABLE_NAME,modelJson:ei.mapProfileToProfileDBEntry(t)}).pipe(Object(dt.tap)((function(){return $o(n,void 0,void 0,(function(){var e=this;return ta(this,(function(n){switch(n.label){case 0:return[4,this.getActiveProfileSession().pipe(Object(dt.map)((function(t){return t.uid})),Object(dt.catchError)((function(e){return e instanceof ra?Object(J.of)(t.uid):Object(J.throwError)(e)})),Object(dt.mergeMap)((function(n){var r=new Ht;r.id=n,r.type=Ht.TYPE_SYSTEM;var i={env:"sdk",actor:r,currentState:Ft.AUDIT_CREATED,updatedProperties:co.getTruthyProps(t),objId:t.uid,objType:at.USER,correlationData:[{id:t.profileType,type:"UserRole"}]};return e.telemetryService.audit(i)}))).toPromise()];case 1:return n.sent(),[2]}}))}))})),Object(dt.mergeMap)((function(){return Object(J.of)(t)})))},t.prototype.deleteProfile=function(t){var e=this;return this.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[t]}).pipe(Object(dt.map)((function(e){if(!e||!e[0])throw new oa("No Profile found with ID "+t);return ei.mapProfileDBEntryToProfile(e[0])})),Object(dt.tap)((function(n){return $o(e,void 0,void 0,(function(){var e=this;return ta(this,(function(r){switch(r.label){case 0:return[4,this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(r){var i=new Ht;i.id=r.uid,i.type=Ht.TYPE_SYSTEM;var o={env:"sdk",actor:i,currentState:Ft.AUDIT_DELETED,objId:t,objType:at.USER,correlationData:[{id:n.profileType,type:"UserRole"}]};return e.telemetryService.audit(o)}))).toPromise()];case 1:return[2,r.sent()]}}))}))})),Object(dt.mergeMap)((function(){return e.dbService.delete({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[t]})})))},t.prototype.updateProfile=function(t){var e=this;return this.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[t.uid]}).pipe(Object(dt.map)((function(e){if(!e||!e[0])throw new oa("No Profile found with ID "+t.uid);return ei.mapProfileDBEntryToProfile(e[0])})),Object(dt.tap)((function(n){return $o(e,void 0,void 0,(function(){var e=this;return ta(this,(function(r){switch(r.label){case 0:return[4,this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(r){var i=new Ht;i.id=r.uid,i.type=Ht.TYPE_SYSTEM;var o={env:"sdk",actor:i,currentState:Ft.AUDIT_UPDATED,updatedProperties:co.getPropDiff(t,n),objId:t.uid,objType:at.USER,correlationData:[{id:t.profileType,type:"UserRole"}]};return e.telemetryService.audit(o)}))).toPromise()];case 1:return r.sent(),[2]}}))}))})),Object(dt.mergeMap)((function(){var n=ei.mapProfileToProfileDBEntry(t);return delete n[Ie.COLUMN_NAME_CREATED_AT],e.dbService.update({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[t.uid],modelJson:n}).pipe(Object(dt.mergeMap)((function(){return Object(J.of)(t)})))})))},t.prototype.updateServerProfile=function(t){return this.userService.updateProfile(t,{apiPath:"/api/user/v3"})},t.prototype.getTenantInfo=function(t){return new Xr(this.apiService,this.sdkConfig.profileServiceConfig).handle(t)},t.prototype.getAllProfiles=function(t){var e=this;return t?t.groupId?t.groupId&&(t.local||t.server)?this.dbService.execute("\n SELECT * FROM "+Ie.TABLE_NAME+" LEFT JOIN "+De.TABLE_NAME+"\n ON "+Ie.TABLE_NAME+"."+Ie.COLUMN_NAME_UID+" =\n "+De.TABLE_NAME+"."+De.COLUMN_NAME_UID+"\n WHERE "+De.COLUMN_NAME_GID+' = "'+t.groupId+'" AND\n '+Ie.COLUMN_NAME_SOURCE+' = "'+(t.local?Fr.LOCAL:Fr.SERVER)+'"\n ').pipe(Object(dt.map)((function(t){return e.mapDbProfileEntriesToProfiles(t)}))):this.dbService.execute("\n SELECT * FROM "+Ie.TABLE_NAME+"\n LEFT JOIN "+De.TABLE_NAME+" ON\n "+Ie.TABLE_NAME+"."+Ie.COLUMN_NAME_UID+" =\n "+De.TABLE_NAME+"."+De.COLUMN_NAME_UID+"\n WHERE "+De.TABLE_NAME+"."+De.COLUMN_NAME_GID+' = "'+t.groupId+'"\n ').pipe(Object(dt.map)((function(t){return e.mapDbProfileEntriesToProfiles(t)}))):this.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_SOURCE+" = ?",selectionArgs:[t.local?Fr.LOCAL:Fr.SERVER],columns:[]}).pipe(Object(dt.map)((function(t){return e.mapDbProfileEntriesToProfiles(t)}))):this.dbService.read({table:Ie.TABLE_NAME,columns:[]}).pipe(Object(dt.map)((function(t){return e.mapDbProfileEntriesToProfiles(t)})))},t.prototype.getServerProfilesDetails=function(t){return new ti(this.cachedItemStore,this.keyValueStore,this.container,this.profileServiceConfig).handle(t)},t.prototype.getActiveSessionProfile=function(t){var e=this,n=t.requiredFields;return this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(t){return e.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[t.managedSession?t.managedSession.uid:t.uid]}).pipe(Object(dt.map)((function(e){var n=e&&e[0];if(!n)throw new oa("No profile found for profileSession with uid "+(t.managedSession?t.managedSession.uid:t.uid));return ei.mapProfileDBEntryToProfile(n)})),Object(dt.mergeMap)((function(t){return t.source===Fr.SERVER?e.getServerProfilesDetails({userId:t.uid,requiredFields:n}).pipe(Object(dt.map)((function(e){return Xo({},t,{handle:e.firstName+(e.lastName?" "+e.lastName:""),serverProfile:e})}))):Object(J.of)(t)})))})))},t.prototype.setActiveSessionForProfile=function(t){var n=this;return Object(J.defer)((function(){return n.generateSessionEndTelemetry()})).pipe(Object(dt.mergeMap)((function(){return n.dbService.read({table:Ie.TABLE_NAME,selection:Ie.COLUMN_NAME_UID+" = ?",selectionArgs:[t]})})),Object(dt.map)((function(t){return t&&t[0]&&ei.mapProfileDBEntryToProfile(t[0])})),Object(dt.map)((function(t){if(!t)throw new oa("No Profile found");return t})),Object(dt.mergeMap)((function(t){return Object(J.iif)((function(){return t.source===Fr.SERVER}),Object(J.defer)((function(){return n.getServerProfilesDetails({userId:t.uid,requiredFields:[]}).pipe(Object(dt.map)((function(e){return Xo({},t,{serverProfile:e})})),Object(dt.mergeMap)((function(t){return n.frameworkService.setActiveChannelId(t.serverProfile.rootOrg.hashTagId)})),Object(dt.catchError)((function(){return Object(J.of)(void 0)})))})),n.frameworkService.setActiveChannelId(n.sdkConfig.apiConfig.api_authentication.channelId).pipe(Object(dt.mapTo)(void 0))).pipe(Object(dt.mapTo)(t))})),Object(dt.mergeMap)((function(t){var r=new zr(t.uid);return vt.CsModule.instance.isInitialised&&vt.CsModule.instance.updateConfig(Xo({},vt.CsModule.instance.config,{core:Xo({},vt.CsModule.instance.config.core,{global:Xo({},vt.CsModule.instance.config.core.global,{sessionId:r.sid})})})),n.sharedPreferences.putString(e.KEY_USER_SESSION,JSON.stringify(r)).pipe(Object(dt.mapTo)(!0))})),Object(dt.tap)((function(){return $o(n,void 0,void 0,(function(){return ta(this,(function(t){switch(t.label){case 0:return[4,this.generateSessionStartTelemetry()];case 1:return[2,t.sent()]}}))}))})))},t.prototype.getActiveProfileSession=function(){return this.sharedPreferences.getString(e.KEY_USER_SESSION).pipe(Object(dt.map)((function(t){if(t)return JSON.parse(t);throw new ra("No active session available")})))},t.prototype.acceptTermsAndConditions=function(t){return new ni(this.apiService,this.sdkConfig.profileServiceConfig).handle(t)},t.prototype.isProfileAlreadyInUse=function(t){return new ai(this.apiService,this.sdkConfig.profileServiceConfig).handle(t)},t.prototype.generateOTP=function(t){return new si(this.apiService,this.sdkConfig.profileServiceConfig).handle(t)},t.prototype.verifyOTP=function(t){return new ui(this.apiService,this.sdkConfig.profileServiceConfig).handle(t)},t.prototype.searchLocation=function(t){return new fi(this.apiService,this.sdkConfig.profileServiceConfig,this.fileService,this.cachedItemStore).handle(t)},t.prototype.getAllContentAccess=function(t){var e="SELECT * FROM "+Je.TABLE_NAME+" "+Cr.getUidnIdentifierFiler(t.uid,t.contentId);return this.dbService.execute(e).pipe(Object(dt.map)((function(t){return t.map((function(t){return ri.mapDBEntryToContenetAccess(t)}))})))},t.prototype.addContentAccess=function(t){var e=this;return this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){var r=n.uid;return e.dbService.read({table:Je.TABLE_NAME,selection:Je.COLUMN_NAME_UID+"= ? AND "+Je.COLUMN_NAME_CONTENT_IDENTIFIER+"= ?",selectionArgs:[r,t.contentId],orderBy:Je.COLUMN_NAME_EPOCH_TIMESTAMP+" DESC",limit:"1"}).pipe(Object(dt.mergeMap)((function(n){var i={uid:r,identifier:t.contentId,epoch_timestamp:Date.now(),status:Hr.PLAYED.valueOf(),content_type:t.contentType&&t.contentType.toLowerCase(),learner_state:t.contentLearnerState&&JSON.stringify(t.contentLearnerState.learnerState)};return n&&n.length?(i.status=n[0][Je.COLUMN_NAME_STATUS],e.dbService.update({table:Je.TABLE_NAME,selection:Je.COLUMN_NAME_UID+"= ? AND "+Je.COLUMN_NAME_CONTENT_IDENTIFIER+"= ?",selectionArgs:[r,t.contentId],modelJson:i}).pipe(Object(dt.map)((function(t){return t>0})))):e.dbService.insert({table:Je.TABLE_NAME,modelJson:i}).pipe(Object(dt.map)((function(t){return t>0})))})))})))},t.prototype.exportProfile=function(t){var e=this,n={userIds:t.userIds,destinationFolder:t.destinationFolder,groupIds:t.groupIds};return Object(J.from)(new hi(this.fileService).execute(n).then((function(t){return new pi(e.dbService).execute(t.body)})).then((function(t){return new yi(e.dbService,e.fileService,e.deviceInfo).execute(t.body)})).then((function(t){return new _i(e.dbService,e.fileService).execute(t.body).catch((function(){return t}))})).then((function(t){return new Mi(e.dbService).execute(t.body)})).then((function(t){return{exportedFilePath:t.body.destinationDBFilePath}})))},t.prototype.importProfile=function(t){var e=this,n={sourceDBFilePath:t.sourceFilePath};return Object(J.from)(new wi(this.dbService).execute(n).then((function(t){return new Ai(e.dbService).execute(t.body)})).then((function(t){return new Yo(e.dbService).execute(t.body)})).then((function(t){return new Ci(e.dbService).execute(t.body)})).then((function(t){return new Pi(e.dbService).execute(t.body)})).then((function(t){return new ji(e.dbService).execute(t.body)})).then((function(t){return new Bo(e.dbService).execute(t.body)})).then((function(t){return new Fo(e.dbService).execute(t.body)})).then((function(t){return new Ei(e.dbService).execute(t.body)})).then((function(t){return{failed:t.body.failed,imported:t.body.imported}})))},t.prototype.mergeServerProfiles=function(t){var n=this,r=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.PATCH).withPath(e.MERGE_SERVER_PROFILES_PATH).withBearerToken(!0).withHeaders({"x-source-user-token":t.from.accessToken,"x-authenticated-user-token":t.to.accessToken}).withBody({request:{fromAccountId:t.from.userId,toAccountId:t.to.userId}}).build();return this.apiService.fetch(r).pipe(Object(dt.map)((function(t){console.log(t)})),Object(dt.finalize)((function(){var t=n.sdkConfig.apiConfig.user_authentication.mergeUserHost+n.sdkConfig.apiConfig.user_authentication.authUrl+"/logout?redirect_uri="+n.sdkConfig.apiConfig.host+"/oauth2callback",e=cordova.InAppBrowser.open(t,"_blank","zoom=no,hidden=yes");e.addEventListener("loadstart",(function(t){return $o(n,void 0,void 0,(function(){return ta(this,(function(n){return t.url.indexOf("/oauth2callback")>-1&&e.close(),[2]}))}))}))})))},t.prototype.isDefaultChannelProfile=function(){return Object(J.zip)(this.frameworkService.getDefaultChannelId(),this.frameworkService.getActiveChannelId()).pipe(Object(dt.map)((function(t){return t[0]===t[1]})))},t.prototype.getUserFeed=function(){var t=this;return this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(e){return t.userService.getUserFeed(e.managedSession?e.managedSession.uid:e.uid,{apiPath:t.sdkConfig.profileServiceConfig.profileApiPath_V5})})))},t.prototype.updateUserFeedEntry=function(t){var e=this;return this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){return e.userService.updateUserFeedEntry(n.managedSession?n.managedSession.uid:n.uid,t.feedEntryId,t.category,t.request,{apiPath:e.sdkConfig.profileServiceConfig.profileApiPath_V5}).pipe(Object(dt.mapTo)(!0),Object(dt.catchError)((function(){return Object(J.of)(!1)})))})))},t.prototype.deleteUserFeedEntry=function(t){var e=this;return this.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){return e.userService.deleteUserFeedEntry(n.managedSession?n.managedSession.uid:n.uid,t.feedEntryId,t.category,{apiPath:e.sdkConfig.profileServiceConfig.profileApiPath}).pipe(Object(dt.mapTo)(!0),Object(dt.catchError)((function(){return Object(J.of)(!1)})))})))},t.prototype.userMigrate=function(t){return new Go(this.sdkConfig,this.apiService).handle(t)},t.prototype.updateServerProfileDeclarations=function(t){return this.userService.updateUserDeclarations(t.declarations,{apiPath:this.sdkConfig.profileServiceConfig.profileApiPath})},t.prototype.getConsent=function(t){return this.userService.getConsent(t,{apiPath:this.sdkConfig.profileServiceConfig.profileApiPath})},t.prototype.updateConsent=function(t){return this.userService.updateConsent(t,{apiPath:this.sdkConfig.profileServiceConfig.profileApiPath})},t.prototype.mapDbProfileEntriesToProfiles=function(t){return t.map((function(t){return ei.mapProfileDBEntryToProfile(t)}))},t.prototype.generateSessionStartTelemetry=function(){return $o(this,void 0,void 0,(function(){return ta(this,(function(t){return[2,br.log.start({type:"session",env:"sdk"}).toPromise()]}))}))},t.prototype.generateSessionEndTelemetry=function(){return $o(this,void 0,void 0,(function(){var t,n;return ta(this,(function(r){switch(r.label){case 0:return[4,this.sharedPreferences.getString(e.KEY_USER_SESSION).toPromise()];case 1:return(t=r.sent())?(n=JSON.parse(t),[4,br.log.end({type:"session",env:"sdk",duration:Math.floor((Date.now()-n.createdTime)/1e3)}).toPromise()]):[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.KEY_USER_SESSION=x.KEY_USER_SESSION,t.MERGE_SERVER_PROFILES_PATH="/api/user/v1/account/merge",t=e=Jo([Object(R.injectable)(),Qo(0,Object(R.inject)(Q.CONTAINER)),Qo(1,Object(R.inject)(Q.SDK_CONFIG)),Qo(2,Object(R.inject)(Q.DB_SERVICE)),Qo(3,Object(R.inject)(Q.API_SERVICE)),Qo(4,Object(R.inject)(Q.CACHED_ITEM_STORE)),Qo(5,Object(R.inject)(Q.KEY_VALUE_STORE)),Qo(6,Object(R.inject)(Q.SHARED_PREFERENCES)),Qo(7,Object(R.inject)(Q.FRAMEWORK_SERVICE)),Qo(8,Object(R.inject)(Q.FILE_SERVICE)),Qo(9,Object(R.inject)(Q.DEVICE_INFO)),Qo(10,Object(R.inject)(Q.AUTH_SERVICE)),Qo(11,Object(R.inject)(Z.USER_SERVICE)),Zo("design:paramtypes",[R.Container,Object,I,Object,Object,Object,Object,Object,Object,Object,Object,Object])],t)}(),na=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ra=function(t){function e(n){var r=t.call(this,n,"NO_ACTIVE_SESSION")||this;return Object.setPrototypeOf(r,e.prototype),r}return na(e,t),e}(ye),ia=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oa=function(t){function e(n){var r=t.call(this,n,"NO_PROFILE_FOUND")||this;return Object.setPrototypeOf(r,e.prototype),r}return ia(e,t),e}(ye),aa=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),sa=function(t){function e(n){var r=t.call(this,n,"AUTH_TOKEN_REFRESH_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return aa(e,t),e}(ye),ua=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ca=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},fa=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ha=function(){function t(t,e,n,r){this.apiConfig=t,this.apiService=e,this.sharedPreferences=n,this.eventsBusService=r}return t.prototype.refreshSession=function(){return ca(this,void 0,void 0,(function(){var t,e,n,r=this;return fa(this,(function(i){switch(i.label){case 0:return[4,this.getSessionData()];case 1:if(!(t=i.sent()))throw new ra("No Active Sessions found");e="ios"===window.device.platform.toLowerCase()?(new P.CsRequest.Builder).withPath("/auth/v1/refresh/token").withType(P.CsHttpRequestType.POST).withSerializer(P.CsHttpSerializer.URLENCODED).withHeaders({"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}).withBearerToken(!0).withBody({refresh_token:t.refresh_token}).build():(new P.CsRequest.Builder).withPath("/auth/v1/refresh/token").withType(P.CsHttpRequestType.POST).withSerializer(P.CsHttpSerializer.URLENCODED).withBearerToken(!0).withBody({refresh_token:t.refresh_token}).build(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this.apiService.fetch(e).toPromise().catch((function(t){if(P.CsHttpClientError.isInstance(t)&&t.response.responseCode===P.CsHttpResponseCode.HTTP_BAD_REQUEST)throw new sa(t.message);throw t})).then((function(e){return ca(r,void 0,void 0,(function(){var n,r,i;return fa(this,(function(o){switch(o.label){case 0:return e.body.result.access_token&&e.body.result.refresh_token?(n=X.getJWTPayload(e.body.result.access_token),r=3===n.sub.split(":").length?n.sub.split(":").pop():n.sub,[4,this.getSessionData()]):[3,3];case 1:return i=o.sent(),t=ua({},e.body.result,{userToken:i?i.userToken:r,managed_access_token:i?i.managed_access_token:void 0,accessTokenExpiresOn:1e3*n.exp}),[4,this.sharedPreferences.putString(k.KEY_OAUTH_SESSION,JSON.stringify(t)).toPromise()];case 2:return[2,o.sent()];case 3:throw new sa("No token found in server response")}}))}))}))];case 3:return i.sent(),[3,5];case 4:throw(n=i.sent())instanceof sa&&this.eventsBusService.emit({namespace:$.ERROR,event:{type:tt.AUTH_TOKEN_REFRESH_ERROR,payload:n}}),n;case 5:return[2]}}))}))},t.prototype.startSession=function(t){return ca(this,void 0,void 0,(function(){return fa(this,(function(e){switch(e.label){case 0:return[4,this.sharedPreferences.putString(k.KEY_OAUTH_SESSION,JSON.stringify(t)).toPromise()];case 1:return e.sent(),[2]}}))}))},t.prototype.endSession=function(){return ca(this,void 0,void 0,(function(){return fa(this,(function(t){switch(t.label){case 0:return[4,this.sharedPreferences.putString(k.KEY_OAUTH_SESSION,"").toPromise()];case 1:return t.sent(),[2]}}))}))},t.prototype.getSessionData=function(){return ca(this,void 0,void 0,(function(){var t;return fa(this,(function(e){switch(e.label){case 0:return[4,this.sharedPreferences.getString(k.KEY_OAUTH_SESSION).toPromise()];case 1:return(t=e.sent())?[2,JSON.parse(t)]:[2,void 0]}}))}))},t}(),la=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},da=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pa=function(t,e){return function(n,r){e(n,r,t)}},ma=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ba=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ya=function(){function t(t,e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y){this.dbService=t,this.decorator=e,this.profileService=n,this.groupService=r,this.keyValueStore=i,this.apiService=o,this.sdkConfig=a,this.deviceInfo=s,this.eventsBusService=u,this.fileService=c,this.frameworkService=f,this.networkInfoService=h,this.errorLoggerService=l,this.sharedPreferences=d,this.appInfoService=p,this.deviceRegisterService=m,this.courseService=b,this.networkQueue=y,this.campaignParameters=[],this.globalCdata=[],this.telemetryConfig=this.sdkConfig.telemetryConfig,this._lastSyncedTimestamp$=new J.BehaviorSubject(void 0)}return Object.defineProperty(t.prototype,"autoSync",{get:function(){return this.telemetryAutoSyncService||(this.telemetryAutoSyncService=new Yr(this,this.sharedPreferences)),this.telemetryAutoSyncService},enumerable:!0,configurable:!0}),t.prototype.preInit=function(){var t=this;return Object(J.defer)((function(){return ma(t,void 0,void 0,(function(){var t=this;return ba(this,(function(e){return this.getInitialUtmParameters().then((function(e){e&&e.length&&t.updateCampaignParameters(e)})),[2,void 0]}))}))}))},t.prototype.onInit=function(){var t=this;return Object(J.combineLatest)([Object(J.defer)((function(){return ma(t,void 0,void 0,(function(){var t;return ba(this,(function(e){switch(e.label){case 0:return[4,this.sharedPreferences.getString(K.KEY_LAST_SYNCED_TIME_STAMP).toPromise()];case 1:if(t=e.sent())try{this._lastSyncedTimestamp$.next(parseInt(t,10))}catch(t){console.error(t)}return[2,void 0]}}))}))})),new J.Observable((function(e){sbsync.onAuthorizationError((function(n){return ma(t,void 0,void 0,(function(){var t;return ba(this,(function(r){return(t=n.network_queue_error)&&e.next(t),[2]}))}))}),(function(e){return ma(t,void 0,void 0,(function(){return ba(this,(function(t){return[2]}))}))}))})).pipe(Object(dt.mergeMap)((function(e){return"API_TOKEN_EXPIRED"===e?new ot(t.sdkConfig.apiConfig,t.apiService,t.deviceInfo).refreshAuthToken().pipe(Object(dt.mergeMap)((function(e){return t.sharedPreferences.putString(j.KEY_API_TOKEN,e)})),Object(dt.catchError)((function(){return Object(J.of)(void 0)}))):Object(J.from)(new ha(t.sdkConfig.apiConfig,t.apiService,t.sharedPreferences,t.eventsBusService).refreshSession()).pipe(Object(dt.catchError)((function(){return Object(J.of)(void 0)})))})))]).pipe(Object(dt.mapTo)(void 0))},t.prototype.saveTelemetry=function(t){var e=this;return Object(J.defer)((function(){try{var n=JSON.parse(t);return e.decorateAndPersist(n)}catch(t){return console.error(t),Object(J.of)(!1)}}))},t.prototype.audit=function(t){var e=t.env,n=t.actor,r=t.currentState,i=t.updatedProperties,o=t.type,a=t.objId,s=t.objType,u=t.objVer,c=t.correlationData,f=t.rollUp,h=new Vt.Audit(e,n,r,i,o,a,s,u,c,f);return this.decorateAndPersist(h)},t.prototype.end=function(t){var e=t.type,n=t.mode,r=t.duration,i=t.pageId,o=t.summaryList,a=t.env,s=t.objId,u=t.objType,c=t.objVer,f=t.rollup,h=t.correlationData,l=new Vt.End(e,n,r,i,o,a,s,u,c,f,h);return this.decorateAndPersist(l)},t.prototype.error=function(t){var e=new Vt.Error(t.errorCode,t.errorType,t.stacktrace,t.pageId);return this.errorLoggerService.logError(t).toPromise().catch((function(t){return console.error(t)})),this.decorateAndPersist(e)},t.prototype.impression=function(t){var e=t.type,n=t.subType,r=t.pageId,i=t.visits,o=t.env,a=t.objId,s=t.objType,u=t.objVer,c=t.rollup,f=t.correlationData,h=new Vt.Impression(e,n,r,i,o,a,s,u,c,f);return this.decorateAndPersist(h)},t.prototype.interact=function(t){var e=t.type,n=t.subType,r=t.id,i=t.pageId,o=t.pos,a=t.env,s=t.rollup,u=t.valueMap,c=t.correlationData,f=t.objId,h=t.objType,l=t.objVer,d=new Vt.Interact(e,n,r,i,o,u,a,f,h,l,s,c);return this.decorateAndPersist(d)},t.prototype.log=function(t){var e=t.type,n=t.level,r=t.message,i=t.pageId,o=t.params,a=t.env,s=t.actorType,u=new Vt.Log(e,n,r,i,o,a,s);return this.decorateAndPersist(u)},t.prototype.share=function(t){var e=t.dir,n=t.type,r=t.items,i=t.correlationData,o=t.objId,a=t.objType,s=t.objVer,u=t.rollUp,c=new Vt.Share(e,n,[],i,o,a,s,u);return r.forEach((function(t){c.addItem(t.type,t.origin,t.identifier,t.pkgVersion,t.transferCount,t.size)})),this.decorateAndPersist(c)},t.prototype.feedback=function(t){var e=t.rating,n=t.comments,r=t.env,i=t.objId,o=t.objType,a=t.objVer,s=t.commentid,u=t.commenttxt,c=new Vt.Feedback(e,n,r,i,o,a,s,u);return this.decorateAndPersist(c)},t.prototype.start=function(t){var e=t.type,n=t.deviceSpecification,r=t.loc,i=t.mode,o=t.duration,a=t.pageId,s=t.env,u=t.objId,c=t.objType,f=t.objVer,h=t.rollup,l=t.correlationData,d=new Vt.Start(e,n,r,i,o,a,s,u,c,f,h,l);return this.decorateAndPersist(d)},t.prototype.summary=function(t){var e=t.type,n=t.starttime,r=t.endtime,i=t.timespent,o=t.pageviews,a=t.interactions,s=t.env,u=t.mode,c=t.envsummary,f=t.eventsummary,h=t.pagesummary,l=t.extra,d=t.correlationData,p=t.objId,m=t.objType,b=t.objVer,y=t.rollup,v=new Vt.Summary(e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y);return this.decorateAndPersist(v)},t.prototype.interrupt=function(t){var e=t.type,n=t.pageId,r=new Vt.Interrupt(e,n);return this.decorateAndPersist(r)},t.prototype.importTelemetry=function(t){var e=this,n={sourceDBFilePath:t.sourceFilePath};return Object(J.from)(new Pr(this.dbService).execute(n).then((function(t){return new kr(e.dbService).execute(t.body)})).then((function(t){return new Ur(e.dbService).execute(t.body)})).then((function(t){return new Ur(e.dbService).execute(t.body)})).then((function(t){return new xr(e.dbService,e).execute(t.body)})).then((function(t){return!0})).catch((function(t){return console.error(t),!1})))},t.prototype.getTelemetryStat=function(){var t="\n SELECT COUNT(*) as TELEMETRY_COUNT\n FROM "+_e.TABLE_NAME+"\n ",e="\n SELECT SUM("+Me.COLUMN_NAME_NUMBER_OF_EVENTS+") as PROCESSED_TELEMETRY_COUNT\n FROM "+Me.TABLE_NAME+"\n ";return Object(J.zip)(this.dbService.execute(t),this.dbService.execute(e),this.keyValueStore.getValue(K.KEY_LAST_SYNCED_TIME_STAMP)).pipe(Object(dt.map)((function(t){return{unSyncedEventCount:t[0][0].TELEMETRY_COUNT+t[1][0].PROCESSED_TELEMETRY_COUNT,lastSyncTime:t[2]?parseInt(t[2],10):0}})))},t.prototype.resetDeviceRegisterTTL=function(){return new wr(this.dbService,this.sdkConfig,this.deviceInfo,this.sharedPreferences,this.appInfoService,this.deviceRegisterService,this.keyValueStore,this.apiService,this.networkQueue).resetDeviceRegisterTTL()},t.prototype.sync=function(t){var e=this;return void 0===t&&(t={ignoreSyncThreshold:!1,ignoreAutoSyncMode:!1}),this.networkInfoService.networkStatus$.pipe(Object(dt.take)(1),Object(dt.mergeMap)((function(e){return e===Lr.ONLINE&&(t.ignoreSyncThreshold=!0),Object(J.of)(t)})),Object(dt.mergeMap)((function(t){return new wr(e.dbService,e.sdkConfig,e.deviceInfo,e.sharedPreferences,e.appInfoService,e.deviceRegisterService,e.keyValueStore,e.apiService,e.networkQueue).handle(t).pipe(Object(dt.tap)((function(t){if(!t.error&&t.syncedEventCount){var n=Date.now();e.sharedPreferences.putString(K.KEY_LAST_SYNCED_TIME_STAMP,n+"").toPromise(),e._lastSyncedTimestamp$.next(n)}})))})))},t.prototype.lastSyncedTimestamp=function(){return this._lastSyncedTimestamp$.asObservable()},t.prototype.buildContext=function(){var t=this;return this.profileService.getActiveProfileSession().pipe(Object(dt.map)((function(e){return t.decorator.buildContext(e.sid,t.frameworkService.activeChannelId,new zt)})))},t.prototype.decorateAndPersist=function(t){var e=this;return Object(J.zip)(this.profileService.getActiveProfileSession(),this.groupService.getActiveGroupSession()).pipe(Object(dt.mergeMap)((function(n){var r=n[0],i=n[1];return e.keyValueStore.getValue(wr.TELEMETRY_LOG_MIN_ALLOWED_OFFSET_KEY).pipe(Object(dt.mergeMap)((function(n){n=n||"0";var o={table:_e.TABLE_NAME,modelJson:e.decorator.prepare(e.decorator.decorate(t,r,i&&i.gid,Number(n),e.frameworkService.activeChannelId,e.campaignParameters,e.globalCdata),1)};return e.dbService.insert(o).pipe(Object(dt.tap)((function(){return e.eventsBusService.emit({namespace:$.TELEMETRY,event:{type:Or.SAVE,payload:t}})})),Object(dt.map)((function(t){return t>1})))})))})))},t.prototype.updateCampaignParameters=function(t){this.campaignParameters=t},t.prototype.populateGlobalCorRelationData=function(t){this.globalCdata=t},t.prototype.getInitialUtmParameters=function(){return new Promise((function(t,e){try{sbutility.getUtmInfo((function(e){t(e.val)}),(function(t){e(t)}))}catch(t){e(t)}}))},t=la([Object(R.injectable)(),pa(0,Object(R.inject)(Q.DB_SERVICE)),pa(1,Object(R.inject)(Q.TELEMETRY_DECORATOR)),pa(2,Object(R.inject)(Q.PROFILE_SERVICE)),pa(3,Object(R.inject)(Q.GROUP_SERVICE_DEPRECATED)),pa(4,Object(R.inject)(Q.KEY_VALUE_STORE)),pa(5,Object(R.inject)(Q.API_SERVICE)),pa(6,Object(R.inject)(Q.SDK_CONFIG)),pa(7,Object(R.inject)(Q.DEVICE_INFO)),pa(8,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),pa(9,Object(R.inject)(Q.FILE_SERVICE)),pa(10,Object(R.inject)(Q.FRAMEWORK_SERVICE)),pa(11,Object(R.inject)(Q.NETWORKINFO_SERVICE)),pa(12,Object(R.inject)(Q.ERROR_LOGGER_SERVICE)),pa(13,Object(R.inject)(Q.SHARED_PREFERENCES)),pa(14,Object(R.inject)(Q.APP_INFO)),pa(15,Object(R.inject)(Q.DEVICE_REGISTER_SERVICE)),pa(16,Object(R.inject)(Q.COURSE_SERVICE)),pa(17,Object(R.inject)(Q.NETWORK_QUEUE)),da("design:paramtypes",[I,Lt,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object])],t)}(),va=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},ga=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_a=function(t,e){return function(n,r){e(n,r,t)}},Ea=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ma=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},wa=function(){function t(t,e,n,r){this.sdkConfig=t,this.apiService=e,this.sharedPreferences=n,this.eventsBusService=r,this.apiConfig=this.sdkConfig.apiConfig,this.authUtil=new ha(this.apiConfig,this.apiService,this.sharedPreferences,this.eventsBusService)}var e;return e=t,t.prototype.onInit=function(){var t=this;return this.sharedPreferences.addListener(k.KEY_OAUTH_SESSION,(function(e){return Ea(t,void 0,void 0,(function(){var t,n,r,i,o;return Ma(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];a.label=1;case 1:return a.trys.push([1,3,,4]),r=(n=JSON).parse,[4,this.sharedPreferences.getString(x.KEY_USER_SESSION).toPromise()];case 2:return t=r.apply(n,[a.sent()]),i=JSON.parse(e),vt.CsModule.instance.config.core.api.authentication.userToken=i.access_token,vt.CsModule.instance.config.core.api.authentication.managedUserToken=t.managedSession?i.managed_access_token:void 0,[3,4];case 3:return o=a.sent(),console.error(o),vt.CsModule.instance.config.core.api.authentication.userToken=void 0,vt.CsModule.instance.config.core.api.authentication.managedUserToken=void 0,[3,4];case 4:return[3,6];case 5:vt.CsModule.instance.config.core.api.authentication.userToken=void 0,vt.CsModule.instance.config.core.api.authentication.managedUserToken=void 0,a.label=6;case 6:return vt.CsModule.instance.updateConfig(vt.CsModule.instance.config),[2]}}))}))})),this.sharedPreferences.addListener(x.KEY_USER_SESSION,(function(e){return Ea(t,void 0,void 0,(function(){var t,n,r,i,o;return Ma(this,(function(a){switch(a.label){case 0:if(!e)return[3,5];a.label=1;case 1:return a.trys.push([1,3,,4]),t=JSON.parse(e),i=(r=JSON).parse,[4,this.sharedPreferences.getString(k.KEY_OAUTH_SESSION).toPromise()];case 2:return n=i.apply(r,[a.sent()]),vt.CsModule.instance.config.core.api.authentication.userToken=n.access_token,vt.CsModule.instance.config.core.api.authentication.managedUserToken=t.managedSession?n.managed_access_token:void 0,[3,4];case 3:return o=a.sent(),console.error(o),vt.CsModule.instance.config.core.api.authentication.userToken=void 0,vt.CsModule.instance.config.core.api.authentication.managedUserToken=void 0,[3,4];case 4:return[3,6];case 5:vt.CsModule.instance.config.core.api.authentication.userToken=void 0,vt.CsModule.instance.config.core.api.authentication.managedUserToken=void 0,a.label=6;case 6:return vt.CsModule.instance.updateConfig(vt.CsModule.instance.config),[2]}}))}))})),Object(J.combineLatest)([Object(J.defer)((function(){return t.getSession()})).pipe(Object(dt.mergeMap)((function(e){return Ea(t,void 0,void 0,(function(){var t,n,r;return Ma(this,(function(i){switch(i.label){case 0:return e?(r=(n=JSON).parse,[4,this.sharedPreferences.getString(x.KEY_USER_SESSION).toPromise()]):[2,void 0];case 1:return t=r.apply(n,[i.sent()]),vt.CsModule.instance.config.core.api.authentication.userToken=e.access_token,vt.CsModule.instance.config.core.api.authentication.managedUserToken=t.managedSession?e.managed_access_token:void 0,vt.CsModule.instance.updateConfig(vt.CsModule.instance.config),[2,void 0]}}))}))}))),Object(J.defer)((function(){return t.onAccessTokenNearingExpiry()})).pipe(Object(dt.mergeMap)((function(e){return Ea(t,void 0,void 0,(function(){return Ma(this,(function(t){return e?[2,this.refreshSession().toPromise()]:[2,void 0]}))}))})))]).pipe(Object(dt.mapTo)(void 0))},t.prototype.setSession=function(t){var e=this;return Object(J.from)(t.provide().then((function(t){if(!t.access_token)throw e.authUtil.endSession(),t;e.authUtil.startSession(t),e.authUtil.refreshSession()})))},t.prototype.getSession=function(){return Object(J.from)(this.authUtil.getSessionData())},t.prototype.resignSession=function(){return Object(J.from)(this.authUtil.endSession())},t.prototype.refreshSession=function(){return Object(J.from)(this.authUtil.refreshSession())},t.prototype.onAccessTokenNearingExpiry=function(){var t=this,n=Object(J.defer)((function(){return t.getSession()})),r=new J.Observable((function(t){document.addEventListener("resume",(function(){setTimeout((function(){t.next()}),0)}),!1)})).pipe(Object(dt.mergeMap)((function(){return t.getSession()})));return Object(J.merge)(n,r).pipe(Object(dt.map)((function(t){return!(!t||!t.accessTokenExpiresOn)&&t.accessTokenExpiresOn-Date.now()<e.ACCESS_TOKEN_NEARING_EXPIRY_DELTA})),Object(dt.distinctUntilChanged)())},t.ACCESS_TOKEN_NEARING_EXPIRY_DELTA=36e5,t=e=va([Object(R.injectable)(),_a(0,Object(R.inject)(Q.SDK_CONFIG)),_a(1,Object(R.inject)(Q.API_SERVICE)),_a(2,Object(R.inject)(Q.SHARED_PREFERENCES)),_a(3,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),ga("design:paramtypes",[Object,Object,Object,Object])],t)}(),Sa=function(){function t(t,e,n,r){this.apiService=t,this.frameworkServiceConfig=e,this.fileService=n,this.cachedItemStore=r,this.CHANNEL_FILE_KEY_PREFIX="channel-",this.CHANNEL_LOCAL_KEY="channel-",this.GET_FRAMEWORK_DETAILS_ENDPOINT="/read"}return t.prototype.handle=function(t){var e=this;return this.cachedItemStore[t.from===Wr.SERVER?"get":"getCached"](t.channelId,this.CHANNEL_LOCAL_KEY,"ttl_"+this.CHANNEL_LOCAL_KEY,(function(){return e.fetchFromServer(t)}),(function(){return e.fetchFromFile(t)})).pipe(Object(dt.map)((function(t){return t.frameworks&&t.frameworks.sort((function(t,e){return t.name.localeCompare(e.name)})),t})))},t.prototype.fetchFromServer=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.frameworkServiceConfig.channelApiPath+this.GET_FRAMEWORK_DETAILS_ENDPOINT+"/"+t.channelId).withBearerToken(!0).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result.channel})))},t.prototype.fetchFromFile=function(t){var e=ci.getAssetPath()+this.frameworkServiceConfig.channelConfigDirPath,n=this.CHANNEL_FILE_KEY_PREFIX+t.channelId+".json";return Object(J.from)(this.fileService.readFileFromAssets(e.concat("/",n))).pipe(Object(dt.map)((function(t){return JSON.parse(t).result.channel})))},t}(),Oa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Aa=function(){function t(){}return t.prepareFrameworkCategoryAssociations=function(t){return t.categories?(t.categories=t.categories.map((function(e,n){return e.terms?Oa({},e,{terms:e.terms.map((function(e){return e.associations?(e.associations=e.associations.filter((function(e){return n>=t.categories.length-1||e.category===t.categories[n+1].code})),e):e}))}):e})),Oa({},t)):t},t.prepareFrameworkTranslations=function(e,n){return e.name=t.getTranslatedValue(e.translations,n,e.name),e.categories&&(e.categories=e.categories.map((function(e){return e.name=t.getTranslatedValue(e.translations,n,e.name),e.terms&&(e.terms=e.terms.map((function(e){return e.name=t.getTranslatedValue(e.translations,n,e.name),e}))),e}))),e},t.prepareFrameworkCategoryTranslations=function(e,n){return e.name=t.getTranslatedValue(e.translations,n,e.name),e.terms&&(e.terms=e.terms.map((function(e){return e.name=t.getTranslatedValue(e.translations,n,e.name),e}))),e},t.getTranslatedValue=function(t,e,n){return t&&JSON.parse(t)[e]||n},t}(),Ta=function(){function t(t,e,n,r,i){this.frameworkService=t,this.apiService=e,this.frameworkServiceConfig=n,this.fileService=r,this.cachedItemStore=i,this.FRAMEWORK_FILE_KEY_PREFIX="framework-",this.FRAMEWORK_LOCAL_KEY="framework-",this.GET_FRAMEWORK_DETAILS_ENDPOINT="/read"}return t.prototype.handle=function(t){var e=this;return Object(J.iif)((function(){return!!t.frameworkId}),Object(J.defer)((function(){return e.cachedItemStore[t.from===Wr.SERVER?"get":"getCached"](t.frameworkId,e.FRAMEWORK_LOCAL_KEY,"ttl_"+e.FRAMEWORK_LOCAL_KEY,(function(){return e.fetchFromServer(t)}),(function(){return e.fetchFromFile(t)}))})),Object(J.defer)((function(){return e.frameworkService.getDefaultChannelDetails().pipe(Object(dt.mergeMap)((function(n){return e.frameworkService.getFrameworkDetails({from:t.from,frameworkId:n.defaultFramework,requiredCategories:t.requiredCategories})})))})))},t.prototype.fetchFromServer=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.frameworkServiceConfig.frameworkApiPath+this.GET_FRAMEWORK_DETAILS_ENDPOINT+"/"+t.frameworkId).withParameters({categories:t.requiredCategories.join(",")}).withBearerToken(!0).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result.framework})),Object(dt.map)((function(t){return Aa.prepareFrameworkCategoryAssociations(t)})))},t.prototype.fetchFromFile=function(t){var e=ci.getAssetPath()+this.frameworkServiceConfig.frameworkConfigDirPath,n=this.FRAMEWORK_FILE_KEY_PREFIX+t.frameworkId+".json";return Object(J.from)(this.fileService.readFileFromAssets(e.concat("/",n))).pipe(Object(dt.map)((function(t){return JSON.parse(t).result.framework})),Object(dt.map)((function(t){return Aa.prepareFrameworkCategoryAssociations(t)})))},t}(),Na=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ca=function(t){function e(n){var r=t.call(this,n,"NO_ACTIVE_CHANNEL_FOUND_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return Na(e,t),e}(ye),Ia=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ra=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Pa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},La=function(t,e){return function(n,r){e(n,r,t)}},Da=function(){function t(t,e,n,r,i,o){this.sdkConfig=t,this.fileService=e,this.apiService=n,this.cachedItemStore=r,this.sharedPreferences=i,this.systemSettingsService=o}var e;return e=t,Object.defineProperty(t.prototype,"activeChannelId",{get:function(){return this._activeChannelId},enumerable:!0,configurable:!0}),t.prototype.preInit=function(){var t=this;return this.getActiveChannelId().pipe(Object(dt.tap)((function(e){return t._activeChannelId=e})),Object(dt.mapTo)(void 0),Object(dt.catchError)((function(e){if(e instanceof Ca)return t.setActiveChannelId(t.sdkConfig.apiConfig.api_authentication.channelId);throw e})))},t.prototype.getDefaultChannelId=function(){var t=this;return Object(J.iif)((function(){return!t.sdkConfig.frameworkServiceConfig.overriddenDefaultChannelId}),Object(J.defer)((function(){return t.systemSettingsService.getSystemSettings({id:t.sdkConfig.frameworkServiceConfig.systemSettingsDefaultChannelIdKey}).pipe(Object(dt.map)((function(t){return t.value})))})),Object(J.defer)((function(){return Object(J.of)(t.sdkConfig.frameworkServiceConfig.overriddenDefaultChannelId)})))},t.prototype.getDefaultChannelDetails=function(t){var e=this;return void 0===t&&(t={from:Wr.CACHE}),this.systemSettingsService.getSystemSettings({id:this.sdkConfig.frameworkServiceConfig.systemSettingsDefaultChannelIdKey}).pipe(Object(dt.map)((function(t){return t.value})),Object(dt.mergeMap)((function(n){return e.getChannelDetails({from:t.from,channelId:e.sdkConfig.frameworkServiceConfig.overriddenDefaultChannelId||n})})))},t.prototype.getChannelDetails=function(t){return new Sa(this.apiService,this.sdkConfig.frameworkServiceConfig,this.fileService,this.cachedItemStore).handle(t)},t.prototype.getFrameworkDetails=function(t){return new Ta(this,this.apiService,this.sdkConfig.frameworkServiceConfig,this.fileService,this.cachedItemStore).handle(t)},t.prototype.searchOrganization=function(t){var n=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.sdkConfig.frameworkServiceConfig.searchOrganizationApiPath+e.SEARCH_ORGANIZATION_ENDPOINT).withBody({request:t}).withBearerToken(!0).build();return this.apiService.fetch(n).pipe(Object(dt.map)((function(t){return t.body.result.response})))},t.prototype.getActiveChannelId=function(){return this.sharedPreferences.getString(e.KEY_ACTIVE_CHANNEL_ID).pipe(Object(dt.map)((function(t){if(!t)throw new Ca("No Active channel ID set in preferences");return t})))},t.prototype.setActiveChannelId=function(t){return this._activeChannelId=t,vt.CsModule.instance.isInitialised&&vt.CsModule.instance.updateConfig(Ia({},vt.CsModule.instance.config,{core:Ia({},vt.CsModule.instance.config.core,{global:Ia({},vt.CsModule.instance.config.core.global,{channelId:t})})})),this.sharedPreferences.putString(e.KEY_ACTIVE_CHANNEL_ID,t)},t.KEY_ACTIVE_CHANNEL_ID=B.KEY_ACTIVE_CHANNEL_ID,t.SEARCH_ORGANIZATION_ENDPOINT="/search",t=e=Ra([Object(R.injectable)(),La(0,Object(R.inject)(Q.SDK_CONFIG)),La(1,Object(R.inject)(Q.FILE_SERVICE)),La(2,Object(R.inject)(Q.API_SERVICE)),La(3,Object(R.inject)(Q.CACHED_ITEM_STORE)),La(4,Object(R.inject)(Q.SHARED_PREFERENCES)),La(5,Object(R.inject)(Q.SYSTEM_SETTINGS_SERVICE)),Pa("design:paramtypes",[Object,Object,Object,Object,Object,Object])],t)}();!function(t){t.BOARD="board",t.MEDIUM="medium",t.GRADE_LEVEL="gradeLevel",t.SUBJECT="subject",t.TOPIC="topic",t.PURPOSE="purpose"}(Co||(Co={}));var ja,ka=function(){function t(){}return t.DEFAULT_FRAMEWORK_CATEGORIES=[Co.BOARD,Co.MEDIUM,Co.GRADE_LEVEL,Co.SUBJECT],t.COURSE_FRAMEWORK_CATEGORIES=[Co.TOPIC,Co.PURPOSE,Co.MEDIUM,Co.GRADE_LEVEL,Co.SUBJECT],t}(),Ua=n(13),xa=n.n(Ua),Ba=n(18),Fa=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Va=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},qa=function(){function t(t,e,n){this.frameworkUtilService=t,this.frameworkService=e,this.sharedPreferences=n}return t.prototype.handle=function(t){var e=this;return(t.frameworkId?e.getTranslatedFrameworkDetails(t.frameworkId,t.requiredCategories,t.language):e.getActiveChannelTranslatedDefaultFrameworkDetails(t)).pipe(Object(dt.tap)((function(t){return Fa(e,void 0,void 0,(function(){return Va(this,(function(e){switch(e.label){case 0:return[4,this.sharedPreferences.putString(B.KEY_ACTIVE_CHANNEL_ACTIVE_FRAMEWORK_ID,t.identifier).toPromise()];case 1:return[2,e.sent()]}}))}))})),Object(dt.map)((function(n){var r=[];if(r=!t.prevCategoryCode&&t.currentCategoryCode?e.getCategoryTerms(n,t).toArray():e.getCategoryAssociationTerms(n,t).toArray(),"gradeLevel"===t.currentCategoryCode){var i=r.reduce((function(t,e){return e.index&&e.index>t?e.index:t}),0);r.sort((function(t,e){return(t.index||i+1)-(e.index||i+1)}))}else r.sort((function(t,e){return t.name.localeCompare(e.name)}));var o=r.indexOf(r.find((function(t){return"Others"===t.name})));if(o>=0&&o!==r.length){var a=r[r.length-1];r[r.length-1]=r[o],r[o]=a}return r})))},t.prototype.getActiveChannelTranslatedDefaultFrameworkDetails=function(t){var e=this;return this.frameworkUtilService.getActiveChannel({from:t.from}).pipe(Object(dt.mergeMap)((function(n){return e.getTranslatedFrameworkDetails(n.defaultFramework,t.requiredCategories,t.language,t.from)})))},t.prototype.getTranslatedFrameworkDetails=function(t,e,n,r){return this.frameworkService.getFrameworkDetails({from:r,frameworkId:t,requiredCategories:e}).pipe(Object(dt.map)((function(t){return Aa.prepareFrameworkTranslations(t,n)})))},t.prototype.getAllCategoriesTermsSet=function(t){return t.categories?t.categories.reduce((function(t,e){return t.concat([e.terms||[]])}),[]).reduce((function(t,e){return t.concat(e)}),[]).reduce((function(t,e){return t.add(e),t}),new xa.a((function(t){return Object(Ba.makeString)(t)}))):new xa.a},t.prototype.getCategoryTerms=function(t,e){return t.categories.find((function(t){return t.code===e.currentCategoryCode})).terms.reduce((function(t,e){return t.add(e),t}),new xa.a((function(t){return Object(Ba.makeString)(t)})))},t.prototype.getCategoryAssociationTerms=function(t,e){var n=this;if(!t.categories)return new xa.a;var r=t.categories.find((function(t){return t.code===e.prevCategoryCode})).terms;if(!r)return new xa.a;var i=r.filter((function(t){return e.selectedTermsCodes.find((function(e){return e===t.code}))})).map((function(t){return t.associations||[]}));return i.some((function(t){return 0===t.length}))?t.categories.find((function(t){return t.code===e.currentCategoryCode})).terms.reduce((function(t,e){return t.add(e),t}),new xa.a((function(t){return Object(Ba.makeString)(t)}))):i.reduce((function(t,e){return t.concat(e)}),[]).reduce((function(t,e){return t.add(e),t}),new xa.a((function(t){return Object(Ba.makeString)(t)}))).toArray().map((function(e){return n.getAllCategoriesTermsSet(t).toArray().find((function(t){return t.identifier===e.identifier}))})).reduce((function(t,e){return t.add(e),t}),new xa.a((function(t){return Object(Ba.makeString)(t)})))},t}(),Ya=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Ga=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ha=function(t,e){return function(n,r){e(n,r,t)}},za=function(){function t(t,e,n){this.sharedPreferences=t,this.frameworkService=e,this.profileService=n}return t.prototype.getActiveChannel=function(t){var e=this;return void 0===t&&(t={from:Wr.CACHE}),this.frameworkService.getActiveChannelId().pipe(Object(dt.mergeMap)((function(n){return e.frameworkService.getChannelDetails({from:t.from,channelId:n})})))},t.prototype.getActiveChannelSuggestedFrameworkList=function(t){var e=this;return this.profileService.getActiveSessionProfile({requiredFields:[]}).pipe(Object(dt.mergeMap)((function(n){return Object(J.iif)((function(){return!!n.serverProfile&&!t.ignoreActiveChannel}),Object(J.defer)((function(){return e.getActiveChannel({from:t.from})})),Object(J.defer)((function(){return e.frameworkService.getDefaultChannelDetails({from:t.from})})))})),Object(dt.mergeMap)((function(n){return n.frameworks?Object(J.of)(n.frameworks).pipe(Object(dt.map)((function(e){return e.map((function(t){return Aa.prepareFrameworkCategoryAssociations(t)})).map((function(e){return Aa.prepareFrameworkTranslations(e,t.language)}))}))):e.frameworkService.getFrameworkDetails({from:t.from,frameworkId:n.defaultFramework,requiredCategories:t.requiredCategories}).pipe(Object(dt.map)((function(t){return t.index=0,[t]})))})))},t.prototype.getFrameworkCategoryTerms=function(t){return new qa(this,this.frameworkService,this.sharedPreferences).handle(t)},t=Ya([Object(R.injectable)(),Ha(0,Object(R.inject)(Q.SHARED_PREFERENCES)),Ha(1,Object(R.inject)(Q.FRAMEWORK_SERVICE)),Ha(2,Object(R.inject)(Q.PROFILE_SERVICE)),Ga("design:paramtypes",[Object,Object,Object])],t)}(),Ka=function(){function t(t){this.dbService=t}return t.prototype.getContentMarker=function(t,e){var n=this,r="SELECT * FROM "+tn.TABLE_NAME+"\n "+Cr.getUidnIdentifierFiler(e,t)+"\n ORDER BY "+tn.COLUMN_NAME_EPOCH_TIMESTAMP+" DESC ";return this.dbService.execute(r).pipe(Object(dt.map)((function(t){return n.mapDBEntriesToContentMarkerDetails(t)})))},t.prototype.mapDBEntriesToContentMarkerDetails=function(t){return t.map((function(t){return{contentId:t[tn.COLUMN_NAME_CONTENT_IDENTIFIER],uid:t[tn.COLUMN_NAME_UID],extraInfoMap:t[tn.COLUMN_NAME_EXTRA_INFO]&&JSON.parse(t[tn.COLUMN_NAME_EXTRA_INFO]),marker:t[tn.COLUMN_NAME_MARKER]}}))},t}(),Wa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Xa=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ja=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Za=We.COLUMN_NAME_MIME_TYPE,Qa=We.COLUMN_NAME_VISIBILITY,$a=function(){function t(t,e,n,r,i,o){this.contentFeedbackService=t,this.profileService=e,this.apiService=n,this.contentServiceConfig=r,this.dbService=i,this.eventsBusService=o,this.GET_CONTENT_DETAILS_ENDPOINT="/read"}return t.getReadContentQuery=function(t){return{table:We.TABLE_NAME,selection:(new Qn).where("? = ?").args([We.COLUMN_NAME_IDENTIFIER,t]).end().build(),limit:"1"}},t.isUnit=function(t){return t[Za]===Un.COLLECTION&&t[Qa]===xn.PARENT},t.prototype.handle=function(e){var n=this;return e.emitUpdateIfAny=void 0===e.emitUpdateIfAny||e.emitUpdateIfAny,this.fetchFromDB(e.contentId).pipe(Object(dt.mergeMap)((function(r){return r?Object(J.of)(Rr.mapContentDBEntryToContent(r)).pipe(Object(dt.mergeMap)((function(t){return"string"==typeof t.contentData.originData&&(t.contentData.originData=Cr.getParseErrorObject(t.contentData.originData)),t.contentData.trackable&&"string"==typeof t.contentData.trackable&&(t.contentData.trackable=JSON.parse(t.contentData.trackable)),n.decorateContent({content:t,attachFeedback:e.attachFeedback,attachContentAccess:e.attachContentAccess,attachContentMarker:e.attachContentMarker})})),Object(dt.tap)((function(i){return Xa(n,void 0,void 0,(function(){var n,o;return Ja(this,(function(a){switch(a.label){case 0:return!e.emitUpdateIfAny||t.isUnit(r)?[2]:(!1,(n=r[We.COLUMN_NAME_SERVER_DATA]&&JSON.parse(r[We.COLUMN_NAME_SERVER_DATA]))&&n.streamingUrl||!0,[4,this.fetchFromServer(e).toPromise()]);case 1:return o=a.sent(),r[We.COLUMN_NAME_SERVER_DATA]=JSON.stringify(o),r[We.COLUMN_NAME_SERVER_LAST_UPDATED_ON]=o.lastUpdatedOn,r[We.COLUMN_NAME_AUDIENCE]=Cr.readAudience(o),[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" =?",selectionArgs:[r[We.COLUMN_NAME_IDENTIFIER]],modelJson:r}).toPromise()];case 2:return a.sent(),Cr.isUpdateAvailable(o,i.contentData)&&this.eventsBusService.emit({namespace:$.CONTENT,event:{type:Kn.UPDATE,payload:{contentId:i.contentData.identifier,size:o.size}}}),o&&this.eventsBusService.emit({namespace:$.CONTENT,event:{type:Kn.SERVER_CONTENT_DATA,payload:{contentId:o.identifier,streamingUrl:o.streamingUrl,licenseDetails:o.licenseDetails,size:o.size,serverContentData:o}}}),[2]}}))}))}))):n.fetchAndDecorate(e)})))},t.prototype.fetchFromDB=function(t){return this.dbService.read({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[t],limit:"1"}).pipe(Object(dt.map)((function(t){return t[0]})))},t.prototype.fetchFromDBForAll=function(t){return this.dbService.read({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" IN ("+t+")"})},t.prototype.fetchFromServer=function(t){switch(t.objectType){case"QuestionSet":return this.apiService.fetch((new P.CsRequest.Builder).withHost(this.contentServiceConfig.host).withType(P.CsHttpRequestType.GET).withPath(this.contentServiceConfig.questionSetReadApiPath+this.GET_CONTENT_DETAILS_ENDPOINT+"/"+t.contentId).withBearerToken(!1).build()).pipe(Object(dt.map)((function(t){return t.body.result.questionset})));case"Question":return this.apiService.fetch((new P.CsRequest.Builder).withHost(this.contentServiceConfig.host).withType(P.CsHttpRequestType.GET).withPath(this.contentServiceConfig.questionReadApiPath+this.GET_CONTENT_DETAILS_ENDPOINT+"/"+t.contentId).withBearerToken(!1).build()).pipe(Object(dt.map)((function(t){return t.body.result.question})));default:return this.apiService.fetch((new P.CsRequest.Builder).withHost(this.contentServiceConfig.host).withType(P.CsHttpRequestType.GET).withPath(this.contentServiceConfig.apiPath+this.GET_CONTENT_DETAILS_ENDPOINT+"/"+t.contentId).withParameters({licenseDetails:"name,url,description"}).withBearerToken(!0).build()).pipe(Object(dt.map)((function(t){return t.body.result.content})))}},t.prototype.fetchAndDecorate=function(t){var e=this;return this.fetchFromServer(t).pipe(Object(dt.map)((function(t){return Rr.mapServerResponseToContent(t)})),Object(dt.mergeMap)((function(n){return e.decorateContent({content:n,attachFeedback:t.attachFeedback,attachContentAccess:t.attachContentAccess,attachContentMarker:t.attachContentMarker})})))},t.prototype.decorateContent=function(t){var e=this;return Object(J.of)(t.content).pipe(Object(dt.mergeMap)((function(n){return t.attachContentAccess?e.attachContentAccess(n):Object(J.of)(n)})),Object(dt.mergeMap)((function(n){return t.attachFeedback?e.attachFeedback(n):Object(J.of)(n)})),Object(dt.mergeMap)((function(n){return t.attachContentMarker?e.attachContentMarker(n):Object(J.of)(n)})))},t.prototype.attachContentAccess=function(t){var e=this;return this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){var r=n.uid;return e.profileService.getAllContentAccess({contentId:t.identifier,uid:r}).pipe(Object(dt.map)((function(e){return Wa({},t,{contentAccess:e})})))})))},t.prototype.attachFeedback=function(t){var e=this;return this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){var r=n.uid;return e.contentFeedbackService.getFeedback({contentId:t.identifier,uid:r}).pipe(Object(dt.map)((function(e){return Wa({},t,{contentFeedback:e})})))})))},t.prototype.attachContentMarker=function(t){var e=this;return this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){var r=n.uid;return new Ka(e.dbService).getContentMarker(t.identifier,r).pipe(Object(dt.map)((function(e){return Wa({},t,{contentMarkers:e})})))})))},t}(),ts=function(){function t(t){this._stack=t||[]}return Object.defineProperty(t.prototype,"count",{get:function(){return this._stack.length},enumerable:!0,configurable:!0}),t.prototype.push=function(t){this._stack.push(t)},t.prototype.pop=function(){return this._stack.pop()},t.prototype.clear=function(){this._stack=[]},t.prototype.isEmpty=function(){return 0===this._stack.length},t.prototype.addAll=function(t){this._stack=this._stack.concat(t)},t}(),es=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ns=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rs=function(){function t(t,e,n,r){this.dbService=t,this.getContentDetailsHandler=e,this.appConfig=n,this.fileService=r}return t.prototype.fetchChildrenOfContent=function(t,e,n,r,i){return es(this,void 0,void 0,(function(){var o,a,s,u,c,f,h,l,d;return ns(this,(function(p){switch(p.label){case 0:return o=Rr.mapContentDBEntryToContent(t),[4,this.getSortedChildrenList(t[We.COLUMN_NAME_LOCAL_DATA],jn.ALL,e)];case 1:if(!(a=p.sent())||!a.length)return[3,7];if((s=(s=[]).concat(i)).push({identifier:t[We.COLUMN_NAME_IDENTIFIER],contentType:t[We.COLUMN_NAME_CONTENT_TYPE],primaryCategory:t[We.COLUMN_NAME_PRIMARY_CATEGORY]}),o.hierarchyInfo=s,!(-1===r||n<=r))return[3,6];u=[],c=0,f=a,p.label=2;case 2:return c<f.length?(h=f[c],l=h,[4,this.fetchChildrenOfContent(l,e,n+1,r,s)]):[3,5];case 3:(d=p.sent()).contentData.appIcon&&!d.contentData.appIcon.startsWith("http")&&(d.contentData.appIcon="_app_file_".concat(d.basePath).concat(d.contentData.appIcon)),u.push(d),p.label=4;case 4:return c++,[3,2];case 5:o.children=u,p.label=6;case 6:return[3,8];case 7:o.hierarchyInfo=i,p.label=8;case 8:return[2,o]}}))}))},t.prototype.getContentsKeyList=function(t){return es(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u;return ns(this,(function(c){switch(c.label){case 0:e=[],n=new ts,r=[],i="",n.push(t),c.label=1;case 1:return n.isEmpty()?[3,4]:(o=n.pop(),Cr.hasChildren(o[We.COLUMN_NAME_LOCAL_DATA])?[4,this.getSortedChildrenListOld(o[We.COLUMN_NAME_LOCAL_DATA],jn.ALL)]:[3,3]);case 2:c.sent().forEach((function(t){n.push(t),r.push(o[We.COLUMN_NAME_IDENTIFIER].concat("/",t[We.COLUMN_NAME_IDENTIFIER]))})),c.label=3;case 3:if(i){for(a=void 0,s=i.split("/").length-1;s>=0&&(u=i.split("/")[s],!Ar.contains(r,u.concat("/",o[We.COLUMN_NAME_IDENTIFIER])));s--)i=i.substring(0,i.lastIndexOf("/"));Un.COLLECTION.valueOf()===o[We.COLUMN_NAME_MIME_TYPE]?i=i+"/"+o[We.COLUMN_NAME_IDENTIFIER]:(a=i+"/"+o[We.COLUMN_NAME_IDENTIFIER],e.push(a))}else i=o[We.COLUMN_NAME_IDENTIFIER];return[3,1];case 4:return[2,e]}}))}))},t.prototype.getContentFromDB=function(t,e,n){return es(this,void 0,void 0,(function(){var t,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y,v;return ns(this,(function(g){switch(g.label){case 0:if(t=[],!e)return[3,7];i=e.split("/"),o=i.length,a=!0,p=0,g.label=1;case 1:return p<o-1?[4,this.getContentDetailsHandler.fetchFromDB(i[p]).toPromise()]:[3,4];case 2:if(!(s=g.sent()))return a=!1,[3,4];t.push({identifier:s[We.COLUMN_NAME_IDENTIFIER],contentType:s[We.COLUMN_NAME_CONTENT_TYPE],primaryCategory:s[We.COLUMN_NAME_PRIMARY_CATEGORY]}),g.label=3;case 3:return p++,[3,1];case 4:return a?[4,this.getContentDetailsHandler.fetchFromDB(i[o-1]).toPromise()]:[3,7];case 5:return(u=g.sent())?((r=Rr.mapContentDBEntryToContent(u,n)).hierarchyInfo=t,r.rollup=Cr.getContentRollup(r.identifier,r.hierarchyInfo),c=Cr.readCompatibilityLevel(r.contentData),f=Cr.isCompatible(this.appConfig,c),r.isCompatible=f,h=t.map((function(t){return t.identifier})),l=Ar.joinPreservingQuotes(h),[4,this.getContentDetailsHandler.fetchFromDBForAll(l).toPromise()]):[3,7];case 6:for(d=(d=g.sent()).sort((function(t,e){return h.indexOf(t.identifier)-h.indexOf(e.identifier)})),p=0;p<d.length&&(m=d[p],b=JSON.parse(m[We.COLUMN_NAME_LOCAL_DATA]),y=Cr.isTrackable(b),0!==p||1!==y);p++)if(1===y){m.identifier,(v=JSON.parse(JSON.stringify(t)))&&(v=v.slice(0,p),r.trackableParentInfo={identifier:m.identifier,hierarchyInfo:v});break}g.label=7;case 7:return[2,r]}}))}))},t.prototype.getNextContentIdentifier=function(t,e,n){var r,i="";t.forEach((function(t){i=i?i.concat("/",t.identifier):t.identifier})),i=i.concat("/",e);var o=n.indexOf(i);return o>0&&(r=n[o-1]),r},t.prototype.getPreviousContentIdentifier=function(t,e,n){var r,i="";t.forEach((function(t){i=i?i.concat("/",t.identifier):t.identifier})),i=i.concat("/",e);var o=n.indexOf(i);return-1!==o&&o<n.length-1&&(r=n[o+1]),r},t.prototype.getSortedChildrenListOld=function(t,e){return es(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c;return ns(this,(function(f){if(n=JSON.parse(t),!(r=n.children)||!r.length)return[2,[]];switch(r=r.sort((function(t,e){return t.index-e.index})),i=[],o="",a=0,r.forEach((function(t){i.push(t.identifier),o=o.concat(" WHEN '"+t.identifier+"' THEN "+a),a+=1})),s="",a>0&&(s=s.concat(" ORDER BY CASE "+We.COLUMN_NAME_IDENTIFIER+" "+o+" END")),u="",e){case jn.DOWNLOADED.valueOf():u=" AND "+We.COLUMN_NAME_CONTENT_STATE+"='"+kn.ARTIFACT_AVAILABLE+"'";break;case jn.SPINE.valueOf():u=" AND "+We.COLUMN_NAME_CONTENT_STATE+"='"+kn.ONLY_SPINE+"'";break;case jn.ALL.valueOf():default:u=""}return c="SELECT * FROM "+We.TABLE_NAME+"\n WHERE "+We.COLUMN_NAME_IDENTIFIER+"\n IN ("+Ar.joinPreservingQuotes(i)+") "+u+" "+s,[2,this.dbService.execute(c).toPromise()]}))}))},t.prototype.getSortedChildrenList=function(t,e,n){return es(this,void 0,void 0,(function(){var r,i,o,a,s,u,c,f,h;return ns(this,(function(l){switch(l.label){case 0:if(r=JSON.parse(t),!(i=r.children)||!i.length)return[2,[]];i=i.sort((function(t,e){return t.index-e.index})),o=[],a=0,s=i,l.label=1;case 1:return a<s.length?(u=s[a],(c=n.get(u.identifier))?(o.push(c),[3,4]):[3,2]):[3,5];case 2:return f="SELECT * FROM "+We.TABLE_NAME+"\n WHERE "+We.COLUMN_NAME_IDENTIFIER+" = '"+u.identifier+"'",[4,this.dbService.execute(f).toPromise()];case 3:(h=l.sent()).length&&o.push(h[0]),l.label=4;case 4:return a++,[3,1];case 5:switch(e){case jn.DOWNLOADED.valueOf():o=o.filter((function(t){return t[We.COLUMN_NAME_CONTENT_STATE]=kn.ARTIFACT_AVAILABLE}));break;case jn.SPINE.valueOf():o=o.filter((function(t){return t[We.COLUMN_NAME_CONTENT_STATE]=kn.ONLY_SPINE}));break;case jn.ALL.valueOf():}return[2,o]}}))}))},t.prototype.getChildIdentifiersFromManifest=function(t){return es(this,void 0,void 0,(function(){var e,n,r=this;return ns(this,(function(i){switch(i.label){case 0:return e="file:///"+t,n=[],[4,this.fileService.readAsText(e,zn.MANIFEST.valueOf()).then((function(t){return es(r,void 0,void 0,(function(){var e;return ns(this,(function(r){return console.log("fileContents",JSON.parse(t)),(e=JSON.parse(t).archive.items).shift(),e.forEach((function(t){n.push(t.identifier)})),[2,n]}))}))})).catch((function(t){console.log("getChildIdentifiersFromManifest err",t)}))];case 1:return i.sent(),[2,n]}}))}))},t}(),is=function(){function t(){}return t.getFileExtension=function(t){var e=t.substring(t.lastIndexOf(".")+1,t.length);return e||""},t.getFileName=function(t){return t.substring(t.lastIndexOf("/")+1)},t.getParentDir=function(t){return t.substr(0,t.lastIndexOf("/",t.length-2)).concat("/")},t.getDirectoryName=function(t){var e=t.split("/");return e[e.length-2]},t.getTempDirPath=function(t){return t+"/tmp"},t.isFreeSpaceAvailable=function(t,e,n){var r=10240;return n>0&&(r=n),t>0&&t>e+r},t.getDirecory=function(t){return t.substr(0,t.lastIndexOf("/"))},t}(),os=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},as=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ss=function(){function t(t,e,n){this.dbService=t,this.fileService=e,this.sharedPreferences=n,this.updateNewContentModels=[],this.fileMapList=[]}return t.prototype.deleteAllChildren=function(t,e){return os(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c,f,h=this;return as(this,(function(l){switch(l.label){case 0:return n=!1,r=Cr.getBasePath(t[We.COLUMN_NAME_PATH]),[4,this.fileService.readAsText(r,zn.MANIFEST.valueOf()).then((function(t){return os(h,void 0,void 0,(function(){var r,i,o=this;return as(this,(function(a){switch(a.label){case 0:return(r=JSON.parse(t).archive.items).shift(),i=[],r.forEach((function(t){i.push(t.identifier)})),[4,this.findAllContentsFromDbWithIdentifiers(i)];case 1:return a.sent().forEach((function(t){return os(o,void 0,void 0,(function(){var r;return as(this,(function(i){switch(i.label){case 0:return[4,this.deleteOrUpdateContent(t,!0,e)];case 1:if(i.sent(),n=!0,(r=t[We.COLUMN_NAME_PATH])&&n&&Cr.getFirstPartOfThePathNameOnLastDelimiter(r))try{this.sharedPreferences.putString(V.KEY_LAST_MODIFIED,(new Date).getMilliseconds()+"").toPromise()}catch(t){console.log("Error",t)}return[2]}}))}))})),[2]}}))}))})).catch((function(t){console.log("fileread err",t)}))];case 1:return l.sent(),[4,this.getMetaData(this.fileMapList)];case 2:if(i=l.sent(),!this.updateNewContentModels.length)return[3,7];this.dbService.beginTransaction(),o=0,a=this.updateNewContentModels,l.label=3;case 3:return o<a.length?(s=a[o],c=(u=s)[We.COLUMN_NAME_IDENTIFIER],f=0,i&&(f=i[c]?i[c].size:0),u[We.COLUMN_NAME_SIZE_ON_DEVICE]=f,[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[c],modelJson:u}).toPromise()]):[3,6];case 4:l.sent(),l.label=5;case 5:return o++,[3,3];case 6:this.dbService.endTransaction(!0),l.label=7;case 7:return[2]}}))}))},t.prototype.deleteOrUpdateContent=function(t,e,n){return os(this,void 0,void 0,(function(){var r,i,o,a,s,u,c,f,h,l;return as(this,(function(d){switch(d.label){case 0:return r=t[We.COLUMN_NAME_REF_COUNT],o=t[We.COLUMN_NAME_VISIBILITY],a=t[We.COLUMN_NAME_MIME_TYPE],s=t[We.COLUMN_NAME_PATH],n?(r>1&&o===xn.DEFAULT.valueOf()&&(r-=1,o=xn.PARENT.valueOf()),i=a===Un.COLLECTION?kn.ARTIFACT_AVAILABLE.valueOf():kn.ONLY_SPINE.valueOf()):(a===Un.COLLECTION.valueOf()&&r>1||r>1&&e?i=kn.ARTIFACT_AVAILABLE.valueOf():(o===xn.DEFAULT.valueOf()&&(o=xn.PARENT.valueOf()),i=kn.ONLY_SPINE.valueOf()),r-=1),s?(i===kn.ONLY_SPINE.valueOf()&&(u=t[We.COLUMN_NAME_LOCAL_DATA],c=u&&JSON.parse(u),f="",h="",u&&(f=c.appIcon?is.getFileName(c.appIcon):"",h=c.itemSetPreviewUrl?is.getFileName(c.itemSetPreviewUrl):""),this.rm(Cr.getBasePath(s),[f,h].join(":"))),t[We.COLUMN_NAME_VISIBILITY]=o,t[We.COLUMN_NAME_REF_COUNT]=Cr.addOrUpdateRefCount(r),t[We.COLUMN_NAME_CONTENT_STATE]=i,e?[3,2]:(t[We.COLUMN_NAME_SIZE_ON_DEVICE]=0,[4,this.dbService.update({table:We.TABLE_NAME,modelJson:t,selection:We.COLUMN_NAME_IDENTIFIER+" =?",selectionArgs:[t[We.COLUMN_NAME_IDENTIFIER]]}).pipe(Object(dt.map)((function(t){return t>0}))).toPromise()])):[3,3];case 1:return d.sent(),[3,3];case 2:(l={}).identifier=t[We.COLUMN_NAME_IDENTIFIER],l.path=Cr.getBasePath(s),this.fileMapList.push(l),this.updateNewContentModels.push(t),d.label=3;case 3:return[2]}}))}))},t.prototype.findAllContentsFromDbWithIdentifiers=function(t){var e=Ar.joinPreservingQuotes(t),n=" WHERE "+We.COLUMN_NAME_IDENTIFIER+" IN ("+e+") AND "+We.COLUMN_NAME_REF_COUNT+" > 0",r="SELECT * FROM "+We.TABLE_NAME+" "+n;return this.dbService.execute(r).toPromise()},t.prototype.rm=function(t,e){return new Promise((function(n,r){try{sbutility.rm(t,e,(function(t){n(t)}),(function(t){console.error(t),r(!1)}))}catch(t){console.error(t),r(!1)}}))},t.prototype.getMetaData=function(t){return os(this,void 0,void 0,(function(){return as(this,(function(e){return[2,new Promise((function(e,n){sbutility.getMetaData(t,(function(t){e(t)}),(function(t){console.error(t),n(t)}))}))]}))}))},t}(),us=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},cs=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},fs=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},hs=function(){function t(t,e,n){this.appConfig=t,this.contentServiceConfig=e,this.telemetryService=n}return t.prototype.getSearchCriteria=function(t){var e,n=this,r=t.request,i=r.query,o=r.exists,a=r.limit,s=r.offset;r.hasOwnProperty("mode")&&"soft"===r.mode&&(e="soft");var u=[];if(r.hasOwnProperty("sort_by")){var c=r.sort_by;Object.keys(c).forEach((function(t){var e={sortAttribute:t,sortOrder:n.getSortOrder(String(c[t]))};u.push(e)}))}var f,h,l,d,p=us({},i?{query:i}:{},o?{exists:o}:{},{mode:e,sortCriteria:u,searchType:this.getSearchType(String(r.searchType)),offset:s||0,limit:a||100});if(r.hasOwnProperty("filters")){var m=r.filters;m.contentType&&(f=m.contentType),m.primaryCategory&&(h=m.primaryCategory),l=this.mapFilterValues(m,p),p.impliedFilters=l,p.contentTypes=f,p.primaryCategories=h}return r.hasOwnProperty("facets")&&(d=r.facets,p.facets=d),p},t.prototype.getSearchContentRequest=function(t){return{query:t.query,offset:t.offset,limit:t.limit,mode:t.mode,exists:t.exists&&t.exists.length>0?t.exists:[],facets:t.facets&&t.facets.length>0?t.facets:[],sort_by:this.getSortByRequest(t.sortCriteria),filters:this.getSearchFilter(t),fields:t.fields}},t.prototype.getSearchFilter=function(t){return t.searchType.valueOf()===Dn.SEARCH.valueOf()?this.getSearchRequest(t):t.searchType.valueOf()===Dn.FILTER.valueOf()?this.getFilterRequest(t):{}},t.prototype.getFilterRequest=function(t){var e={};return this.addFiltersToRequest(e,t.facetFilters),this.addFiltersToRequest(e,t.impliedFilters),t.impliedFiltersMap&&t.impliedFiltersMap.length>0&&t.impliedFiltersMap.forEach((function(t){e=us({},e,t)})),e},t.prototype.addFiltersToRequest=function(t,e){e&&e.length&&e.forEach((function(e){var n=[];if(e.values.forEach((function(t){t.apply&&n.push(t.name)})),n.length){var r=e.name;switch(e.name){case"board":r="se_boards";break;case"medium":r="se_mediums";break;case"gradeLevel":case"grade":r="se_gradeLevels"}t[r]=n}}))},t.prototype.getSearchRequest=function(t){var e=this,n=us({audience:t.audience&&t.audience.length>0?t.audience:[],status:t.contentStatusArray,objectType:["Content","QuestionSet"],contentType:t.contentTypes&&t.contentTypes.length>0?t.contentTypes:[],primaryCategory:t.primaryCategories&&t.primaryCategories.length>0?t.primaryCategories:[]},t.keywords&&t.keywords.length?{keywords:t.keywords}:{},t.dialCodes&&t.dialCodes.length?{dialcodes:t.dialCodes}:{},t.createdBy&&t.createdBy.length?{createdBy:t.createdBy}:{},t.grade&&t.grade.length?{se_gradeLevels:t.grade}:{},{se_mediums:t.medium&&t.medium.length>0?t.medium:[],se_boards:t.board&&t.board.length>0?t.board:[],language:t.language&&t.language.length>0?t.language:[],topic:t.topic&&t.topic.length>0?t.topic:[],purpose:t.purpose&&t.purpose.length>0?t.purpose:[],channel:t.channel&&t.channel.length>0?t.channel:[],mimeType:t.mimeType&&t.mimeType.length>0?t.mimeType:[],subject:t.subject&&t.subject.length>0?t.subject:[]});return t.impliedFiltersMap&&t.impliedFiltersMap.forEach((function(t){Object.keys(t).forEach((function(e){n[e]=t[e]}))})),t.impliedFilters&&t.impliedFilters.forEach((function(t){Object.keys(t).forEach((function(r){var i=t.values,o=t.name,a=e.getImpliedFilterValues(i);if(n[o]||(n[o]=[]),n[o]){var s=n[o].concat(a);s&&(n[o]=s.filter((function(t,e){return s.indexOf(t)===e})))}}))})),n},t.prototype.getImpliedFilterValues=function(t){var e=[];return t?(t.forEach((function(t){t.apply&&e.push(t.name)})),e):[]},t.prototype.getSortByRequest=function(t){return t?t.reduce((function(t,e){return t[e.sortAttribute]=e.sortOrder,t}),{}):{}},t.prototype.createFilterCriteria=function(t,e,n){var r=this,i=[],o={query:t.query,limit:t.limit,offset:t.offset,facets:t.facets,contentTypes:t.contentTypes,primaryCategories:t.primaryCategories,sortCriteria:t.sortCriteria&&t.sortCriteria.length?t.sortCriteria:[],mode:"soft"===t.mode?"soft":"hard"};return e?(e.forEach((function(t){var e=n?n[t.name]:[],o=t.values,a=r.getSortedFilterValuesWithAppliedFilters(o,e);if(t.name){var s={name:t.name,values:a};i.push(s)}delete n[t.name]})),o.facetFilters=i,o.impliedFilters=this.mapFilterValues(n,o),o):o},t.prototype.addFilterValue=function(t,e){t&&t.length>0&&t.forEach((function(t){var n=t.name;t.values,e[n]}))},t.prototype.getFilterValuesWithAppliedFilter=function(t,e){return t.forEach((function(t){var n=!1;e&&e.indexOf(name)>-1&&(n=!0),t.apply=n})),t},t.prototype.mapSearchResponse=function(t,e,n){var r=(e.result.content||[]).concat(e.result.QuestionSet||[]);return{id:e.id,responseMessageId:e.params.resmsgid,filterCriteria:this.createFilterCriteria(t,e.result.facets,n.filters),request:n,contentDataList:r,count:e.result.count,collectionDataList:e.result.collections?e.result.collections:[]}},t.prototype.getContentSearchFilter=function(t,e,n){return void 0===n&&(n=[]),{filters:{identifier:t.filter((function(e,n){return t.indexOf(e)===n})),status:e,objectType:["Content"]},fields:n.concat(["downloadUrl","variants","mimeType","contentType","primaryCategory","pkgVersion"])}},t.prototype.getDownloadUrl=function(t,e){return cs(this,void 0,void 0,(function(){var n,r,i,o;return fs(this,(function(a){switch(a.label){case 0:try{i=t.variants&&"string"==typeof t.variants?JSON.parse(t.variants):t.variants}catch(e){i=t.variants}return t.mimeType===Un.COLLECTION.valueOf()?i&&i.online?r="online":i&&i.spine&&(r="spine"):t.mimeType===Un.QUESTION_SET&&(i&&i.full?r="full":i&&i.online&&(r="online")),i&&r&&i[r]?(o=i[r],n=o&&o.ecarUrl,[4,this.buildContentLoadingEvent(r,e,t.primaryCategory||t.contentType,t.pkgVersion)]):[3,2];case 1:a.sent(),a.label=2;case 2:return n?[3,4]:(n=t.downloadUrl.trim(),[4,this.buildContentLoadingEvent("full",e,t.primaryCategory||t.contentType,t.pkgVersion)]);case 3:a.sent(),a.label=4;case 4:return[2,n]}}))}))},t.prototype.buildContentLoadingEvent=function(t,e,n,r){var i=new oe;return i.type=Dt.OTHER,i.subType=t,i.pageId="ImportContent",i.id="ImportContent",i.objId=e.contentId,i.objType=n,i.objVer=r,i.rollup=e.rollUp,i.correlationData=e.correlationData,this.telemetryService.interact(i).toPromise()},t.prototype.getSortOrder=function(t){return"asc"===t?Pn.ASC:Pn.DESC},t.prototype.getSearchType=function(t){return"search"===t?Dn.SEARCH:"filter"===t?Dn.FILTER:Dn.SEARCH},t.prototype.getSortedFilterValuesWithAppliedFilters=function(t,e){return t.forEach((function(t){var n=!1;e&&e.forEach((function(e){e&&t.name&&t.name.toLowerCase()===e.toLowerCase()&&(n=!0)})),t.apply=n,t.count=qt.parseInt(t.count)})),t},t.prototype.mapFilterValues=function(t,e){var n=[],r=[];return Object.keys(t).forEach((function(e){var i=t[e];if(Array.isArray(i)&&i.length){var o=[];i.forEach((function(t){var e={name:t,apply:!0};o.push(e)})),n.push({name:e,values:o})}else if(i){var a={};a[e]=i,r.push(a)}})),e.impliedFiltersMap=r,n},t}(),ls=function(){function t(){}return t.prototype.getAllLocalContentQuery=function(t){t.primaryCategories&&t.primaryCategories.length||(t.primaryCategories=["Course","Learning Resource","Explanation Content","Teacher Resource","Content Playlist","Digital Textbook","Practice Question Set","eTextBook","Course Assessment"]);var e=t.uid,n=t.resourcesOnly?"":"c."+We.COLUMN_NAME_VISIBILITY+" = '"+xn.DEFAULT.valueOf()+"' AND",r="c."+We.COLUMN_NAME_CONTENT_STATE+" = '"+kn.ARTIFACT_AVAILABLE.valueOf()+"'",i=n+" "+r;if(t.resourcesOnly){i=i+" AND ("+("c."+We.COLUMN_NAME_MIME_TYPE+" != '"+Un.COLLECTION.valueOf()+"'")+")"}else{var o=Ar.joinPreservingQuotes(t.primaryCategories);i=i+" AND ("+("c."+We.COLUMN_NAME_PRIMARY_CATEGORY+" IN("+o.toLowerCase()+")")+")"}var a=this.getAudienceFilter(t.audience),s=this.getPragmaFilter(t.exclPragma,t.pragma),u=this.generateFieldMatchQuery(t);a&&(i=i+" AND ("+a+")"),s&&(i=i+" AND ("+s+")"),u&&(i=i+" AND ("+u+")");var c="WHERE ("+i+")",f="",h=t.resourcesOnly?"":this.generateSortByQuery(t.sortCriteria,e);return t.recentlyViewed?e&&(c="WHERE ("+(i=t.localOnly?"ca."+Je.COLUMN_NAME_UID+" = '"+e+"' AND "+r+"\n AND cm."+We.COLUMN_NAME_MIME_TYPE+" NOT IN ('"+Un.COLLECTION.valueOf()+"', '')":"ca."+Je.COLUMN_NAME_UID+" = '"+e+"'\n AND cm."+We.COLUMN_NAME_MIME_TYPE+" NOT IN ('"+Un.COLLECTION.valueOf()+"', '')")+")",f=this.getRecentlyViewedQuery(c,h,t.limit)):f=e?this.getLocalOnlyQuery(c,h,e):"SELECT c.* FROM "+We.TABLE_NAME+" c "+c+" "+h,f},t.prototype.getAudienceFilter=function(t){var e="";return t&&t.forEach((function(t){e=e.concat(e.length>0?" OR ":"","c."+We.COLUMN_NAME_AUDIENCE+" LIKE '%%"+t+"%%'")})),e},t.prototype.getPragmaFilter=function(t,e){var n="";return t?t.forEach((function(t){n=n.concat(n.length>0?" OR ":"","c."+We.COLUMN_NAME_PRAGMA+" NOT LIKE '%%"+t+"%%'")})):e&&e.forEach((function(t){n=n.concat(n.length>0?" OR ":"","c."+We.COLUMN_NAME_PRAGMA+" LIKE '%%"+t+"%%'")})),n},t.prototype.getRecentlyViewedQuery=function(t,e,n){return"SELECT c.*, ca."+Je.COLUMN_NAME_EPOCH_TIMESTAMP+",\n cm."+tn.COLUMN_NAME_DATA+" FROM "+Je.TABLE_NAME+" ca LEFT JOIN\n "+tn.TABLE_NAME+" cm ON\n (cm."+tn.COLUMN_NAME_UID+" = ca."+Je.COLUMN_NAME_UID+"\n AND cm."+tn.COLUMN_NAME_CONTENT_IDENTIFIER+" = ca."+Je.COLUMN_NAME_CONTENT_IDENTIFIER+")\n LEFT JOIN "+We.TABLE_NAME+" c ON\n c."+We.COLUMN_NAME_IDENTIFIER+" = ca."+Je.COLUMN_NAME_CONTENT_IDENTIFIER+"\n "+t+" "+e+" LIMIT "+n},t.prototype.getLocalOnlyQuery=function(t,e,n){var r="";return r=Array.isArray(n)?"ca."+Je.COLUMN_NAME_UID+" IN ("+Ar.joinPreservingQuotes(n)+")":"ca."+Je.COLUMN_NAME_UID+" ='"+n+"'","SELECT c.*, ca."+Je.COLUMN_NAME_EPOCH_TIMESTAMP+"\n FROM "+We.TABLE_NAME+" c LEFT JOIN "+Je.TABLE_NAME+" ca\n ON c."+We.COLUMN_NAME_IDENTIFIER+" = ca."+Je.COLUMN_NAME_CONTENT_IDENTIFIER+"\n AND "+r+"\n "+t+" "+e},t.prototype.generateSortByQuery=function(t,e){var n=this,r="",i=0;return t||((t=[]).push({sortAttribute:"lastUsedOn",sortOrder:Pn.DESC}),t.push({sortAttribute:"localLastUpdatedOn",sortOrder:Pn.DESC})),t.forEach((function(t){t&&("lastUsedOn"===t.sortAttribute.valueOf()&&e?(r=n.generateOrderByQuery(i,r," ca."+Je.COLUMN_NAME_EPOCH_TIMESTAMP,t.sortOrder.valueOf()),i++):"localLastUpdatedOn"===t.sortAttribute.valueOf()?(r=n.generateOrderByQuery(i,r," c."+We.COLUMN_NAME_LOCAL_LAST_UPDATED_ON,t.sortOrder.valueOf()),i++):"sizeOnDevice"===t.sortAttribute.valueOf()&&(r=n.generateOrderByQuery(i,r," c."+We.COLUMN_NAME_SIZE_ON_DEVICE,t.sortOrder.valueOf()),i++))})),r},t.prototype.generateOrderByQuery=function(t,e,n,r){return(t>0?e.concat(","):e.concat("ORDER BY")).concat(n+" "+r)},t.prototype.generateFieldMatchQuery=function(t){var e=this;return[{field:"board",column:We.COLUMN_NAME_BOARD},{field:"medium",column:We.COLUMN_NAME_MEDIUM},{field:"grade",column:We.COLUMN_NAME_GRADE},{field:"dialcodes",column:We.COLUMN_NAME_DIALCODES},{field:"childNodes",column:We.COLUMN_NAME_CHILD_NODES}].reduce((function(n,r){var i=r.field,o=r.column;return t[i]&&t[i].length&&n.push(e.generateLikeQuery(t[i],o)),n}),[]).join(" AND ")},t.prototype.generateLikeQuery=function(t,e){for(var n="",r=e+" LIKE ",i=0;i<t.length;i++)n=i<t.length-1?n.concat(r,"'%%~"+t[i].toLowerCase().trim()+"~%%' OR "):n.concat(r,"'%%~"+t[i].toLowerCase().trim()+"~%%' ");return"("+n+")"},t}(),ds=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ps=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ms=We.COLUMN_NAME_LOCAL_DATA,bs=We.COLUMN_NAME_IDENTIFIER,ys=We.COLUMN_NAME_REF_COUNT,vs=function(){function t(t,e,n){this.deviceInfo=t,this.dbService=e,this.fileService=n}return t.prototype.populateItems=function(t){var e=this,n=[],r=[],i=[],o={};t.forEach((function(t){var n=JSON.parse(t[ms]);if(o[t[bs]]=n,Cr.addViralityMetadataIfMissing(n,e.deviceInfo.getDeviceID()),Cr.hasChildren(n)){var a=Cr.getChildContentsIdentifiers(n);i=i.concat(a)}r.push(t[bs])}));try{r.forEach((function(t){var e=o[t];Ar.contains(i,t)&&(e.visibility=xn.PARENT.valueOf()),n.push(e)}))}catch(t){console.log(t)}return n},t.prototype.populateItemList=function(t){var e=this,n=[],r=[],i=[],o={};t.forEach((function(t){if(o[t.identifier]=t,Cr.addViralityMetadataIfMissing(t,e.deviceInfo.getDeviceID()),Cr.hasChildren(t)){var n=Cr.getChildContentsIdentifiers(t);i=i.concat(n)}r.push(t.identifier)}));try{r.forEach((function(t){var e=o[t];Ar.contains(i,t)&&(e.visibility=xn.PARENT.valueOf()),n.push(e)}))}catch(t){console.log(t)}return n},t.prototype.getContentExportDBModelToExport=function(t){return ds(this,void 0,void 0,(function(){var e,n,r,i=this;return ps(this,(function(o){switch(o.label){case 0:return e=[],[4,this.findAllContentsWithIdentifiers(t)];case 1:return n=o.sent(),r=Cr.getBasePath(n[0][We.COLUMN_NAME_PATH]),[4,this.fileService.readAsText(r,zn.MANIFEST.valueOf()).then((function(t){return ds(i,void 0,void 0,(function(){var n,r;return ps(this,(function(i){switch(i.label){case 0:return n=JSON.parse(t).archive.items,r=[],n.forEach((function(t){r.push(t.identifier)})),[4,this.findAllContentsWithIdentifiers(r,!0)];case 1:return e=i.sent(),[2]}}))}))})).catch((function(t){console.log("fileRead error",t)}))];case 2:return o.sent(),[2,Promise.resolve(Cr.deDupe(e,"identifier"))]}}))}))},t.prototype.generateManifestForArchive=function(e){var n={},r={ttl:24};return r.count=e.length,r.items=e,n.id=t.EKSTEP_CONTENT_ARCHIVE,n.ver=t.SUPPORTED_MANIFEST_VERSION,n.ts=et().format("YYYY-MM-DDTHH:mm:ss[Z]"),n.archive=r,n},t.prototype.findAllContentsWithIdentifiers=function(t,e){var n="";e&&t.length&&(n=t.reduce((function(t,e,n){return t+" WHEN '"+e+"' THEN "+n})," ORDER BY CASE "+bs)+" END");var r=Ar.joinPreservingQuotes(t),i=" where "+bs+" in ("+r+") AND "+ys+" > 0",o="select * from "+We.TABLE_NAME+" "+i+" "+n;return this.dbService.execute(o).toPromise()},t.EKSTEP_CONTENT_ARCHIVE="ekstep.content.archive",t.SUPPORTED_MANIFEST_VERSION="1.1",t}(),gs=function(){function t(t,e){this.dbService=t,this.exportHandler=e}return t.prototype.execute=function(e){var n=new P.CsResponse,r=this.exportHandler.populateItems(e.contentModelsToExport);e.items=[],e.manifest={},e.items=e.items.concat(r);var i={ttl:24};return i.count=e.items.length,i.items=e.items,e.manifest.id=t.EKSTEP_CONTENT_ARCHIVE,e.manifest.ver=t.SUPPORTED_MANIFEST_VERSION,e.manifest.ts=et().format(),e.manifest.archive=i,n.body=e,Promise.resolve(n)},t.EKSTEP_CONTENT_ARCHIVE="ekstep.content.archive",t.SUPPORTED_MANIFEST_VERSION="1.1",t}(),_s=function(){function t(t,e){this.fileService=t,this.deviceInfo=e}return t.prototype.execute=function(t){var e=this,n=new P.CsResponse;return this.deviceInfo.getAvailableInternalMemorySize().toPromise().then((function(r){var i=Number(r);if(i>0&&i<1048576)throw n.errorMesg=Gn.EXPORT_FAILED_MEMORY_NOT_SUFFICIENT,n;return e.fileService.writeFile(t.tmpLocationPath,zn.MANIFEST.valueOf(),JSON.stringify(t.manifest),{replace:!0})})).then((function(){return n.body=t,Promise.resolve(n)})).catch((function(){return n.errorMesg=Gn.EXPORT_FAILED_WRITING_MANIFEST,Promise.reject(n)}))},t}(),Es=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ms=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ws=function(){function t(t){this.zipService=t}return t.prototype.execute=function(t){return Es(this,void 0,void 0,(function(){var e,n,r,i,o,a=this;return Ms(this,(function(s){switch(s.label){case 0:e=new P.CsResponse,n=function(e){var n,r,i,o,s,u,c;return Ms(this,(function(f){switch(f.label){case 0:return n=e,r=JSON.parse(n[We.COLUMN_NAME_LOCAL_DATA]),!Cr.isAvailableLocally(n[We.COLUMN_NAME_CONTENT_STATE])||Cr.isOnlineContent(r)||Cr.isInlineIdentity(r.contentDisposition,r.contentEncoding)?[2,"continue"]:(i=r.artifactUrl)?(o=t.tmpLocationPath.concat(i),s=n[We.COLUMN_NAME_PATH],c=[],(u=[]).push(n[We.COLUMN_NAME_IDENTIFIER]),c.push(n[We.COLUMN_NAME_IDENTIFIER].concat("/",zn.MANIFEST.valueOf())),[4,new Promise((function(t,e){a.zipService.zip(s,{target:o},u,c,(function(){t()}),(function(){e()}))}))]):[3,2];case 1:f.sent(),f.label=2;case 2:return[2]}}))},r=0,i=t.contentModelsToExport,s.label=1;case 1:return r<i.length?(o=i[r],[5,n(o)]):[3,4];case 2:s.sent(),s.label=3;case 3:return r++,[3,1];case 4:return e.body=t,[2,Promise.resolve(e)]}}))}))},t}(),Ss=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Os=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},As=function(){function t(t){this.fileService=t}return t.prototype.execute=function(t){return Ss(this,void 0,void 0,(function(){var e,n=this;return Os(this,(function(r){return e=new P.CsResponse,[2,this.fileService.getFreeDiskSpace().then((function(r){n.getFileSize(t.items);return e.body=t,e}))]}))}))},t.prototype.getFileSize=function(t){var e=0;return t&&t.forEach((function(t){t.size&&(e+=Number(t.size))})),e},t}(),Ts=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ns=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Cs=function(){function t(){}return t.prototype.execute=function(t){return Ts(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y,v,g;return Ns(this,(function(_){switch(_.label){case 0:e=new P.CsResponse,_.label=1;case 1:_.trys.push([1,15,,16]),n=0,r=[],null!=t.subContentIds&&t.subContentIds.length>0&&(r=this.excludeContentForSubModule(t.contentModelsToExport,t.subContentIds)),i=t.contentModelsToExport,r&&r.length>0&&(i=r),o=0,a=i,_.label=2;case 2:if(!(o<a.length))return[3,14];s=a[o],u=s,c=t.items[n],f=c.appIcon,h=c.itemSetPreviewUrl,l=0,d=[f,h],_.label=3;case 3:if(!(l<d.length))return[3,8];if(!(p=d[l])||p.startsWith("https:"))return[3,7];_.label=4;case 4:return _.trys.push([4,6,,7]),[4,this.copyFile(u[We.COLUMN_NAME_PATH],t.tmpLocationPath,p)];case 5:return _.sent(),[3,7];case 6:return m=_.sent(),console.error(m),[3,7];case 7:return l++,[3,3];case 8:if(b=c.contentDisposition,y=c.contentEncoding,!Cr.isInlineIdentity(b,y))return[3,12];if(!(v=c.artifactUrl))return[3,12];_.label=9;case 9:return _.trys.push([9,11,,12]),[4,this.copyFile(u[We.COLUMN_NAME_PATH],t.tmpLocationPath,v)];case 10:return _.sent(),[3,12];case 11:return g=_.sent(),console.error(g),[3,12];case 12:n++,_.label=13;case 13:return o++,[3,2];case 14:return e.body=t,[2,e];case 15:throw _.sent(),e.errorMesg=Gn.EXPORT_FAILED_COPY_ASSET,e;case 16:return[2]}}))}))},t.prototype.excludeContentForSubModule=function(t,e){var n=[];return t.forEach((function(t){var r=t.identifier;e&&e.indexOf(r)>-1&&n.push(t)})),n},t.prototype.copyFile=function(t,e,n){return Ts(this,void 0,void 0,(function(){return Ns(this,(function(r){return[2,new Promise((function(r,i){sbutility.copyFile(t,e,n,(function(){r()}),(function(t){console.error(t),r(t)}))}))]}))}))},t}(),Is=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Rs=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Ps=function(){function t(t,e){this.fileService=t,this.zipService=e}return t.prototype.execute=function(e){return Is(this,void 0,void 0,(function(){var n,r,i=this;return Rs(this,(function(o){switch(o.label){case 0:return n=new P.CsResponse,[4,new Promise((function(t,r){i.zipService.zip(e.tmpLocationPath,{target:e.ecarFilePath},[],[],(function(){t()}),(function(){throw n.errorMesg=Gn.EXPORT_FAILED_ECAR_BUNDLE,n}))}))];case 1:return o.sent(),[4,this.fileService.getMetaData(e.ecarFilePath)];case 2:return r=o.sent(),e.metadata[t.FILE_SIZE]=r.size,n.body=e,[2,n]}}))}))},t.FILE_SIZE="FILE_SIZE",t}(),Ls=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ds=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},js=function(){function t(t,e){this.fileService=t,this.zipService=e,this.FILE_SIZE="FILE_SIZE"}return t.prototype.execute=function(t){var e,n=this,r=new P.CsResponse;return this.fileService.getMetaData(t.ecarFilePath).then((function(r){return e=r.size,n.fileService.createDir(t.tmpLocation.concat(ar.generateUniqueId()),!0)})).then((function(i){return Ls(n,void 0,void 0,(function(){var n=this;return Ds(this,(function(o){switch(o.label){case 0:return t.tmpLocation=i.nativeURL,[4,new Promise((function(e,r){n.zipService.unzip(t.ecarFilePath,{target:i.nativeURL},(function(){e()}),(function(t){r(t)}))}))];case 1:return o.sent(),t.metadata={},t.metadata.FILE_SIZE=e,r.body=t,[2,Promise.resolve(r)]}}))}))})).catch((function(t){return r.errorMesg=Gn.IMPORT_FAILED_EXTRACT_ECAR.valueOf(),Promise.reject(r)}))},t}(),ks=function(){function t(){this.identifierList=new Set}return t.prototype.hierarchyToManifestConversion=function(t){this.identifierList=new Set,this.archive={count:0,items:[]};var e=this.reorderData(t,1);return e&&(this.archive.count+=1,this.archive.items.push(e)),t.children&&t.children.length&&this.recurssiveFunc(t.children,1),this.archive},t.prototype.recurssiveFunc=function(t,e){for(var n=0;n<t.length;n++){var r=this.reorderData(t[n],e+1,xn.PARENT.valueOf());r&&(this.archive.count+=1,this.archive.items.push(r)),t[n].children&&t[n].children.length&&this.recurssiveFunc(t[n].children,e+1)}},t.prototype.reorderData=function(t,e,n){if(this.identifierList.has(t.identifier))return null;var r=[],i=JSON.parse(JSON.stringify(t));if(i.children&&i.children.length){for(var o=0;o<i.children.length;o++)r.push({name:i.children[o].name,identifier:i.children[o].identifier,objectType:i.children[o].objectType,depth:e,index:o});i.children=r}return i.visibility=n||i.visibility,this.identifierList.add(i.identifier),i},t}(),Us=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},xs=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bs=function(){function t(t,e,n,r){this.fileService=t,this.dbService=e,this.appConfig=n,this.getContentDetailsHandler=r}return t.prototype.execute=function(t){return Us(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y,v,g,_,E,M,w,S,O;return xs(this,(function(A){switch(A.label){case 0:e=new P.CsResponse,A.label=1;case 1:return A.trys.push([1,3,,5]),[4,this.fileService.readAsText(t.tmpLocation,zn.HIERARCHY.valueOf())];case 2:return(n=A.sent())&&((r=JSON.parse(n)).archive=(new ks).hierarchyToManifestConversion(r.content),delete r.content,n=JSON.stringify(r)),[3,5];case 3:return A.sent(),[4,this.fileService.readAsText(t.tmpLocation,zn.MANIFEST.valueOf())];case 4:return n=A.sent(),[3,5];case 5:return n?[3,7]:(e.errorMesg=Gn.IMPORT_FAILED_MANIFEST_FILE_NOT_FOUND.valueOf(),[4,this.fileService.removeRecursively(t.tmpLocation)]);case 6:throw A.sent(),e;case 7:return 1!==(i=JSON.parse(n)).ver?[3,9]:(e.errorMesg=Gn.IMPORT_FAILED_UNSUPPORTED_MANIFEST.valueOf(),[4,this.fileService.removeRecursively(t.tmpLocation)]);case 8:throw A.sent(),e;case 9:return(o=i.archive).items?[3,11]:(e.errorMesg=Gn.IMPORT_FAILED_NO_CONTENT_METADATA.valueOf(),[4,this.fileService.removeRecursively(t.tmpLocation)]);case 10:throw A.sent(),e;case 11:for(t.manifestVersion=i.ver,t.items=[],a=o.items,s=[],u=0,c=a;u<c.length;u++)b=c[u],v=(y=b).identifier,s.push(v);return f=Ar.joinPreservingQuotes(s),[4,this.getContentDetailsHandler.fetchFromDBForAll(f).toPromise()];case 12:for(h=A.sent(),l=h.reduce((function(t,e){return t[e.identifier]=e,t}),{}),d=!1,t.existedContentIdentifiers={},p=0,m=a;p<m.length;p++)b=m[p],v=(y=b).identifier,g=Cr.readVisibility(y),_=y.status,(E=Cr.isDraftContent(_))&&Cr.isExpired(y.expires)?this.skipContent(t,v,g,Yn.CONTENT_EXPIRED,a):(g===xn.DEFAULT.valueOf()&&(d=!1),M=l[v],w=void 0,M&&(S=M[We.COLUMN_NAME_REF_COUNT],(w=M[We.COLUMN_NAME_PATH])&&g===xn.DEFAULT.valueOf()&&S&&S>0&&(d=!0,(O=JSON.parse(M[We.COLUMN_NAME_LOCAL_DATA]))&&y.pkgVersion>O.pkgVersion&&O.childNodes&&O.childNodes.length>0&&(t.contentIdsToDelete=new Set(O.childNodes)))),w&&g===xn.DEFAULT.valueOf()&&!Cr.isDuplicateCheckRequired(E,y.pkgVersion)&&Cr.isImportFileExist(M,y)?(t.rootIdentifier=v,this.skipContent(t,v,g,Yn.ALREADY_EXIST,a)):(d&&t.contentIdsToDelete.delete(v)&&(t.existedContentIdentifiers[v]=!0),t.items.push(y)));return e.body=t,[2,e]}}))}))},t.prototype.skipContent=function(t,e,n,r,i){n===xn.DEFAULT&&(r===Yn.ALREADY_EXIST?i&&1===i.length&&t.contentImportResponseList.push({identifier:e,status:r}):t.contentImportResponseList.push({identifier:e,status:r})),t.skippedItemsIdentifier.push(e)},t}(),Fs=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Vs=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},qs=function(){function t(t,e,n){this.dbService=t,this.sharedPreferences=e,this.fileService=n}return t.prototype.execute=function(){return this.updateAllRootContentSize().toPromise()},t.prototype.findAllChildContents=function(t){var e="SELECT * FROM "+We.TABLE_NAME+"\n WHERE "+We.COLUMN_NAME_IDENTIFIER+" IN ("+Ar.joinPreservingQuotes(t)+")\n AND "+We.COLUMN_NAME_REF_COUNT+" > 0";return this.dbService.execute(e).toPromise()},t.prototype.updateAllRootContentSize=function(){var t=this,e="SELECT * FROM "+We.TABLE_NAME+" WHERE "+We.COLUMN_NAME_REF_COUNT+" > 0\n AND "+We.COLUMN_NAME_VISIBILITY+" = '"+xn.DEFAULT.valueOf()+"'";return this.dbService.execute(e).pipe(Object(dt.tap)((function(){return Fs(t,void 0,void 0,(function(){return Vs(this,(function(t){return[2,this.sharedPreferences.putBoolean(V.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!1).toPromise()]}))}))})),Object(dt.mergeMap)((function(e){return Fs(t,void 0,void 0,(function(){var t,n=this;return Vs(this,(function(r){switch(r.label){case 0:return t=[],[4,Promise.all(e.map((function(e){return Fs(n,void 0,void 0,(function(){var n,r;return Vs(this,(function(i){switch(i.label){case 0:return[4,this.getSizeOnDevice(e)];case 1:return n=i.sent(),(r=JSON.parse(e[We.COLUMN_NAME_LOCAL_DATA]).childNodes)?[4,this.findAllChildContents(r)]:[3,3];case 2:i.sent().forEach((function(t){n+=t[We.COLUMN_NAME_SIZE_ON_DEVICE]||0})),e[We.COLUMN_NAME_SIZE_ON_DEVICE]=n,t.push(e),i.label=3;case 3:return[2]}}))}))})))];case 1:return r.sent(),this.updateInDb(t),[2]}}))}))})),Object(dt.tap)((function(){return Fs(t,void 0,void 0,(function(){return Vs(this,(function(t){return[2,this.sharedPreferences.putBoolean(V.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!0).toPromise()]}))}))})))},t.prototype.getSizeOnDevice=function(t){return Fs(this,void 0,void 0,(function(){var e,n,r,i,o;return Vs(this,(function(a){switch(a.label){case 0:return e=0,t[We.COLUMN_NAME_MIME_TYPE]!==Un.COLLECTION.valueOf()?[3,3]:t[We.COLUMN_NAME_VISIBILITY]!==xn.DEFAULT.valueOf()?[3,2]:(n=[],r={},i=t[We.COLUMN_NAME_IDENTIFIER],r.identifier=i,r.path=t[We.COLUMN_NAME_PATH],n.push(r),[4,this.getMetaData(n)]);case 1:o=a.sent(),e=o[i]?o[i].size:0,a.label=2;case 2:return[3,4];case 3:e=t[We.COLUMN_NAME_SIZE_ON_DEVICE]?t[We.COLUMN_NAME_SIZE_ON_DEVICE]:0,a.label=4;case 4:return[2,Promise.resolve(e||0)]}}))}))},t.prototype.updateInDb=function(t){return Fs(this,void 0,void 0,(function(){var e,n,r,i,o;return Vs(this,(function(a){for(this.dbService.beginTransaction(),e=0,n=t;e<n.length;e++)r=n[e],o=(i=r)[We.COLUMN_NAME_IDENTIFIER],this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[o],modelJson:i}).toPromise();return this.dbService.endTransaction(!0),[2]}))}))},t.prototype.getMetaData=function(t){return Fs(this,void 0,void 0,(function(){return Vs(this,(function(e){return[2,new Promise((function(e,n){sbutility.getMetaData(t,(function(t){e(t)}),(function(t){console.error(t),n(t)}))}))]}))}))},t.prototype.updateTextBookSize=function(t){var e=this;console.log("in updateAllRootContentSize");var n="SELECT * FROM "+We.TABLE_NAME+" WHERE "+We.COLUMN_NAME_IDENTIFIER+" == "+t;return this.dbService.execute(n).pipe(Object(dt.tap)((function(){return Fs(e,void 0,void 0,(function(){return Vs(this,(function(t){return[2,this.sharedPreferences.putBoolean(V.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!1).toPromise()]}))}))})),Object(dt.mergeMap)((function(t){return Fs(e,void 0,void 0,(function(){var e,n=this;return Vs(this,(function(r){switch(r.label){case 0:return e=[],[4,Promise.all(t.map((function(t){return Fs(n,void 0,void 0,(function(){var n,r;return Vs(this,(function(i){switch(i.label){case 0:return[4,this.getSizeOnDevice(t)];case 1:return n=i.sent(),(r=JSON.parse(t[We.COLUMN_NAME_LOCAL_DATA]).childNodes)?[4,this.findAllChildContents(r)]:[3,3];case 2:i.sent().forEach((function(t){n+=t[We.COLUMN_NAME_SIZE_ON_DEVICE]||0})),t[We.COLUMN_NAME_SIZE_ON_DEVICE]=n,e.push(t),i.label=3;case 3:return[2]}}))}))})))];case 1:return r.sent(),this.updateInDb(e),[2]}}))}))})),Object(dt.tap)((function(){return Fs(e,void 0,void 0,(function(){return Vs(this,(function(t){return[2,this.sharedPreferences.putBoolean(V.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,!0).toPromise()]}))}))})))},t}(),Ys=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Gs=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Hs=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},zs=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}},Ks=We.COLUMN_NAME_VISIBILITY,Ws=function(){function t(t,e,n,r,i,o,a,s){this.fileService=t,this.zipService=e,this.appConfig=n,this.dbService=r,this.deviceInfo=i,this.getContentDetailsHandler=o,this.eventsBusService=a,this.sharedPreferences=s}return t.prototype.execute=function(t){return Gs(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y,v,g,_,E,M,w,S,O,A,T,N=this;return Hs(this,(function(C){switch(C.label){case 0:for(e=new P.CsResponse,t.identifiers=[],n=[],r=[],i=new Map,o=new Map,s=0,this.postImportProgressEvent(s,t.items.length),u=[],c=[],f=[],h=0,l=t.items;h<l.length;h++)A=l[h],p=(d=A).identifier,m=Cr.readVisibility(d),b=d.appIcon,Cr.isNotUnit(d.mimeType,m)&&(c.push(p),b&&!b.startsWith("https:")&&f.push(p+"/"+b.substring(0,b.lastIndexOf("/")))),u.push(p);return y=Cr.getContentRootDir(t.destinationFolder),t.items[0].mimeType!==Un.QUESTION_SET?[3,2]:[4,this.segregateQuestions(y,JSON.parse(JSON.stringify(t.items)))];case 1:return v=C.sent(),[3,4];case 2:return[4,this.createDirectories(y,c)];case 3:v=C.sent(),C.label=4;case 4:return[4,this.createDirectories(y,f)];case 5:return C.sent(),g=Ar.joinPreservingQuotes(u),[4,this.getContentDetailsHandler.fetchFromDBForAll(g).toPromise()];case 6:_=C.sent(),E=_.reduce((function(t,e){return t[e.identifier]=e,t}),{}),M=function(e){var u,c,f,h,l,d,p,m,b,y,g,_,M,S,O,A,T,C,I,R,P,L,D,j,k,U,x,B,F,V,q;return Hs(this,(function(Y){switch(Y.label){case 0:return c=(u=e).identifier,t.skippedItemsIdentifier&&t.skippedItemsIdentifier.indexOf(c)>-1?[2,"continue"]:(f=u.mimeType,h=u.contentEncoding,l=u.contentDisposition,d=Cr.readContentType(u),p=Cr.readPrimaryCategory(u),m=Cr.readVisibility(u),b=Cr.readAudience(u),y=Cr.readPragma(u),g=u.pkgVersion,_=u.artifactUrl,M=u.appIcon,S=u.itemSetPreviewUrl,O=u.board,A=u.medium,T=u.gradeLevel,C=u.dialcodes,I=u.childNodes,R=kn.ONLY_SPINE.valueOf(),L=E[c],D=void 0,L&&(D=Cr.getBasePath(L[We.COLUMN_NAME_PATH])),void 0,m===xn.DEFAULT.valueOf()&&c,Cr.isNotUnit(f,m)?v[c]&&v[c].path?(P="ios"===window.device.platform.toLowerCase()?v[c].path.concat("/"):v[c].path,[3,3]):[3,1]:[3,3]);case 1:return j="ios"===window.device.platform.toLowerCase()?Cr.getContentRootDir(t.destinationFolder).concat(c):Cr.getContentRootDir(t.destinationFolder).concat("/",c),[4,w.fileService.createDir(j,!1)];case 2:k=Y.sent(),P=k.nativeURL,Y.label=3;case 3:return U=!1,(x=Cr.doesContentExist(L,c,g,!1))&&u.status!==Bn.DRAFT.valueOf()?(L[Ks]===xn.DEFAULT.valueOf()&&(u=JSON.parse(L[We.COLUMN_NAME_LOCAL_DATA])),[3,17]):[3,4];case 4:if(x=!1,!_)return[3,16];if(Cr.isInlineIdentity(l,h)||f!==Un.EPUB)return[3,8];Y.label=5;case 5:return Y.trys.push([5,7,,8]),[4,w.copyAssets(t.tmpLocation,_,P)];case 6:return Y.sent(),U=!0,[3,8];case 7:return Y.sent(),U=!1,[3,8];case 8:return l&&h&&(l!==Vn.INLINE.valueOf()||h!==Fn.GZIP.valueOf())?[3,10]:(B=t.tmpLocation.concat(_),[4,new Promise((function(t,e){N.zipService.unzip(B,{target:P},(function(){U=!0,t()}),(function(){t()}))}))]);case 9:return Y.sent(),[3,16];case 10:if(!Cr.isInlineIdentity(l,h))return[3,15];Y.label=11;case 11:return Y.trys.push([11,13,,14]),[4,w.copyAssets(t.tmpLocation,_,P)];case 12:return Y.sent(),U=!0,[3,14];case 13:return Y.sent(),U=!1,[3,14];case 14:return[3,16];case 15:Vn.ONLINE.valueOf()===l&&(U=!0),Y.label=16;case 16:if(R=U||w.shouldDownloadQuestionSet(t.items,u)||Un.COLLECTION.valueOf()===f?kn.ARTIFACT_AVAILABLE.valueOf():kn.ONLY_SPINE.valueOf(),Cr.isNotUnit(f,m))try{M.startsWith("https:")||w.copyAssets(t.tmpLocation,M,P,!0)}catch(t){}try{S.startsWith("https:")||w.copyAssets(t.tmpLocation,S,P,!1)}catch(t){}Y.label=17;case 17:return F=w.getBasePath(P,x,D),m===xn.DEFAULT.valueOf()?(a=F,t.rootIdentifier=c):Cr.isNotUnit(f,m)&&t.identifiers.push(c),V=w.getReferenceCount(L,m,t.isChildContent,t.existedContentIdentifiers),m=w.getContentVisibility(L,u.objectType,t.isChildContent,m),Cr.addOrUpdateViralityMetadata(u,w.deviceInfo.getDeviceID().toString()),0,Cr.isNotUnit(f,m)&&o.set(c,P),q=w.constructContentDBModel(c,t.manifestVersion,JSON.stringify(u),f,d,m,F,V,R,b,y,0,O,A,T,C,I,p),L?w.getContentState(L,R)===kn.ONLY_SPINE.valueOf()||U||Un.COLLECTION.valueOf()===f?r.push(q):q[We.COLUMN_NAME_CONTENT_STATE]=w.getContentState(L,R):n.push(q),i.set(c,q),++s%20!=0&&s!==t.items.length||w.postImportProgressEvent(s,t.items.length),[2]}}))},w=this,S=0,O=t.items,C.label=7;case 7:return S<O.length?(A=O[S],[5,M(A)]):[3,10];case 8:C.sent(),C.label=9;case 9:return S++,[3,7];case 10:if(this.updateContentDB(n,r),T=setTimeout((function(){N.updateContentFileSizeInDB(t,i,o,E)}),5e3),!a)return[3,14];C.label=11;case 11:return C.trys.push([11,13,,14]),[4,this.fileService.copyFile(t.tmpLocation,zn.MANIFEST.valueOf(),a,zn.MANIFEST.valueOf())];case 12:return C.sent(),[3,14];case 13:return C.sent(),console.log("Exception Raised During Import"),[3,14];case 14:return e.body=t,[2,Promise.resolve([e,T])]}}))}))},t.prototype.updateContentFileSizeInDB=function(t,e,n,r){return Gs(this,void 0,void 0,(function(){var i,o,a,s,u,c,f,h,l;return Hs(this,(function(d){switch(d.label){case 0:i=[],o=0,a=t.items,d.label=1;case 1:if(!(o<a.length))return[3,6];if(s=a[o],u=s.identifier,c=e.get(u).mimeType,f=e.get(u).visibility,h=n.get(u),l=0,r[u],!Cr.isNotUnit(c,f))return[3,5];d.label=2;case 2:return d.trys.push([2,4,,5]),[4,this.fileService.getDirectorySize(h)];case 3:return l=d.sent(),e.get(u).size_on_device=l,i.push(e.get(u)),[3,5];case 4:return d.sent(),[3,5];case 5:return o++,[3,1];case 6:return this.updateContentDB([],i,!0),[2]}}))}))},t.prototype.updateContentDB=function(t,e,n){return Gs(this,void 0,void 0,(function(){var r,i,o,a,s,u;return Hs(this,(function(c){switch(c.label){case 0:if(t=t&&t.length?this.filterQuestionSetContent(t):t,e=e&&e.length?this.filterQuestionSetContent(e):e,!t.length&&!e.length)return[3,9];this.dbService.beginTransaction(),r=0,i=t,c.label=1;case 1:return r<i.length?(s=i[r],u=s,[4,this.dbService.insert({table:We.TABLE_NAME,modelJson:u}).toPromise()]):[3,4];case 2:c.sent(),c.label=3;case 3:return r++,[3,1];case 4:o=0,a=e,c.label=5;case 5:return o<a.length?(s=a[o],u=s,[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[u[We.COLUMN_NAME_IDENTIFIER]],modelJson:u}).toPromise()]):[3,8];case 6:c.sent(),c.label=7;case 7:return o++,[3,5];case 8:this.dbService.endTransaction(!0),c.label=9;case 9:return n&&new qs(this.dbService,this.sharedPreferences,this.fileService).execute(),[2]}}))}))},t.prototype.copyAssets=function(t,e,n,r){return Gs(this,void 0,void 0,(function(){var i,o,a=this;return Hs(this,(function(s){switch(s.label){case 0:return s.trys.push([0,7,,8]),e?(i=e.substring(0,e.lastIndexOf("/")),r?[3,2]:[4,this.fileService.createDir(n.concat(i),!1)]):[3,6];case 1:s.sent(),s.label=2;case 2:return"ios"!==window.device.platform.toLowerCase()?[3,4]:[4,this.fileService.exists(n.concat("/",e)).then((function(t){t&&a.fileService.removeFile(n.concat("/",e)).then()})).catch((function(t){console.log("Error =>",t)}))];case 3:s.sent(),s.label=4;case 4:return[4,this.fileService.copyFile(t.concat(i),is.getFileName(e),n.concat(i),is.getFileName(e))];case 5:s.sent(),s.label=6;case 6:return[3,8];case 7:throw o=s.sent(),console.error("Cannot Copy Asset"),o;case 8:return[2]}}))}))},t.prototype.getContentVisibility=function(t,e,n,r){var i;return"Library"===e?i=xn.PARENT.valueOf():t&&(n||xn.PARENT.valueOf()!==t[Ks])&&(i=t[Ks]),i||r},t.prototype.getContentState=function(t,e){return t&&t[We.COLUMN_NAME_CONTENT_STATE]>e&&(e=t[We.COLUMN_NAME_CONTENT_STATE]),e},t.prototype.getBasePath=function(t,e,n){return t&&!e?t:n},t.prototype.getReferenceCount=function(t,e,n,r){var i;t?(i=t[We.COLUMN_NAME_REF_COUNT],(r?r[t[We.COLUMN_NAME_IDENTIFIER]]:void 0)||n||xn.DEFAULT.valueOf()===t[Ks]&&xn.DEFAULT.valueOf()===e||(i+=1)):i=1;return i},t.prototype.postImportProgressEvent=function(t,e){this.eventsBusService.emit({namespace:$.CONTENT,event:{type:Kn.IMPORT_PROGRESS,payload:{totalCount:e,currentCount:t}}})},t.prototype.constructContentDBModel=function(t,e,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y){var v;return(v={})[We.COLUMN_NAME_IDENTIFIER]=t,v[We.COLUMN_NAME_SERVER_DATA]="",v[We.COLUMN_NAME_PATH]=Cr.getBasePath(a),v[We.COLUMN_NAME_REF_COUNT]=s,v[We.COLUMN_NAME_CONTENT_STATE]=u,v[We.COLUMN_NAME_SIZE_ON_DEVICE]=h,v[We.COLUMN_NAME_MANIFEST_VERSION]=e,v[We.COLUMN_NAME_LOCAL_DATA]=n,v[We.COLUMN_NAME_MIME_TYPE]=r,v[We.COLUMN_NAME_CONTENT_TYPE]=i,v[We.COLUMN_NAME_VISIBILITY]=o,v[We.COLUMN_NAME_AUDIENCE]=c,v[We.COLUMN_NAME_PRAGMA]=f,v[We.COLUMN_NAME_LOCAL_LAST_UPDATED_ON]=et(Date.now()).format(),v[We.COLUMN_NAME_BOARD]=Cr.getContentAttribute(l),v[We.COLUMN_NAME_MEDIUM]=Cr.getContentAttribute(d),v[We.COLUMN_NAME_GRADE]=Cr.getContentAttribute(p),v[We.COLUMN_NAME_DIALCODES]=Cr.getContentAttribute(m),v[We.COLUMN_NAME_CHILD_NODES]=Cr.getContentAttribute(b),v[We.COLUMN_NAME_PRIMARY_CATEGORY]=y,v},t.prototype.createDirectories=function(t,e){return Gs(this,void 0,void 0,(function(){return Hs(this,(function(n){return[2,new Promise((function(n,r){t="ios"===window.device.platform.toLowerCase()?t.concat("/"):t,sbutility.createDirectories(Cr.getBasePath(t),e,(function(t){n(t)}),(function(t){console.error(t),r(t)}))}))]}))}))},t.prototype.filterQuestionSetContent=function(t){return t.filter((function(t){return t.mimeType!==Un.QUESTION&&t.mime_type!==Un.QUESTION}))},t.prototype.segregateQuestions=function(t,e){return Gs(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c,f,h,l,d,p;return Hs(this,(function(m){switch(m.label){case 0:for(i={},o=0;o<e.length;o++)e[o].mimeType!==Un.QUESTION_SET||i[e[o].identifier]?e[o].mimeType===Un.QUESTION&&(i[e[o].parent]?i[e[o].parent].push(e[o].identifier):i[e[o].identifier]=[e[o].identifier]):i[e[o].identifier]=[];return a=Object.keys(i),[4,this.createDirectories(t,a)];case 1:for(c in s=m.sent(),u=[],i)u.push({idArr:i[c],dir:t+"/"+c});m.label=2;case 2:m.trys.push([2,9,10,15]),f=zs(u),m.label=3;case 3:return[4,f.next()];case 4:return(h=m.sent()).done?[3,8]:[4,h.value];case 5:return l=m.sent(),[4,this.createDirectories(l.dir,l.idArr)];case 6:d=m.sent(),s=Ys({},s,d),m.label=7;case 7:return[3,3];case 8:return[3,15];case 9:return p=m.sent(),n={error:p},[3,15];case 10:return m.trys.push([10,,13,14]),h&&!h.done&&(r=f.return)?[4,r.call(f)]:[3,12];case 11:m.sent(),m.label=12;case 12:return[3,14];case 13:if(n)throw n.error;return[7];case 14:return[7];case 15:return[2,s]}}))}))},t.prototype.shouldDownloadQuestionSet=function(t,e){return e.mimeType===Un.QUESTION_SET&&Cr.readVisibility(e)===xn.DEFAULT.valueOf()||this.checkParentQustionSet(t,e)},t.prototype.checkParentQustionSet=function(t,e){if(!e||!e.parent)return!1;var n=t.find((function(t){return t.identifier===e.parent}));return!(!n||n.mimeType!==Un.QUESTION_SET)&&(n.mimeType===Un.QUESTION_SET&&Cr.readVisibility(n)===xn.DEFAULT.valueOf()||this.checkParentQustionSet(t,n))},t}(),Xs=n(167),Js=n.n(Xs),Zs=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Qs=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},$s=function(){function t(t,e,n){this.dbService=t,this.deviceInfo=e,this.fileService=n,this.contentDataMap={}}return t.prototype.execute=function(t){return Zs(this,void 0,void 0,(function(){var e,n,r,i,o,a=this;return Qs(this,(function(s){switch(s.label){case 0:return[4,this.fileService.readAsText(t.tmpLocation,zn.MANIFEST.valueOf())];case 1:e=s.sent(),n=JSON.parse(e),r=n.archive,r.items.forEach((function(t){a.contentDataMap[t.identifier]=t})),i=new P.CsResponse,s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.createnWriteManifest(t.identifiers,t.destinationFolder)];case 3:return s.sent(),i.body=t,[2,Promise.resolve(i)];case 4:return o=s.sent(),console.error(o),[2,Promise.reject(i)];case 5:return[2]}}))}))},t.prototype.createnWriteManifest=function(t,e){return Zs(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c=this;return Qs(this,(function(f){switch(f.label){case 0:for(n=new vs(this.deviceInfo),r=[],i=function(t){var i=o.contentDataMap[t],a=new Js.a;a.add(i);var s=void 0,u=[];u.push(i);for(var f=function(){if(s=a.dequeue(),Cr.hasChildren(s)){var t=Cr.getChildContentsIdentifiers(s);if(t&&t.length){var e=[];t.forEach((function(t){var n=c.contentDataMap[t];n&&(a.add(n),e.push(n))})),u=u.concat(e)}}};!a.isEmpty();)f();var h=n.populateItemList(u),l=n.generateManifestForArchive(h),d={};h&&h[0]&&h[0].parent&&h[0].mimeType===Un.QUESTION?d.path=Cr.getBasePath(Cr.getContentRootDir(e).concat("/",h[0].parent,"/",t,"/")):d.path=Cr.getBasePath(Cr.getContentRootDir(e).concat("/",t,"/")),d.fileName=zn.MANIFEST.valueOf(),d.data=JSON.stringify(l),r.push(d)},o=this,a=0,s=t;a<s.length;a++)u=s[a],i(u);return[4,this.writeFile(r)];case 1:return f.sent(),[2]}}))}))},t.prototype.writeFile=function(t){return Zs(this,void 0,void 0,(function(){return Qs(this,(function(e){return[2,new Promise((function(e,n){sbutility.writeFile(t,(function(t){e()}),(function(t){console.error(t),n(t)}))}))]}))}))},t}(),tu=function(){function t(t){this.fileService=t}return t.prototype.execute=function(t){var e=new P.CsResponse;return this.fileService.removeRecursively(t.tmpLocation).then((function(){return e.body=t,Promise.resolve(e)})).catch((function(){return Promise.reject(e)}))},t}(),eu=function(){function t(t){this.fileService=t}return t.prototype.execute=function(t){var e=new P.CsResponse;return this.fileService.createDir(t.tmpLocationPath.concat(ar.generateUniqueId()),!1).then((function(n){return t.tmpLocationPath=n.nativeURL,e.body=t,Promise.resolve(e)})).catch((function(){return Promise.reject(e)}))},t}(),nu=function(){function t(t,e,n,r){this.apiService=t,this.contentServiceConfig=e,this.framework=n,this.langCode=r,this.SEARCH_ENDPOINT="/search"}return t.prototype.handle=function(t){var e=this.framework&&this.langCode&&"?framework="+this.framework+"&lang="+this.langCode+"&orgdetails=orgName",n=(new P.CsRequest.Builder).withHost(this.contentServiceConfig.host).withType(P.CsHttpRequestType.POST).withPath(this.contentServiceConfig.searchApiPath.concat(this.SEARCH_ENDPOINT).concat(e||"")).withBearerToken(!0).withBody({request:t}).build();return this.apiService.fetch(n).pipe(Object(dt.map)((function(t){return t.body})))},t}(),ru=function(){function t(t){this.telemetryService=t}return t.prototype.execute=function(t){t.metadata;for(var e=[],n=0,r=t.items;n<r.length;n++){var i=r[n],o={type:Cr.readPrimaryCategoryServer(i),origin:Cr.readOriginFromContentMap(i),identifier:i.identifier,pkgVersion:Number(i.pkgVersion),transferCount:Cr.readTransferCountFromContentMap(i),size:Cr.readSizeFromContentMap(i)};e.push(o)}var a={dir:ft.IN,type:ht.FILE.valueOf(),items:e,env:"sdk",correlationData:t.correlationData,objId:t.items&&t.items.length?t.items[0].identifier:"",objType:t.items&&t.items.length?Cr.readPrimaryCategoryServer(t.items[0]):"",objVer:t.items&&t.items.length?Cr.readPkgVersion(t.items[0])+"":"",rollUp:t.rollUp},s=new P.CsResponse;return this.telemetryService.share(a).toPromise().then((function(){return s.body=t,Promise.resolve(s)})).catch((function(){return Promise.reject(s)}))},t}(),iu=function(){function t(t){this.telemetryService=t}return t.prototype.execute=function(t,e,n){for(var r=new P.CsResponse,i=0,o=t.items;i<o.length;i++){var a=o[i];lt.CONTENT,Cr.readOriginFromContentMap(a),a.identifier,Number(a.pkgVersion),Cr.readTransferCountFromContentMap(a),Cr.readSizeFromContentMap(a)}var s={dir:ft.OUT,type:ht.FILE.valueOf(),items:[],env:"sdk"};return this.telemetryService.share(s).toPromise().then((function(){var t;n.saveLocally?t=n.destinationFolder.concat(e):t=("ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalCacheDirectory).concat(e);var i={exportedFilePath:t};return r.body=i,Promise.resolve(r)})).catch((function(){return Promise.reject(r)}))},t}(),ou=function(){function t(t){this.telemetryService=t}return t.prototype.execute=function(t,e){var n=t.items&&t.items.length?t.items[0].identifier:"",r=new oe;r.type=Dt.OTHER,r.subType=e,r.pageId="ImportContent",r.id="ImportContent",r.env="sdk",r.objId=n||t.identifier,r.objType=t.items&&t.items.length?Cr.readPrimaryCategoryServer(t.items[0]):"",r.objVer=t.items&&t.items.length?Cr.readPkgVersion(t.items[0])+"":"",r.correlationData=t.correlationData;var i=new P.CsResponse;return i.body=t,this.telemetryService.interact(r).pipe(Object(dt.map)((function(){return i}))).toPromise()},t}(),au=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},su=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},uu=function(){function t(t){this.dbService=t}return t.prototype.getUsgaeSpace=function(t){var e="SELECT SUM("+We.COLUMN_NAME_SIZE_ON_DEVICE+") as total_size\n FROM "+We.TABLE_NAME+"\n WHERE "+We.COLUMN_NAME_VISIBILITY+" = '"+xn.DEFAULT.valueOf()+"'\n AND "+We.COLUMN_NAME_PATH+" LIKE '"+t.replace("file://","")+"%'";return this.dbService.execute(e).pipe(Object(dt.map)((function(t){return t[0].total_size||0})))},t.prototype.getContentUsageSummary=function(t){return au(this,void 0,void 0,(function(){var e,n,r,i,o;return su(this,(function(a){switch(a.label){case 0:e=[],n=0,r=t,a.label=1;case 1:return n<r.length?(i=r[n],[4,this.getUsgaeSpace(i).toPromise()]):[3,4];case 2:o=a.sent(),e.push({path:i,sizeOnDevice:o}),a.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t}(),cu=function(){function t(t,e,n){this.sharedPreferences=t,this.key=e,this.toStringFunction=n,this.changes=new J.BehaviorSubject(void 0)}return t.prototype.addAll=function(t){var e=this;return this.asSet().pipe(Object(dt.mergeMap)((function(n){return t.forEach((function(t){return n.add(t)})),e.sharedPreferences.putString(e.key,JSON.stringify(n.toArray())).pipe(Object(dt.mapTo)(void 0))})),Object(dt.tap)((function(){return e.changes.next(void 0)})))},t.prototype.add=function(t){var e=this;return this.asSet().pipe(Object(dt.mergeMap)((function(n){return n.add(t),e.sharedPreferences.putString(e.key,JSON.stringify(n.toArray())).pipe(Object(dt.mapTo)(void 0))})),Object(dt.tap)((function(){return e.changes.next(void 0)})))},t.prototype.clear=function(){var t=this;return this.sharedPreferences.putString(this.key,"[]").pipe(Object(dt.mapTo)(void 0),Object(dt.tap)((function(){return t.changes.next(void 0)})))},t.prototype.remove=function(t){var e=this;return this.asSet().pipe(Object(dt.mergeMap)((function(n){var r=n.remove(t);return e.sharedPreferences.putString(e.key,JSON.stringify(n.toArray())).pipe(Object(dt.mapTo)(r))})),Object(dt.tap)((function(){return e.changes.next(void 0)})))},t.prototype.contains=function(t){return this.asSet().pipe(Object(dt.map)((function(e){return e.contains(t)})))},t.prototype.asList=function(){return this.sharedPreferences.getString(this.key).pipe(Object(dt.map)((function(t){return t?JSON.parse(t):[]})))},t.prototype.asSet=function(){var t=this;return this.asList().pipe(Object(dt.map)((function(e){return e.reduce((function(t,e){return t.add(e),t}),new xa.a(t.toStringFunction))})))},t.prototype.asListChanges=function(){var t=this;return this.changes.asObservable().pipe(Object(dt.mergeMap)((function(){return t.asList()})))},t}(),fu=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},hu=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},lu=function(){function t(){}return t.prototype.execute=function(t,e){return fu(this,void 0,void 0,(function(){return hu(this,(function(n){return[2,new Promise((function(n,r){var i;i=e.saveLocally?e.destinationFolder:"ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalCacheDirectory,sbutility.copyFile(is.getDirecory(t.body.ecarFilePath),i,is.getFileName(t.body.ecarFilePath),(function(){n(t)}),(function(t){console.error(t),n(t)}))}))]}))}))},t}(),du=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},pu=function(){function t(t,e){this.apiService=t,this.contentServiceConfig=e,this.GET_CONTENT_HEIRARCHY_ENDPOINT="/hierarchy"}return t.prototype.handle=function(t){var e=this,n=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.contentServiceConfig.contentHeirarchyAPIPath+this.GET_CONTENT_HEIRARCHY_ENDPOINT+"/"+t.contentId).withBearerToken(!0).build();return this.apiService.fetch(n).pipe(Object(dt.map)((function(t){return e.mapContentFromContentHeirarchyData(t.body.result.content)})))},t.prototype.mapContentFromContentHeirarchyData=function(t){var e=this;return t.contentData=du({},t),t.children&&t.children.length&&(t.children=t.children.map((function(t){return e.mapContentFromContentHeirarchyData(du({},t))}))),t},t}(),mu=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},bu=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},yu=function(){function t(){}return t.prototype.execute=function(t){return mu(this,void 0,void 0,(function(){var e;return bu(this,(function(n){return e=new P.CsResponse,[2,new Promise((function(n,r){var i=t.destinationFolder.concat("tmp/");sbutility.rm(i,"",(function(){e.body=t,n(e)}),(function(r){e.body=t,n(e)}))}))]}))}))},t}(),vu=n(93),gu=n(22),_u=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Eu=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Mu=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},wu=function(){function t(t,e,n,r,i,o,a,s){this.searchContentHandler=t,this.formService=e,this.contentService=n,this.cachedItemStore=r,this.courseService=i,this.profileService=o,this.apiService=a,this.networkInfoService=s}return t.buildRequestHash=function(t){return gu(JSON.stringify(co.withDeeplyOrderedKeys(t))).toString()},t.prototype.aggregate=function(e,n,r,i,o){var a=this;return void 0===o&&(o=!1),Object(J.defer)((function(){return Eu(a,void 0,void 0,(function(){var a,s,u,c,f,h=this;return Mu(this,(function(l){switch(l.label){case 0:if(!r&&!i)throw new Error("formRequest or formFields required");return a=[],r?(r.from=e.from,[4,this.formService.getForm(r).toPromise().then((function(t){return t.form.data.fields}))]):[3,2];case 1:return a=l.sent(),[3,3];case 2:i&&(a=i,o=!1),l.label=3;case 3:return a=a.filter((function(t){return-1===n.indexOf(t.dataSrc.type)})),s=a.map((function(t){return Eu(h,void 0,void 0,(function(){return Mu(this,(function(n){switch(n.label){case 0:if(!t.dataSrc)throw new Error("INVALID_CONFIG");switch(t.dataSrc.type){case"CONTENT_FACETS":return[3,1];case"RECENTLY_VIEWED_CONTENTS":return[3,3];case"CONTENTS":return[3,5];case"TRACKABLE_COLLECTIONS":return[3,7];case"CONTENT_DISCOVERY_BANNER":return[3,9]}return[3,11];case 1:return[4,this.buildFacetsTask(t,e)];case 2:return[2,n.sent()];case 3:return[4,this.buildRecentlyViewedTask(t,e)];case 4:return[2,n.sent()];case 5:return[4,this.buildContentSearchTask(t,e)];case 6:return[2,n.sent()];case 7:return[4,this.buildTrackableCollectionsTask(t,e)];case 8:return[2,n.sent()];case 9:return[4,this.buildContentDiscoveryBannerTask(t)];case 10:return[2,n.sent()];case 11:return console.error("UNKNOWN_DATA_SRC"),[2,{requestHash:"",task:Object(J.of)([])}];case 12:return[2]}}))}))})),[4,Promise.all(s)];case 4:return u=l.sent(),c=u.map((function(t){return t.requestHash})).join("-"),f=Object(J.defer)((function(){return Eu(h,void 0,void 0,(function(){var t;return Mu(this,(function(e){switch(e.label){case 0:return[4,this.networkInfoService.networkStatus$.pipe(Object(dt.take)(1)).toPromise()];case 1:if(t=e.sent(),o&&t===Lr.OFFLINE)throw new Error("ContentAggregator: offline request");return[2,Promise.all(u.map((function(t){return t.task.toPromise()}))).then((function(t){return t.reduce((function(t,e){return t.concat(e)}),[]).sort((function(t,e){return t.index-e.index}))}))]}}))}))})),[2,Object(J.defer)((function(){return o?h.cachedItemStore.get(c,t.CONTENT_AGGREGATION_KEY,"ttl_"+t.CONTENT_AGGREGATION_KEY,(function(){return f})):f})).pipe(Object(dt.map)((function(t){return{result:t}}))).toPromise()]}}))}))}))},t.prototype.buildRecentlyViewedTask=function(e,n){return Eu(this,void 0,void 0,(function(){var n,r,i=this;return Mu(this,(function(o){switch(o.label){case 0:return[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return n=o.sent(),r={uid:n.managedSession?n.managedSession.uid:n.uid,primaryCategories:[],recentlyViewed:!0,limit:20},[2,{requestHash:"RECENTLY_VIEWED_CONTENTS_"+t.buildRequestHash(r),task:Object(J.defer)((function(){return Eu(i,void 0,void 0,(function(){var t;return Mu(this,(function(n){switch(n.label){case 0:return[4,this.contentService.getContents(r).toPromise()];case 1:return t=n.sent(),[2,e.sections.map((function(n){return{index:n.index,title:n.title,data:{name:n.index+"",sections:[{name:n.index+"",count:t.length,contents:t.map((function(t){return t.contentData.cardImg=t.contentData.appIcon,t}))}]},dataSrc:e.dataSrc,theme:n.theme,description:n.description,landingDetails:n.landingDetails,isEnabled:n.isEnabled}}))]}}))}))}))}]}}))}))},t.prototype.buildContentDiscoveryBannerTask=function(e){return Eu(this,void 0,void 0,(function(){var n=this;return Mu(this,(function(r){return[2,{requestHash:"CONTENT_DISCOVERY_BANNER"+t.buildRequestHash(e.dataSrc.type),task:Object(J.defer)((function(){return Eu(n,void 0,void 0,(function(){return Mu(this,(function(t){return[2,e.sections.map((function(t){return{index:t.index,code:t.code,title:t.title,data:e.dataSrc.values.filter((function(t){return Number(t.expiry)>Math.floor(Date.now()/1e3)})),dataSrc:e.dataSrc,theme:t.theme,description:t.description,landingDetails:t.landingDetails,isEnabled:t.isEnabled}}))]}))}))}))}]}))}))},t.prototype.buildFacetsTask=function(e,n){return Eu(this,void 0,void 0,(function(){var r,i,o,a=this;return Mu(this,(function(s){return e.dataSrc.values?[2,{requestHash:"",task:Object(J.defer)((function(){return Eu(a,void 0,void 0,(function(){return Mu(this,(function(t){return[2,e.sections.map((function(t){return{index:t.index,code:t.code,title:t.title,data:e.dataSrc.values.sort((function(t,e){return t.index-e.index})),dataSrc:e.dataSrc,theme:t.theme,description:t.description,landingDetails:t.landingDetails,isEnabled:t.isEnabled}}))]}))}))}))}]:(r=this.buildSearchRequestAndCriteria(e,n),i=r.searchRequest,(o=r.searchCriteria).facets=e.dataSrc.mapping.map((function(t){return t.facet})),i.facets=o.facets,i.limit=0,i.offset=0,[2,{requestHash:"CONTENT_FACETS_"+t.buildRequestHash(i),task:Object(J.defer)((function(){return Eu(a,void 0,void 0,(function(){var t;return Mu(this,(function(r){switch(r.label){case 0:return[4,this.searchContents(e,o,i)];case 1:return t=r.sent(),[2,e.sections.map((function(r,i){var a=t.filterCriteria.facetFilters||[],s=[];a.map((function(t){var n=e.dataSrc.params.config.find((function(e){return e.name===t.name}));n&&n.mergeableAttributes.map((function(e){s.push(e);var r=a.find((function(t){return t.name===e}));t.values=t.values.filter((function(t){return n.values.find((function(e){return e.code===t.name.replace(/\s+/g,"").toLowerCase()}))}));var i=n.values.filter((function(t){return t.type=e}));r.values=r.values.filter((function(t){return i.find((function(e){return e.code===t.name.replace(/\s+/g,"")}))})),t.values=t.values.concat(r.values)}))}));var u=(a=a.filter((function(t){return-1===s.indexOf(t.name)}))).find((function(t){return t.name===(e.dataSrc.mapping[i]&&e.dataSrc.mapping[i].facet)}));if(u){var c=e.dataSrc.params&&e.dataSrc.params.config&&e.dataSrc.params.config.find((function(t){return t.name===u.name}));return{index:r.index,title:r.title,code:r.code,data:u.values.map((function(t){var n=c?c.values.find((function(e){return e.code===t.name.replace(/\s+/g,"").toLowerCase()})):[];return{facet:n&&n.name?n.name:t.name,searchCriteria:_u({},o,{primaryCategories:[],impliedFilters:n.searchCriteria&&n.searchCriteria.impliedFilters?n.searchCriteria.impliedFilters:[{name:u.name,values:[{name:t.name,apply:!0}]}]}),aggregate:e.dataSrc.mapping[i].aggregate,filterPillBy:e.dataSrc.mapping[i].filterPillBy}})).sort((function(t,e){if(n.userPreferences){var r=n.userPreferences[u.name];if(!r||Array.isArray(r)&&r.indexOf(t.facet)>-1&&r.indexOf(e.facet)>-1||r===t.facet&&r===e.facet)return t.facet.localeCompare(e.facet);if(Array.isArray(r)&&r.indexOf(t.facet)>-1||r===t.facet)return-1;if(Array.isArray(r)&&r.indexOf(e.facet)>-1||r===e.facet)return 1}return t.facet.localeCompare(e.facet)})),dataSrc:e.dataSrc,theme:r.theme,description:r.description,landingDetails:r.landingDetails,isEnabled:r.isEnabled}}return{index:r.index,title:r.title,code:r.code,data:[],dataSrc:e.dataSrc,theme:r.theme,description:r.description,isEnabled:r.isEnabled}}))]}}))}))}))}])}))}))},t.prototype.buildTrackableCollectionsTask=function(e,n){return Eu(this,void 0,void 0,(function(){var n,r,i=this;return Mu(this,(function(o){switch(o.label){case 0:return n=this.apiService,[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return r=o.sent(),[2,{requestHash:"TRACKABLE_COLLECTIONS_"+t.buildRequestHash({userId:r.managedSession?r.managedSession.uid:r.uid}),task:Object(J.defer)((function(){return Eu(i,void 0,void 0,(function(){var t,i=this;return Mu(this,(function(o){switch(o.label){case 0:return[4,this.courseService.getEnrolledCourses({userId:r.managedSession?r.managedSession.uid:r.uid,returnFreshCourses:!0},new(function(){function t(){}return t.prototype.handle=function(t){var r=t.userId;e.dataSrc.request.path&&(e.dataSrc.request.path=e.dataSrc.request.path.replace("${userId}",r));var i=P.CsRequest.fromJSON(e.dataSrc.request);return n.fetch(i).pipe(Object(dt.map)((function(t){return t.body})))},t}())).toPromise()];case 1:return t=o.sent(),[2,e.sections.map((function(n,r){if(e.dataSrc.mapping[r]&&e.dataSrc.mapping[r].aggregate){var o=e.dataSrc.mapping[r].aggregate;return{index:n.index,title:n.title,data:vu.CsContentsGroupGenerator.generate({contents:t,groupBy:o.groupBy,sortBy:o.sortBy?i.buildSortByCriteria(o.sortBy):[],filterBy:o.filterBy?i.buildFilterByCriteria(o.filterBy):[],groupSortBy:o.groupSortBy?i.buildSortByCriteria(o.groupSortBy):[],groupFilterBy:o.groupFilterBy?i.buildFilterByCriteria(o.groupFilterBy):[],includeSearchable:!1}),dataSrc:e.dataSrc,theme:n.theme,description:n.description,landingDetails:n.landingDetails,isEnabled:n.isEnabled}}return{index:n.index,title:n.title,data:{name:n.index+"",sections:[{name:n.index+"",count:t.length,contents:t}]},dataSrc:e.dataSrc,theme:n.theme,description:n.description,landingDetails:n.landingDetails,isEnabled:n.isEnabled}}))]}}))}))}))}]}}))}))},t.prototype.buildContentSearchTask=function(e,n){return Eu(this,void 0,void 0,(function(){var r,i,o,a=this;return Mu(this,(function(s){return r=this.buildSearchRequestAndCriteria(e,n),i=r.searchRequest,o=r.searchCriteria,[2,{requestHash:"CONTENTS_"+t.buildRequestHash(i),task:Object(J.defer)((function(){return Eu(a,void 0,void 0,(function(){var t,r,a,s,u=this;return Mu(this,(function(c){switch(c.label){case 0:return[4,Eu(u,void 0,void 0,(function(){return Mu(this,(function(t){return i.filters&&i.filters.primaryCategory||o.primaryCategories&&0===o.primaryCategories.length?[2,[]]:[2,this.contentService.getContents({primaryCategories:o.primaryCategories&&o.primaryCategories.length&&o.primaryCategories||i.filters&&i.filters.primaryCategory||[],board:o.board,medium:o.medium,grade:o.grade}).pipe(Object(dt.map)((function(t){return t.map((function(t){return t.contentData.appIcon&&!t.contentData.appIcon.startsWith("https://")&&(t.contentData.appIcon=t.basePath+t.contentData.appIcon),t.contentData}))}))).toPromise()]}))}))];case 1:return t=c.sent(),[4,this.searchContents(e,o,i)];case 2:return r=c.sent(),a=(r.contentDataList||[]).filter((function(e){return!t.find((function(t){return t.identifier===e.identifier}))})),(s=t.concat(a).map((function(t){return t.cardImg=t.appIcon,t}))).sort((function(t,e){return t.lastPublishedOn>e.lastPublishedOn?-1:1})),[2,e.sections.map((function(t,a){if(e.dataSrc.mapping[a]&&e.dataSrc.mapping[a].aggregate){var c=e.dataSrc.mapping[a].aggregate,f=function(){var t=vu.CsContentsGroupGenerator.generate({contents:s,groupBy:c.groupBy,sortBy:c.sortBy?u.buildSortByCriteria(c.sortBy):[],filterBy:c.filterBy?u.buildFilterByCriteria(c.filterBy):[],groupSortBy:c.groupSortBy?u.buildSortByCriteria(c.groupSortBy):[],groupFilterBy:c.groupFilterBy?u.buildFilterByCriteria(c.groupFilterBy):[],combination:e.dataSrc.mapping[a].applyFirstAvailableCombination&&n.applyFirstAvailableCombination,includeSearchable:!1});(n.userPreferences&&n.userPreferences[c.groupBy]&&t.sections.sort((function(t,e){return n.userPreferences[c.groupBy].indexOf(t.name.replace(/[^A-Z0-9]/gi,"").toLocaleLowerCase())>-1&&n.userPreferences[c.groupBy].indexOf(e.name.replace(/[^A-Z0-9]/gi,"").toLocaleLowerCase())>-1?t.name.localeCompare(e.name):n.userPreferences[c.groupBy].indexOf(t.name.replace(/[^A-Z0-9]/gi,"").toLocaleLowerCase())>-1?-1:n.userPreferences[c.groupBy].indexOf(e.name.replace(/[^A-Z0-9]/gi,"").toLocaleLowerCase())>-1?1:0})),t.name)&&(r.filterCriteria.facetFilters||[]).map((function(e){var n=e.name==t.name?e.values:[];return t.sections.filter((function(t){return n.some((function(e){return t.name.toLocaleLowerCase()===e.name.toLowerCase()&&(t.totalCount=e.count),t.name===e.name}))}))}));return t}();return{index:t.index,title:t.title,meta:{searchCriteria:o,filterCriteria:r.filterCriteria,searchRequest:i},data:f,dataSrc:e.dataSrc,theme:t.theme,description:t.description,landingDetails:t.landingDetails,isEnabled:t.isEnabled}}return{index:t.index,title:t.title,meta:{searchCriteria:o,filterCriteria:r.filterCriteria,searchRequest:i},data:{name:t.index+"",sections:[{count:s.length,contents:s}]},dataSrc:e.dataSrc,theme:t.theme,description:t.description,landingDetails:t.landingDetails,isEnabled:t.isEnabled}}))]}}))}))}))}]}))}))},t.prototype.buildFilterByCriteria=function(t){return t.reduce((function(t,e){return Object.keys(e).forEach((function(n){return t.push({filterAttribute:n,filterCondition:{operation:e[n].operation,value:e[n].value}})})),t}),[])},t.prototype.buildSortByCriteria=function(t){return t.reduce((function(t,e){return Object.keys(e).forEach((function(n){return t.push({sortAttribute:n,sortOrder:e[n]})})),t}),[])},t.prototype.buildSearchRequestAndCriteria=function(t,e){var n,r=this,i=function(t){return r.searchContentHandler.getSearchCriteria(t)},o=t.dataSrc.request&&t.dataSrc.request.body?_u({filters:{}},t.dataSrc.request.body.request):{filters:{}},a=e.interceptSearchCriteria?e.interceptSearchCriteria(i({request:o})):i({request:o});return{searchRequest:(n=a,r.searchContentHandler.getSearchContentRequest(n)),searchCriteria:a}},t.prototype.searchContents=function(e,n,r){var i=this.apiService;return this.contentService.searchContent(n,void 0,new(function(){function n(){}return n.prototype.handle=function(n){if(r&&r.filters&&r.filters.mimeType){r.filters.mimeType=r.filters.mimeType.reduce((function(t,e){return Sr.MimeTypeCategoryMapping[e]?t.concat(Sr.MimeTypeCategoryMapping[e]):t.concat([e])}),[])}e.dataSrc.request&&e.dataSrc.request.body&&e.dataSrc.request.body.request?e.dataSrc.request.body={request:_u({},e.dataSrc.request.body.request,r)}:e.dataSrc.request.body={request:r};var o=JSON.stringify(co.withDeeplyOrderedKeys(e.dataSrc.request));if(t.searchContentCache.has(o))return Object(J.of)(t.searchContentCache.get(o)).pipe(Object(dt.map)((function(t){return t.body})));var a=P.CsRequest.fromJSON(e.dataSrc.request);return i.fetch(a).pipe(Object(dt.tap)((function(e){t.searchContentCache.set(o,e)})),Object(dt.map)((function(t){return t.body})))},n}()),!0).pipe(Object(dt.catchError)((function(t){return console.error(t),Object(J.of)({id:"OFFLINE_RESPONSE_ID",responseMessageId:"OFFLINE_RESPONSE_ID",filterCriteria:n,contentDataList:[]})}))).toPromise()},t.searchContentCache=new Map,t.CONTENT_AGGREGATION_KEY="content-aggregation",t}(),Su=n(168),Ou=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Au=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Tu=function(){function t(t,e){this.storageService=t,this.fileService=e}return t.prototype.getLocallyAvailableQuestion=function(t,e){var n=this,r=this.storageService.getStorageDestinationDirectoryPath(),i=[];return t.forEach((function(t){return Ou(n,void 0,void 0,(function(){var n;return Au(this,(function(o){return n=this.fileService.readAsText("ios"===window.device.platform.toLowerCase()?r+"/content/"+e+"/"+t:r+"content/"+e+"/"+t,"index.json"),i.push(n),[2]}))}))})),Object(J.from)(Promise.all(i)).pipe(Object(dt.map)((function(t){return{questions:t.map((function(t){return t&&"string"==typeof t?JSON.parse(t).archive.items[0]:t})),count:t.length}})))},t}(),Nu=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Cu=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Iu=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}},Ru=function(){function t(t,e,n,r){this.contentService=t,this.dbService=e,this.storageService=n,this.fileService=r}return t.prototype.handle=function(t){return Nu(this,void 0,void 0,(function(){var e,n,r;return Cu(this,(function(i){switch(i.label){case 0:return e=this.getQuery(t),[4,this.getQuestionSetFromQuery(e)];case 1:return(n=i.sent())&&n.isAvailableLocally?[3,3]:[4,this.fetchServerChildQuestions(t)];case 2:return[2,i.sent()];case 3:if(!n.children)return[2,[]];i.label=4;case 4:r=this.storageService.getStorageDestinationDirectoryPath(),i.label=5;case 5:return i.trys.push([5,7,,8]),[4,this.fetchDBChildQuestions(n,r)];case 6:return n=i.sent(),[3,8];case 7:return i.sent(),[2,n.children];case 8:return[2,n.children]}}))}))},t.prototype.fetchDBChildQuestions=function(t,e){return Nu(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c,f,h,l;return Cu(this,(function(d){switch(d.label){case 0:if(!t||!t.children)return[2,t];i=[],d.label=1;case 1:d.trys.push([1,12,13,18]),o=Iu(t.children),d.label=2;case 2:return[4,o.next()];case 3:return(a=d.sent()).done?[3,11]:[4,a.value];case 4:return"QuestionSet"!==(s=d.sent()).objectType?[3,8]:(u=void 0,c=this.getQuery(s.identifier),[4,this.getQuestionSetFromQuery(c)]);case 5:return(u=d.sent())&&u.children?[4,this.fetchDBChildQuestions(u,e)]:[3,7];case 6:u=d.sent(),i.push(u),d.label=7;case 7:return[3,10];case 8:return"Question"!==s.objectType?[3,10]:[4,this.fileService.readAsText(e+"content/"+t.identifier+"/"+s.identifier,"index.json")];case 9:(f=d.sent())&&"string"==typeof f&&(h=JSON.parse(f))&&h.archive&&h.archive.items.length&&i.push(h.archive.items[0]),d.label=10;case 10:return[3,2];case 11:return[3,18];case 12:return l=d.sent(),n={error:l},[3,18];case 13:return d.trys.push([13,,16,17]),a&&!a.done&&(r=o.return)?[4,r.call(o)]:[3,15];case 14:d.sent(),d.label=15;case 15:return[3,17];case 16:if(n)throw n.error;return[7];case 17:return[7];case 18:return t.children=i,[2,t]}}))}))},t.prototype.getQuery=function(t){return"SELECT * FROM "+We.TABLE_NAME+" WHERE ("+We.COLUMN_NAME_IDENTIFIER+" = '"+t+"')"},t.prototype.getQuestionSetFromQuery=function(t){return Nu(this,void 0,void 0,(function(){var e,n;return Cu(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.dbService.execute(t).toPromise()];case 1:return(e=r.sent())&&e.length&&e[0][We.COLUMN_NAME_LOCAL_DATA]?((n=JSON.parse(e[0][We.COLUMN_NAME_LOCAL_DATA])).isAvailableLocally=Cr.isAvailableLocally(e[0][We.COLUMN_NAME_CONTENT_STATE]),[2,n]):[2,null];case 2:return r.sent(),[2,null];case 3:return[2]}}))}))},t.prototype.fetchServerChildQuestions=function(t){return Nu(this,void 0,void 0,(function(){var e;return Cu(this,(function(n){switch(n.label){case 0:return[4,this.contentService.getQuestionSetHierarchy(t).toPromise()];case 1:return(e=n.sent())&&e.questionSet&&e.questionSet.children?[2,e.questionSet.children]:[2,[]]}}))}))},t}(),Pu=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Lu=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Du=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ju=function(t,e){return function(n,r){e(n,r,t)}},ku=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Uu=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},xu=function(){function t(t,n,r,i,o,a,s,u,c,f,h,l,d,p,m,b,y){this.sdkConfig=t,this.apiService=n,this.dbService=r,this.profileService=i,this.fileService=o,this.zipService=a,this.deviceInfo=s,this.telemetryService=u,this.contentFeedbackService=c,this.downloadService=f,this.sharedPreferences=h,this.eventsBusService=l,this.cachedItemStore=d,this.appInfo=p,this.networkInfoService=m,this.container=b,this.storageService=y,this.contentUpdateSizeOnDeviceTimeoutRef=new Map,this.contentServiceConfig=this.sdkConfig.contentServiceConfig,this.appConfig=this.sdkConfig.appConfig,this.getContentDetailsHandler=new $a(this.contentFeedbackService,this.profileService,this.apiService,this.contentServiceConfig,this.dbService,this.eventsBusService),this.getContentHeirarchyHandler=new pu(this.apiService,this.contentServiceConfig),this.questionSetFileReadHandler=new Tu(this.storageService,this.fileService),this.getChildQuestionSetHandler=new Ru(this,this.dbService,this.storageService,this.fileService),this.contentDeleteRequestSet=new cu(this.sharedPreferences,e.KEY_CONTENT_DELETE_REQUEST_LIST,(function(t){return t.contentId}))}var e;return e=t,t.prototype.onInit=function(){return this.downloadService.registerOnDownloadCompleteDelegate(this),Object(J.combineLatest)([this.handleContentDeleteRequestSetChanges(),this.handleUpdateSizeOnDeviceFail()]).pipe(Object(dt.mapTo)(void 0))},t.prototype.getContentDetails=function(t){return this.getContentDetailsHandler.handle(t)},t.prototype.getContentHeirarchy=function(t){return this.getContentHeirarchyHandler.handle(t)},t.prototype.getContents=function(t){var e=this,n=(new ls).getAllLocalContentQuery(t);return this.dbService.execute(n).pipe(Object(dt.mergeMap)((function(n){return Object(J.defer)((function(){return ku(e,void 0,void 0,(function(){var e,r,i,o,a,s,u;return Uu(this,(function(c){switch(c.label){case 0:e=[],r=0,i=n,c.label=1;case 1:return r<i.length?(o=i[r],a=Rr.mapContentDBEntryToContent(o),[4,this.getContentDetailsHandler.decorateContent({content:a,attachContentAccess:t.attachContentAccess,attachContentMarker:t.attachContentAccess,attachFeedback:t.attachFeedback}).toPromise()]):[3,4];case 2:a=c.sent(),e.push(a),c.label=3;case 3:return r++,[3,1];case 4:return t.resourcesOnly?(s=t.uid,u="SELECT * FROM "+tn.TABLE_NAME+"\n WHERE UID IN ("+Ar.joinPreservingQuotes(s)+")",[4,this.dbService.execute(u).toPromise()]):[3,6];case 5:c.sent().forEach((function(t){var n={identifier:t[tn.COLUMN_NAME_CONTENT_IDENTIFIER],name:"",contentData:t[tn.COLUMN_NAME_DATA]&&JSON.parse(t[tn.COLUMN_NAME_DATA]),isUpdateAvailable:!1,mimeType:"",basePath:"",contentType:"",primaryCategory:"",isAvailableLocally:!1,referenceCount:0,sizeOnDevice:0,lastUsedTime:0,lastUpdatedTime:0};e.push(n)})),c.label=6;case 6:return[2,e]}}))}))}))})))},t.prototype.cancelImport=function(t){return this.downloadService.cancel({identifier:t})},t.prototype.deleteContent=function(t){var e=this;return Object(J.defer)((function(){return ku(e,void 0,void 0,(function(){var e,n,r,i,o,a,s=this;return Uu(this,(function(u){switch(u.label){case 0:t.contentDeleteList.forEach((function(t){var e=s.contentUpdateSizeOnDeviceTimeoutRef.get(t.contentId);e&&(clearTimeout(e),s.contentUpdateSizeOnDeviceTimeoutRef.delete(t.contentId))})),e=[],n=new ss(this.dbService,this.fileService,this.sharedPreferences),r=0,i=t.contentDeleteList,u.label=1;case 1:return r<i.length?(o=i[r],[4,this.getContentDetailsHandler.fetchFromDB(o.contentId).toPromise()]):[3,8];case 2:return(a=u.sent())?(e.push({identifier:o.contentId,status:Rn.DELETED_SUCCESSFULLY}),Cr.hasChildren(a[We.COLUMN_NAME_LOCAL_DATA])?[4,n.deleteAllChildren(a,o.isChildContent)]:[3,4]):[3,6];case 3:u.sent(),u.label=4;case 4:return[4,n.deleteOrUpdateContent(a,!1,o.isChildContent)];case 5:return u.sent(),[3,7];case 6:e.push({identifier:o.contentId,status:Rn.NOT_FOUND}),u.label=7;case 7:return r++,[3,1];case 8:return new qs(this.dbService,this.sharedPreferences,this.fileService).execute(),[2,e]}}))}))})).pipe(Object(dt.tap)((function(){return t.contentDeleteList.forEach((function(t){e.downloadService.onContentDelete(t.contentId)}))})))},t.prototype.enqueueContentDelete=function(t){return this.contentDeleteRequestSet.addAll(t.contentDeleteList)},t.prototype.clearContentDeleteQueue=function(){return this.contentDeleteRequestSet.clear()},t.prototype.getContentDeleteQueue=function(){return this.contentDeleteRequestSet.asListChanges()},t.prototype.exportContent=function(t){var e=this,n=new vs(this.deviceInfo,this.dbService,this.fileService);return Object(J.from)(n.getContentExportDBModelToExport(t.contentIds).then((function(r){return e.fileService.getTempLocation(t.destinationFolder).then((function(n){var i={},o=Cr.getExportedFileName(r,e.appInfo.getAppName());i.content_count=r.length;var a={metadata:i,ecarFilePath:n.nativeURL.concat(o),destinationFolder:t.destinationFolder,contentModelsToExport:r,tmpLocationPath:n.nativeURL,subContentIds:t.subContentIds};return new eu(e.fileService).execute(a)})).then((function(t){return new gs(e.dbService,n).execute(t.body)})).then((function(t){return new _s(e.fileService,e.deviceInfo).execute(t.body)})).then((function(t){return new ws(e.zipService).execute(t.body)})).then((function(t){return new As(e.fileService).execute(t.body)})).then((function(t){return(new Cs).execute(t.body)})).then((function(t){return new Ps(e.fileService,e.zipService).execute(t.body)})).then((function(e){return(new lu).execute(e,t)})).then((function(t){return(new yu).execute(t.body)})).then((function(n){var i=Cr.getExportedFileName(r,e.appInfo.getAppName());return new iu(e.telemetryService).execute(n.body,i,t)})).then((function(t){return t.body}))})))},t.prototype.getChildContents=function(t){var e=this;t.level||(t.level=-1);var n=new rs(this.dbService,this.getContentDetailsHandler,this.appConfig),r=t.hierarchyInfo;if(r){if(r.length>0&&r[r.length-1].identifier===t.contentId){var i=r.length;r.splice(i-1,1)}}else r=[];return this.dbService.read($a.getReadContentQuery(t.contentId)).pipe(Object(dt.mergeMap)((function(i){return ku(e,void 0,void 0,(function(){var e,o,a,s;return Uu(this,(function(u){switch(u.label){case 0:return e=new Map,o=JSON.parse(i[0][We.COLUMN_NAME_LOCAL_DATA]),a=o.childNodes,console.log("childIdentifiers",a),a?(s="SELECT * FROM "+We.TABLE_NAME+"\n WHERE "+We.COLUMN_NAME_IDENTIFIER+"\n IN ("+Ar.joinPreservingQuotes(a)+")",[4,this.dbService.execute(s).toPromise()]):[3,2];case 1:u.sent().forEach((function(t){e.set(t.identifier,t)})),u.label=2;case 2:return[2,n.fetchChildrenOfContent(i[0],e,0,t.level,r)]}}))}))})))},t.prototype.getDownloadState=function(){throw new Error("Not Implemented yet")},t.prototype.importContent=function(t){var e=this,n=new hs(this.appConfig,this.contentServiceConfig,this.telemetryService),r=Ar.deDupe(t.contentImportArray.map((function(t){return t.contentId}))),i=n.getContentSearchFilter(r,t.contentStatusArray,t.fields);return new nu(this.apiService,this.contentServiceConfig).handle(i).pipe(Object(dt.map)((function(t){return t.result.content&&t.result.content.length&&t.result.QuestionSet&&t.result.QuestionSet.length?t.result.content.concat(t.result.QuestionSet):t.result.content||t.result.QuestionSet})),Object(dt.mergeMap)((function(i){return Object(J.defer)((function(){return ku(e,void 0,void 0,(function(){var e,o,a,s,u,c;return Uu(this,(function(f){switch(f.label){case 0:if(e=[],!i||!i.length)return[3,5];o=[],a=function(r){var a,s,u,c,f;return Uu(this,(function(h){switch(h.label){case 0:return(a=i.find((function(t){return t.identifier===r})))?(s=t.contentImportArray.find((function(t){return t.contentId===r})),[4,n.getDownloadUrl(a,s)]):[3,2];case 1:u=h.sent(),c=Yn.NOT_FOUND,u&&is.getFileExtension(u)===qn.CONTENT.valueOf()&&(c=Yn.ENQUEUED_FOR_DOWNLOAD,f={identifier:r,downloadUrl:u,mimeType:Un.ECAR,destinationFolder:s.destinationFolder,isChildContent:s.isChildContent,filename:r.concat(".",qn.CONTENT),correlationData:s.correlationData,rollUp:s.rollUp,contentMeta:a,withPriority:t.withPriority||(a.mimeType===Un.COLLECTION.valueOf()?1:0),title:a.name?a.name.concat(".",qn.CONTENT):r.concat(".",qn.CONTENT)},o.push(f)),e.push({identifier:r,status:c}),h.label=2;case 2:return[2]}}))},s=0,u=r,f.label=1;case 1:return s<u.length?(c=u[s],[5,a(c)]):[3,4];case 2:f.sent(),f.label=3;case 3:return s++,[3,1];case 4:this.downloadService.download(o).toPromise().then(),f.label=5;case 5:return[2,e]}}))}))}))})))},t.prototype.importEcar=function(t){var e=this;return Object(J.from)(this.fileService.exists(t.sourceFilePath).then((function(n){var r={isChildContent:t.isChildContent,ecarFilePath:t.sourceFilePath,destinationFolder:t.destinationFolder,skippedItemsIdentifier:[],items:[],contentImportResponseList:[],correlationData:t.correlationData||[],rollUp:t.rollUp||new Qt,contentIdsToDelete:new Set,identifier:t.identifier};return new ou(e.telemetryService).execute(r,"ContentImport-Initiated").then((function(){return e.fileService.getTempLocation(t.destinationFolder)})).then((function(t){return r.tmpLocation=t.nativeURL,new js(e.fileService,e.zipService).execute(r)})).then((function(t){return new Bs(e.fileService,e.dbService,e.appConfig,e.getContentDetailsHandler).execute(t.body)})).then((function(t){return new Ws(e.fileService,e.zipService,e.appConfig,e.dbService,e.deviceInfo,e.getContentDetailsHandler,e.eventsBusService,e.sharedPreferences).execute(t.body)})).then((function(t){var n=t[0],i=t[1];e.contentUpdateSizeOnDeviceTimeoutRef.set(r.rootIdentifier?r.rootIdentifier:r.identifiers[0],i),e.eventsBusService.emit({namespace:$.CONTENT,event:{type:Kn.CONTENT_EXTRACT_COMPLETED,payload:{contentId:r.rootIdentifier?r.rootIdentifier:r.identifiers[0]}}});new P.CsResponse;return new $s(e.dbService,e.deviceInfo,e.fileService).execute(n.body)})).then((function(t){return new tu(e.fileService).execute(t.body)})).then((function(t){var n=new P.CsResponse;return e.cleanupContent(r).toPromise().then((function(){return n.body=r,Promise.resolve(n)})).catch((function(){return Promise.reject(n)}))})).then((function(t){return new ru(e.telemetryService).execute(t.body)})).then((function(t){return new ou(e.telemetryService).execute(t.body,"ContentImport-Success")})).then((function(t){return e.eventsBusService.emit({namespace:$.CONTENT,event:{type:Kn.IMPORT_COMPLETED,payload:{contentId:r.rootIdentifier?r.rootIdentifier:r.identifiers[0]}}}),t.body.contentImportResponseList}))})).catch((function(t){return console.log("error",t),[{identifier:"",status:Yn.NOT_FOUND}]})))},t.prototype.nextContent=function(t,e,n){var r=this,i=new rs(this.dbService,this.getContentDetailsHandler,this.appConfig);return this.dbService.read($a.getReadContentQuery(t[0].identifier)).pipe(Object(dt.mergeMap)((function(o){return ku(r,void 0,void 0,(function(){var r,a;return Uu(this,(function(s){switch(s.label){case 0:return[4,i.getContentsKeyList(o[0])];case 1:return r=s.sent(),a=i.getNextContentIdentifier(t,e,r),[2,i.getContentFromDB(t,a,n)]}}))}))})))},t.prototype.prevContent=function(t,e,n){var r=this,i=new rs(this.dbService,this.getContentDetailsHandler,this.appConfig);return this.dbService.read($a.getReadContentQuery(t[0].identifier)).pipe(Object(dt.mergeMap)((function(o){return ku(r,void 0,void 0,(function(){var r,a;return Uu(this,(function(s){switch(s.label){case 0:return[4,i.getContentsKeyList(o[0])];case 1:return r=s.sent(),a=i.getPreviousContentIdentifier(t,e,r),[2,i.getContentFromDB(t,a,n)]}}))}))})))},t.prototype.getRelevantContent=function(t){var e=this,n={};return Object(J.of)(n).pipe(Object(dt.mergeMap)((function(r){return t.next?e.nextContent(t.hierarchyInfo,t.contentIdentifier,t.shouldConvertBasePath).pipe(Object(dt.map)((function(t){return n.nextContent=t,n}))):Object(J.of)(n)})),Object(dt.mergeMap)((function(r){return t.prev?e.prevContent(t.hierarchyInfo,t.contentIdentifier,t.shouldConvertBasePath).pipe(Object(dt.map)((function(t){return n.previousContent=t,n}))):Object(J.of)(n)})),Object(dt.map)((function(t){var e={};return e.next=t.nextContent?{content:t.nextContent}:void 0,e.prev=t.previousContent?{content:t.previousContent}:void 0,e})))},t.prototype.subscribeForImportStatus=function(t){throw new Error("Not Implemented yet")},t.prototype.searchContent=function(t,e,n,r){var i=this;if((t=JSON.parse(JSON.stringify(t))).facetFilters){var o=t.facetFilters.find((function(t){return"mimeType"===t.name}));o&&(o.values=o.values.filter((function(t){return t.apply})).reduce((function(t,e){return t=t.concat(e.values.map((function(t){return Pu({},t,{apply:!0})})))}),[]))}var a=new hs(this.appConfig,this.contentServiceConfig,this.telemetryService),s=t.languageCode;e?(t=a.getSearchCriteria(e),s&&(t.languageCode=s)):(t.limit=t.limit?t.limit:100,t.offset=t.offset?t.offset:0);var u=a.getSearchContentRequest(t);return this.sharedPreferences.getString(B.KEY_ACTIVE_CHANNEL_ACTIVE_FRAMEWORK_ID).pipe(Object(dt.mergeMap)((function(e){return n||(n=new nu(i.apiService,i.contentServiceConfig,e,t.languageCode)),n.handle(u).pipe(Object(dt.map)((function(e){return t.facetFilters||t.searchType!==Dn.SEARCH||(r||(u.filters.contentType=[],u.filters.primaryCategory=[]),u.filters.audience=[]),a.mapSearchResponse(t,e,u)})),Object(dt.map)((function(e){if(!e.filterCriteria.facetFilters)return e;var n=e.filterCriteria.facetFilters.find((function(t){return"mimeType"===t.name}));return n&&(n.values=Su.CsMimeTypeFacetToMimeTypeCategoryAggregator.aggregate(n.values,"filter"===t.searchType?[Sr.MimeTypeCategory.ALL]:[])),e})))})))},t.prototype.cancelDownload=function(t){return this.downloadService.cancel({identifier:t})},t.prototype.setContentMarker=function(t){var e=this,n="SELECT * FROM "+tn.TABLE_NAME+"\n WHERE "+tn.COLUMN_NAME_UID+" = '"+t.uid+"'\n AND "+tn.COLUMN_NAME_CONTENT_IDENTIFIER+"='"+t.contentId+"'\n AND "+tn.COLUMN_NAME_MARKER+" = "+t.marker;return this.dbService.execute(n).pipe(Object(dt.mergeMap)((function(n){var r={uid:t.uid,identifier:t.contentId,epoch_timestamp:Date.now(),data:t.data,extra_info:JSON.stringify(t.extraInfo),marker:t.marker.valueOf(),mime_type:e.getMimeType(t.data)};return Ar.isEmpty(n)?e.dbService.insert({table:tn.TABLE_NAME,modelJson:r}).pipe(Object(dt.map)((function(t){return t>0}))):t.isMarked?e.dbService.update({table:tn.TABLE_NAME,selection:tn.COLUMN_NAME_UID+"= ? AND "+tn.COLUMN_NAME_CONTENT_IDENTIFIER+"= ? AND "+tn.COLUMN_NAME_MARKER+"= ?",selectionArgs:[t.uid,t.contentId,t.marker.valueOf().toString()],modelJson:r}).pipe(Object(dt.map)((function(t){return t>0}))):e.dbService.delete({table:tn.TABLE_NAME,selection:tn.COLUMN_NAME_UID+" = ? AND "+tn.COLUMN_NAME_CONTENT_IDENTIFIER+" = ? AND "+tn.COLUMN_NAME_MARKER+" = ?",selectionArgs:[t.uid,t.contentId,""+t.marker]}).pipe(Object(dt.map)((function(t){return t})))})))},t.prototype.onDownloadCompletion=function(t){var e=this,n={isChildContent:t.isChildContent,sourceFilePath:t.downloadedFilePath,destinationFolder:t.destinationFolder,correlationData:t.correlationData,rollUp:t.rollUp,identifier:t.identifier};return this.importEcar(n).pipe(Object(dt.mergeMap)((function(){return e.downloadService.cancel({identifier:t.identifier},!1)})),Object(dt.catchError)((function(){return e.downloadService.cancel({identifier:t.identifier},!1)})),Object(dt.mapTo)(void 0))},t.prototype.getContentSpaceUsageSummary=function(t){var e=new uu(this.dbService);return Object(J.from)(e.getContentUsageSummary(t.paths))},t.prototype.buildContentAggregator=function(t,e,n){return new wu(new hs(this.appConfig,this.contentServiceConfig,this.telemetryService),t,this,this.cachedItemStore,e,n,this.apiService,this.networkInfoService)},t.prototype.getQuestionList=function(t,e){var n=this;return this.getContentDetails({contentId:e,objectType:"QuestionSet"}).pipe(Object(dt.switchMap)((function(r){return r.isAvailableLocally&&e?n.questionSetFileReadHandler.getLocallyAvailableQuestion(t,e):n.contentServiceDelegate.getQuestionList(t)})),Object(dt.catchError)((function(e){return n.contentServiceDelegate.getQuestionList(t)})))},t.prototype.getQuestionSetHierarchy=function(t){return this.contentServiceDelegate.getQuestionSetHierarchy(t)},t.prototype.getQuestionSetRead=function(t,e){return this.contentServiceDelegate.getQuestionSetRead(t,e)},t.prototype.getQuestionSetChildren=function(t){return ku(this,void 0,void 0,(function(){return Uu(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getChildQuestionSetHandler.handle(t)];case 1:return[2,e.sent()];case 2:return e.sent(),[2,[]];case 3:return[2]}}))}))},t.prototype.formatSearchCriteria=function(t){return new hs(this.appConfig,this.contentServiceConfig,this.telemetryService).getSearchCriteria(t)},t.prototype.cleanupContent=function(t){for(var e=[],n=0,r=Array.from(t.contentIdsToDelete.values());n<r.length;n++){var i={contentId:r[n],isChildContent:!1};e.push(i)}return this.deleteContent({contentDeleteList:e}).pipe(Object(dt.mapTo)(void 0))},t.prototype.getMimeType=function(t){var e="";t&&(e=JSON.parse(t).mimeType);return e},t.prototype.handleContentDeleteRequestSetChanges=function(){var t=this;return this.contentDeleteRequestSet.asListChanges().pipe(Object(dt.mergeMap)((function(e){var n=e[0];return n?t.deleteContent({contentDeleteList:[n]}).pipe(Object(dt.mergeMap)((function(){return t.contentDeleteRequestSet.remove(n)})),Object(dt.mapTo)(void 0)):Object(J.of)(void 0)})))},t.prototype.handleUpdateSizeOnDeviceFail=function(){var t=this;return this.sharedPreferences.getBoolean(e.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL).pipe(Object(dt.mergeMap)((function(e){return e?Object(J.of)(void 0):Object(J.from)(new qs(t.dbService,t.sharedPreferences,t.fileService).execute()).pipe(Object(dt.mapTo)(void 0))})))},Object.defineProperty(t.prototype,"contentServiceDelegate",{get:function(){return this.container.get(Z.CONTENT_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.downloadTranscriptFile=function(t){var n=this,r="ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalDataDirectory+e.DOWNLOAD_DIR_NAME;return this.createTranscriptDir(t,r).then((function(){var e={uri:t.downloadUrl,title:t.fileName,description:"",mimeType:"",visibleInDownloadsUi:!0,notificationVisibility:1,destinationInExternalPublicDir:{dirType:"Download",subPath:t.fileName},headers:[],destinationUri:t.destinationUrl};return n.downloadTranscript(e).toPromise().then((function(e){if(e&&e.path)return n.copyFile(e.path.split(/\/(?=[^\/]+$)/)[0],r.concat("/"+t.identifier),t.fileName).then((function(){n.deleteFolder(e.path)})),e.path}))}))},t.prototype.createTranscriptDir=function(t,e){var n=this;return this.fileService.exists(e.concat("/"+t.identifier)).then((function(t){return t.nativeURL})).catch((function(){return n.fileService.createDir(e,!1).then((function(r){n.fileService.createDir(e.concat("/"+t.identifier),!1).then((function(t){return t.nativeURL}))}))}))},t.prototype.downloadTranscript=function(t){return new J.Observable((function(e){downloadManager.enqueue(t,(function(t,n){if(t)return e.error(t);e.next(n),e.complete()}))})).pipe(Object(dt.mergeMap)((function(t){return Object(J.interval)(1e3).pipe(Object(dt.mergeMap)((function(){return new J.Observable((function(e){downloadManager.query({ids:[t]},(function(t,n){return t||16===n[0].status?e.error(t||new Error("Unknown Error")):e.next(n[0])}))}))})),Object(dt.filter)((function(t){return 8===t.status})),Object(dt.take)(1))})),Object(dt.map)((function(t){return{path:t.localUri}})))},t.prototype.copyFile=function(t,e,n){return ku(this,void 0,void 0,(function(){return Uu(this,(function(r){return[2,new Promise((function(r,i){sbutility.copyFile(t,e,n,(function(){r()}),(function(t){console.error(t),r(t)}))}))]}))}))},t.prototype.deleteFolder=function(t){return ku(this,void 0,void 0,(function(){return Uu(this,(function(e){return t?[2,new Promise((function(e,n){sbutility.rm(t,"",(function(){e()}),(function(t){n(t)}))}))]:[2]}))}))},t.DOWNLOAD_DIR_NAME="transcript",t.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL=V.KEY_IS_UPDATE_SIZE_ON_DEVICE_SUCCESSFUL,t.KEY_CONTENT_DELETE_REQUEST_LIST=V.KEY_CONTENT_DELETE_REQUEST_LIST,t=e=Lu([Object(R.injectable)(),ju(0,Object(R.inject)(Q.SDK_CONFIG)),ju(1,Object(R.inject)(Q.API_SERVICE)),ju(2,Object(R.inject)(Q.DB_SERVICE)),ju(3,Object(R.inject)(Q.PROFILE_SERVICE)),ju(4,Object(R.inject)(Q.FILE_SERVICE)),ju(5,Object(R.inject)(Q.ZIP_SERVICE)),ju(6,Object(R.inject)(Q.DEVICE_INFO)),ju(7,Object(R.inject)(Q.TELEMETRY_SERVICE)),ju(8,Object(R.inject)(Q.CONTENT_FEEDBACK_SERVICE)),ju(9,Object(R.inject)(Q.DOWNLOAD_SERVICE)),ju(10,Object(R.inject)(Q.SHARED_PREFERENCES)),ju(11,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),ju(12,Object(R.inject)(Q.CACHED_ITEM_STORE)),ju(13,Object(R.inject)(Q.APP_INFO)),ju(14,Object(R.inject)(Q.NETWORKINFO_SERVICE)),ju(15,Object(R.inject)(Q.CONTAINER)),ju(16,Object(R.inject)(Q.STORAGE_SERVICE)),Du("design:paramtypes",[Object,Object,I,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,Object,R.Container,Object])],t)}(),Bu=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Fu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vu=function(t,e){return function(n,r){e(n,r,t)}},qu=function(){function t(t){this.dbService=t}return t.prototype.getValue=function(t){return this.dbService.read({table:on.TABLE_NAME,columns:[],selection:on.COLUMN_NAME_KEY+" = ?",selectionArgs:[t]}).pipe(Object(dt.map)((function(t){return t[0]&&t[0].value})))},t.prototype.setValue=function(t,e){var n=this;return this.getValue(t).pipe(Object(dt.mergeMap)((function(r){var i,o;return r?n.dbService.update({table:on.TABLE_NAME,selection:on.COLUMN_NAME_KEY+" = ?",selectionArgs:[t],modelJson:(i={},i[on.COLUMN_NAME_KEY]=t,i[on.COLUMN_NAME_VALUE]=e,i)}).pipe(Object(dt.map)((function(t){return t>0}))):n.dbService.insert({table:on.TABLE_NAME,modelJson:(o={},o[on.COLUMN_NAME_KEY]=t,o[on.COLUMN_NAME_VALUE]=e,o)}).pipe(Object(dt.map)((function(t){return t>0})))})))},t=Bu([Object(R.injectable)(),Vu(0,Object(R.inject)(Q.DB_SERVICE)),Fu("design:paramtypes",[I])],t)}(),Yu=function(){function t(t,e,n,r){this.apiService=t,this.formServiceConfig=e,this.fileService=n,this.cachedItemStore=r,this.FORM_FILE_KEY_PREFIX="form-",this.FORM_LOCAL_KEY="form-",this.GET_FORM_DETAILS_ENDPOINT="/read"}return t.getIdForRequest=function(t){var e=t.type+"_"+t.subType+"_"+t.action;return t.rootOrgId&&"*"!==t.rootOrgId&&(e+="_"+t.rootOrgId),t.framework&&(e+="_"+t.framework),t.component&&(e+="_"+t.component),e},t.prototype.handle=function(e){var n=this;return this.cachedItemStore[e.from===Wr.SERVER?"get":"getCached"](t.getIdForRequest(e),this.FORM_LOCAL_KEY,"ttl_"+this.FORM_LOCAL_KEY,(function(){return n.fetchFormServer(e)}),(function(){return n.fetchFromFile(e)}))},t.prototype.fetchFormServer=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.formServiceConfig.apiPath+this.GET_FORM_DETAILS_ENDPOINT).withBearerToken(!0).withHeaders({"X-Platform-Id":window.device.platform}).withBody({request:t}).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result})))},t.prototype.fetchFromFile=function(e){var n=ci.getAssetPath()+this.formServiceConfig.formConfigDirPath,r=this.FORM_FILE_KEY_PREFIX+t.getIdForRequest(e)+".json";return Object(J.from)(this.fileService.readFileFromAssets(n.concat("/",r))).pipe(Object(dt.map)((function(t){return JSON.parse(t).result})))},t}(),Gu=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Hu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zu=function(t,e){return function(n,r){e(n,r,t)}},Ku=function(){function t(t,e,n,r){this.sdkConfig=t,this.apiService=e,this.fileService=n,this.cachedItemStore=r,this.formServiceConfig=this.sdkConfig.formServiceConfig}return t.prototype.getForm=function(t){return new Yu(this.apiService,this.formServiceConfig,this.fileService,this.cachedItemStore).handle(t)},t=Gu([Object(R.injectable)(),zu(0,Object(R.inject)(Q.SDK_CONFIG)),zu(1,Object(R.inject)(Q.API_SERVICE)),zu(2,Object(R.inject)(Q.FILE_SERVICE)),zu(3,Object(R.inject)(Q.CACHED_ITEM_STORE)),Hu("design:paramtypes",[Object,Object,Object,Object])],t)}(),Wu=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Xu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ju=function(t,e){return function(n,r){e(n,r,t)}},Zu=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Qu=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},$u=function(){function t(t,e,n){this.sdkConfig=t,this.keyValueStore=e,this.sharedPreferences=n,this.apiConfig=this.sdkConfig.apiConfig}var e;return e=t,t.isItemEmpty=function(t){return!(!Array.isArray(t)||0!==t.length)||"object"==typeof t&&0===Object.keys(t).length},t.prototype.get=function(t,e,n,r,i,o,a){var s=this;return r().pipe(Object(dt.tap)((function(r){s.saveItemTTL(t,n).toPromise(),s.saveItemToDb(t,e,r).toPromise()})),Object(dt.catchError)((function(){return s.getCached(t,e,n,r,i,o,a)})))},t.prototype.getCached=function(t,e,n,r,i,o,a){var s=this;return this.isItemCachedInDb(n,t).pipe(Object(dt.mergeMap)((function(u){return u?s.isItemTTLExpired(n,t,isNaN(o)?s.apiConfig.cached_requests.timeToLive:o).pipe(Object(dt.mergeMap)((function(i){return i?s.keyValueStore.getValue(e+"-"+t).pipe(Object(dt.map)((function(t){return JSON.parse(t)})),Object(dt.tap)((function(){return Zu(s,void 0,void 0,(function(){var i,o=this;return Qu(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,r().pipe(Object(dt.switchMap)((function(r){return o.saveItem(t,n,e,r,a)}))).toPromise()];case 1:return s.sent(),[3,3];case 2:return i=s.sent(),console.error(i),[3,3];case 3:return[2]}}))}))}))):s.keyValueStore.getValue(e+"-"+t).pipe(Object(dt.map)((function(t){return JSON.parse(t)})))}))):i?i().pipe(Object(dt.switchMap)((function(r){return s.saveItem(t,n,e,r,a)})),Object(dt.catchError)((function(i){return r().pipe(Object(dt.switchMap)((function(r){return s.saveItem(t,n,e,r,a)})))}))):r().pipe(Object(dt.switchMap)((function(r){return s.saveItem(t,n,e,r,a)})))})))},t.prototype.isItemCachedInDb=function(t,e){return this.sharedPreferences.getString(t+"-"+e).pipe(Object(dt.mergeMap)((function(t){return Object(J.iif)((function(){return!!t}),Object(J.defer)((function(){return Object(J.of)(!0)})),Object(J.defer)((function(){return Object(J.of)(!1)})))})))},t.prototype.isItemTTLExpired=function(t,e,n){return this.sharedPreferences.getString(t+"-"+e).pipe(Object(dt.map)((function(t){var e=Number(t);return!(Date.now()-e<n)})))},t.prototype.saveItem=function(t,n,r,i,o){return e.isItemEmpty(i)||o&&o(i)?Object(J.of)(i):Object(J.zip)(this.saveItemTTL(t,n),this.saveItemToDb(t,r,i)).pipe(Object(dt.switchMap)((function(){return Object(J.of)(i)})))},t.prototype.saveItemTTL=function(t,e){return this.sharedPreferences.putString(e+"-"+t,Date.now()+"").pipe(Object(dt.mergeMap)((function(t){return Object(J.of)(!0)})))},t.prototype.saveItemToDb=function(t,e,n){return this.keyValueStore.setValue(e+"-"+t,JSON.stringify(n))},t=e=Wu([Object(R.injectable)(),Ju(0,Object(R.inject)(Q.SDK_CONFIG)),Ju(1,Object(R.inject)(Q.KEY_VALUE_STORE)),Ju(2,Object(R.inject)(Q.SHARED_PREFERENCES)),Xu("design:paramtypes",[Object,Object,Object])],t)}();!function(t){t.RESOURCE="Resource",t.COURSE="Course",t.ANONYMOUS_COURSE="AnonymousCourse",t.DIAL_CODE="DIAL Code Consumption"}(ja||(ja={}));var tc,ec=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},nc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rc=function(){function t(t,e,n,r,i,o,a,s){this.apiService=t,this.pageApiServiceConfig=e,this.sharedPreferences=n,this.cachedItemStore=r,this.keyValueStore=i,this.authService=o,this.profileService=a,this.systemSettingsService=s,this.PAGE_ASSEMBLE_LOCAL_KEY="page_assemble-",this.PAGE_ASSEMBLE_ENDPOINT="/page/assemble?orgdetails=orgName",this.DIALCODE_ASSEMBLE_ENDPOINT="/dial/assemble"}return t.getIdForDb=function(t){return t.name+"-"+(t.organisationId||"")+"-"+(t.source||"app")+"-"+(t.mode||"")+"-"+(t.filters?gu(JSON.stringify(t.filters)).toString():"")+(t.sections?gu(JSON.stringify(t.sections)).toString():"")},t.prototype.handle=function(e){var n=this;return e.from=e.from||Wr.CACHE,Object(J.defer)((function(){return ec(n,void 0,void 0,(function(){var n,r,i,o=this;return nc(this,(function(a){switch(a.label){case 0:return e.name!==ja.COURSE?[2,e]:[4,this.sharedPreferences.getString(W.KEY_ORGANISATION_ID).toPromise()];case 1:return(n=a.sent())?[4,function(){return ec(o,void 0,void 0,(function(){var t,e;return nc(this,(function(n){switch(n.label){case 0:return[4,this.authService.getSession().toPromise()];case 1:return t=!!n.sent(),[4,this.profileService.isDefaultChannelProfile().toPromise()];case 2:return e=n.sent(),[2,t&&!e]}}))}))}()]:[2,e];case 2:return a.sent()?[2,e]:[4,this.systemSettingsService.getSystemSettings({id:t.SYSTEM_SETTINGS_TENANT_COURSE_PAGE_ID}).toPromise().then((function(t){try{return JSON.parse(t.value)}catch(t){return console.error(t),[]}}))];case 3:return r=a.sent(),e.organisationId=n,(i=r.find((function(t){return t.channelId===n})))&&(e.name=i.page),[2,e]}}))}))})).pipe(Object(dt.mergeMap)((function(t){return t.from===Wr.SERVER?n.fetchFromServer(t).pipe(Object(dt.catchError)((function(){return n.fetchFromCache(t)}))):n.fetchFromCache(t)})))},t.prototype.fetchFromServer=function(e){var n=this,r=e.name===ja.DIAL_CODE?this.DIALCODE_ASSEMBLE_ENDPOINT:this.PAGE_ASSEMBLE_ENDPOINT,i=(new P.CsRequest.Builder).withHost(this.pageApiServiceConfig.host).withType(P.CsHttpRequestType.POST).withPath(this.pageApiServiceConfig.apiPath+r).withBearerToken(!0).withBody({request:e}).build();return this.apiService.fetch(i).pipe(Object(dt.map)((function(t){return t.body.result.response})),Object(dt.tap)((function(r){var i=JSON.stringify(r);n.sharedPreferences.putString("ttl_"+n.PAGE_ASSEMBLE_LOCAL_KEY+"-"+t.getIdForDb(e),Date.now()+"").toPromise(),n.keyValueStore.setValue(n.PAGE_ASSEMBLE_LOCAL_KEY+"-"+t.getIdForDb(e),i).toPromise()})))},t.prototype.fetchFromCache=function(e){var n=this;return this.cachedItemStore.getCached(t.getIdForDb(e),this.PAGE_ASSEMBLE_LOCAL_KEY,"ttl_"+this.PAGE_ASSEMBLE_LOCAL_KEY,(function(){return n.fetchFromServer(e)}))},t.SYSTEM_SETTINGS_TENANT_COURSE_PAGE_ID="tenantCoursePage",t}(),ic=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},oc=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ac=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},sc=function(){function t(t,e){this.defaultDelegate=t,this.dbService=e}return t.prototype.handle=function(t){var e=this;return Object(J.defer)((function(){return oc(e,void 0,void 0,(function(){var e,n,r,i;return ac(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.defaultDelegate.handle(t).toPromise()];case 1:return e=o.sent(),[3,3];case 2:return n=o.sent(),console.error(n),[3,3];case 3:return t.filters&&t.filters.dialcodes?(r="SELECT c.* FROM content c WHERE ref_count > 0 AND dialcodes LIKE '%%~"+t.filters.dialcodes+"~%%'",[4,this.dbService.execute(r).toPromise()]):[3,8];case 4:return i=o.sent().map((function(t){return Rr.mapContentDBEntryToContent(t).contentData})),e&&e.sections[0]&&i.length?[4,this.mergePageAssembleWithLocalContents(e,i)]:[3,6];case 5:return e=o.sent(),[3,8];case 6:return e||!i.length?[3,8]:[4,this.buildPageAssembleWithLocalContents(i)];case 7:e=o.sent(),o.label=8;case 8:if(!e)throw new Error("NO_DATA");return[2,e]}}))}))}))},t.prototype.buildPageAssembleWithLocalContents=function(t){return oc(this,void 0,void 0,(function(){var e;return ac(this,(function(n){return e={name:"",id:"",sections:[{display:"",count:0,index:0,sectionDataType:"",resmsgId:"",searchQuery:"",name:"",id:"",apiId:"",group:0,contents:t}]},[2,this.mergePageAssembleWithLocalCollections(e,t)]}))}))},t.prototype.mergePageAssembleWithLocalContents=function(t,e){return oc(this,void 0,void 0,(function(){var n,r;return ac(this,(function(i){switch(i.label){case 0:return(n=t.sections[0]).contents&&n.contents.length?(r=e.filter((function(t){return!n.contents.find((function(e){return e.identifier===t.identifier}))}))).length?(n.contents=r.concat(n.contents),[4,this.mergePageAssembleWithLocalCollections(t,r)]):[3,2]:[3,3];case 1:t=i.sent(),i.label=2;case 2:return[3,5];case 3:return n.contents=e,[4,this.mergePageAssembleWithLocalCollections(t,e)];case 4:t=i.sent(),i.label=5;case 5:return[2,t]}}))}))},t.prototype.mergePageAssembleWithLocalCollections=function(t,e){return oc(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c,f,h;return ac(this,(function(l){switch(l.label){case 0:(n=t.sections[0]).collections||(n.collections=[]),r=0,i=e,l.label=1;case 1:return r<i.length?(o=i[r],a="SELECT c.* FROM content c WHERE c.visibility = 'Default' AND ref_count > 0 AND child_nodes LIKE '%%~"+o.identifier+"~%%'",[4,this.dbService.execute(a).toPromise()]):[3,4];case 2:if((s=l.sent().map((function(t){return Rr.mapContentDBEntryToContent(t).contentData}))).length)for(u=function(t){var e=n.collections.find((function(e){return e.identifier===t.identifier}));e?e.childNodes.indexOf(o.identifier)>=0||e.childNodes.push(o.identifier):n.collections.push(ic({},t,{childNodes:[o.identifier]}))},c=0,f=s;c<f.length;c++)h=f[c],u(h);l.label=3;case 3:return r++,[3,1];case 4:return[2,t]}}))}))},t}(),uc=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},cc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},fc=function(){function t(t,e,n,r){this.defaultDelegate=t,this.authService=e,this.frameworkService=n,this.systemSettingsService=r,this.ssoSectionIdMap=new Map}return t.prototype.handle=function(e){var n=this;return Object(J.defer)((function(){return uc(n,void 0,void 0,(function(){var n,r,i,o,a,s;return cc(this,(function(u){switch(u.label){case 0:return[4,this.authService.getSession().toPromise()];case 1:return!!u.sent()?[4,this.frameworkService.getDefaultChannelId().toPromise()]:[2,e];case 2:if(r=u.sent(),i=this.frameworkService.activeChannelId,i===r)return[3,7];o=void 0,u.label=3;case 3:return u.trys.push([3,5,,6]),[4,this.systemSettingsService.getSystemSettings({id:t.SSO_COURSE_SECTION_ID}).toPromise()];case 4:return a=u.sent(),o=a&&a.value,[3,6];case 5:return s=u.sent(),console.error(s),[3,6];case 6:o&&(e.sections=((n={})[o]={filters:{"batches.createdFor":[i]}},n),this.ssoSectionIdMap.set(e.name+"-"+i,o)),u.label=7;case 7:return[2,e]}}))}))})).pipe(Object(dt.mergeMap)((function(t){return n.defaultDelegate.handle(t)})),Object(dt.map)((function(t){var r=n.ssoSectionIdMap.get(e.name+"-"+n.frameworkService.activeChannelId);return r&&(t.ssoSectionId=r),t})))},t.SSO_COURSE_SECTION_ID="ssoCourseSection",t}(),hc=function(){function t(t,e,n,r,i,o,a,s,u,c){this.apiService=t,this.pageApiServiceConfig=e,this.cachedItemStore=n,this.keyValueStore=r,this.sharedPreferences=i,this.frameworkService=o,this.authService=a,this.systemSettingsService=s,this.dbService=u,this.profileService=c,this.defaultRequestDelegate=new rc(t,e,i,n,r,a,c,s),this.dialcodeRequestDelegate=new sc(this.defaultRequestDelegate,u),this.courseRequestDelegate=new fc(this.defaultRequestDelegate,a,o,s)}return t.prototype.handle=function(t){switch(t.from=t.from||Wr.CACHE,t.name){case ja.COURSE:return this.courseRequestDelegate.handle(t);case ja.DIAL_CODE:return this.dialcodeRequestDelegate.handle(t);default:return this.defaultRequestDelegate.handle(t)}},t}(),lc=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},dc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pc=function(t,e){return function(n,r){e(n,r,t)}},mc=function(){function t(t,e,n,r,i,o,a,s,u,c){this.apiService=t,this.sdkConfig=e,this.cachedItemStore=n,this.keyValueStore=r,this.sharedPreferences=i,this.frameworkService=o,this.authService=a,this.systemSettingsService=s,this.dbService=u,this.profileService=c,this.pageAssembleServiceConfig=this.sdkConfig.pageServiceConfig}return t.prototype.setPageAssembleChannel=function(t){this.sharedPreferences.putString(W.KEY_ORGANISATION_ID,t.channelId).toPromise()},t.prototype.getPageAssemble=function(t){return new hc(this.apiService,this.pageAssembleServiceConfig,this.cachedItemStore,this.keyValueStore,this.sharedPreferences,this.frameworkService,this.authService,this.systemSettingsService,this.dbService,this.profileService).handle(t)},t=lc([Object(R.injectable)(),pc(0,Object(R.inject)(Q.API_SERVICE)),pc(1,Object(R.inject)(Q.SDK_CONFIG)),pc(2,Object(R.inject)(Q.CACHED_ITEM_STORE)),pc(3,Object(R.inject)(Q.KEY_VALUE_STORE)),pc(4,Object(R.inject)(Q.SHARED_PREFERENCES)),pc(5,Object(R.inject)(Q.FRAMEWORK_SERVICE)),pc(6,Object(R.inject)(Q.AUTH_SERVICE)),pc(7,Object(R.inject)(Q.SYSTEM_SETTINGS_SERVICE)),pc(8,Object(R.inject)(Q.DB_SERVICE)),pc(9,Object(R.inject)(Q.PROFILE_SERVICE)),dc("design:paramtypes",[Object,Object,Object,Object,Object,Object,Object,Object,I,Object])],t)}(),bc=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},yc=function(){function t(){this.listeners=new Map}return t.prototype.getString=function(t){return Object(J.defer)((function(){return Object(J.of)(localStorage.getItem(t)).pipe(Object(dt.map)((function(t){return t||void 0})))}))},t.prototype.putString=function(t,e){return Object(J.defer)((function(){return Object(J.of)(localStorage.setItem(t,e)).pipe(Object(dt.mapTo)(void 0))}))},t.prototype.putBoolean=function(t,e){return Object(J.defer)((function(){return Object(J.of)(localStorage.setItem(t,e+"")).pipe(Object(dt.mapTo)(!0))}))},t.prototype.getBoolean=function(t){return Object(J.defer)((function(){return Object(J.of)("true"===localStorage.getItem(t))}))},t.prototype.addListener=function(t,e){var n=this.listeners.get(t)||[];n.push(e),this.listeners.set(t,n)},t.prototype.removeListener=function(t,e){var n=this.listeners.get(t)||[];this.listeners.set(t,n.filter((function(t){return t!==e})))},t=bc([Object(R.injectable)()],t)}(),vc=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},gc=function(){function t(){this.listeners=new Map,this.sharedPreferences=plugins.SharedPreferences.getInstance(e.sharedPreferncesName)}var e;return e=t,t.prototype.getString=function(t){var e=this,n=localStorage.getItem(t);return n?(localStorage.removeItem(t),this.putString(t,n).pipe(Object(dt.mapTo)(n))):new J.Observable((function(n){e.sharedPreferences.getString(t,"",(function(t){n.next(t),n.complete()}),(function(t){n.error(t)}))}))},t.prototype.putString=function(t,e){var n=this;return new J.Observable((function(r){n.sharedPreferences.putString(t,e,(function(){(n.listeners.get(t)||[]).forEach((function(t){return t(e)})),r.next(void 0),r.complete()}),(function(t){r.error(t)}))}))},t.prototype.putBoolean=function(t,e){var n=this;return new J.Observable((function(r){n.sharedPreferences.putBoolean(t,e,(function(){(n.listeners.get(t)||[]).forEach((function(t){return t(e)})),r.next(!0),r.complete()}),(function(t){r.error(t)}))}))},t.prototype.getBoolean=function(t){var e=this,n=localStorage.getItem(t);return n?(localStorage.removeItem(t),this.putBoolean(t,"true"===n).pipe(Object(dt.mapTo)("true"===n))):new J.Observable((function(n){e.sharedPreferences.getBoolean(t,!1,(function(t){n.next(t),n.complete()}),(function(t){n.error(t)}))}))},t.prototype.addListener=function(t,e){var n=this.listeners.get(t)||[];n.push(e),this.listeners.set(t,n)},t.prototype.removeListener=function(t,e){var n=this.listeners.get(t)||[];this.listeners.set(t,n.filter((function(t){return t!==e})))},t.sharedPreferncesName="org.ekstep.genieservices.preference_file",t=e=vc([Object(R.injectable)()],t)}();!function(t){t[t.PERSISTENT=1]="PERSISTENT",t[t.TEMPORARY=0]="TEMPORARY"}(tc||(tc={}));var _c,Ec,Mc,wc=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Sc=function(){function t(){this.initialized=!1}return t.prototype.init=function(){var t=this;file.requestFileSystem(tc.PERSISTENT,0,(function(e){t.initialized=!0,t.fileSystem=e}),(function(){}))},t.prototype.readAsText=function(t,e){return this.readFile(t,e,"Text")},t.prototype.readAsBinaryString=function(t,e){return this.readFile(t,e,"BinaryString")},t.prototype.readFileFromAssets=function(t){return new Promise((function(e,n){try{sbutility.readFromAssets(t,(function(t){e(t)}),(function(t){n(t)}))}catch(t){n(t)}}))},t.prototype.writeFile=function(t,e,n,r){var i=this;void 0===r&&(r={});var o={create:!r.append,exclusive:!r.replace};return this.resolveDirectoryUrl(t).then((function(t){return i.getFile(t,e,o)})).then((function(t){return i.writeFileEntry(t,n,r)}))},t.prototype.createFile=function(t,e,n){var r=this,i={create:!0};return n||(i.exclusive=!0),this.resolveDirectoryUrl(t).then((function(t){return r.getFile(t,e,i)}))},t.prototype.getFile=function(t,e,n){return new Promise((function(r,i){try{t.getFile(e,n,(function(t){r(t)}),(function(t){i(t)}))}catch(t){i(t)}}))},t.prototype.removeFile=function(t){var e=this,n=is.getParentDir(t),r=is.getFileName(t).replace("/","");return this.resolveDirectoryUrl(n).then((function(t){return e.getFile(t,r,{create:!1})})).then((function(t){return e.remove(t)}))},t.prototype.createDir=function(t,e){var n=this,r={create:!0};e||(r.exclusive=!0);var i=is.getParentDir(t),o=is.getFileName(t).replace("/","");return this.exists(t).then((function(){return n.resolveDirectoryUrl(t)})).catch((function(){return n.resolveDirectoryUrl(i).then((function(t){return n.getDirectory(t,o,r)}))}))},t.prototype.listDir=function(t){var e=this;return this.resolveDirectoryUrl(is.getDirecory(t)).then((function(n){return e.getDirectory(n,is.getFileName(t),{create:!1,exclusive:!1})})).then((function(t){var n=t.createReader();return e.readEntries(n)}))},t.prototype.removeDir=function(t,e){var n=this;return this.resolveDirectoryUrl(t).then((function(t){return n.getDirectory(t,e,{create:!1})})).then((function(t){return n.remove(t)}))},t.prototype.removeRecursively=function(t){var e=this;t=t.endsWith("/")?t.substring(0,t.length-1):t;var n=is.getParentDir(t),r=is.getFileName(t).replace("/","");return this.resolveDirectoryUrl(n).then((function(t){return e.getDirectory(t,r,{create:!1})})).then((function(t){return e.rimraf(t)}))},t.prototype.copyDir=function(t,e,n,r){var i=this;return this.resolveDirectoryUrl(t).then((function(t){return i.getDirectory(t,e,{create:!1})})).then((function(t){return i.resolveDirectoryUrl(n).then((function(e){return i.copy(t,e,r)}))}))},t.prototype.copyFile=function(t,e,n,r){var i=this;return r=r||e,this.resolveDirectoryUrl(t).then((function(t){return i.getFile(t,e,{create:!1})})).then((function(t){return i.resolveDirectoryUrl(n).then((function(e){return i.copy(t,e,r)}))}))},t.prototype.exists=function(t){return this.resolveLocalFilesystemUrl(t)},t.prototype.getTempLocation=function(t){var e=this;return this.resolveDirectoryUrl(t).then((function(n){return e.resolveDirectoryUrl(t.concat("tmp"))})).catch((function(){return e.createDir(t.concat("tmp"),!1)}))},t.prototype.getFreeDiskSpace=function(){return new Promise((function(t,e){cordova.exec(t,e,"File","getFreeDiskSpace",[])}))},t.prototype.resolveLocalFilesystemUrl=function(t){return t.includes("file://")||(t="file://"+t),console.log(t),new Promise((function(e,n){try{resolveLocalFileSystemURL(t,(function(t){e(t)}),(function(t){n(t)}))}catch(t){n(t)}}))},t.prototype.getMetaData=function(t){var e=this;if("string"==typeof t)return this.resolveLocalFilesystemUrl(t).then((function(t){return e.getMetaData(t)}));var n=t;return new Promise((function(t){n.getMetadata((function(e){t(e)}),(function(){return t()}))}))},t.prototype.getExternalApplicationStorageDirectory=function(){return file.externalApplicationStorageDirectory},t.prototype.getDirectorySize=function(t){var e=this;return this.resolveDirectoryUrl(t).then((function(t){return e.size(t)})).catch((function(){return 0}))},t.prototype.size=function(t){var e=this;return t.isFile?new Promise((function(e,n){t.getMetadata((function(t){return e(t.size)}),(function(t){return n(t)}))})):t.isDirectory?new Promise((function(n,r){t.createReader().readEntries((function(t){Promise.all(t.map((function(t){return e.size(t)}))).then((function(t){var e=t.reduce((function(t,e){return t+e}),0);n(e)})).catch((function(t){return r(t)}))}),(function(t){return r(t)}))})):Promise.resolve(0)},t.prototype.readEntries=function(t){return new Promise((function(e,n){t.readEntries((function(t){e(t)}),(function(t){n(t)}))}))},t.prototype.readFile=function(t,e,n){var r=this;return this.resolveDirectoryUrl(t).then((function(t){return r.getFile(t,e,{create:!1})})).then((function(t){var e=new FileReader;return new Promise((function(r,i){e.onloadend=function(){void 0!==e.result||null!==e.result?r(e.result):void 0!==e.error||null!==e.error?i(e.error):i({code:null,message:"READER_ONLOADEND_ERR"})},t.file((function(t){e["readAs"+n].call(e,t)}),(function(t){i(t)}))}))})).catch((function(t){throw t}))},t.prototype.resolveDirectoryUrl=function(t){return this.resolveLocalFilesystemUrl(t).then((function(t){return t.isDirectory?t:Promise.reject("input is not a directory")}))},t.prototype.remove=function(t){return new Promise((function(e,n){t.remove((function(){e({success:!0,fileRemoved:t})}),(function(t){n(t)}))}))},t.prototype.copy=function(t,e,n){return new Promise((function(r,i){t.copyTo(e,n,(function(t){r(t)}),(function(t){i(t)}))}))},t.prototype.getDirectory=function(t,e,n){return new Promise((function(r,i){try{t.getDirectory(e,n,(function(t){r(t)}),(function(t){i(t)}))}catch(t){i(t)}}))},t.prototype.rimraf=function(t){return new Promise((function(e,n){t.removeRecursively((function(){e({success:!0,fileRemoved:t})}),(function(t){n(t)}))}))},t.prototype.createWriter=function(t){return new Promise((function(e,n){t.createWriter((function(t){e(t)}),(function(t){n(t)}))}))},t.prototype.writeFileEntry=function(t,e,n){var r=this;return this.createWriter(t).then((function(t){return n.append&&t.seek(t.length),n.truncate&&t.truncate(n.truncate),r.write(t,e)})).then((function(){return t}))},t.prototype.write=function(t,e){return new Promise((function(n,r){t.onwriteend=function(e){t.error?r(t.error):n(e)},t.write(e)}))},t=wc([Object(R.injectable)()],t)}(),Oc=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ac=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Tc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Nc=function(t){function e(){return t.call(this,2,17)||this}return Oc(e,t),e.prototype.apply=function(t){return Ac(this,void 0,void 0,(function(){var e=this;return Tc(this,(function(n){return this.queries().forEach((function(n){return Ac(e,void 0,void 0,(function(){return Tc(this,(function(e){switch(e.label){case 0:return[4,t.execute(n).toPromise()];case 1:return e.sent(),[2]}}))}))})),[2,void 0]}))}))},e.prototype.queries=function(){return[Ie.getAlterEntryForProfileSyllabus()]},e}(C),Cc=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ic=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Rc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Pc=function(t){function e(){return t.call(this,3,18)||this}return Cc(e,t),e.prototype.apply=function(t){return Ic(this,void 0,void 0,(function(){var e=this;return Rc(this,(function(n){switch(n.label){case 0:return this.queries().forEach((function(n){return Ic(e,void 0,void 0,(function(){return Rc(this,(function(e){switch(e.label){case 0:return[4,t.execute(n).toPromise()];case 1:return e.sent(),[2]}}))}))})),[4,t.read({table:Ie.TABLE_NAME,columns:[]}).pipe(Object(dt.map)((function(n){n.forEach((function(n){return Ic(e,void 0,void 0,(function(){return Rc(this,(function(e){switch(e.label){case 0:return n[Ie.COLUMN_NAME_UID]===n[Ie.COLUMN_NAME_HANDLE]?n[Ie.COLUMN_NAME_SOURCE]=Fr.SERVER.valueOf():n[Ie.COLUMN_NAME_SOURCE]=Fr.LOCAL.valueOf(),[4,t.update({table:Ie.TABLE_NAME,modelJson:n}).toPromise()];case 1:return e.sent(),[2]}}))}))}))}))).toPromise()];case 1:return n.sent(),[2,void 0]}}))}))},e.prototype.queries=function(){return[De.getCreateEntry(),ke.getCreateEntry()]},e.prototype.updateProfileTable=function(){},e}(C),Lc=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dc=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},jc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},kc=function(t){function e(){return t.call(this,4,19)||this}return Lc(e,t),e.prototype.apply=function(t){return Dc(this,void 0,void 0,(function(){var e=this;return jc(this,(function(n){switch(n.label){case 0:return[4,t.read({table:Fe.TABLE_NAME,columns:[]}).pipe(Object(dt.map)((function(n){n.forEach((function(n){return Dc(e,void 0,void 0,(function(){var e;return jc(this,(function(r){switch(r.label){case 0:return e=Number(n[qe.COLUMN_NAME_TOTAL_TS]),n[qe.COLUMN_NAME_TOTAL_TS]=Math.round(e/1e3),[4,t.update({table:qe.TABLE_NAME,modelJson:n}).toPromise()];case 1:return r.sent(),[2]}}))}))}))}))).toPromise()];case 1:return n.sent(),[2,void 0]}}))}))},e.prototype.queries=function(){return[]},e}(C),Uc=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xc=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Bc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Fc=function(t){function e(){return t.call(this,7,22)||this}return Uc(e,t),e.prototype.apply=function(t){return xc(this,void 0,void 0,(function(){var e=this;return Bc(this,(function(n){return this.queries().forEach((function(n){return xc(e,void 0,void 0,(function(){return Bc(this,(function(e){switch(e.label){case 0:return[4,t.execute(n).toPromise()];case 1:return e.sent(),[2]}}))}))})),[2,void 0]}))}))},e.prototype.queries=function(){return[sn.getCreateEntry()]},e}(C),Vc=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qc=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Yc=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Gc=function(t){function e(){return t.call(this,5,20)||this}return Vc(e,t),e.prototype.apply=function(t){return qc(this,void 0,void 0,(function(){var e=this;return Yc(this,(function(n){return this.queries().forEach((function(n){return qc(e,void 0,void 0,(function(){return Yc(this,(function(e){switch(e.label){case 0:return[4,t.execute(n).toPromise()];case 1:return e.sent(),[2]}}))}))})),[2,void 0]}))}))},e.prototype.queries=function(){return[tn.getCreateEntry()]},e}(C),Hc=function(){function t(t,e,n,r){this.apiService=t,this.systemSettingsConfig=e,this.fileservice=n,this.cachedItemStore=r,this.SYSTEM_SETTINGS_FILE_KEY_PREFIX="system-setting-",this.SYSTEM_SETTINGS_LOCAL_KEY="system-settings-",this.GET_SYSTEM_SETTINGS_ENDPOINT="/system/settings/get"}return t.prototype.handle=function(t){var e=this;return this.cachedItemStore.getCached(t.id,this.SYSTEM_SETTINGS_LOCAL_KEY,"ttl_"+this.SYSTEM_SETTINGS_LOCAL_KEY,(function(){return e.fetchFromServer(t)}),(function(){return e.fetchFromFile(t)}))},t.prototype.fetchFromServer=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.systemSettingsConfig.systemSettingsApiPath+this.GET_SYSTEM_SETTINGS_ENDPOINT+"/"+t.id).withBearerToken(!0).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){return t.body.result.response})))},t.prototype.fetchFromFile=function(t){var e=ci.getAssetPath()+this.systemSettingsConfig.systemSettingsDirPath,n=this.SYSTEM_SETTINGS_FILE_KEY_PREFIX+t.id+".json";return Object(J.from)(this.fileservice.readFileFromAssets(e.concat("/",n))).pipe(Object(dt.map)((function(t){return JSON.parse(t).result.response})))},t}(),zc=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Kc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wc=function(t,e){return function(n,r){e(n,r,t)}},Xc=function(){function t(t,e,n,r){this.sdkConfig=t,this.apiService=e,this.fileService=n,this.cachedChannelItemStore=r,this.systemSettingsConfig=this.sdkConfig.systemSettingsConfig}return t.prototype.getSystemSettings=function(t){return new Hc(this.apiService,this.systemSettingsConfig,this.fileService,this.cachedChannelItemStore).handle(t)},t=zc([Object(R.injectable)(),Wc(0,Object(R.inject)(Q.SDK_CONFIG)),Wc(1,Object(R.inject)(Q.API_SERVICE)),Wc(2,Object(R.inject)(Q.FILE_SERVICE)),Wc(3,Object(R.inject)(Q.CACHED_ITEM_STORE)),Kc("design:paramtypes",[Object,Object,Object,Object])],t)}(),Jc=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Zc=function(){function t(){}return t.prototype.unzip=function(t,e,n,r){JJzip.unzip(t,e,(function(){n&&n()}),(function(t){r&&r(t)}))},t.prototype.zip=function(t,e,n,r,i,o){JJzip.zip(t,e,n,r,(function(){i&&i()}),(function(t){o&&o(t)}))},t=Jc([Object(R.injectable)()],t)}();!function(t){t.INTERNAL_STORAGE="INTERNAL_STORAGE",t.EXTERNAL_STORAGE="EXTERNAL_STORAGE"}(_c||(_c={})),function(t){t.TRANSFER_PROGRESS="TRANSFER_PROGRESS",t.TRANSFER_COMPLETED="TRANSFER_COMPLETED",t.TRANSFER_REVERT_COMPLETED="TRANSFER_REVERT_COMPLETED",t.TRANSFER_FAILED_DUPLICATE_CONTENT="TRANSFER_FAILED_DUPLICATE_CONTENT",t.TRANSFER_FAILED_LOW_MEMORY="TRANSFER_FAILED_LOW_MEMORY"}(Ec||(Ec={})),function(t){t.IGNORE="IGNORE",t.KEEP_HIGER_VERSION="KEEP_HIGER_VERSION",t.KEEP_LOWER_VERSION="KEEP_LOWER_VERSION",t.KEEP_SOURCE="KEEP_SOURCE",t.KEEP_DESTINATION="KEEP_DESTINATION"}(Mc||(Mc={}));var Qc,$c=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),tf=function(t){function e(n){var r=t.call(this,n,"TRANSFER_FAILED_DUPLICATE_CONTENT_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return $c(e,t),e}(ye),ef=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nf=function(t){function e(n,r){var i=t.call(this,n,"TRANSFER_FAILED_ERROR")||this;return i.directory=r,Object.setPrototypeOf(i,e.prototype),i}return ef(e,t),e}(ye),rf=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},of=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sf=function(){function t(){this.deviceId=gu(window.device.uuid).toString()}return t.prototype.getDeviceID=function(){return this.deviceId},t.prototype.getDeviceSpec=function(){var t=this;return this.deviceSpec?Object(J.of)(this.deviceSpec):new J.Observable((function(e){sbutility.getDeviceSpec((function(n){t.deviceSpec=n,e.next(n),e.complete()}))}))},t.prototype.getAvailableInternalMemorySize=function(){return new J.Observable((function(t){sbutility.getAvailableInternalMemorySize((function(e){t.next(e),t.complete()}),(function(e){t.error(e)}))}))},t.prototype.getStorageVolumes=function(){return J.Observable.create((function(t){sbutility.getStorageVolumes((function(e){t.next(e.map((function(t){return t.isRemovable?{storageDestination:_c.EXTERNAL_STORAGE,info:rf({},t)}:{storageDestination:_c.INTERNAL_STORAGE,info:rf({},t)}}))),t.complete()}),(function(e){t.error(e)}))}))},t.prototype.isKeyboardShown=function(){var t,e,n;return new J.Observable((function(r){t=function(){return r.next(!0)},e=function(){return r.next(!0)},n=function(){return r.next(!1)},function(){return r.next(!1)},window.addEventListener("native.keyboardshow",t),window.addEventListener("keyboardWillShow",e),window.addEventListener("native.keyboardhide",n),window.addEventListener("keyboardWillHide",n)})).pipe(Object(dt.distinctUntilChanged)(),Object(dt.tap)((function(){console.log("Subscribed isKeyboardShown event")})),Object(dt.finalize)((function(){console.log("Unsubscribed isKeyboardShown event"),window.removeEventListener("native.keyboardshow",t),window.removeEventListener("keyboardWillShow",e),window.removeEventListener("native.keyboardhide",n),window.removeEventListener("keyboardWillHide",n)})))},t=of([Object(R.injectable)(),af("design:paramtypes",[])],t)}(),uf=function(){function t(){}return t.mapFeedbackDBEntrytoResponseFeedback=function(t){return{contentId:t[Qe.COLUMN_NAME_CONTENT_ID],rating:Number(t[Qe.COLUMN_NAME_RATING]),comments:t[Qe.COLUMN_NAME_COMMENTS],createdAt:Number(t[Qe.COLUMN_NAME_CREATED_AT]),stageId:"",contentVersion:""}},t}(),cf=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hf=function(t,e){return function(n,r){e(n,r,t)}},lf=function(){function t(t,e,n){this.dbService=t,this.profileService=e,this.telemetryService=n}return t.prototype.getFeedback=function(t){var e="SELECT * FROM "+Qe.TABLE_NAME+" "+Cr.getUidnIdentifierFiler(t.uid,t.contentId);return this.dbService.execute(e).pipe(Object(dt.map)((function(t){return t.map((function(t){return uf.mapFeedbackDBEntrytoResponseFeedback(t)}))})))},t.prototype.sendFeedback=function(t){var e=this;return this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){var r={table:Qe.TABLE_NAME,selection:(new Qn).where("? = ? AND ? = ?").args([Qe.COLUMN_NAME_CONTENT_ID,t.contentId,Qe.COLUMN_NAME_UID,n.uid]).end().build(),limit:"1"},i={uid:n.uid,identifier:t.contentId,rating:t.rating,comments:t.comments,createdAt:Date.now()};return e.telemetryService.feedback({env:"sdk",rating:t.rating,comments:t.comments,objId:t.contentId,objType:lt.CONTENT.valueOf(),objVer:t.contentVersion}).pipe(Object(dt.mergeMap)((function(){return e.dbService.read(r).pipe(Object(dt.mergeMap)((function(r){return r&&r.length?e.dbService.update({table:Qe.TABLE_NAME,selection:Qe.COLUMN_NAME_UID+"= ? AND "+Qe.COLUMN_NAME_CONTENT_ID+"= ?",selectionArgs:[n.uid,t.contentId],modelJson:i}).pipe(Object(dt.map)((function(t){return t>0}))):e.dbService.insert({table:Qe.TABLE_NAME,modelJson:i}).pipe(Object(dt.map)((function(t){return t>0})))})))})))})))},t=cf([Object(R.injectable)(),hf(0,Object(R.inject)(Q.DB_SERVICE)),hf(1,Object(R.inject)(Q.PROFILE_SERVICE)),hf(2,Object(R.inject)(Q.TELEMETRY_SERVICE)),ff("design:paramtypes",[I,Object,Object])],t)}(),df=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},pf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mf=function(t,e){return function(n,r){e(n,r,t)}},bf=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},yf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},vf=function(){function t(t){this.sdkConfig=t,this.eventsBus=new J.Subject,this.eventDelegates=[],this.eventsBusConfig=this.sdkConfig.eventsBusConfig}return t.prototype.onInit=function(){var t=this;return this.eventsBus.pipe(Object(dt.tap)((function(e){t.eventsBusConfig.debugMode&&console.log("SDK Telemetry Events",e)})),Object(dt.tap)((function(e){return bf(t,void 0,void 0,(function(){var t,n;return yf(this,(function(r){switch(r.label){case 0:t=this.eventDelegates.filter((function(t){return t.namespace===e.namespace})).map((function(t){return t.observer.onEvent(e.event).pipe(Object(dt.take)(1),Object(dt.catchError)((function(e){return console.error("Error: ",e,"EventObserver: ",t),Object(J.of)(void 0)})))})),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,J.zip.apply(void 0,t).toPromise()];case 2:return r.sent(),[3,4];case 3:return n=r.sent(),console.error("EVENT_BUS_DELEGATE_ERROR",n),[3,4];case 4:return[2]}}))}))})),Object(dt.mapTo)(void 0))},t.prototype.events=function(t){return this.eventsBus.asObservable().pipe(Object(dt.filter)((function(e){return!t||e.namespace===t})),Object(dt.map)((function(t){return t.event})))},t.prototype.emit=function(t){var e=t.namespace,n=t.event;this.eventsBus.next({namespace:e,event:n})},t.prototype.registerObserver=function(t){var e=t.namespace,n=t.observer;this.eventDelegates.push({namespace:e,observer:n})},t=df([Object(R.injectable)(),mf(0,Object(R.inject)(Q.SDK_CONFIG)),pf("design:paramtypes",[Object])],t)}(),gf=n(169),_f=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Ef=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mf=function(t,e){return function(n,r){e(n,r,t)}},wf=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Sf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Of=function(){function t(t,n){this.eventsBusService=t,this.sharedPreferences=n,this.currentDownloadRequest$=new J.BehaviorSubject(void 0),this.completedDownloadRequestsCache=new xa.a((function(t){return t.identifier})),window.downloadManager=gf,this.sharedPreferencesSetCollection=new cu(this.sharedPreferences,e.KEY_TO_DOWNLOAD_LIST,(function(t){return t.identifier}))}var e;return e=t,t.generateDownloadStartTelemetry=function(t){return wf(this,void 0,void 0,(function(){return Sf(this,(function(e){return[2,br.log.interact({type:Dt.OTHER,subType:jt.CONTENT_DOWNLOAD_INITIATE,env:"sdk",pageId:"ContentDetail",id:"ContentDetail",objId:t.identifier,objType:t.contentMeta&&t.contentMeta.primaryCategory?Cr.readPrimaryCategoryServer(t.contentMeta):"Content",objVer:t.contentMeta&&t.contentMeta.pkgVersion?t.contentMeta.pkgVersion:"",correlationData:t.correlationData||[]}).pipe(Object(dt.mapTo)(void 0)).toPromise()]}))}))},t.generateDownloadCompleteTelemetry=function(t){return wf(this,void 0,void 0,(function(){return Sf(this,(function(e){return[2,br.log.interact({type:Dt.OTHER,subType:jt.CONTENT_DOWNLOAD_SUCCESS,env:"sdk",pageId:"ContentDetail",id:"ContentDetail",objId:t.identifier,objType:t.contentMeta&&t.contentMeta.primaryCategory?Cr.readPrimaryCategoryServer(t.contentMeta):"Content",objVer:t.contentMeta&&t.contentMeta.pkgVersion?t.contentMeta.pkgVersion:"",correlationData:t.correlationData||[]}).pipe(Object(dt.mapTo)(void 0)).toPromise()]}))}))},t.generateDownloadCancelTelemetry=function(t){return wf(this,void 0,void 0,(function(){return Sf(this,(function(e){return[2,br.log.interact({type:Dt.OTHER,subType:jt.CONTENT_DOWNLOAD_CANCEL,env:"sdk",pageId:"ContentDetail",id:"ContentDetail",objId:t.identifier,objType:t.contentMeta&&t.contentMeta.primaryCategory?Cr.readPrimaryCategoryServer(t.contentMeta):"Content",objVer:t.contentMeta&&t.contentMeta.pkgVersion?t.contentMeta.pkgVersion:"",correlationData:t.correlationData||[]}).pipe(Object(dt.mapTo)(void 0)).toPromise()]}))}))},t.prototype.onInit=function(){var t=this;return this.switchToNextDownloadRequest().pipe(Object(dt.mergeMap)((function(){return t.listenForDownloadProgressChanges()})))},t.prototype.download=function(t){var e=this;return this.currentDownloadRequest$.pipe(Object(dt.take)(1),Object(dt.mergeMap)((function(n){return n?e.addToDownloadList(t):e.addToDownloadList(t).pipe(Object(dt.tap)((function(){return e.switchToNextDownloadRequest().toPromise()})))})))},t.prototype.cancel=function(t,e){var n=this;return void 0===e&&(e=!0),this.currentDownloadRequest$.pipe(Object(dt.take)(1),Object(dt.mergeMap)((function(r){return r&&r.identifier===t.identifier?new J.Observable((function(t){downloadManager.remove([r.downloadId],(function(e,n){e&&t.error(e),t.next(!!n),t.complete()}))})).pipe(Object(dt.mergeMap)((function(){return n.removeFromDownloadList(t,e)})),Object(dt.tap)((function(){return n.switchToNextDownloadRequest().toPromise()}))):n.removeFromDownloadList(t,e)})))},t.prototype.cancelAll=function(){var t=this;return this.currentDownloadRequest$.pipe(Object(dt.take)(1),Object(dt.mergeMap)((function(e){return e?new J.Observable((function(t){downloadManager.remove([e.downloadId],(function(e,n){e&&t.error(e),t.next(!!n),t.complete()}))})).pipe(Object(dt.mergeMap)((function(){return t.removeAllFromDownloadList()})),Object(dt.mergeMap)((function(){return t.switchToNextDownloadRequest()}))):t.removeAllFromDownloadList()})))},t.prototype.registerOnDownloadCompleteDelegate=function(t){this.downloadCompleteDelegate=t},t.prototype.getActiveDownloadRequests=function(){return this.sharedPreferencesSetCollection.asListChanges().pipe(Object(dt.map)((function(t){return t.sort((function(t,e){var n=t.withPriority||0;return(e.withPriority||0)-n}))})))},t.prototype.switchToNextDownloadRequest=function(){var t=this;return this.sharedPreferencesSetCollection.asSet().pipe(Object(dt.mergeMap)((function(n){if(!n.size())return Object(J.of)(void 0).pipe(Object(dt.tap)((function(){return t.currentDownloadRequest$.next(void 0)})));var r=n.toArray().sort((function(t,e){var n=t.withPriority||0;return(e.withPriority||0)-n})).shift();return new J.Observable((function(t){downloadManager.enqueue({uri:r.downloadUrl,title:r.filename,description:"",mimeType:r.mimeType,visibleInDownloadsUi:!0,notificationVisibility:1,destinationInExternalFilesDir:{dirType:e.DOWNLOAD_DIR_NAME,subPath:r.filename},headers:[]},(function(e,n){if(e)return t.error(e);t.next(n)}))})).pipe(Object(dt.tap)((function(n){var i="ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalDataDirectory;r.downloadedFilePath=i+e.DOWNLOAD_DIR_NAME+"/"+r.filename,r.downloadId=n,t.currentDownloadRequest$.next(r)})),Object(dt.tap)((function(){return wf(t,void 0,void 0,(function(){return Sf(this,(function(t){switch(t.label){case 0:return[4,e.generateDownloadStartTelemetry(r)];case 1:return[2,t.sent()]}}))}))})),Object(dt.mapTo)(void 0),Object(dt.catchError)((function(){return t.cancel({identifier:r.identifier})})))})))},t.prototype.addToDownloadList=function(t){return this.sharedPreferencesSetCollection.addAll(t).pipe(Object(dt.mapTo)(void 0))},t.prototype.removeFromDownloadList=function(t,n){var r=this;return this.sharedPreferencesSetCollection.asList().pipe(Object(dt.mergeMap)((function(i){var o=i.find((function(e){return e.identifier===t.identifier}));return o?r.sharedPreferencesSetCollection.remove(o).pipe(Object(dt.mapTo)(void 0),Object(dt.tap)((function(){return wf(r,void 0,void 0,(function(){var t;return Sf(this,(function(r){switch(r.label){case 0:return(t=n)?[4,e.generateDownloadCancelTelemetry(o)]:[3,2];case 1:t=r.sent(),r.label=2;case 2:return[2,t]}}))}))}))):Object(J.of)(void 0)})))},t.prototype.removeAllFromDownloadList=function(){var t=this;return this.sharedPreferencesSetCollection.asList().pipe(Object(dt.take)(1),Object(dt.mergeMap)((function(n){return t.sharedPreferencesSetCollection.clear().pipe(Object(dt.mergeMap)((function(){return Object(J.from)(n).pipe(Object(dt.tap)((function(n){return wf(t,void 0,void 0,(function(){return Sf(this,(function(t){switch(t.label){case 0:return[4,e.generateDownloadCancelTelemetry(n)];case 1:return[2,t.sent()]}}))}))})),Object(dt.concatMapTo)(Object(J.of)(void 0)))})))})))},t.prototype.handleDownloadCompletion=function(t){var n=this;return this.currentDownloadRequest$.pipe(Object(dt.take)(1),Object(dt.mergeMap)((function(r){return t.payload.status===Zr.STATUS_SUCCESSFUL?(n.completedDownloadRequestsCache.add(r),Object(J.iif)((function(){return!!n.downloadCompleteDelegate}),Object(J.defer)((function(){return wf(n,void 0,void 0,(function(){return Sf(this,(function(t){return e.generateDownloadCompleteTelemetry(r),this.downloadCompleteDelegate.onDownloadCompletion(r).toPromise(),[2]}))}))})),Object(J.defer)((function(){return Object(J.of)(void 0)}))).pipe(Object(dt.mapTo)(void 0))):Object(J.of)(void 0)})))},t.prototype.emitProgressInEventBus=function(t){var e=this;return Object(J.defer)((function(){return Object(J.of)(e.eventsBusService.emit({namespace:$.DOWNLOADS,event:t})).pipe(Object(dt.mapTo)(void 0))}))},t.prototype.getDownloadProgress=function(t){var e=this;return new J.Observable((function(n){downloadManager.query({ids:[t.downloadId]},(function(r,i){if(r)return n.next({type:Jr.PROGRESS,payload:{downloadId:t.downloadId,identifier:t.identifier,progress:-1,bytesDownloaded:0,totalSizeInBytes:0,status:Zr.STATUS_FAILED}}),n.complete(),void e.cancel({identifier:t.identifier}).toPromise();var o=i[0];n.next({type:Jr.PROGRESS,payload:{downloadId:t.downloadId,identifier:t.identifier,progress:Math.round(o.totalSizeBytes>=0?o.bytesDownloadedSoFar/o.totalSizeBytes*100:-1),bytesDownloaded:o.bytesDownloadedSoFar,totalSizeInBytes:o.totalSizeBytes,status:o.status}}),n.complete()}))}))},t.prototype.listenForDownloadProgressChanges=function(){var t=this;return this.currentDownloadRequest$.pipe(Object(dt.switchMap)((function(e){return e?(t.eventsBusService.emit({namespace:$.DOWNLOADS,event:{type:Jr.START,payload:void 0}}),Object(J.interval)(1e3).pipe(Object(dt.mergeMap)((function(){return t.getDownloadProgress(e)})),Object(dt.distinctUntilChanged)((function(t,e){return JSON.stringify(t)===JSON.stringify(e)})),Object(dt.mergeMap)((function(e){return Object(J.zip)(t.handleDownloadCompletion(e),t.emitProgressInEventBus(e)).pipe(Object(dt.mapTo)(e))})),Object(dt.tap)((function(e){e.payload.status!==Zr.STATUS_FAILED&&e.payload.status!==Zr.STATUS_SUCCESSFUL||t.eventsBusService.emit({namespace:$.DOWNLOADS,event:{type:Jr.END,payload:void 0}})})),Object(dt.mapTo)(void 0))):Object(J.of)(void 0)})))},t.prototype.trackDownloads=function(t){var e=this;return t.groupBy.fieldPath&&t.groupBy.value?this.getActiveDownloadRequests().pipe(Object(dt.map)((function(n){var r=function(e){return t.groupBy.value===t.groupBy.fieldPath.split(".").reduce((function(t,e){if(t&&t[e])return t[e]}),e)};return{completed:e.completedDownloadRequestsCache.size()?e.completedDownloadRequestsCache.toArray().filter(r):[],queued:n.length?n.filter(r):[]}}))):J.EMPTY},t.prototype.onContentDelete=function(t){this.completedDownloadRequestsCache.remove({identifier:t})},t.KEY_TO_DOWNLOAD_LIST=F.KEY_TO_DOWNLOAD_LIST,t.DOWNLOAD_DIR_NAME="Download",t=e=_f([Object(R.injectable)(),Mf(0,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),Mf(1,Object(R.inject)(Q.SHARED_PREFERENCES)),Ef("design:paramtypes",[Object,Object])],t)}(),Af=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Tf=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Nf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cf=function(t,e){return function(n,r){e(n,r,t)}},If=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Rf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Pf=function(){function t(t,e){var n=this;this.sdkConfig=t,this.sharedPreferences=e,"cordova"!==t.platform&&(this.versionName="sunbird-debug"),cordova.getAppVersion.getAppName((function(t){return n.appName=t}))}return t.prototype.getVersionName=function(){return this.versionName},t.prototype.getAppName=function(){return this.appName},t.prototype.init=function(){return If(this,void 0,void 0,(function(){var t,e=this;return Rf(this,(function(n){switch(n.label){case 0:return[4,this.setFirstAccessTimestamp()];case 1:return n.sent(),"cordova"!==this.sdkConfig.platform?[2,void 0]:(t=this.sdkConfig.appConfig.buildConfigPackage?this.sdkConfig.appConfig.buildConfigPackage:"org.sunbird.app",[2,this.getBuildConfigValue(t,"REAL_VERSION_NAME").then((function(t){e.versionName=t,vt.CsModule.instance.isInitialised&&vt.CsModule.instance.updateConfig(Af({},vt.CsModule.instance.config,{core:Af({},vt.CsModule.instance.config.core,{global:Af({},vt.CsModule.instance.config.core.global,{appVersion:t})})})),console.log("version name",e.versionName)}))])}}))}))},t.prototype.getBuildConfigValue=function(t,e){return new Promise((function(n,r){try{sbutility.getBuildConfigValue(t,e,(function(t){n(t)}),(function(t){console.error(t),r(t)}))}catch(t){console.error(t),r(t)}}))},t.prototype.getFirstAccessTimestamp=function(){return this.sharedPreferences.getString(D.KEY_FIRST_ACCESS_TIMESTAMP).pipe(Object(dt.map)((function(t){return t})))},t.prototype.setFirstAccessTimestamp=function(){return If(this,void 0,void 0,(function(){return Rf(this,(function(t){switch(t.label){case 0:return[4,this.sharedPreferences.getString(D.KEY_FIRST_ACCESS_TIMESTAMP).toPromise()];case 1:return t.sent()?[3,3]:[4,this.sharedPreferences.putString(D.KEY_FIRST_ACCESS_TIMESTAMP,Date.now()+"").toPromise()];case 2:return t.sent(),[2,!0];case 3:return[2,!1]}}))}))},t=Tf([Object(R.injectable)(),Cf(0,Object(R.inject)(Q.SDK_CONFIG)),Cf(1,Object(R.inject)(Q.SHARED_PREFERENCES)),Nf("design:paramtypes",[Object,Object])],t)}(),Lf=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Df=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kf=function(t,e){return function(n,r){e(n,r,t)}},Uf=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},xf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bf=function(){function t(t,e,n,r,i,o,a){this.profileService=t,this.groupService=e,this.config=n,this.frameworkService=r,this.deviceInfo=i,this.appInfo=o,this.dbService=a}return t.prototype.getPlayerConfig=function(t,e){var n=this,r={};r.did=this.deviceInfo.getDeviceID(),r.origin=this.config.apiConfig.host;var i=new te;i.id=this.config.apiConfig.api_authentication.producerId,i.pid=this.config.apiConfig.api_authentication.producerUniqueId,i.ver=this.appInfo.getVersionName(),r.pdata=i;var o={};return t.rollup=Cr.getRollup(t.identifier,t.hierarchyInfo),r.objectRollup=t.rollup,"ios"===window.device.platform.toLowerCase()?t.basePath=(t.basePath||(t.basePath="")).replace(/\/$/,""):t.basePath=t.basePath.replace(/\/$/,""),t.isAvailableLocally&&(t.contentData.streamingUrl=t.basePath,t.contentData.previewUrl=t.basePath),o.metadata=t,o.config=this.config.playerConfig,this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(e){r.sid=e?e.sid:"";var i=new Ht;i.id=e?e.uid:"",r.actor=i;var a=n.config.appConfig.deepLinkBasePath;r.deeplinkBasePath=a||"";var s=t.rollup&&t.rollup.l1?t.rollup.l1:t.identifier;return n.fetchPlayerState(i.id,s,t.identifier).then((function(t){t&&o.config&&(o.config=Lf({},o.config,JSON.parse(t.saveState)))})),n.profileService.getActiveSessionProfile({requiredFields:[]})})),Object(dt.mergeMap)((function(t){if(t&&t.serverProfile){var i=t.serverProfile.organisations;if(i){var o=i[0]&&i[0].organisationId;r.contextRollup={l1:o}}}return t&&t.profileType&&(e.correlationData=(e.correlationData||[]).concat([{id:t.profileType,type:"UserType"}])),n.groupService.getActiveGroupSession()})),Object(dt.mergeMap)((function(t){var i=[];t&&t.gid&&i.push({id:t.gid,type:"group"});var a=e&&e.hasOwnProperty("streaming"),s=e.correlationData;s&&s.length&&(i=i.concat(s)),i.push({id:a?"streaming":"offline",type:"PlayerLaunch"}),r.cdata=i,o.context=r;var u={local:!0,server:!1};return u.groupId=t?t.gid:"",o.appContext=u,n.frameworkService.getActiveChannelId()})),Object(dt.mergeMap)((function(t){return r.channel=t||n.config.apiConfig.api_authentication.channelId,o.context=r,Object(J.of)(o)})))},t.prototype.savePlayerState=function(t,e,n,r){var i=this;return this.dbService.read({table:mn.TABLE_NAME,selection:mn.COLUMN_NAME_USER_ID+" = ? AND "+mn.COLUMN_PARENT_IDENTIFIER+" = ?\n AND "+mn.COLUMN_IDENTIFIER+" = ?",selectionArgs:[t,e,n]}).toPromise().then((function(o){return Uf(i,void 0,void 0,(function(){return xf(this,(function(i){return o&&o.length?[2,this.dbService.update({table:mn.TABLE_NAME,selection:mn.COLUMN_NAME_USER_ID+" = ? AND "+mn.COLUMN_PARENT_IDENTIFIER+" = ?\n AND "+mn.COLUMN_IDENTIFIER+" = ?",selectionArgs:[t,e,n],modelJson:In.mapPlayerStateToPlayerDbEntry(t,e,n,r)}).toPromise()]:[2,this.dbService.insert({table:mn.TABLE_NAME,modelJson:In.mapPlayerStateToPlayerDbEntry(t,e,n,r)}).toPromise()]}))}))}))},t.prototype.fetchPlayerState=function(t,e,n){return this.dbService.read({table:mn.TABLE_NAME,selection:mn.COLUMN_NAME_USER_ID+" = ? AND "+mn.COLUMN_PARENT_IDENTIFIER+" = ?\n AND "+mn.COLUMN_IDENTIFIER+" = ?",selectionArgs:[t,e,n]}).toPromise().then((function(t){return t&&t[0]&&In.mapPlayerDbEntryToPlayer(t[0])}))},t.prototype.deletePlayerSaveState=function(t,e,n){return this.dbService.delete({table:mn.TABLE_NAME,selection:mn.COLUMN_NAME_USER_ID+" =? AND "+mn.COLUMN_PARENT_IDENTIFIER+" = ?\n AND "+mn.COLUMN_IDENTIFIER+" = ?",selectionArgs:[t,e,n]}).toPromise()},t=Df([Object(R.injectable)(),kf(0,Object(R.inject)(Q.PROFILE_SERVICE)),kf(1,Object(R.inject)(Q.GROUP_SERVICE_DEPRECATED)),kf(2,Object(R.inject)(Q.SDK_CONFIG)),kf(3,Object(R.inject)(Q.FRAMEWORK_SERVICE)),kf(4,Object(R.inject)(Q.DEVICE_INFO)),kf(5,Object(R.inject)(Q.APP_INFO)),kf(6,Object(R.inject)(Q.DB_SERVICE)),jf("design:paramtypes",[Object,Object,Object,Object,Object,Object,I])],t)}(),Ff=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Vf=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},qf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Yf=function(t){function e(){return t.call(this,6,21)||this}return Ff(e,t),e.prototype.apply=function(t){return Vf(this,void 0,void 0,(function(){var e=this;return qf(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.queries().map((function(e){return t.execute(e).toPromise()})))];case 1:return n.sent(),[4,t.read({table:We.TABLE_NAME,selection:We.COLUMN_NAME_CONTENT_TYPE+" = ?",selectionArgs:["textbook"]}).pipe(Object(dt.map)((function(n){n.forEach((function(n){return Vf(e,void 0,void 0,(function(){var e,r;return qf(this,(function(i){switch(i.label){case 0:return(e=n[We.COLUMN_NAME_LOCAL_DATA])?(r=JSON.parse(e),n[We.COLUMN_NAME_BOARD]=Cr.getContentAttribute(r.board),n[We.COLUMN_NAME_MEDIUM]=Cr.getContentAttribute(r.medium),n[We.COLUMN_NAME_GRADE]=Cr.getContentAttribute(r.gradeLevel),[4,t.update({table:We.TABLE_NAME,modelJson:n,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[n[We.COLUMN_NAME_IDENTIFIER]]}).toPromise()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))}))}))).toPromise()];case 2:return n.sent(),[2,void 0]}}))}))},e.prototype.queries=function(){return[We.getAlterEntryForBoard(),We.getAlterEntryForMedium(),We.getAlterEntryForGrade()]},e}(C),Gf=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Hf=function(t){function e(n){var r=t.call(this,n,"LOW_MEMORY")||this;return Object.setPrototypeOf(r,e.prototype),r}return Gf(e,t),e}(ye),zf=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Kf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Wf=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return zf(e,void 0,void 0,(function(){var e,n,r;return Kf(this,(function(i){switch(i.label){case 0:return[4,this.getFreeUsableSpace(t.destinationFolder)];case 1:return e=i.sent(),[4,new uu(this.dbService).getContentUsageSummary([t.sourceFolder])];case 2:if(n=i.sent(),r=0,n&&n.length&&(r=n[0].sizeOnDevice),Cr.isFreeSpaceAvailable(e,r,0))return[2,t];throw new Hf("Available memory not sufficient for transfer operation")}}))}))}))},t.prototype.getFreeUsableSpace=function(t){return zf(this,void 0,void 0,(function(){return Kf(this,(function(e){return[2,new Promise((function(e,n){sbutility.getFreeUsableSpace(t,(function(t){e(Number(t))}),(function(t){n(t)}))}))]}))}))},t}(),Xf=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Jf=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Zf=function(){function t(t,e){this.fileService=t,this.appConfig=e}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return Xf(e,void 0,void 0,(function(){var e,n=this;return Jf(this,(function(r){switch(r.label){case 0:return e=t,[4,this.getSubdirectoriesEntries(t.destinationFolder).then((function(t){return n.extractValidContentIdsInDestination(t)}))];case 1:return e.validContentIdsInDestination=r.sent(),[2,t]}}))}))}))},t.prototype.getSubdirectoriesEntries=function(t){return Xf(this,void 0,void 0,(function(){return Jf(this,(function(e){return[2,this.fileService.listDir(t.replace(/\/$/,"")).then((function(t){return t.filter((function(t){return t.isDirectory}))}))]}))}))},t.prototype.extractValidContentIdsInDestination=function(t){return Xf(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u,c;return Jf(this,(function(f){switch(f.label){case 0:e=[],n=0,r=t,f.label=1;case 1:if(!(n<r.length))return[3,7];if(!(i=r[n]).isDirectory)return[3,6];o=void 0,f.label=2;case 2:return f.trys.push([2,4,,5]),[4,this.extractManifest(i)];case 3:return o=f.sent(),[3,5];case 4:return f.sent(),[3,5];case 5:if(!o)return[3,6];for(a=o.archive.items,s=0,u=a;s<u.length;s++)c=u[s],Cr.readVisibility(c)!==xn.PARENT&&(Cr.isDraftContent(c.status)&&Cr.isExpired(c.expires)||e.push(i.name));f.label=6;case 6:return n++,[3,1];case 7:return[2,e]}}))}))},t.prototype.extractManifest=function(t){return Xf(this,void 0,void 0,(function(){var e;return Jf(this,(function(n){switch(n.label){case 0:return[4,this.fileService.readAsText(t.nativeURL,zn.MANIFEST.valueOf())];case 1:return e=n.sent(),[2,JSON.parse(e)]}}))}))},t}(),Qf=function(){function t(){}return t.prototype.execute=function(t){return Object(J.of)(t)},t}(),$f=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),th=function(t){function e(n){var r=t.call(this,n,"DUPLICATE_CONTENT")||this;return Object.setPrototypeOf(r,e.prototype),r}return $f(e,t),e}(ye),eh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},nh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},rh=We.COLUMN_NAME_IDENTIFIER,ih=We.COLUMN_NAME_LOCAL_DATA,oh=function(){function t(t,e){this.dbService=t,this.fileService=e}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return eh(e,void 0,void 0,(function(){var e,n,r;return nh(this,(function(i){switch(i.label){case 0:return[4,this.getContentsInDb(t.contentIds)];case 1:return e=i.sent(),n=[],t.validContentIdsInDestination&&t.validContentIdsInDestination.length?[4,this.getContentsInDb(t.validContentIdsInDestination)]:[3,3];case 2:n=i.sent(),i.label=3;case 3:return[4,this.generateMoveContentResponses(t,n)];case 4:if(r=i.sent().moveContentDupContentList,t.contentsInSource=e,t.duplicateContents=r,t.duplicateContents.length&&!t.shouldMergeInDestination)throw new th("context.shouldMergeInDestination is false");return[2]}}))}))})).pipe(Object(dt.mapTo)(t))},t.prototype.getContentsInDb=function(t){return eh(this,void 0,void 0,(function(){return nh(this,(function(e){return t.length?[2,this.dbService.execute(Cr.getFindAllContentsWithIdentifierQuery(t)).toPromise()]:[2,this.dbService.execute(Cr.getFindAllContentsQuery()).toPromise()]}))}))},t.prototype.getPkgVersionFromFile=function(t,e){return this.fileService.readAsText(t.concat(e),zn.MANIFEST.valueOf()).then((function(t){var n=JSON.parse(t).archive.items;return n?n.find((function(t){return t.identifier===e})).pkgVersion:0})).catch((function(){return-1}))},t.prototype.generateMoveContentResponses=function(t,e){return eh(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,c;return nh(this,(function(f){switch(f.label){case 0:n=[],r=[],i=0,o=e,f.label=1;case 1:return i<o.length?(a=o[i],[4,this.getPkgVersionFromFile(t.destinationFolder,a[rh])]):[3,4];case 2:s=f.sent(),u=Cr.readPkgVersion(JSON.parse(a[ih])),-1!==s&&(s>u?(c={identifier:a[rh],status:Qc.HIGHER_VERSION_IN_DESTINATION},n.push(c),r.push(c)):s<u?(c={identifier:a[rh],status:Qc.LOWER_VERSION_IN_DESTINATION},n.push(c),r.push(c)):(c={identifier:a[rh],status:Qc.SAME_VERSION_IN_BOTH},r.push(c))),f.label=3;case 3:return i++,[3,1];case 4:return[2,{moveContentDiffPkgList:n,moveContentDupContentList:r}]}}))}))},t}(),ah=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),sh=function(t){function e(n){var r=t.call(this,n,"CANCELLED")||this;return Object.setPrototypeOf(r,e.prototype),r}return ah(e,t),e}(ye),uh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ch=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},fh=We.COLUMN_NAME_IDENTIFIER,hh=We.COLUMN_NAME_PATH,lh=function(){function t(t){this.eventsBusService=t,this.contentsTransferred=0}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return uh(e,void 0,void 0,(function(){var e,n,r,i,o;return ch(this,(function(a){switch(a.label){case 0:e=function(e){var r,i;return ch(this,(function(o){switch(o.label){case 0:return t.hasTransferCancelled?[4,n.deleteFolder(t.destinationFolder.concat("temp","/"))]:[3,2];case 1:throw o.sent(),new sh("CANCELLED");case 2:if((r=t.duplicateContents.find((function(t){return t.identifier===e[fh]})))&&!Ar.isEmpty(t.duplicateContents))return[3,7];i=t.destinationFolder.concat("temp","/"),o.label=3;case 3:return o.trys.push([3,5,,6]),[4,n.copyFolder(e[hh],i+e[fh])];case 4:return o.sent(),[3,6];case 5:return o.sent(),[3,6];case 6:return n.emitContentTransferProgress(t),[2,"continue"];case 7:if(!t.existingContentAction)return n.emitContentTransferProgress(t),[2,"continue"];if(r.status===Qc.SAME_VERSION_IN_BOTH)return n.emitContentTransferProgress(t),[2,"continue"];switch(t.existingContentAction){case Mc.KEEP_HIGER_VERSION:return[3,8];case Mc.KEEP_LOWER_VERSION:return[3,11];case Mc.KEEP_SOURCE:return[3,14];case Mc.IGNORE:case Mc.KEEP_DESTINATION:return[3,17]}return[3,17];case 8:return r.status===Qc.HIGHER_VERSION_IN_DESTINATION?[3,17]:[4,n.copyToTempDestination(t,e,r)];case 9:return o.sent(),[4,n.removeSourceAndDestination(t,e,r)];case 10:return o.sent(),[3,17];case 11:return r.status===Qc.LOWER_VERSION_IN_DESTINATION?[3,17]:[4,n.copyToTempDestination(t,e,r)];case 12:return o.sent(),[4,n.removeSourceAndDestination(t,e,r)];case 13:return o.sent(),[3,17];case 14:return[4,n.copyToTempDestination(t,e,r)];case 15:return o.sent(),[4,n.removeSourceAndDestination(t,e,r)];case 16:return o.sent(),[3,17];case 17:return n.emitContentTransferProgress(t),[2]}}))},n=this,r=0,i=t.contentsInSource,a.label=1;case 1:return r<i.length?(o=i[r],[5,e(o)]):[3,4];case 2:a.sent(),a.label=3;case 3:return r++,[3,1];case 4:return[2,t]}}))}))}))},t.prototype.emitContentTransferProgress=function(t){this.eventsBusService.emit({namespace:$.STORAGE,event:{type:Ec.TRANSFER_PROGRESS,payload:{progress:{transferredCount:++this.contentsTransferred,totalCount:t.contentsInSource.length}}}})},t.prototype.deleteFolder=function(t){return uh(this,void 0,void 0,(function(){return ch(this,(function(e){return t?[2,new Promise((function(e,n){sbutility.rm(t,"",(function(){e()}),(function(t){n(t)}))}))]:[2]}))}))},t.prototype.copyFolder=function(t,e){return uh(this,void 0,void 0,(function(){return ch(this,(function(n){return t&&e?[2,new Promise((function(n,r){sbutility.copyDirectory(t,e,(function(){n()}),(function(t){r(t)}))}))]:[2]}))}))},t.prototype.renameFolder=function(t,e){return uh(this,void 0,void 0,(function(){return ch(this,(function(n){return t?[2,new Promise((function(n,r){sbutility.renameDirectory(t,e,(function(){n()}),(function(t){r(t)}))}))]:[2]}))}))},t.prototype.copyToTempDestination=function(t,e,n){return uh(this,void 0,void 0,(function(){return ch(this,(function(r){switch(r.label){case 0:return[4,this.renameFolder(t.destinationFolder,n.identifier)];case 1:return r.sent(),[4,this.copyFolder(e[hh],t.destinationFolder+e[fh])];case 2:return r.sent(),[2]}}))}))},t.prototype.removeSourceAndDestination=function(t,e,n){return uh(this,void 0,void 0,(function(){return ch(this,(function(r){switch(r.label){case 0:return[4,this.deleteFolder(t.destinationFolder.concat(n.identifier,"_temp"))];case 1:return r.sent(),[4,this.deleteFolder(e[hh])];case 2:return r.sent(),[2]}}))}))},t}(),dh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ph=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},mh=We.COLUMN_NAME_PATH,bh=We.COLUMN_NAME_IDENTIFIER,yh=function(){function t(t){this.dbService=t}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return dh(e,void 0,void 0,(function(){var e,n,r;return ph(this,(function(i){switch(i.label){case 0:this.dbService.beginTransaction(),i.label=1;case 1:i.trys.push([1,6,,7]),e=0,n=t.contentsInSource,i.label=2;case 2:return e<n.length?((r=n[e])[mh]=Cr.getBasePath(t.destinationFolder.concat(r[bh],"/")),[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[r[We.COLUMN_NAME_IDENTIFIER]],modelJson:r}).toPromise()]):[3,5];case 3:i.sent(),i.label=4;case 4:return e++,[3,2];case 5:return this.dbService.endTransaction(!0),[3,7];case 6:return i.sent(),this.dbService.endTransaction(!1),[3,7];case 7:return[2]}}))}))})).pipe(Object(dt.mapTo)(t))},t}(),vh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},gh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},_h=function(){function t(t,e,n,r){this.appConfig=t,this.fileService=e,this.dbService=n,this.deviceInfo=r}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return vh(e,void 0,void 0,(function(){var e,n,r,i,o,a,s;return gh(this,(function(u){switch(u.label){case 0:for(n=0,r=t.duplicateContents;n<r.length;n++)switch(i=r[n],t.existingContentAction||Mc.IGNORE){case Mc.KEEP_HIGER_VERSION:i.status===Qc.HIGHER_VERSION_IN_DESTINATION&&this.addDestinationContentInDb(i.identifier,t.destinationFolder,!1);break;case Mc.KEEP_LOWER_VERSION:i.status===Qc.LOWER_VERSION_IN_DESTINATION&&this.addDestinationContentInDb(i.identifier,t.destinationFolder,!0);break;case Mc.KEEP_DESTINATION:case Mc.IGNORE:i.status===Qc.LOWER_VERSION_IN_DESTINATION?this.addDestinationContentInDb(i.identifier,t.destinationFolder,!0):this.addDestinationContentInDb(i.identifier,t.destinationFolder,!1)}if(t.validContentIdsInDestination&&t.validContentIdsInDestination.length&&t.duplicateContents&&t.duplicateContents.length?e=this.getNewlyAddedContents(t.validContentIdsInDestination,t.duplicateContents.map((function(t){return t.identifier}))):t.validContentIdsInDestination&&t.duplicateContents.length||!t.validContentIdsInDestination||!t.validContentIdsInDestination.length||(e=t.validContentIdsInDestination),!e)return[3,4];o=0,a=e,u.label=1;case 1:return o<a.length?(s=a[o],[4,this.addDestinationContentInDb(s,t.destinationFolder,!1)]):[3,4];case 2:u.sent(),u.label=3;case 3:return o++,[3,1];case 4:return[2]}}))}))}))},t.prototype.getNewlyAddedContents=function(t,e){return t.filter((function(t){return e.find((function(e){return e!==t}))}))},t.prototype.addDestinationContentInDb=function(t,e,n){var r=this,i=e.concat(t);return this.fileService.readAsText(e.concat(t),zn.MANIFEST.valueOf()).then((function(t){var e=JSON.parse(t),o=e.archive.items;return r.extractContentFromItem(o,i.concat("/"),e.ver,n)})).catch((function(t){console.error(t)}))},t.prototype.extractContentFromItem=function(t,e,n,r){return vh(this,void 0,void 0,(function(){var i,o,a,s,u,c,f,h,l,d,p,m,b,y,v,g,_,E,M,w,S,O,A,T,N,C,I,R,P;return gh(this,(function(L){switch(L.label){case 0:i=[],o=[],a=0,s=t,L.label=1;case 1:return a<s.length?(R=s[a],c=(u=R).identifier,f=u.mimeType,h=Cr.readContentType(u),l=Cr.readPrimaryCategory(u),d=Cr.readVisibility(u),p=Cr.readAudience(u),m=Cr.readPragma(u),b=u.pkgVersion,y=kn.ONLY_SPINE.valueOf(),v=u.board,g=u.medium,_=u.gradeLevel,[4,this.dbService.read({table:We.TABLE_NAME,columns:[],selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[c]}).toPromise()]):[3,5];case 2:return E=L.sent()[0],M=E&&Cr.getBasePath(E[We.COLUMN_NAME_PATH]),(w=Cr.doesContentExist(E,c,b,r))&&u.status!==Bn.DRAFT.valueOf()?E[We.COLUMN_NAME_VISIBILITY]===xn.DEFAULT.valueOf()&&(u=JSON.parse(E[We.COLUMN_NAME_LOCAL_DATA])):(w=!1,y=(Un.COLLECTION.valueOf(),kn.ARTIFACT_AVAILABLE.valueOf())),S=Cr.getReferenceCount(E,d),d=Cr.getContentVisibility(E,u.objectType,d),y=Cr.getContentState(E,y),O=w?M:e,[4,this.fileService.getDirectorySize(O)];case 3:A=L.sent(),Cr.addOrUpdateViralityMetadata(u,this.deviceInfo.getDeviceID().toString()),P=Cr.constructContentDBModel(c,n,JSON.stringify(u),f,h,d,O,S,y,p,m,A,v,g,_,l),E?o.push(P):i.push(P),L.label=4;case 4:return a++,[3,1];case 5:if(!i.length&&!o.length)return[3,14];this.dbService.beginTransaction(),T=0,N=i,L.label=6;case 6:return T<N.length?(R=N[T],P=R,[4,this.dbService.insert({table:We.TABLE_NAME,modelJson:P}).toPromise()]):[3,9];case 7:L.sent(),L.label=8;case 8:return T++,[3,6];case 9:C=0,I=o,L.label=10;case 10:return C<I.length?(R=I[C],P=R,[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[P[We.COLUMN_NAME_IDENTIFIER]],modelJson:P}).toPromise()]):[3,13];case 11:L.sent(),L.label=12;case 12:return C++,[3,10];case 13:this.dbService.endTransaction(!0),L.label=14;case 14:return[2]}}))}))},t}(),Eh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Mh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},wh=function(){function t(t){this.fileService=t}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return Eh(e,void 0,void 0,(function(){var e,n=this;return Mh(this,(function(r){switch(r.label){case 0:return e=t,[4,this.validate(t.destinationFolder).then((function(t){return n.createDirectory(t)}))];case 1:return e.destinationFolder=r.sent(),[2,t]}}))}))}))},t.prototype.validate=function(t){return this.canWrite(t).then((function(){return t.endsWith("content/")||(t=t.concat("content")),t})).catch((function(){throw Error("Destination is not writable")}))},t.prototype.createDirectory=function(t){var e=this;return this.fileService.exists(t).then((function(t){return t.nativeURL})).catch((function(){return e.fileService.createDir(t,!1).then((function(t){return t.nativeURL}))}))},t.prototype.canWrite=function(t){return Eh(this,void 0,void 0,(function(){return Mh(this,(function(e){return[2,new Promise((function(e,n){sbutility.canWrite(t,(function(){e()}),(function(t){n(t)}))}))]}))}))},t}(),Sh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Oh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Ah=We.COLUMN_NAME_IDENTIFIER,Th=We.COLUMN_NAME_PATH,Nh=function(){function t(t){this.eventsBusService=t}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return Sh(e,void 0,void 0,(function(){var e,n,r;return Oh(this,(function(i){switch(i.label){case 0:e=function(e){var r,i,o;return Oh(this,(function(a){switch(a.label){case 0:if(r=t.contentsInSource[e],i=t.duplicateContents.find((function(t){return t.identifier===r[Ah]})),o=t.destinationFolder.concat("temp","/"),i&&!Ar.isEmpty(t.duplicateContents))return[3,9];a.label=1;case 1:return a.trys.push([1,7,,8]),[4,n.copyFolder(o.concat(r[Ah]),t.destinationFolder+r[Ah])];case 2:return a.sent(),[4,n.deleteFolder(o.concat(r[Ah]))];case 3:return a.sent(),[4,n.deleteFolder(r[Th])];case 4:return a.sent(),e!==t.contentsInSource.length-1?[3,6]:[4,n.deleteFolder(o)];case 5:a.sent(),a.label=6;case 6:return[3,8];case 7:return a.sent(),[3,8];case 8:return[2,"continue"];case 9:if(!t.existingContentAction)return[2,"continue"];if(i.status===Qc.SAME_VERSION_IN_BOTH)return[2,"continue"];switch(t.existingContentAction){case Mc.KEEP_HIGER_VERSION:return[3,10];case Mc.KEEP_LOWER_VERSION:return[3,12];case Mc.KEEP_SOURCE:return[3,14];case Mc.IGNORE:case Mc.KEEP_DESTINATION:return[3,16]}return[3,16];case 10:return i.status===Qc.HIGHER_VERSION_IN_DESTINATION?[3,16]:[4,n.removeSourceAndDestination(t,r,i)];case 11:return a.sent(),[3,16];case 12:return i.status===Qc.LOWER_VERSION_IN_DESTINATION?[3,16]:[4,n.removeSourceAndDestination(t,r,i)];case 13:return a.sent(),[3,16];case 14:return[4,n.removeSourceAndDestination(t,r,i)];case 15:return a.sent(),[3,16];case 16:return e!==t.contentsInSource.length-1?[3,18]:[4,n.deleteFolder(o)];case 17:a.sent(),a.label=18;case 18:return[2]}}))},n=this,r=0,i.label=1;case 1:return r<t.contentsInSource.length?[5,e(r)]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2,t]}}))}))}))},t.prototype.deleteFolder=function(t){return Sh(this,void 0,void 0,(function(){return Oh(this,(function(e){return t?[2,new Promise((function(e,n){sbutility.rm(t,"",(function(){e()}),(function(t){n(t)}))}))]:[2]}))}))},t.prototype.copyFolder=function(t,e){return Sh(this,void 0,void 0,(function(){return Oh(this,(function(n){return t&&e?[2,new Promise((function(n,r){sbutility.copyDirectory(t,e,(function(){n()}),(function(t){r(t)}))}))]:[2]}))}))},t.prototype.renameFolder=function(t,e){return Sh(this,void 0,void 0,(function(){return Oh(this,(function(n){return t?[2,new Promise((function(n,r){sbutility.renameDirectory(t,e,(function(){n()}),(function(t){r(t)}))}))]:[2]}))}))},t.prototype.removeSourceAndDestination=function(t,e,n){return Sh(this,void 0,void 0,(function(){return Oh(this,(function(r){switch(r.label){case 0:return[4,this.deleteFolder(t.destinationFolder.concat(n.identifier,"_temp"))];case 1:return r.sent(),[4,this.deleteFolder(e[Th])];case 2:return r.sent(),[2]}}))}))},t}(),Ch=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Ih=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};!function(t){t.SAME_VERSION_IN_BOTH="SAME_VERSION_IN_BOTH",t.HIGHER_VERSION_IN_DESTINATION="HIGHER_VERSION_IN_DESTINATION",t.LOWER_VERSION_IN_DESTINATION="LOWER_VERSION_IN_DESTINATION"}(Qc||(Qc={}));var Rh,Ph,Lh=function(){function t(t,e,n,r,i){this.sdkConfig=t,this.fileService=e,this.dbService=n,this.eventsBusService=r,this.deviceInfo=i,this.context={}}return t.prototype.transfer=function(t){var e=this,n=t.contentIds,r=t.existingContentAction,i=t.deleteDestination,o=t.destinationFolder,a=t.shouldMergeInDestination,s=t.sourceFolder;return this.context.hasTransferCancelled=!1,this.context.shouldMergeInDestination=a,this.context.contentIds=n,this.context.existingContentAction=r,this.context.deleteDestination=i,this.context.destinationFolder=o,this.context.sourceFolder=s,new wh(this.fileService).execute(this.context).pipe(Object(dt.mergeMap)((function(t){return(new Qf).execute(t)})),Object(dt.mergeMap)((function(t){return new Wf(e.dbService).execute(t)})),Object(dt.mergeMap)((function(t){return new Zf(e.fileService,e.sdkConfig.appConfig).execute(t)})),Object(dt.mergeMap)((function(t){return new oh(e.dbService,e.fileService).execute(t)})),Object(dt.mergeMap)((function(t){return new lh(e.eventsBusService).execute(t)})),Object(dt.mergeMap)((function(t){return new Nh(e.eventsBusService).execute(t)})),Object(dt.mergeMap)((function(t){return new yh(e.dbService).execute(t)})),Object(dt.mergeMap)((function(t){return new _h(e.sdkConfig.appConfig,e.fileService,e.dbService,e.deviceInfo).execute(t)}))).pipe(Object(dt.tap)((function(){e.eventsBusService.emit({namespace:$.STORAGE,event:{type:Ec.TRANSFER_COMPLETED}})})),Object(dt.mapTo)(void 0),Object(dt.catchError)((function(t){return t instanceof sh?e.eventsBusService.emit({namespace:$.STORAGE,event:{type:Ec.TRANSFER_REVERT_COMPLETED}}):t instanceof th?e.eventsBusService.emit({namespace:$.STORAGE,event:{type:Ec.TRANSFER_FAILED_DUPLICATE_CONTENT}}):t instanceof Hf&&e.eventsBusService.emit({namespace:$.STORAGE,event:{type:Ec.TRANSFER_FAILED_LOW_MEMORY}}),console.error("Error",t),Object(J.throwError)(t)})))},t.prototype.cancel=function(){var t=this;return Object(J.defer)((function(){return Ch(t,void 0,void 0,(function(){return Ih(this,(function(t){return this.context.hasTransferCancelled=!0,[2]}))}))})).pipe(Object(dt.mapTo)(void 0))},t}(),Dh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},jh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},kh=function(){function t(t,e){this.fileService=t,this.dbService=e}return t.prototype.execute=function(t){var e=this;return Object(J.defer)((function(){return Dh(e,void 0,void 0,(function(){var e,n,r,i,o;return jh(this,(function(a){switch(a.label){case 0:return[4,this.getContentsInDb()];case 1:return e=a.sent(),t.currentStoragePath?(n=Cr.getContentRootDir(t.currentStoragePath).concat("/"),"ios"===window.device.platform.toLowerCase()&&(n="file://"+n),[4,this.getFolderList(n)]):[3,5];case 2:return r=a.sent(),i=t,[4,this.getNewlyAddedContents(r,e)];case 3:return i.newlyAddedIdentifiers=a.sent(),o=t,[4,this.getDeletedContents(r,e)];case 4:return o.deletedIdentifiers=a.sent(),[3,6];case 5:t.newlyAddedIdentifiers=[],t.deletedIdentifiers=e,a.label=6;case 6:return[2]}}))}))})).pipe(Object(dt.mapTo)(t))},t.prototype.doesDestinationStorageExist=function(t){return this.fileService.exists(t).then((function(t){return!0})).catch((function(){return!1}))},t.prototype.getContentsInDb=function(){return Dh(this,void 0,void 0,(function(){return jh(this,(function(t){return[2,this.dbService.execute(Cr.getFindAllContentsQuery()).pipe(Object(dt.map)((function(t){return t.filter((function(t){return"textbookunit"!==t[We.COLUMN_NAME_CONTENT_TYPE].toLowerCase()})).map((function(t){return t[We.COLUMN_NAME_IDENTIFIER]}))}))).toPromise()]}))}))},t.prototype.getNewlyAddedContents=function(t,e){return t.filter((function(t){return!Ar.contains(e,t)}))},t.prototype.getDeletedContents=function(t,e){return e.filter((function(e){return!Ar.contains(t,e)}))},t.prototype.getFolderList=function(t){return this.fileService.listDir(t.replace(/\/$/,"")).then((function(t){return t.map((function(t){return t.name}))})).catch((function(){return[]}))},t}(),Uh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},xh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bh=function(){function t(t){this.storageHandler=t}return t.prototype.exexute=function(t){var e=this;return Object(J.defer)((function(){return Uh(e,void 0,void 0,(function(){var e,n,r;return xh(this,(function(i){switch(i.label){case 0:return t.deletedIdentifiers.length?[4,this.storageHandler.deleteContentsFromDb(t.deletedIdentifiers)]:[3,2];case 1:i.sent(),i.label=2;case 2:if(!t.newlyAddedIdentifiers.length)return[3,6];e=0,n=t.newlyAddedIdentifiers,i.label=3;case 3:return e<n.length?(r=n[e],[4,this.storageHandler.addDestinationContentInDb(r,Cr.getContentRootDir(t.currentStoragePath).concat("/"),!1)]):[3,6];case 4:i.sent(),i.label=5;case 5:return e++,[3,3];case 6:return[2]}}))}))})).pipe(Object(dt.mapTo)(t))},t}(),Fh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Vh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},qh=function(){function t(t,e,n,r){this.appConfig=t,this.fileService=e,this.dbService=n,this.deviceInfo=r}return t.prototype.addDestinationContentInDb=function(t,e,n){return Fh(this,void 0,void 0,(function(){var r,i=this;return Vh(this,(function(o){return r=e.concat(t),this.fileService.readAsText(e.concat(t),zn.MANIFEST.valueOf()).then((function(t){var e=JSON.parse(t),o=e.archive.items;return i.extractContentFromItem(o,r.concat("/"),e.ver,n)})).catch((function(t){console.error(t)})),[2]}))}))},t.prototype.deleteContentsFromDb=function(t){return Fh(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,u;return Vh(this,(function(c){switch(c.label){case 0:return[4,this.dbService.execute(Cr.getFindAllContentsWithIdentifierQuery(t)).toPromise()];case 1:for(e=c.sent(),n=0,r=e;n<r.length;n++)s=r[n],(u=s)[We.COLUMN_NAME_MIME_TYPE]===Un.COLLECTION&&u[We.COLUMN_NAME_REF_COUNT]>1?u[We.COLUMN_NAME_CONTENT_STATE]=kn.ARTIFACT_AVAILABLE:u[We.COLUMN_NAME_CONTENT_STATE]=kn.ONLY_SPINE,u[We.COLUMN_NAME_VISIBILITY]===xn.DEFAULT&&u[We.COLUMN_NAME_REF_COUNT]>0&&(i=u[We.COLUMN_NAME_REF_COUNT],u[We.COLUMN_NAME_REF_COUNT]=Cr.addOrUpdateRefCount(i-1)),u[We.COLUMN_NAME_VISIBILITY]=xn.PARENT;this.dbService.beginTransaction(),o=0,a=e,c.label=2;case 2:return o<a.length?(s=a[o],u=s,[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[u[We.COLUMN_NAME_IDENTIFIER]],modelJson:u}).toPromise()]):[3,5];case 3:c.sent(),c.label=4;case 4:return o++,[3,2];case 5:return this.dbService.endTransaction(!0),[2]}}))}))},t.prototype.extractContentFromItem=function(t,e,n,r){return Fh(this,void 0,void 0,(function(){var i,o,a,s,u,c,f,h,l,d,p,m,b,y,v,g,_,E,M,w,S,O,A,T,N,C,I,R,P;return Vh(this,(function(L){switch(L.label){case 0:i=[],o=[],a=0,s=t,L.label=1;case 1:return a<s.length?(R=s[a],c=(u=R).identifier,f=u.mimeType,h=Cr.readContentType(u),l=Cr.readPrimaryCategory(u),d=Cr.readVisibility(u),p=Cr.readAudience(u),m=Cr.readPragma(u),b=u.pkgVersion,y=kn.ONLY_SPINE.valueOf(),v=u.board,g=u.medium,_=u.gradeLevel,[4,this.dbService.read({table:We.TABLE_NAME,columns:[],selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[c]}).toPromise()]):[3,5];case 2:return E=L.sent()[0],M=E&&Cr.getBasePath(E[We.COLUMN_NAME_PATH]),(w=Cr.doesContentExist(E,c,b,r))&&u.status!==Bn.DRAFT.valueOf()?E[We.COLUMN_NAME_VISIBILITY]===xn.DEFAULT.valueOf()&&(u=JSON.parse(E[We.COLUMN_NAME_LOCAL_DATA])):(w=!1,y=(Un.COLLECTION.valueOf(),kn.ARTIFACT_AVAILABLE.valueOf())),S=Cr.getReferenceCount(E,d),d=Cr.getContentVisibility(E,u.objectType,d),y=Cr.getContentState(E,y),O=w?M:e,[4,this.fileService.getDirectorySize(O)];case 3:A=L.sent(),Cr.addOrUpdateViralityMetadata(u,this.deviceInfo.getDeviceID().toString()),P=Cr.constructContentDBModel(c,n,JSON.stringify(u),f,h,d,O,S,y,p,m,A,v,g,_,l),E?o.push(P):i.push(P),L.label=4;case 4:return a++,[3,1];case 5:if(!i.length&&!o.length)return[3,14];this.dbService.beginTransaction(),T=0,N=i,L.label=6;case 6:return T<N.length?(R=N[T],P=R,[4,this.dbService.insert({table:We.TABLE_NAME,modelJson:P}).toPromise()]):[3,9];case 7:L.sent(),L.label=8;case 8:return T++,[3,6];case 9:C=0,I=o,L.label=10;case 10:return C<I.length?(R=I[C],P=R,[4,this.dbService.update({table:We.TABLE_NAME,selection:We.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[P[We.COLUMN_NAME_IDENTIFIER]],modelJson:P}).toPromise()]):[3,13];case 11:L.sent(),L.label=12;case 12:return C++,[3,10];case 13:this.dbService.endTransaction(!0),L.label=14;case 14:return[2]}}))}))},t}(),Yh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Gh=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zh=function(t,e){return function(n,r){e(n,r,t)}},Kh=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Wh=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Xh=function(){function t(t,e,n,r,i,o){this.eventsBusService=t,this.sharedPreferences=e,this.dbService=n,this.deviceInfo=r,this.fileService=i,this.sdkConfig=o,this.contentsToTransfer=new cu(this.sharedPreferences,q.KEY_TO_TRANSFER_LIST,(function(t){return t})),this.transferContentHandler=new Lh(this.sdkConfig,this.fileService,this.dbService,this.eventsBusService,this.deviceInfo)}var e;return e=t,t.prototype.onInit=function(){var t=this;return Object(J.zip)(this.deviceInfo.getStorageVolumes(),this.getStorageDestination()).pipe(Object(dt.tap)((function(e){t.availableStorageVolumes=e[0],t.currentStorageDestination=e[1],t.scanStorage().toPromise()})),Object(dt.mapTo)(void 0))},t.prototype.getStorageDestinationDirectoryPath=function(){var t=this,e=this.availableStorageVolumes.find((function(e){return e.storageDestination===t.currentStorageDestination}));return e&&e.info.contentStoragePath},t.prototype.cancelTransfer=function(){return this.transferContentHandler.cancel()},t.prototype.getStorageDestination=function(){return this.sharedPreferences.getString(e.STORAGE_DESTINATION).pipe(Object(dt.map)((function(t){return t||_c.INTERNAL_STORAGE})))},t.prototype.getStorageDestinationVolumeInfo=function(){var t=this;return this.getStorageDestination().pipe(Object(dt.map)((function(e){return t.availableStorageVolumes.find((function(t){return t.storageDestination===e}))})))},t.prototype.getToTransferContents=function(){return Object(J.of)([])},t.prototype.getTransferringContent=function(){return Object(J.of)(void 0)},t.prototype.retryCurrentTransfer=function(){return this.lastTransferContentsRequest?this.transferContents(Yh({},this.lastTransferContentsRequest,{shouldMergeInDestination:!0})):Object(J.of)(void 0)},t.prototype.transferContents=function(t){var n=this;return this.lastTransferContentsRequest=t,t.sourceFolder=this.getStorageDestinationDirectoryPath(),this.transferContentHandler.transfer(t).pipe(Object(dt.mergeMap)((function(){return n.getStorageDestination()})),Object(dt.map)((function(t){return t===_c.EXTERNAL_STORAGE?_c.INTERNAL_STORAGE:_c.EXTERNAL_STORAGE})),Object(dt.tap)((function(t){n.currentStorageDestination=t})),Object(dt.mergeMap)((function(t){return n.sharedPreferences.putString(e.STORAGE_DESTINATION,t)})))},t.prototype.scanStorage=function(){var t=this,e=this.getStorageDestinationDirectoryPath(),n={currentStoragePath:e};return e||this.resetStorageDestination(),new kh(this.fileService,this.dbService).execute(n).pipe(Object(dt.mergeMap)((function(e){var n=new qh(t.sdkConfig.appConfig,t.fileService,t.dbService,t.deviceInfo);return new Bh(n).exexute(e)})),Object(dt.mapTo)(!0))},t.prototype.resetStorageDestination=function(){return Kh(this,void 0,void 0,(function(){return Wh(this,(function(t){return this.currentStorageDestination=_c.INTERNAL_STORAGE,[2,this.sharedPreferences.putString(e.STORAGE_DESTINATION,_c.INTERNAL_STORAGE).toPromise()]}))}))},t.STORAGE_DESTINATION=q.KEY_STORAGE_DESTINATION,t=e=Gh([Object(R.injectable)(),zh(0,Object(R.inject)(Q.EVENTS_BUS_SERVICE)),zh(1,Object(R.inject)(Q.SHARED_PREFERENCES)),zh(2,Object(R.inject)(Q.DB_SERVICE)),zh(3,Object(R.inject)(Q.DEVICE_INFO)),zh(4,Object(R.inject)(Q.FILE_SERVICE)),zh(5,Object(R.inject)(Q.SDK_CONFIG)),Hh("design:paramtypes",[Object,Object,I,Object,Object,Object])],t)}();!function(t){t[t.ACTIONABLE_NOTIFICATION=1]="ACTIONABLE_NOTIFICATION",t[t.NOTIFY=2]="NOTIFY",t[t.CONFIG=3]="CONFIG"}(Rh||(Rh={})),function(t){t.READ="read",t.UNREAD="unread",t.ALL="all"}(Ph||(Ph={}));var Jh,Zh=function(){function t(){}return t.constructNotificationDBModel=function(t){return{message_id:t.id,expiry_time:t.expiry,display_time:t.displayTime,received_at:Date.now(),notification_json:JSON.stringify(t),is_read:t.isRead}},t.getFilterForNotification=function(t){switch(t.notificationStatus){case Ph.ALL:nn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+nn.COLUMN_NAME_EXPIRY_TIME+" > ?",[Date.now().toString(),Date.now().toString()];break;case Ph.UNREAD:nn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+nn.COLUMN_NAME_EXPIRY_TIME+" > ? AND\n AND "+nn.COLUMN_NAME_IS_READ+" > ?",[Date.now().toString(),Date.now().toString(),0];break;case Ph.READ:default:nn.COLUMN_NAME_NOTIFICATION_DISPLAY_TIME+" <= ?\n AND "+nn.COLUMN_NAME_EXPIRY_TIME+" > ?\n AND "+nn.COLUMN_NAME_IS_READ+" > ?",[Date.now().toString(),Date.now().toString(),1]}return{table:nn.TABLE_NAME,orderBy:nn.COLUMN_NAME_NOTIFICATION_RECEIVED_AT+" desc"}},t}(),Qh=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},$h=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},tl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},el=function(t,e){return function(n,r){e(n,r,t)}},nl=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},rl=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},il=nn.COLUMN_NAME_NOTIFICATION_JSON,ol=function(){function t(t,e,n,r){this.dbService=t,this.sharedPreferences=e,this.profileService=n,this.keyValueStore=r,this._notifications$=new J.BehaviorSubject([]),this._notificationTrigger$=new J.Subject}var e;return e=t,Object.defineProperty(t.prototype,"notifications$",{get:function(){return this._notifications$},enumerable:!0,configurable:!0}),t.prototype.onInit=function(){var t=this,e=Object(J.interval)(36e5).pipe(Object(dt.startWith)(null),Object(dt.mapTo)(null)),n=this._notificationTrigger$.pipe(Object(dt.startWith)(null),Object(dt.throttleTime)(1e3));return Object(J.combineLatest)([e,n]).pipe(Object(dt.switchMap)((function(){return Object(J.defer)((function(){return nl(t,void 0,void 0,(function(){var t,e;return rl(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.fetchNotificationAndUserFeed()];case 1:return t=n.sent(),this._notifications$.next(t),[3,3];case 2:return e=n.sent(),console.error(e),[3,3];case 3:return[2]}}))}))}))})),Object(dt.mapTo)(void 0))},t.prototype.addNotification=function(t){var e=this;return t.actionData&&"codePush"===t.actionData.actionType&&t.actionData.deploymentKey&&this.sharedPreferences.putString(G.DEPLOYMENT_KEY,t.actionData.deploymentKey),this.dbService.read({table:nn.TABLE_NAME,selection:nn.COLUMN_NAME_MESSAGE_ID+"= ?",selectionArgs:[t.id.toString()],limit:"1"}).pipe(Object(dt.mergeMap)((function(n){return n&&n.length?e.dbService.update({table:nn.TABLE_NAME,selection:nn.COLUMN_NAME_MESSAGE_ID+"= ?",selectionArgs:[t.id.toString()],modelJson:Zh.constructNotificationDBModel(t)}).pipe(Object(dt.mapTo)(!0)):e.dbService.insert({table:nn.TABLE_NAME,modelJson:Zh.constructNotificationDBModel(t)}).pipe(Object(dt.mapTo)(!0))})),Object(dt.tap)((function(){return e.triggerNotificationChange()})))},t.prototype.deleteNotification=function(t){var e=this;if("USER_FEED"===t.source)return this.profileService.deleteUserFeedEntry({feedEntryId:t.id,category:Gr.UserFeedCategory.NOTIFICATION}).pipe(Object(dt.tap)((function(){return e.triggerNotificationChange()})));var n=("DELETE FROM "+nn.TABLE_NAME+" ").concat(t.id?"WHERE "+nn.COLUMN_NAME_MESSAGE_ID+" = "+t.id:"");return this.dbService.execute(n).pipe(Object(dt.mapTo)(!0),Object(dt.tap)((function(){return e.triggerNotificationChange()})))},t.prototype.getAllNotifications=function(t){return this.dbService.read(Zh.getFilterForNotification(t)).pipe(Object(dt.map)((function(t){return t.map((function(t){var e=JSON.parse(t[il]);return e.isRead=t[nn.COLUMN_NAME_IS_READ],e}))})))},t.prototype.updateNotification=function(t){var e=this;return"USER_FEED"===t.source?this.profileService.updateUserFeedEntry({feedEntryId:t.id,category:Gr.UserFeedCategory.NOTIFICATION,request:{status:t.isRead?Gr.UserFeedStatus.READ:Gr.UserFeedStatus.UNREAD}}).pipe(Object(dt.tap)((function(){return e.triggerNotificationChange()}))):this.dbService.read({table:nn.TABLE_NAME,selection:nn.COLUMN_NAME_MESSAGE_ID+"= ?",selectionArgs:[t.id.toString()],limit:"1"}).pipe(Object(dt.mergeMap)((function(n){return n&&n.length?e.dbService.update({table:nn.TABLE_NAME,selection:nn.COLUMN_NAME_MESSAGE_ID+"= ?",selectionArgs:[t.id.toString()],modelJson:Zh.constructNotificationDBModel(t)}).pipe(Object(dt.mapTo)(!0)):Object(J.of)(!1)})),Object(dt.tap)((function(){return e.triggerNotificationChange()})))},t.prototype.deleteAllNotifications=function(){var t=this;return Object(J.defer)((function(){return nl(t,void 0,void 0,(function(){var t,e,n=this;return rl(this,(function(r){switch(r.label){case 0:t=this._notifications$.getValue(),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.all(t.map((function(t){return n.deleteNotification(t).toPromise()})))];case 2:return r.sent(),[2,!0];case 3:return e=r.sent(),console.error(e),[2,!1];case 4:return[2]}}))}))}))},t.prototype.fetchNotificationAndUserFeed=function(){return nl(this,void 0,void 0,(function(){var t,n,r,i,o,a=this;return rl(this,(function(s){switch(s.label){case 0:return t=function(){return nl(a,void 0,void 0,(function(){return rl(this,(function(t){return[2,this.getAllNotifications({notificationStatus:Ph.ALL}).toPromise()]}))}))},n=function(){return nl(a,void 0,void 0,(function(){var t,n,r;return rl(this,(function(i){switch(i.label){case 0:return i.trys.push([0,6,,7]),[4,this.profileService.getActiveProfileSession().toPromise()];case 1:t=i.sent(),n=e.USER_NOTIFICATION_FEED_KEY+"_"+(t.managedSession?t.managedSession.uid:t.uid),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this.profileService.getUserFeed().toPromise().then((function(t){return t.filter((function(t){return t.category===Gr.UserFeedCategory.NOTIFICATION}))}))];case 3:return r=i.sent(),this.keyValueStore.setValue(n,Object(dr.gzip)(JSON.stringify(r))).toPromise(),[2,r];case 4:return i.sent(),[2,this.keyValueStore.getValue(n).toPromise().then((function(t){return JSON.parse(Object(go.ungzip)(t,{to:"string"}))})).catch((function(t){return console.error(t),[]}))];case 5:return[3,7];case 6:return i.sent(),[2,[]];case 7:return[2]}}))}))},[4,Promise.all([t(),n()])];case 1:return r=s.sent(),i=r[0],o=r[1],[2,i.concat(o.map((function(t){return Qh({id:t.id,source:"USER_FEED",displayTime:new Date(t.createdOn).getTime(),expiry:t.expireOn?new Date(t.expireOn).getTime():0,isRead:"read"===t.status?1:0},t.data)}))).sort((function(t,e){return new Date(e.displayTime).getTime()-new Date(t.displayTime).getTime()}))]}}))}))},t.prototype.triggerNotificationChange=function(){return nl(this,void 0,void 0,(function(){return rl(this,(function(t){return this._notificationTrigger$.next(null),[2]}))}))},t.USER_NOTIFICATION_FEED_KEY="user_notification_feed",t=e=$h([Object(R.injectable)(),el(0,Object(R.inject)(Q.DB_SERVICE)),el(1,Object(R.inject)(Q.SHARED_PREFERENCES)),el(2,Object(R.inject)(Q.PROFILE_SERVICE)),el(3,Object(R.inject)(Q.KEY_VALUE_STORE)),tl("design:paramtypes",[I,Object,Object,Object])],t)}();!function(t){t.CUSTODIAN_ORG_ID="custodianOrgId",t.COURSE_FRAMEWORK_ID="courseFrameworkId",t.ERROR_LOG_SYNC_SETTINGS="errorLogSyncSettings"}(Jh||(Jh={}));var al,sl=function(){function t(){}return t.mapErrorSatckDBEntryToErrorStack=function(t){return{appver:t[sn.COLUMN_NAME_APP_VERSION],pageid:t[sn.COLUMN_NAME_PAGE_ID],ts:t[sn.COLUMN_NAME_TIME_STAMP],log:t[sn.COLUMN_NAME_ERROR_LOG]}},t.mapErrorStackToErrorStackDBEntry=function(t){var e;return(e={})[sn.COLUMN_NAME_APP_VERSION]=t.appver,e[sn.COLUMN_NAME_PAGE_ID]=t.pageid,e[sn.COLUMN_NAME_TIME_STAMP]=t.ts,e[sn.COLUMN_NAME_ERROR_LOG]=t.log,e},t}(),ul=sn._ID,cl=function(){function t(t,e,n,r,i){this.apiService=t,this.dbService=e,this.errorLoggerConfig=n,this.networkInfoService=r,this.errorStackSyncRequestDecorator=i}return t.prototype.handle=function(t){var e=this;return this.processBatch(t).pipe(Object(dt.expand)((function(n){return n>0?e.processBatch(t):J.EMPTY})),Object(dt.mapTo)(void 0),Object(dt.catchError)((function(){return Object(J.of)(void 0)})))},t.prototype.processBatch=function(t){var e=this;return this.getErrorStackBatch(t).pipe(Object(dt.mergeMap)((function(t){return e.sync(t)})),Object(dt.mergeMap)((function(t){return e.clearLogs(t)})),Object(dt.map)((function(t){return t.length})))},t.prototype.getErrorStackBatch=function(t){return this.dbService.execute("\n SELECT * FROM "+sn.TABLE_NAME+"\n LIMIT "+t+"\n ")},t.prototype.clearLogs=function(t){return t.length?this.dbService.execute("\n DELETE FROM "+sn.TABLE_NAME+"\n WHERE "+sn._ID+" IN ("+t.map((function(t){return t[ul]})).join(",")+")\n ").pipe(Object(dt.mapTo)(t)):Object(J.of)(t)},t.prototype.sync=function(t){var e=this;return t.length?this.networkInfoService.networkStatus$.pipe(Object(dt.mergeMap)((function(n){if(n===Lr.OFFLINE)return Object(J.throwError)(new Error("Fake Error"));var r={pdata:void 0,context:void 0,logs:t.map((function(t){return sl.mapErrorSatckDBEntryToErrorStack(t)}))};return e.errorStackSyncRequestDecorator.decorate(r).pipe(Object(dt.mergeMap)((function(){var t=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(e.errorLoggerConfig.errorLoggerApiPath).withBearerToken(!0).withBody({request:r}).build();return e.apiService.fetch(t)})))})),Object(dt.mapTo)(t)):Object(J.of)(t)},t}(),fl=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},hl=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},ll=function(){function t(t,e,n){this.apiConfig=t,this.deviceInfo=e,this.appInfo=n}return t.prototype.decorate=function(t){var e=this;return Object(J.defer)((function(){return fl(e,void 0,void 0,(function(){return hl(this,(function(e){switch(e.label){case 0:return this.patchPData(t),[4,this.patchContext(t)];case 1:return e.sent(),[2,t]}}))}))}))},t.prototype.patchContext=function(t){return fl(this,void 0,void 0,(function(){var e,n;return hl(this,(function(r){switch(r.label){case 0:return e=t,n={did:this.deviceInfo.getDeviceID()},[4,this.deviceInfo.getDeviceSpec().toPromise()];case 1:return e.context=(n.spec=r.sent(),n),[2]}}))}))},t.prototype.patchPData=function(t){t.pdata=new te,t.pdata.id=this.apiConfig.api_authentication.producerId;var e=t.pdata.pid;e?t.pdata.pid=e:this.apiConfig.api_authentication.producerUniqueId?t.pdata.pid=this.apiConfig.api_authentication.producerUniqueId:t.pdata.pid="sunbird.android",t.pdata.ver||(t.pdata.ver=this.appInfo.getVersionName())},t}(),dl=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},pl=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bl=function(t,e){return function(n,r){e(n,r,t)}},yl=function(){function t(t,e,n,r,i,o,a,s){this.systemSettingsService=t,this.dbService=e,this.appInfo=n,this.apiService=r,this.sdkConfig=i,this.errorLoggerService=o,this.deviceInfo=a,this.sharedPreferences=s,this.errorLoggerConfig=this.sdkConfig.errorLoggerConfig,this.errorStackSyncRequestDecorator=new ll(this.sdkConfig.apiConfig,this.deviceInfo,this.appInfo),this.errorStackSyncHandler=new cl(this.apiService,this.dbService,this.errorLoggerConfig,this.errorLoggerService,this.errorStackSyncRequestDecorator)}var e;return e=t,t.prototype.onInit=function(){var t=this;return this.sharedPreferences.getString(Y.KEY_ERROR_LOG_LAST_SYNCED_TIME_STAMP).pipe(Object(dt.mergeMap)((function(e){return e?Object(J.of)(void 0):t.sharedPreferences.putString(Y.KEY_ERROR_LOG_LAST_SYNCED_TIME_STAMP,Date.now()+"")})))},t.prototype.logError=function(t){var e=this,n={appver:this.appInfo.getVersionName(),pageid:t.pageId,ts:Date.now(),log:t.stacktrace};return this.dbService.insert({table:sn.TABLE_NAME,modelJson:sl.mapErrorStackToErrorStackDBEntry(n)}).pipe(Object(dt.mergeMap)((function(){return e.getErrorCount()})),Object(dt.mergeMap)((function(t){return e.getErrorLogSyncSettings().pipe(Object(dt.map)((function(e){return dl({},e,{errorCount:t})})))})),Object(dt.map)((function(t){return{errorCount:t.errorCount,errorLogSyncFrequency:t.frequency,errorLogSyncBandwidth:t.bandwidth}})),Object(dt.mergeMap)((function(t){var n=t.errorCount,r=t.errorLogSyncFrequency,i=t.errorLogSyncBandwidth;return e.hasErrorLogSyncFrequencyCrossed(n,r).pipe(Object(dt.map)((function(t){return{shouldSync:t,errorLogSyncBandwidth:i}})))})),Object(dt.mergeMap)((function(t){var n=t.shouldSync,r=t.errorLogSyncBandwidth;return n?e.errorStackSyncHandler.handle(r).pipe(Object(dt.mergeMap)((function(){return e.sharedPreferences.putString(Y.KEY_ERROR_LOG_LAST_SYNCED_TIME_STAMP,Date.now()+"")}))):Object(J.of)(void 0)})))},t.prototype.hasErrorLogSyncFrequencyCrossed=function(t,e){return this.sharedPreferences.getString(Y.KEY_ERROR_LOG_LAST_SYNCED_TIME_STAMP).pipe(Object(dt.map)((function(t){return parseInt(t,10)})),Object(dt.map)((function(t){return t+e<Date.now()})))},t.prototype.getErrorCount=function(){return this.dbService.execute("SELECT COUNT(*) as count FROM "+sn.TABLE_NAME).pipe(Object(dt.map)((function(t){return t[0].count})))},t.prototype.getErrorLogSyncSettings=function(){var t={id:e.ERROR_LOG_SYNC_SETTINGS};return this.systemSettingsService.getSystemSettings(t).pipe(Object(dt.map)((function(t){return JSON.parse(t.value)})))},t.ERROR_LOG_SYNC_SETTINGS=Jh.ERROR_LOG_SYNC_SETTINGS,t=e=pl([Object(R.injectable)(),bl(0,Object(R.inject)(Q.SYSTEM_SETTINGS_SERVICE)),bl(1,Object(R.inject)(Q.DB_SERVICE)),bl(2,Object(R.inject)(Q.APP_INFO)),bl(3,Object(R.inject)(Q.API_SERVICE)),bl(4,Object(R.inject)(Q.SDK_CONFIG)),bl(5,Object(R.inject)(Q.NETWORKINFO_SERVICE)),bl(6,Object(R.inject)(Q.DEVICE_INFO)),bl(7,Object(R.inject)(Q.SHARED_PREFERENCES)),ml("design:paramtypes",[Object,I,Object,Object,Object,Object,Object,Object])],t)}(),vl=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},gl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_l=function(){function t(){var t=this;navigator.connection.type===Connection.NONE?this.networkStatusSource=new J.BehaviorSubject(Lr.OFFLINE):this.networkStatusSource=new J.BehaviorSubject(Lr.ONLINE),window.addEventListener("online",(function(){t.networkStatusSource.next(Lr.ONLINE)}),!1),window.addEventListener("offline",(function(){t.networkStatusSource.next(Lr.OFFLINE)}),!1),this.networkStatus$=this.networkStatusSource.asObservable()}return t=vl([Object(R.injectable)(),gl("design:paramtypes",[])],t)}(),El=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ml=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},wl=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Sl=function(t){function e(){return t.call(this,8,23)||this}return El(e,t),e.prototype.apply=function(t){return Ml(this,void 0,void 0,(function(){var e=this;return wl(this,(function(n){return this.queries().forEach((function(n){return Ml(e,void 0,void 0,(function(){return wl(this,(function(e){switch(e.label){case 0:return[4,t.execute(n).toPromise()];case 1:return e.sent(),[2]}}))}))})),[2,void 0]}))}))},e.prototype.queries=function(){return[cn.getCreateEntry()]},e}(C),Ol=cn.COLUMN_NAME_USER_ID,Al=cn.COLUMN_NAME_QUERY,Tl=cn.COLUMN_NAME_TIME_STAMP,Nl=function(){function t(){}return t.mapSearchHistoryDbEntryToSearchEntry=function(t){return{uid:t[Ol],query:t[Al],timestamp:t[Tl]}},t}(),Cl=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Il=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rl=function(t,e){return function(n,r){e(n,r,t)}},Pl=function(){function t(t,e){this.dbService=t,this.profileService=e}var e;return e=t,t.prototype.addEntry=function(t){var n=this,r=t.query,i=t.namespace;return this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(t){var e,o=t.uid;return n.dbService.insert({table:cn.TABLE_NAME,modelJson:(e={},e[cn.COLUMN_NAME_QUERY]=r.trim(),e[cn.COLUMN_NAME_NAMESPACE]=i,e[cn.COLUMN_NAME_USER_ID]=o,e[cn.COLUMN_NAME_TIME_STAMP]=Date.now(),e)}).pipe(Object(dt.mapTo)(o))})),Object(dt.mergeMap)((function(t){return n.dbService.execute("\n DELETE FROM "+cn.TABLE_NAME+" WHERE\n "+cn._ID+" IN (SELECT "+cn._ID+" FROM "+cn.TABLE_NAME+" WHERE\n "+cn.COLUMN_NAME_USER_ID+' = "'+t+'" AND\n '+cn.COLUMN_NAME_NAMESPACE+' = "'+i+'"\n ORDER BY '+cn.COLUMN_NAME_TIME_STAMP+" DESC\n LIMIT -1 OFFSET "+e.MAX_USER_SEARCH_HISTORY_ENTRIES+")\n ")})),Object(dt.mapTo)(void 0))},t.prototype.getEntries=function(t){var e=this,n=t.like,r=t.limit,i=t.namespace;return this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(t){var o=t.uid,a="";return n&&(a="AND "+cn.COLUMN_NAME_QUERY+' LIKE "%'+n.trim()+'%"'),e.dbService.execute("\n SELECT * FROM "+cn.TABLE_NAME+" WHERE\n "+cn.COLUMN_NAME_USER_ID+' = "'+o+'" AND\n '+cn.COLUMN_NAME_NAMESPACE+' = "'+i+'"\n '+a+"\n ORDER BY "+cn.COLUMN_NAME_TIME_STAMP+" DESC\n LIMIT "+r+"\n ")})),Object(dt.map)((function(t){return t.map((function(t){return Nl.mapSearchHistoryDbEntryToSearchEntry(t)}))})))},t.MAX_USER_SEARCH_HISTORY_ENTRIES=10,t=e=Cl([Object(R.injectable)(),Rl(0,Object(R.inject)(Q.DB_SERVICE)),Rl(1,Object(R.inject)(Q.PROFILE_SERVICE)),Il("design:paramtypes",[I,Object])],t)}(),Ll=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dl=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},jl=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},kl=function(t){function e(){return t.call(this,9,24)||this}return Ll(e,t),e.prototype.apply=function(t){return Dl(this,void 0,void 0,(function(){var e=this;return jl(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.queries().map((function(e){return t.execute(e).toPromise()})))];case 1:return n.sent(),[4,t.read({table:tn.TABLE_NAME}).pipe(Object(dt.map)((function(n){n.forEach((function(n){return Dl(e,void 0,void 0,(function(){var e,r;return jl(this,(function(i){switch(i.label){case 0:return(e=n[tn.COLUMN_NAME_DATA])?(r=JSON.parse(e),n[We.COLUMN_NAME_MIME_TYPE]=r.mimeType,[4,t.update({table:tn.TABLE_NAME,modelJson:n,selection:tn.COLUMN_NAME_CONTENT_IDENTIFIER+" = ?",selectionArgs:[n[tn.COLUMN_NAME_CONTENT_IDENTIFIER]]}).toPromise()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))}))}))).toPromise()];case 2:return n.sent(),[2,void 0]}}))}))},e.prototype.queries=function(){return[tn.getAlterEntryForMimeType()]},e}(C),Ul=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xl=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Bl=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Fl=function(t){function e(){return t.call(this,10,25)||this}return Ul(e,t),e.prototype.apply=function(t){return xl(this,void 0,void 0,(function(){var e,n,r;return Bl(this,(function(i){switch(i.label){case 0:e=0,n=this.queries(),i.label=1;case 1:return e<n.length?(r=n[e],[4,t.execute(r).toPromise()]):[3,4];case 2:i.sent(),i.label=3;case 3:return e++,[3,1];case 4:return[2,void 0]}}))}))},e.prototype.queries=function(){return[hn.getCreateEntry()]},e}(C),Vl=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},ql=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yl=function(t,e){return function(n,r){e(n,r,t)}},Gl=function(){function t(t){this.sharedPreferences=t}return t.prototype.setDefaultDeploymentKey=function(t){return this.sharedPreferences.putString(H.DEFAULT_DEPLOYMENT_KEY,t)},t.prototype.getDefaultDeploymentKey=function(){return this.sharedPreferences.getString(H.DEFAULT_DEPLOYMENT_KEY)},t.prototype.setExperimentKey=function(t){var e=this;return this.sharedPreferences.putString(H.EXPERIMENT_KEY,t).pipe(Object(dt.tap)((function(){e.experimentKey||(e.experimentKey=t)})))},t.prototype.getExperimentKey=function(){var t=this;return this.experimentKey?this.experimentKey:this.sharedPreferences.getString(H.EXPERIMENT_KEY).pipe(Object(dt.tap)((function(e){return t.experimentKey=e,e})))},t.prototype.setExperimentAppVersion=function(t){return this.sharedPreferences.putString(H.EXPERIMENT_APP_VERSION,t)},t.prototype.getExperimentAppVersion=function(){return this.sharedPreferences.getString(H.EXPERIMENT_APP_VERSION)},t=Vl([Object(R.injectable)(),Yl(0,Object(R.inject)(Q.SHARED_PREFERENCES)),ql("design:paramtypes",[Object])],t)}(),Hl=function(){function t(t,e,n,r){this.apiService=t,this.faqServiceConfig=e,this.fileservice=n,this.cachedItemStore=r,this.FAQ_FILE_KEY_PREFIX="faq-",this.FAQ_LOCAL_KEY="faq-new-"}return t.prototype.handle=function(t){var e=this;return this.cachedItemStore.getCached(t.language,this.FAQ_LOCAL_KEY,"ttl_"+this.FAQ_LOCAL_KEY,(function(){return e.fetchFromServer(t)}),(function(){return e.fetchFromFile(t.language)}))},t.prototype.fetchFromServer=function(t){var e=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withHost(t.faqUrl).withPath("/faq-"+t.language+".json").withBearerToken(!1).build();return this.apiService.fetch(e).pipe(Object(dt.map)((function(t){var e;try{e=JSON.parse(t.body.trim())}catch(n){e=t.body}return e})))},t.prototype.fetchFromFile=function(t){var e=ci.getAssetPath()+this.faqServiceConfig.faqConfigDirPath,n=this.FAQ_FILE_KEY_PREFIX+t+".json";return Object(J.from)(this.fileservice.readFileFromAssets(e.concat("/",n))).pipe(Object(dt.map)((function(t){return JSON.parse(t)})))},t}(),zl=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Kl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wl=function(t,e){return function(n,r){e(n,r,t)}},Xl=function(){function t(t,e,n,r){this.sdkConfig=t,this.fileService=e,this.apiService=n,this.cachedItemStore=r}return t.prototype.getFaqDetails=function(t){return new Hl(this.apiService,this.sdkConfig.faqServiceConfig,this.fileService,this.cachedItemStore).handle(t)},t=zl([Object(R.injectable)(),Wl(0,Object(R.inject)(Q.SDK_CONFIG)),Wl(1,Object(R.inject)(Q.FILE_SERVICE)),Wl(2,Object(R.inject)(Q.API_SERVICE)),Wl(3,Object(R.inject)(Q.CACHED_ITEM_STORE)),Kl("design:paramtypes",[Object,Object,Object,Object])],t)}();!function(t){t.CONTENT="content",t.PROFILE="profile",t.TELEMETRY="telemetry"}(al||(al={}));var Jl=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zl=function(t){function e(n,r){var i=t.call(this,n,"ASSERTION_ERROR_"+r)||this;return Object.setPrototypeOf(i,e.prototype),i}return Jl(e,t),e}(ye),Ql=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$l=function(t){function e(n){var r=t.call(this,n,"INVALID_REQUEST")||this;return Object.setPrototypeOf(r,e.prototype),r}return Ql(e,t),e}(Zl),td=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ed=function(t){function e(n){var r=t.call(this,n,"OBJECT_NOT_FOUND")||this;return Object.setPrototypeOf(r,e.prototype),r}return td(e,t),e}(Zl),nd=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},rd=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},id=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},od=function(){function t(t,e){this.dbService=t,this.fileService=e}return t.prototype.export=function(t,e){var n=this;return new J.Observable((function(t){rd(n,void 0,void 0,(function(){var n,r,i,o,a;return id(this,(function(s){switch(s.label){case 0:n={task:"",completed:[]},t.next(n=nd({},n,{task:"VALIDATING"})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.validate()];case 2:return s.sent(),[3,4];case 3:return r=s.sent(),t.error(r),[2];case 4:return t.next(n=nd({},n,{task:"PREPARING"})),[4,this.prepare(e)];case 5:return s.sent(),t.next(n=nd({},n,{task:"INITIALIZING"})),[4,this.createWorkspace()];case 6:return s.sent(),[4,this.getMessageIds()];case 7:i=s.sent(),s.label=8;case 8:s.trys.push([8,12,,13]),s.label=9;case 9:return i.length?(o=i.pop(),[4,this.processBatch(o).then((function(e){if(e){var r=e.file,i=e.mid,o=e.eventsCount,a=e.size;t.next(n=nd({},n,{task:"BUILDING_BATCH",completed:n.completed.concat([{file:r,mid:i,eventsCount:o,size:a,objectType:al.TELEMETRY,contentEncoding:"gzip",explodedSize:-1}])}))}else t.next(n=nd({},n,{task:"SKIPPING_BATCH"}))}))]):[3,11];case 10:return s.sent(),[3,9];case 11:return[3,13];case 12:return a=s.sent(),t.error(a),[2];case 13:return t.next(n=nd({},n,{task:"OBJECT_ARCHIVE_COMPLETE"})),t.complete(),[2]}}))}))}))},t.prototype.validate=function(){return rd(this,void 0,void 0,(function(){return id(this,(function(t){switch(t.label){case 0:return[4,this.dbService.execute(("\n SELECT count(*) as COUNT FROM "+dn.TABLE_NAME+" WHERE "+dn.COLUMN_NAME_TYPE+" = '"+pn.TELEMETRY+"'\n ").trim()).pipe(Object(dt.map)((function(t){return t&&t[0]&&t[0].COUNT}))).toPromise()];case 1:if(!t.sent())throw new ed("No telemetry to export");return[2]}}))}))},t.prototype.prepare=function(t){return rd(this,void 0,void 0,(function(){return id(this,(function(e){return this.workspaceSubPath=""+t.workspacePath,[2]}))}))},t.prototype.createWorkspace=function(){return rd(this,void 0,void 0,(function(){return id(this,(function(t){return[2,this.fileService.createDir(this.workspaceSubPath,!1)]}))}))},t.prototype.getMessageIds=function(){return rd(this,void 0,void 0,(function(){return id(this,(function(t){switch(t.label){case 0:return[4,this.dbService.read({table:dn.TABLE_NAME,columns:[dn.COLUMN_NAME_MSG_ID],selection:dn.COLUMN_NAME_TYPE+" = ?",selectionArgs:[pn.TELEMETRY],distinct:!0}).toPromise()];case 1:return[2,t.sent().map((function(t){return t[dn.COLUMN_NAME_MSG_ID]}))]}}))}))},t.prototype.processBatch=function(t){return rd(this,void 0,void 0,(function(){var e;return id(this,(function(n){switch(n.label){case 0:return[4,this.dbService.read({table:dn.TABLE_NAME,selection:dn.COLUMN_NAME_MSG_ID+" = ? AND "+dn.COLUMN_NAME_TYPE+" = ?",selectionArgs:[t,pn.TELEMETRY]}).toPromise()];case 1:return(e=n.sent()[0])?[4,this.fileService.writeFile(this.workspaceSubPath,e[dn.COLUMN_NAME_MSG_ID],e[dn.COLUMN_NAME_DATA],{replace:!0})]:[2];case 2:return n.sent(),[2,{size:[dn.COLUMN_NAME_DATA].length,eventsCount:e[dn.COLUMN_NAME_NUMBER_OF_ITEM],mid:e[dn.COLUMN_NAME_MSG_ID],file:""+e[dn.COLUMN_NAME_MSG_ID]}]}}))}))},t}(),ad=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),sd=function(t){function e(n,r){var i=t.call(this,n,"ASSERTION_ERROR_"+r)||this;return Object.setPrototypeOf(i,e.prototype),i}return ad(e,t),e}(ye),ud=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cd=function(t){function e(n){var r=t.call(this,n,"UNKNOWN_OBJECT_ERROR")||this;return Object.setPrototypeOf(r,e.prototype),r}return ud(e,t),e}(sd),fd=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},hd=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ld=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},dd=function(){function t(t,e,n,r){this.dbService=t,this.fileService=e,this.networkQueue=n,this.sdkConfig=r}return t.prototype.import=function(t,e){var n=this;return new J.Observable((function(t){hd(n,void 0,void 0,(function(){var n,r,i,o;return ld(this,(function(a){switch(a.label){case 0:return n={task:"",pending:[]},r=e.items,t.next({task:"PREPARING",pending:r.slice()}),[4,this.prepare(e)];case 1:a.sent(),a.label=2;case 2:a.trys.push([2,6,,7]),a.label=3;case 3:return r.length?"gzip"!==(i=r.pop()).contentEncoding?(t.error(new cd("Unknown content encoding "+i.contentEncoding)),[2]):[4,this.processBatch(i).then((function(){t.next(n=fd({},n,{task:"IMPORTING_BATCH",pending:r.slice()}))}))]:[3,5];case 4:return a.sent(),[3,3];case 5:return[3,7];case 6:return o=a.sent(),t.error(o),[2];case 7:return t.next(n=fd({},n,{task:"OBJECT_IMPORT_COMPLETE"})),t.complete(),[2]}}))}))}))},t.prototype.prepare=function(t){return hd(this,void 0,void 0,(function(){return ld(this,(function(e){return this.workspaceSubPath=""+t.workspacePath,[2]}))}))},t.prototype.processBatch=function(t){return hd(this,void 0,void 0,(function(){var e=this;return ld(this,(function(n){return[2,this.fileService.readAsBinaryString(this.workspaceSubPath,t.file).then((function(n){e.networkQueue.enqueue(new _r(e.sdkConfig).generateNetworkQueueRequest(pn.TELEMETRY,n,t.mid,t.eventsCount,!1),!1).toPromise()}))]}))}))},t}(),pd=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),md=function(t){function e(n){var r=t.call(this,n,"INVALID_ARCHIVE")||this;return Object.setPrototypeOf(r,e.prototype),r}return pd(e,t),e}(sd),bd=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},yd=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},vd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gd=function(t,e){return function(n,r){e(n,r,t)}},_d=function(){function t(t,e,n,r,i,o,a){this.fileService=t,this.dbService=e,this.telemetryService=n,this.zipService=r,this.deviceInfo=i,this.networkQueue=o,this.sdkConfig=a}var e;return e=t,t.reduceObjectProgressToArchiveObjectExportProgress=function(t){return t.reduce((function(t,e){var n=e.type,r=e.progress;return t.set(n,r),t}),new Map)},t.reduceObjectProgressToArchiveObjectImportProgress=function(t){return t.reduce((function(t,e){var n=e.type,r=e.progress;return t.set(n,r),t}),new Map)},t.prototype.export=function(t){var n,r=this,i=""+("ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalCacheDirectory)+ar.generateUniqueId();return t.objects.length?Object(J.concat)(Object(J.defer)((function(){return Object(J.from)(r.fileService.createDir(i,!1))})).pipe(Object(dt.concatMap)((function(){return Object(J.combineLatest)(t.objects.map((function(e){switch(e.type){case al.CONTENT:case al.PROFILE:throw new Error("To be implemented");case al.TELEMETRY:return new od(r.dbService,r.fileService).export({filePath:t.filePath},{workspacePath:i}).pipe(Object(dt.map)((function(t){return{type:al.TELEMETRY,progress:t}})))}})))})),Object(dt.map)((function(t){return{task:"BUILDING",progress:e.reduceObjectProgressToArchiveObjectExportProgress(t)}})),Object(dt.tap)((function(t){return n=t}))),Object(J.defer)((function(){return r.generateManifestFile(n,i)})),Object(J.defer)((function(){return r.generateZipArchive(n,i)})),Object(J.defer)((function(){return r.generateExportTelemetries(n,i)}))).pipe(Object(dt.tap)((function(t){return n=t}))):Object(J.throwError)(new $l("No archive objects to export"))},t.prototype.generateExportTelemetries=function(t,e){var n=this;return t.progress.forEach((function(t,e){switch(e){case al.CONTENT:case al.PROFILE:throw new Error("To be implemented");case al.TELEMETRY:var r={dir:ft.OUT,type:ht.FILE,items:[],env:"sdk"};n.telemetryService.share(r).toPromise()}})),Object(J.of)(bd({},t))},t.prototype.generateZipArchive=function(t,e){var n=this,r=("ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalCacheDirectory)+"archive-"+(new Date).toISOString()+".zip";return new J.Observable((function(t){n.zipService.zip(e,{target:r},[],[],(function(){t.next(),t.complete()}),(function(e){t.error(e)}))})).pipe(Object(dt.mapTo)(bd({},t,{task:"COMPLETE",filePath:r})))},t.prototype.generateManifestFile=function(t,n){var r=this,i=t.progress;return this.telemetryService.buildContext().pipe(Object(dt.map)((function(t){return t.pdata})),Object(dt.concatMap)((function(t){var o=Array.from(i.entries()).reduce((function(t,e){e[0];var n=e[1];return t.concat(n.completed)}),[]);return Object(J.from)(r.fileService.writeFile(n,"manifest.json",JSON.stringify({id:e.ARCHIVE_ID,ver:e.ARCHIVE_VERSION,ts:(new Date).toISOString(),producer:t,archive:{count:o.length,items:o}}),{replace:!0}))})),Object(dt.mapTo)({progress:i,task:"BUILDING_MANIFEST"}))},t.prototype.import=function(t){var n=this,r=""+("ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalCacheDirectory)+ar.generateUniqueId();if(!t.objects.length)return Object(J.throwError)(new $l("No archive objects to export"));var i={task:"",progress:new Map,filePath:t.filePath};return Object(J.concat)(Object(J.defer)((function(){return Object(J.from)(n.fileService.createDir(r,!1))})).pipe(Object(dt.concatMap)((function(){return n.extractZipArchive(i,r)}))),Object(J.defer)((function(){return n.readManifestFile(i,r,t.objects.map((function(t){return t.type})))})),Object(J.defer)((function(){return n.generateImportTelemetries(i,r)})),Object(J.defer)((function(){return Object(J.combineLatest)(t.objects.map((function(e){switch(e.type){case al.CONTENT:case al.PROFILE:throw new Error("To be implemented");case al.TELEMETRY:return new dd(n.dbService,n.fileService,n.networkQueue,n.sdkConfig).import({filePath:t.filePath},{workspacePath:r,items:i.progress.get(al.TELEMETRY).pending}).pipe(Object(dt.map)((function(t){return{type:al.TELEMETRY,progress:t}})))}}))).pipe(Object(dt.map)((function(t){return{task:"IMPORTING",progress:e.reduceObjectProgressToArchiveObjectImportProgress(t)}})))})),Object(J.of)(bd({},i,{task:"COMPLETE"}))).pipe(Object(dt.tap)((function(t){return i=t})))},t.prototype.generateImportTelemetries=function(t,e){var n=this;return t.progress.forEach((function(t,e){switch(e){case al.CONTENT:case al.PROFILE:throw new Error("To be implemented");case al.TELEMETRY:var r={dir:ft.IN,type:ht.FILE.valueOf(),items:[],env:"sdk"};n.telemetryService.share(r).toPromise()}})),Object(J.of)(bd({},t))},t.prototype.extractZipArchive=function(t,e){var n=this,r=t.filePath;return new J.Observable((function(t){sbutility.copyFile(is.getDirecory(r),e+"/",is.getFileName(r),(function(){n.zipService.unzip(e+"/"+is.getFileName(r),{target:e+"/"},(function(){t.next(),t.complete()}),(function(e){return t.error(e)}))}),(function(e){console.error(e),t.error(e)}))})).pipe(Object(dt.mapTo)(bd({},t,{task:"EXTRACTING"})))},t.prototype.readManifestFile=function(t,e,n){return Object(J.from)(this.fileService.readAsText(e,"manifest.json")).pipe(Object(dt.map)((function(t){try{return JSON.parse(t)}catch(t){throw new md("Invalid manfiest.json")}})),Object(dt.map)((function(e){return bd({},t,{progress:(n.forEach((function(n){var r=e.archive.items.filter((function(t){return t.objectType===n}));if(!r.length)throw new md("Nothing to import");t.progress.set(n,{task:"INITIALISING",pending:r})})),t.progress),task:"VALIDATING"})})))},t.ARCHIVE_ID="sunbird.data.archive",t.ARCHIVE_VERSION="1.0",t=e=yd([Object(R.injectable)(),gd(0,Object(R.inject)(Q.FILE_SERVICE)),gd(1,Object(R.inject)(Q.DB_SERVICE)),gd(2,Object(R.inject)(Q.TELEMETRY_SERVICE)),gd(3,Object(R.inject)(Q.ZIP_SERVICE)),gd(4,Object(R.inject)(Q.DEVICE_INFO)),gd(5,Object(R.inject)(Q.NETWORK_QUEUE)),gd(6,Object(R.inject)(Q.SDK_CONFIG)),vd("design:paramtypes",[Object,I,Object,Object,Object,Object,Object])],t)}(),Ed=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Md=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},wd=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Sd=function(t){function e(e,n){var r=t.call(this,14,27)||this;return r.sdkConfig=e,r.networkQueue=n,r}return Ed(e,t),e.prototype.apply=function(t){return Md(this,void 0,void 0,(function(){var e=this;return wd(this,(function(n){switch(n.label){case 0:return[4,Promise.all(this.queries().map((function(e){return t.execute(e).toPromise()})))];case 1:return n.sent(),[4,t.read({table:Me.TABLE_NAME,selection:"",selectionArgs:[]}).pipe(Object(dt.map)((function(n){var r=new _r(e.sdkConfig);n.forEach((function(n){return Md(e,void 0,void 0,(function(){var e,i,o;return wd(this,(function(a){switch(a.label){case 0:return n?(e=n[Me.COLUMN_NAME_MSG_ID],i=n[Me.COLUMN_NAME_DATA],o=n[Me.COLUMN_NAME_NUMBER_OF_EVENTS],[4,this.networkQueue.enqueue(r.generateNetworkQueueRequest(pn.TELEMETRY,i,e,o,!1),!1).toPromise()]):[3,3];case 1:return a.sent(),[4,t.execute("DELETE FROM "+Me.TABLE_NAME+" WHERE "+Me.COLUMN_NAME_MSG_ID+"='"+e+"'").toPromise()];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))}))}))).toPromise()];case 2:return n.sent(),[2,void 0]}}))}))},e.prototype.queries=function(){return[dn.getCreateEntry()]},e}(C),Od=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Ad=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Td=function(t,e){return function(n,r){e(n,r,t)}},Nd=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Cd=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Id=function(){function t(t,e,n,r){this.dbService=t,this.sharedPreferences=e,this.deviceInfo=n,this.sdkConfig=r}return t.prototype.enqueue=function(t,e){var n=this,r="Uint8Array"===this.getTypeOf(t.networkRequest.body)?t.networkRequest.body.buffer:t.networkRequest.body;return new J.Observable((function(i){Nd(n,void 0,void 0,(function(){var n;return Cd(this,(function(o){switch(o.label){case 0:return n=t,[4,this.interceptRequest(t.networkRequest).toPromise()];case 1:return n.networkRequest=o.sent(),sbsync.enqueue(r,dn.Mapper.networkQueueRequestToEntry(t),e,(function(){i.next(void 0),i.complete()}),(function(t){i.error(t)})),[2]}}))}))}))},t.prototype.interceptRequest=function(t){var e=this;return this.sharedPreferences.getString(j.KEY_API_TOKEN).pipe(Object(dt.map)((function(e){if(e){var n=t.headers;n.Authorization="Bearer "+e,t.headers=n}return t})),Object(dt.mergeMap)((function(){return e.sharedPreferences.getString(k.KEY_OAUTH_SESSION).pipe(Object(dt.map)((function(e){if(e){var n=JSON.parse(e),r=t.headers;r["X-Authenticated-User-Token"]=n.access_token,n.managed_access_token&&(r["X-Authenticated-For"]=n.managed_access_token),t.headers=r}return t})))})),Object(dt.map)((function(){return t.headers["X-Channel-Id"]=e.sdkConfig.apiConfig.api_authentication.channelId,t.headers["X-App-Id"]=e.sdkConfig.apiConfig.api_authentication.producerId,t.headers["X-Device-Id"]=e.deviceInfo.getDeviceID(),t.headers.Accept="application/json",t.headers["Content-Type"]="application/json",t.headers["Access-Control-Allow-Origin"]="*",t.body={},(new P.CsRequest.Builder).withSerializer(t.serializer).withHost(e.sdkConfig.apiConfig.host).withType(t.type).withPath(t.path).withHeaders(t.headers).withBody({}).withBearerToken(!0).build()})))},t.prototype.getTypeOf=function(t){switch(Object.prototype.toString.call(t)){case"[object Uint8Array]":return"Uint8Array";default:return"Unknown"}},t=Od([Object(R.injectable)(),Td(0,Object(R.inject)(Q.DB_SERVICE)),Td(1,Object(R.inject)(Q.SHARED_PREFERENCES)),Td(2,Object(R.inject)(Q.DEVICE_INFO)),Td(3,Object(R.inject)(Q.SDK_CONFIG)),Ad("design:paramtypes",[I,Object,Object,Object])],t)}(),Rd=function(){function t(t,e){this.groupActivityService=t,this.cachedItemStore=e}return t.prototype.getDataAggregation=function(e){var n=this;return this.cachedItemStore[e.from===Wr.SERVER?"get":"getCached"]("group-"+e.groupId+"-activity-"+e.activity.id+"-"+e.activity.type,t.GROUP_ACTIVITY_DATA_AGGREGATION_KEY,"ttl_"+t.GROUP_ACTIVITY_DATA_AGGREGATION_KEY,(function(){return n.groupActivityService.getDataAggregation(e.groupId,e.activity,e.mergeGroup,e.leafNodesCount)}))},t.prototype.getDataForDashlets=function(t,e){return this.groupActivityService.getDataForDashlets(t,e)},t.GROUP_ACTIVITY_DATA_AGGREGATION_KEY="GROUP_ACTIVITY_DATA_AGGREGATION-",t}(),Pd=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Ld=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dd=function(t,e){return function(n,r){e(n,r,t)}},jd=function(){function t(t,e){this.container=t,this.cachedItemStore=e}var e;return e=t,Object.defineProperty(t.prototype,"activityService",{get:function(){return this._groupActivityService||(this._groupActivityService=new Rd(this.groupServiceDelegate.activityService,this.cachedItemStore)),this._groupActivityService},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"groupServiceDelegate",{get:function(){return this.container.get(Z.GROUP_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.create=function(t){return this.groupServiceDelegate.create(t)},t.prototype.getById=function(t){var n=this;return this.cachedItemStore[t.from===Wr.SERVER?"get":"getCached"](t.id+"-"+t.userId+(t.options&&t.options.includeMembers?"-includeMembers:"+t.options.includeMembers:"")+(t.options&&t.options.includeActivities?"-includeActivities:"+t.options.includeActivities:"")+(t.options&&t.options.groupActivities?"-groupActivities:"+t.options.groupActivities:""),e.GROUP_LOCAL_KEY,"ttl_"+e.GROUP_LOCAL_KEY,(function(){return n.groupServiceDelegate.getById(t.id,t.options)}))},t.prototype.search=function(t){var n=this,r=t.request,i=t.from;return this.cachedItemStore[i===Wr.SERVER?"get":"getCached"](""+r.filters.userId,e.GROUP_SEARCH_LOCAL_KEY,"ttl_"+e.GROUP_SEARCH_LOCAL_KEY,(function(){return n.groupServiceDelegate.search(r)}))},t.prototype.updateById=function(t){return this.groupServiceDelegate.updateById(t.id,t.updateRequest)},t.prototype.deleteById=function(t){return this.groupServiceDelegate.deleteById(t.id)},t.prototype.addMembers=function(t){return this.groupServiceDelegate.addMembers(t.groupId,t.addMembersRequest)},t.prototype.updateMembers=function(t){return this.groupServiceDelegate.updateMembers(t.groupId,t.updateMembersRequest)},t.prototype.removeMembers=function(t){return this.groupServiceDelegate.removeMembers(t.groupId,t.removeMembersRequest)},t.prototype.addActivities=function(t){return this.groupServiceDelegate.addActivities(t.groupId,t.addActivitiesRequest)},t.prototype.updateActivities=function(t){return this.groupServiceDelegate.updateActivities(t.groupId,t.updateActivitiesRequest)},t.prototype.removeActivities=function(t){return this.groupServiceDelegate.removeActivities(t.groupId,t.removeActivitiesRequest)},t.prototype.getSupportedActivities=function(){return this.groupServiceDelegate.getSupportedActivities()},t.prototype.suspendById=function(t){return this.groupServiceDelegate.suspendById(t.id)},t.prototype.reactivateById=function(t){return this.groupServiceDelegate.reactivateById(t.id)},t.prototype.updateGroupGuidelines=function(t){return this.groupServiceDelegate.updateGroupGuidelines(t)},t.GROUP_LOCAL_KEY="GROUP-",t.GROUP_SEARCH_LOCAL_KEY="GROUP_SEARCH-",t=e=Pd([Object(R.injectable)(),Dd(0,Object(R.inject)(Q.CONTAINER)),Dd(1,Object(R.inject)(Q.CACHED_ITEM_STORE)),Ld("design:paramtypes",[R.Container,Object])],t)}(),kd=function(){function t(t){this._gid=t,this._sid=ar.generateUniqueId(),this._createdTime=Date.now()}return Object.defineProperty(t.prototype,"gid",{get:function(){return this._gid},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sid",{get:function(){return this._sid},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"createdTime",{get:function(){return this._createdTime},enumerable:!0,configurable:!0}),t}(),Ud=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),xd=function(t){function e(n){var r=t.call(this,n,"NO_GROUP_FOUND")||this;return Object.setPrototypeOf(r,e.prototype),r}return Ud(e,t),e}(ye),Bd=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Fd=function(t){function e(n){var r=t.call(this,n,"NO_ACTIVE_SESSION")||this;return Object.setPrototypeOf(r,e.prototype),r}return Bd(e,t),e}(ye),Vd=function(){function t(){}return t.mapGroupDBEntryToGroup=function(t){return{gid:t[He.COLUMN_NAME_GID],name:t[He.COLUMN_NAME_NAME],syllabus:t[He.COLUMN_NAME_SYLLABUS].split(","),grade:t[He.COLUMN_NAME_GRADE].split(","),gradeValue:JSON.parse(t[He.COLUMN_NAME_GRADE_VALUE]),createdAt:t[He.COLUMN_NAME_CREATED_AT],updatedAt:t[He.COLUMN_NAME_UPDATED_AT]}},t.mapGroupToGroupDBEntry=function(t){var e;return(e={})[He.COLUMN_NAME_GID]=t.gid,e[He.COLUMN_NAME_SYLLABUS]=t.syllabus?t.syllabus.join(","):"",e[He.COLUMN_NAME_GRADE]=t.grade?t.grade.join(","):"",e[He.COLUMN_NAME_NAME]=t.name,e[He.COLUMN_NAME_GRADE_VALUE]=JSON.stringify(t.gradeValue),e[He.COLUMN_NAME_CREATED_AT]=t.createdAt,e[He.COLUMN_NAME_UPDATED_AT]=t.updatedAt,e},t}(),qd=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Yd=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Gd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hd=function(t,e){return function(n,r){e(n,r,t)}},zd=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Kd=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Wd=function(){function t(t,e,n,r){this.container=t,this.dbService=e,this.profileService=n,this.sharedPreferences=r}var e;return e=t,Object.defineProperty(t.prototype,"telemetryService",{get:function(){return this.container.get(Q.TELEMETRY_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.createGroup=function(t){var e=this;return t.gid=ar.generateUniqueId(),t.createdAt=Date.now(),t.updatedAt=Date.now(),this.dbService.insert({table:He.TABLE_NAME,modelJson:Vd.mapGroupToGroupDBEntry(t)}).pipe(Object(dt.tap)((function(){return zd(e,void 0,void 0,(function(){var e=this;return Kd(this,(function(n){switch(n.label){case 0:return[4,this.profileService.getActiveProfileSession().pipe(Object(dt.map)((function(t){return t.uid})),Object(dt.mergeMap)((function(n){var r=new Ht;r.id=n,r.type=Ht.TYPE_SYSTEM;var i={env:"sdk",actor:r,currentState:Ft.AUDIT_CREATED,updatedProperties:co.getTruthyProps(t),objId:t.gid,objType:at.GROUP};return e.telemetryService.audit(i)}))).toPromise()];case 1:return n.sent(),[2]}}))}))})),Object(dt.map)((function(){return t})))},t.prototype.deleteGroup=function(t){var e=this;return Object(J.defer)((function(){return Object(J.of)(e.dbService.beginTransaction())})).pipe(Object(dt.mergeMap)((function(){return Object(J.zip)(e.dbService.delete({table:He.TABLE_NAME,selection:He.COLUMN_NAME_GID+" = ?",selectionArgs:[t]}),e.dbService.delete({table:Ge.TABLE_NAME,selection:Ge.COLUMN_NAME_GID+" = ?",selectionArgs:[t]})).pipe(Object(dt.mapTo)(void 0))})),Object(dt.tap)((function(){e.dbService.endTransaction(!0)})),Object(dt.tap)((function(){return zd(e,void 0,void 0,(function(){var e=this;return Kd(this,(function(n){switch(n.label){case 0:return[4,this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(n){var r=new Ht;r.id=n.uid,r.type=Ht.TYPE_SYSTEM;var i={env:"sdk",actor:r,currentState:Ft.AUDIT_DELETED,objId:t,objType:at.GROUP};return e.telemetryService.audit(i)}))).toPromise()];case 1:return n.sent(),[2]}}))}))})),Object(dt.catchError)((function(t){return e.dbService.endTransaction(!1),J.Observable.throw(t)})))},t.prototype.updateGroup=function(t){var e=this;return this.dbService.read({table:He.TABLE_NAME,selection:"gid = ?",selectionArgs:[t.gid]}).pipe(Object(dt.map)((function(e){return e&&e[0]?Vd.mapGroupDBEntryToGroup(e[0]):J.Observable.throw(new xd("No Group found with ID "+t.gid))})),Object(dt.tap)((function(n){return zd(e,void 0,void 0,(function(){var e=this;return Kd(this,(function(r){switch(r.label){case 0:return[4,this.profileService.getActiveProfileSession().pipe(Object(dt.mergeMap)((function(r){var i=new Ht;i.id=r.uid,i.type=Ht.TYPE_SYSTEM;var o={env:"sdk",actor:i,currentState:Ft.AUDIT_UPDATED,updatedProperties:co.getPropDiff(t,n),objId:t.gid,objType:at.GROUP};return e.telemetryService.audit(o)}))).toPromise()];case 1:return r.sent(),[2]}}))}))})),Object(dt.mergeMap)((function(){var n;return e.dbService.update({table:He.TABLE_NAME,selection:"gid = ?",selectionArgs:[t.gid],modelJson:(n={},n[He.COLUMN_NAME_NAME]=t.name,n[He.COLUMN_NAME_SYLLABUS]=t.syllabus.join(","),n[He.COLUMN_NAME_UPDATED_AT]=Date.now(),n[He.COLUMN_NAME_GRADE]=t.grade.join(","),n[He.COLUMN_NAME_GRADE_VALUE]=JSON.stringify(t.gradeValue),n)}).pipe(Object(dt.mapTo)(t))})))},t.prototype.getActiveSessionGroup=function(){var t=this;return this.getActiveGroupSession().pipe(Object(dt.map)((function(t){if(!t)throw new Fd("No active session available");return t})),Object(dt.mergeMap)((function(e){return t.dbService.read({table:He.TABLE_NAME,selection:He.COLUMN_NAME_GID+" = ?",selectionArgs:[e.gid]}).pipe(Object(dt.map)((function(t){return t&&t[0]})))})))},t.prototype.setActiveSessionForGroup=function(t){var n=this;return this.dbService.read({table:He.TABLE_NAME,selection:He.COLUMN_NAME_GID+" = ?",selectionArgs:[t]}).pipe(Object(dt.map)((function(t){return t&&t[0]&&Vd.mapGroupDBEntryToGroup(t[0])})),Object(dt.map)((function(t){if(!t)throw new xd("No Profile found");return t})),Object(dt.mergeMap)((function(t){var r=new kd(t.gid);return n.sharedPreferences.putString(e.KEY_GROUP_SESSION,JSON.stringify({gid:r.gid,sid:r.sid,createdTime:r.createdTime})).pipe(Object(dt.mapTo)(!0))})))},t.prototype.getActiveGroupSession=function(){return this.sharedPreferences.getString(e.KEY_GROUP_SESSION).pipe(Object(dt.map)((function(t){if(t)return JSON.parse(t)})))},t.prototype.getAllGroups=function(t){var e=this;return Object(J.defer)((function(){return t?e.dbService.execute("\n SELECT * FROM "+He.TABLE_NAME+"\n LEFT JOIN "+Ge.TABLE_NAME+" ON\n "+He.TABLE_NAME+"."+He.COLUMN_NAME_GID+" =\n "+Ge.TABLE_NAME+"."+Ge.COLUMN_NAME_GID+"\n WHERE "+Ge.COLUMN_NAME_UID+' = "'+t.uid+'"').pipe(Object(dt.map)((function(t){return t.map((function(t){return Vd.mapGroupDBEntryToGroup(t)}))}))):e.dbService.read({table:He.TABLE_NAME,columns:[]}).pipe(Object(dt.map)((function(t){return t.map((function(t){return Vd.mapGroupDBEntryToGroup(t)}))})))})).pipe(Object(dt.mergeMap)((function(t){return Object(J.from)(t)})),Object(dt.mergeMap)((function(t){return e.profileService.getAllProfiles({groupId:t.gid}).pipe(Object(dt.map)((function(e){return qd({},t,{profilesCount:e.length})})))})),Object(dt.reduce)((function(t,e){return t.concat([e])}),[]))},t.prototype.addProfilesToGroup=function(t){var e=this;return Object(J.defer)((function(){return Object(J.of)(e.dbService.beginTransaction())})).pipe(Object(dt.mergeMap)((function(){return e.dbService.delete({table:Ge.TABLE_NAME,selection:Ge.COLUMN_NAME_GID+" = ?",selectionArgs:[t.groupId]})})),Object(dt.mergeMap)((function(){return t.uidList.length?J.zip.apply(void 0,t.uidList.map((function(n){var r;return e.dbService.insert({table:Ge.TABLE_NAME,modelJson:(r={},r[Ge.COLUMN_NAME_GID]=t.groupId,r[Ge.COLUMN_NAME_UID]=n,r)})}))).pipe(Object(dt.mapTo)(t.uidList.length)):Object(J.of)(0)})),Object(dt.tap)((function(){e.dbService.endTransaction(!0)})),Object(dt.catchError)((function(t){return e.dbService.endTransaction(!1),Object(J.throwError)(t)})))},t.prototype.removeActiveGroupSession=function(){var t=this;return this.getActiveGroupSession().pipe(Object(dt.mergeMap)((function(n){return n?t.sharedPreferences.putString(e.KEY_GROUP_SESSION,""):Object(J.of)(void 0)})))},t.KEY_GROUP_SESSION=U.KEY_GROUP_SESSION,t=e=Yd([Object(R.injectable)(),Hd(0,Object(R.inject)(Q.CONTAINER)),Hd(1,Object(R.inject)(Q.DB_SERVICE)),Hd(2,Object(R.inject)(Q.PROFILE_SERVICE)),Hd(3,Object(R.inject)(Q.SHARED_PREFERENCES)),Gd("design:paramtypes",[R.Container,I,Object,Object])],t)}(),Xd=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Jd=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Zd=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Qd=function(t){function e(){return t.call(this,15,28)||this}return Xd(e,t),e.prototype.apply=function(t){return Jd(this,void 0,void 0,(function(){return Zd(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this.queries().map((function(e){return t.execute(e).toPromise()})))];case 1:return e.sent(),[4,this.updateContentTable(t)];case 2:return e.sent(),[2,void 0]}}))}))},e.prototype.updateContentTable=function(t){return Jd(this,void 0,void 0,(function(){var e,n,r,i,o;return Zd(this,(function(a){switch(a.label){case 0:t.beginTransaction(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,t.read({table:We.TABLE_NAME}).toPromise()];case 2:return e=a.sent(),(n=e.reduce((function(t,e){var n;e[We.COLUMN_NAME_LOCAL_DATA]&&Cr.isAvailableLocally(e[We.COLUMN_NAME_CONTENT_STATE])?n=JSON.parse(e[We.COLUMN_NAME_LOCAL_DATA]):e[We.COLUMN_NAME_SERVER_DATA]&&(n=JSON.parse(e[We.COLUMN_NAME_SERVER_DATA]));var r=n?n.resourceType:void 0,i=Tr.CsPrimaryCategoryMapper.getPrimaryCategory(e[We.COLUMN_NAME_CONTENT_TYPE],e[We.COLUMN_NAME_MIME_TYPE],r).toLowerCase();return t.set(e[We.COLUMN_NAME_IDENTIFIER],i),t}),new Map)).size?(r=this.buildPrimaryCategoryCases(n),i=("UPDATE "+We.TABLE_NAME+" SET "+r+";").trim(),[4,t.execute(i).toPromise()]):(t.endTransaction(!0),[2]);case 3:return a.sent(),t.endTransaction(!0),[3,5];case 4:throw o=a.sent(),console.error(o),t.endTransaction(!1),o;case 5:return[2]}}))}))},e.prototype.buildPrimaryCategoryCases=function(t){return Array.from(t.entries()).reduce((function(t,e){var n=e[0],r=e[1];return r?t.concat(" WHEN '"+n+"' THEN '"+r+"' "):t})," "+We.COLUMN_NAME_PRIMARY_CATEGORY+" = CASE "+We.COLUMN_NAME_IDENTIFIER+" ").concat(" ELSE '' END ")},e.prototype.queries=function(){return[We.getAlterEntryForPrimaryCategory()]},e}(C),$d=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},tp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ep=function(t,e){return function(n,r){e(n,r,t)}},np=function(){function t(t){this.container=t}return Object.defineProperty(t.prototype,"discussionServiceDelegate",{get:function(){return this.container.get(Z.DISCUSSION_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.getForumIds=function(t){return this.discussionServiceDelegate.getForumIds(t)},t.prototype.createUser=function(t){return this.discussionServiceDelegate.createUser(t)},t.prototype.attachForum=function(t){return this.discussionServiceDelegate.attachForum(t)},t.prototype.removeForum=function(t){return this.discussionServiceDelegate.removeForum(t)},t.prototype.createForum=function(t){return this.discussionServiceDelegate.createForum(t)},t=$d([Object(R.injectable)(),ep(0,Object(R.inject)(Q.CONTAINER)),tp("design:paramtypes",[R.Container])],t)}(),rp=function(){function t(t){this.keyValueStore=t,this.TAG_KEY="segment-tag_"}return t.prototype.handle=function(t){return this.keyValueStore.getValue(this.TAG_KEY+t).pipe(Object(dt.map)((function(t){return t||null})))},t}(),ip=function(){function t(t){this.keyValueStore=t,this.COMMAND_KEY="segment-command_"}return t.prototype.handle=function(t){return this.keyValueStore.getValue(this.COMMAND_KEY+t).pipe(Object(dt.map)((function(t){return t||null})))},t}(),op=function(){function t(t){this.keyValueStore=t,this.TAG_KEY="segment-tag_"}return t.prototype.handle=function(t,e){return this.keyValueStore.setValue(this.TAG_KEY+e,t)},t}(),ap=function(){function t(t){this.keyValueStore=t,this.COMMAND_KEY="segment-command_"}return t.prototype.handle=function(t,e){return this.keyValueStore.setValue(this.COMMAND_KEY+e,t)},t}(),sp=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},up=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cp=function(t,e){return function(n,r){e(n,r,t)}},fp=function(){function t(t){this.keyValueStore=t}return t.prototype.saveTags=function(t,e){return new op(this.keyValueStore).handle(t,e)},t.prototype.getTags=function(t){return new rp(this.keyValueStore).handle(t)},t.prototype.removeTagsForId=function(t){throw new Error("Method not implemented.")},t.prototype.clearAllTags=function(){throw new Error("Method not implemented.")},t.prototype.saveCommandList=function(t,e){return new ap(this.keyValueStore).handle(t,e)},t.prototype.getCommand=function(t){return new ip(this.keyValueStore).handle(t)},t=sp([Object(R.injectable)(),cp(0,Object(R.inject)(Q.KEY_VALUE_STORE)),up("design:paramtypes",[Object])],t)}(),hp=n(44),lp=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},dp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},pp=function(){function t(t,e){this.sharedPreferences=t,this.debuggingServiceImpl=e}return t.prototype.handle=function(t){return lp(this,void 0,void 0,(function(){var e,n,r=this;return dp(this,(function(i){switch(i.label){case 0:return[4,this.sharedPreferences.getString("debug_started_at").toPromise()];case 1:return e=i.sent(),console.log(e),e?(n=setInterval((function(){return lp(r,void 0,void 0,(function(){var r,i;return dp(this,(function(o){switch(o.label){case 0:return r=(new Date).getTime(),i=(r-new Date(parseInt(e)).getTime())/1e3,i/=60,console.log("diff",Math.abs(Math.round(i))),Math.abs(Math.round(i))>=10?(this.sharedPreferences.putString("debug_started_at","").toPromise(),this.debuggingServiceImpl.disableDebugging(),[4,this.sharedPreferences.putString(hp.CsClientStorage.TRACE_ID,"").toPromise()]):[3,2];case 1:return o.sent(),t.next(!1),t.complete(),clearInterval(n),this.debuggingServiceImpl.watcher.interval=null,this.debuggingServiceImpl.watcher.observer=null,this.debuggingServiceImpl.watcher.debugStatus=!1,[3,3];case 2:t.next(!0),o.label=3;case 3:return[2]}}))}))}),6e4),this.debuggingServiceImpl.watcher.interval=n,this.debuggingServiceImpl.watcher.observer=t,this.debuggingServiceImpl.watcher.debugStatus=!0):(t.next(!1),t.complete()),[2]}}))}))},t}(),mp=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},bp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yp=function(t,e){return function(n,r){e(n,r,t)}},vp=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},gp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},_p=function(){function t(t,e){this.sharedPreferences=t,this.profileService=e,this.watcher={interval:null,observer:null,debugStatus:!1}}return Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(t){this._userId=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(t){this._deviceId=t},enumerable:!0,configurable:!0}),t.prototype.enableDebugging=function(t){var e=this;return new J.Observable((function(n){e.profileService.getActiveProfileSession().toPromise().then((function(r){return vp(e,void 0,void 0,(function(){var e;return gp(this,(function(i){switch(i.label){case 0:return r&&r.uid?(this._userId=r.uid,e=X.createJWToken(this._deviceId,this.userId,T.HS256),t?[4,this.sharedPreferences.putString(hp.CsClientStorage.TRACE_ID,t).toPromise()]:[3,2]):[3,5];case 1:return i.sent(),[3,4];case 2:return[4,this.sharedPreferences.putString(hp.CsClientStorage.TRACE_ID,e).toPromise()];case 3:i.sent(),i.label=4;case 4:new pp(this.sharedPreferences,this).handle(n),console.log("Watcher Value:",this.watcher),i.label=5;case 5:return[2]}}))}))}))}))},t.prototype.disableDebugging=function(){return this.watcher.debugStatus?(clearTimeout(this.watcher.interval),this.watcher.observer.complete(),this.watcher={interval:null,observer:null,debugStatus:!1},this.sharedPreferences.putString("debug_started_at","").toPromise(),this.sharedPreferences.putString(hp.CsClientStorage.TRACE_ID,"").toPromise(),Object(J.of)(!0)):Object(J.of)(!1)},t.prototype.isDebugOn=function(){return!!this.watcher.debugStatus},t=mp([Object(R.injectable)(),yp(0,Object(R.inject)(Q.SHARED_PREFERENCES)),yp(1,Object(R.inject)(Q.PROFILE_SERVICE)),bp("design:paramtypes",[Object,Object])],t)}(),Ep=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(n,r){e(n,r,t)}},Sp=function(){function t(t){this.container=t}return Object.defineProperty(t.prototype,"NotificationServiceV2Delegate",{get:function(){return this.container.get(Z.NOTIFICATION_SERVICE_V2)},enumerable:!0,configurable:!0}),t.prototype.notificationRead=function(t){return this.NotificationServiceV2Delegate.notificationRead(t)},t.prototype.notificationUpdate=function(t){return this.NotificationServiceV2Delegate.notificationUpdate(t)},t.prototype.notificationDelete=function(t){return this.NotificationServiceV2Delegate.notificationDelete(t)},t=Ep([Object(R.injectable)(),wp(0,Object(R.inject)(Q.CONTAINER)),Mp("design:paramtypes",[R.Container])],t)}(),Op=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ap=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Tp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Np=function(t){function e(){return t.call(this,16,29)||this}return Op(e,t),e.prototype.apply=function(t){return Ap(this,void 0,void 0,(function(){var e=this;return Tp(this,(function(n){return this.queries().forEach((function(n){return Ap(e,void 0,void 0,(function(){return Tp(this,(function(e){switch(e.label){case 0:return[4,t.execute(n).toPromise()];case 1:return e.sent(),[2]}}))}))})),[2,void 0]}))}))},e.prototype.queries=function(){return[mn.getAlterEntryForPlayerConfig()]},e}(C),Cp=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ip=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Rp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Pp=function(t){function e(){return t.call(this,17,30)||this}return Cp(e,t),e.prototype.apply=function(t){return Ip(this,void 0,void 0,(function(){return Rp(this,(function(e){switch(e.label){case 0:return[4,Promise.all(this.queries().map((function(e){return t.execute(e).toPromise()})))];case 1:return e.sent(),[2,void 0]}}))}))},e.prototype.queries=function(){return[Nn.getCreateEntry()]},e}(C),Lp=function(){function t(t,e,n,r){this.dbService=t,this.container=e,this.certificateServiceConfig=n,this.apiConfig=r}return Object.defineProperty(t.prototype,"csCertificateService",{get:function(){return this.container.get(Z.CERTIFICATE_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.handle=function(t){var e=this;return this.dbService.read({table:Nn.TABLE_NAME,selection:Nn.COLUMN_NAME_IDENTIFIER+"= ?",selectionArgs:[t.osid.toString()]}).pipe(Object(dt.mergeMap)((function(n){return n&&n.length?n[0].expiry_time<Date.now()?e.fetchFromServer(t).pipe(Object(dt.mergeMap)((function(t){return e.updatePublicKey(t)}))):Object(J.of)({osid:n[0].identifier,value:n[0].public_key,alg:n[0].alg,osOwner:n[0].owner?n[0].owner.split(","):[]}):e.fetchFromServer(t).pipe(Object(dt.mergeMap)((function(t){return e.insertPublicKey(t)})))})))},t.prototype.updatePublicKey=function(t){return this.dbService.update({table:Nn.TABLE_NAME,selection:Nn.COLUMN_NAME_IDENTIFIER+" = ?",selectionArgs:[t.osid],modelJson:{identifier:t.osid,public_key:t.value,alg:t.alg,owner:t.osOwner&&t.osOwner.length?t.osOwner.join(","):"",expiry_time:Date.now()+this.apiConfig.cached_requests.timeToLive}}).pipe(Object(dt.mapTo)(t))},t.prototype.insertPublicKey=function(t){return this.dbService.insert({table:Nn.TABLE_NAME,modelJson:{identifier:t.osid,public_key:t.value,alg:t.alg,owner:t.osOwner&&t.osOwner.length?t.osOwner.join(","):"",expiry_time:Date.now()+this.apiConfig.cached_requests.timeToLive}}).pipe(Object(dt.mapTo)(t))},t.prototype.fetchFromServer=function(t){return this.csCertificateService.getPublicKey(t)},t}(),Dp=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kp=function(t,e){return function(n,r){e(n,r,t)}},Up=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},xp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Bp=function(){function t(t,e,n,r,i,o){this.container=t,this.dbService=e,this.sdkConfig=n,this.profileService=r,this.keyValueStore=i,this.fileService=o}return t.prototype.getCertificates=function(t){return this.csCertificateService.fetchCertificates(t)},t.prototype.getPublicKey=function(t){return new Lp(this.dbService,this.container,this.sdkConfig.certificateServiceConfig,this.sdkConfig.apiConfig).handle(t)},t.prototype.getCertificate=function(t){var e=this;return this.csCertificateService.getCerificateDownloadURI({certificateId:t.certificate.identifier,type:t.certificate.type,schemaName:"certificate",templateUrl:t.certificate.templateUrl}).pipe(Object(dt.tap)((function(n){return Up(e,void 0,void 0,(function(){var e,r;return xp(this,(function(i){switch(i.label){case 0:return r=(e=this.keyValueStore).setValue,[4,this.buildCertificatePersistenceId(t)];case 1:return[4,r.apply(e,[i.sent(),Object(dr.gzip)(n.printUri,{to:"string"})]).toPromise()];case 2:return i.sent(),[2]}}))}))})),Object(dt.map)((function(t){return t.printUri})),Object(dt.catchError)((function(n){return Object(J.defer)((function(){return Up(e,void 0,void 0,(function(){var e;return xp(this,(function(r){switch(r.label){case 0:return[4,this.getCertificateFromCache(t)];case 1:if(e=r.sent())return[2,e];throw n}}))}))}))})))},t.prototype.downloadCertificate=function(t){var e=this,n=t.fileName,r=t.blob;return Object(J.defer)((function(){return Up(e,void 0,void 0,(function(){return xp(this,(function(t){return[2,this.fileService.writeFile(cordova.file.externalDataDirectory,n,r,{replace:!0}).then((function(){return{path:""+cordova.file.externalDataDirectory+n}}))]}))}))}))},t.prototype.downloadLegacyeCertificate=function(t){var e=this;return Object(J.defer)((function(){return Up(e,void 0,void 0,(function(){var e,n,r;return xp(this,(function(i){switch(i.label){case 0:return[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return e=i.sent(),n=e.managedSession?e.managedSession.uid:e.uid,r="ios"===window.device.platform.toLowerCase()?cordova.file.documentsDirectory:cordova.file.externalRootDirectory,r+"Download/"+t.certificate.name+"_"+t.courseId+"_"+n+".pdf",[2,{userId:n}]}}))}))})).pipe(Object(dt.mergeMap)((function(n){var r=n.userId;return e.csCertificateService.getLegacyCerificateDownloadURI({pdfUrl:t.certificate.url}).pipe(Object(dt.map)((function(t){return{signedPdfUrl:t.signedUrl,userId:r}})))})),Object(dt.mergeMap)((function(e){var n=e.signedPdfUrl,r=e.userId,i={uri:n,title:t.certificate.token,description:"",mimeType:"application/pdf",visibleInDownloadsUi:!0,notificationVisibility:1,destinationInExternalPublicDir:{dirType:"Download",subPath:"/"+t.certificate.name+"_"+t.courseId+"_"+r+".pdf"},headers:[]};return new J.Observable((function(t){downloadManager.enqueue(i,(function(e,n){if(e)return t.error(e);t.next(n),t.complete()}))}))})),Object(dt.mergeMap)((function(t){return Object(J.interval)(1e3).pipe(Object(dt.mergeMap)((function(){return new J.Observable((function(e){downloadManager.query({ids:[t]},(function(t,n){return t||n[0].status===DownloadStatus.STATUS_FAILED?e.error(t||new Error("Unknown Error")):e.next(n[0])}))}))})),Object(dt.filter)((function(t){return t.status===DownloadStatus.STATUS_SUCCESSFUL})),Object(dt.take)(1))})),Object(dt.map)((function(t){return{path:t.localUri}})))},t.prototype.isCertificateCached=function(t){var e=this;return Object(J.defer)((function(){return Up(e,void 0,void 0,(function(){var e;return xp(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getCertificateFromCache(t)];case 1:return[2,!!n.sent()];case 2:return e=n.sent(),console.error(e),[2,!1];case 3:return[2]}}))}))}))},t.prototype.getEncodedData=function(t){return this.csCertificateService.getEncodedData(t)},t.prototype.verifyCertificate=function(t){return this.csCertificateService.verifyCertificate(t)},Object.defineProperty(t.prototype,"csCertificateService",{get:function(){return this.container.get(Z.CERTIFICATE_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.buildCertificatePersistenceId=function(t){return Up(this,void 0,void 0,(function(){var e,n;return xp(this,(function(r){switch(r.label){case 0:return[4,this.profileService.getActiveProfileSession().toPromise()];case 1:return e=r.sent(),n=e.managedSession?e.managedSession.uid:e.uid,[2,"certificate_"+t.certificate.identifier+"_"+t.courseId+"_"+n]}}))}))},t.prototype.getCertificateFromCache=function(t){return Up(this,void 0,void 0,(function(){var e,n,r;return xp(this,(function(i){switch(i.label){case 0:return r=(n=this.keyValueStore).getValue,[4,this.buildCertificatePersistenceId(t)];case 1:return[4,r.apply(n,[i.sent()]).toPromise()];case 2:return[2,(e=i.sent())?Object(go.ungzip)(e,{to:"string"}):void 0]}}))}))},t=Dp([Object(R.injectable)(),kp(0,Object(R.inject)(Q.CONTAINER)),kp(1,Object(R.inject)(Q.DB_SERVICE)),kp(2,Object(R.inject)(Q.SDK_CONFIG)),kp(3,Object(R.inject)(Q.PROFILE_SERVICE)),kp(4,Object(R.inject)(Q.KEY_VALUE_STORE)),kp(5,Object(R.inject)(Q.FILE_SERVICE)),jp("design:paramtypes",[R.Container,I,Object,Object,Object,Object])],t)}(),Fp=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Vp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},qp=function(){function t(){this._isInitialised=!1}return Object.defineProperty(t,"instance",{get:function(){return t._instance||(t._instance=new t),t._instance},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isInitialised",{get:function(){return this._isInitialised},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sdkConfig",{get:function(){return this._container.get(Q.SDK_CONFIG)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"appInfo",{get:function(){return this._container.get(Q.APP_INFO)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageAssembleService",{get:function(){return this._container.get(Q.PAGE_ASSEMBLE_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dbService",{get:function(){return this._container.get(Q.DB_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"telemetryService",{get:function(){return this._container.get(Q.TELEMETRY_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"authService",{get:function(){return this._container.get(Q.AUTH_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"apiService",{get:function(){return this._container.get(Q.API_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"keyValueStore",{get:function(){return this._container.get(Q.KEY_VALUE_STORE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"profileService",{get:function(){return this._container.get(Q.PROFILE_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"groupService",{get:function(){return this._container.get(Q.GROUP_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"groupServiceDeprecated",{get:function(){return this._container.get(Q.GROUP_SERVICE_DEPRECATED)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentService",{get:function(){return this._container.get(Q.CONTENT_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"contentFeedbackService",{get:function(){return this._container.get(Q.CONTENT_FEEDBACK_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"courseService",{get:function(){return this._container.get(Q.COURSE_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formService",{get:function(){return this._container.get(Q.FORM_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"frameworkService",{get:function(){return this._container.get(Q.FRAMEWORK_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"frameworkUtilService",{get:function(){return this._container.get(Q.FRAMEWORK_UTIL_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"sharedPreferences",{get:function(){return this._container.get(Q.SHARED_PREFERENCES)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"systemSettingsService",{get:function(){return this._container.get(Q.SYSTEM_SETTINGS_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventsBusService",{get:function(){return this._container.get(Q.EVENTS_BUS_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"summarizerService",{get:function(){return this._container.get(Q.SUMMARIZER_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"downloadService",{get:function(){return this._container.get(Q.DOWNLOAD_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"playerService",{get:function(){return this._container.get(Q.PLAYER_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"deviceInfo",{get:function(){return this._container.get(Q.DEVICE_INFO)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"storageService",{get:function(){return this._container.get(Q.STORAGE_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"notificationService",{get:function(){return this._container.get(Q.NOTIFICATION_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"errorLoggerService",{get:function(){return this._container.get(Q.ERROR_LOGGER_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"networkInfoService",{get:function(){return this._container.get(Q.NETWORKINFO_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"searchHistoryService",{get:function(){return this._container.get(Q.SEARCH_HISTORY_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"codePushExperimentService",{get:function(){return this._container.get(Q.CODEPUSH_EXPERIMENT_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"faqService",{get:function(){return this._container.get(Q.FAQ_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"deviceRegisterService",{get:function(){return this._container.get(Q.DEVICE_REGISTER_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"archiveService",{get:function(){return this._container.get(Q.ARCHIVE_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"networkQueueService",{get:function(){return this._container.get(Q.NETWORK_QUEUE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"discussionService",{get:function(){return this._container.get(Q.DISCUSSION_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"segmentationService",{get:function(){return this._container.get(Q.SEGMENTATION_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"debuggingService",{get:function(){return this._container.get(Q.DEBUGGING_SERVICE)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"notificationServiceV2",{get:function(){return this._container.get(Q.NOTIFICATION_SERVICE_V2)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"certificateService",{get:function(){return this._container.get(Q.CERTIFICATE_SERVICE)},enumerable:!0,configurable:!0}),t.prototype.init=function(t){return Fp(this,void 0,void 0,(function(){var e,n=this;return Vp(this,(function(r){switch(r.label){case 0:switch(this._container=new R.Container,this._container.bind(Q.CONTAINER).toConstantValue(this._container),this._container.bind(Q.DB_VERSION).toConstantValue(30),this._container.bind(Q.DB_MIGRATION_LIST).toConstantValue([new Nc,new Pc,new kc,new Gc,new Yf,new Fc,new Sl,new kl,new Fl,function(){return new Sd(t,n._container.get(Q.NETWORK_QUEUE))},new Qd,new Np,new Pp]),t.platform){case"cordova":this._container.bind(Q.SHARED_PREFERENCES).to(gc).inSingletonScope();break;case"web":this._container.bind(Q.SHARED_PREFERENCES).to(yc).inSingletonScope();break;default:throw new Error("FATAL_ERROR: Invalid platform")}return this._container.bind(Q.DB_SERVICE).to(ir).inSingletonScope(),this._container.bind(Q.FILE_SERVICE).to(Sc).inSingletonScope(),this._container.bind(Q.SDK_CONFIG).toConstantValue(t),this._container.bind(Q.DEVICE_INFO).to(sf).inSingletonScope(),this._container.bind(Q.EVENTS_BUS_SERVICE).to(vf).inSingletonScope(),this._container.bind(Q.APP_INFO).to(Pf).inSingletonScope(),this._container.bind(Q.API_SERVICE).to(wt).inSingletonScope(),this._container.bind(Q.AUTH_SERVICE).to(wa).inSingletonScope(),this._container.bind(Q.KEY_VALUE_STORE).to(qu).inSingletonScope(),this._container.bind(Q.SYSTEM_SETTINGS_SERVICE).to(Xc).inSingletonScope(),this._container.bind(Q.FRAMEWORK_SERVICE).to(Da).inSingletonScope(),this._container.bind(Q.PROFILE_SERVICE).to(ea).inSingletonScope(),this._container.bind(Q.GROUP_SERVICE).to(jd).inSingletonScope(),this._container.bind(Q.GROUP_SERVICE_DEPRECATED).to(Wd).inSingletonScope(),this._container.bind(Q.ERROR_LOGGER_SERVICE).to(yl).inSingletonScope(),this._container.bind(Q.ZIP_SERVICE).to(Zc).inSingletonScope(),this._container.bind(Q.TELEMETRY_SERVICE).to(ya).inSingletonScope(),this._container.bind(Q.CONTENT_FEEDBACK_SERVICE).to(lf).inSingletonScope(),this._container.bind(Q.FORM_SERVICE).to(Ku).inSingletonScope(),this._container.bind(Q.PAGE_ASSEMBLE_SERVICE).to(mc).inSingletonScope(),this._container.bind(Q.FRAMEWORK_UTIL_SERVICE).to(za).inSingletonScope(),this._container.bind(Q.DOWNLOAD_SERVICE).to(Of).inSingletonScope(),this._container.bind(Q.CONTENT_SERVICE).to(xu).inSingletonScope(),this._container.bind(Q.COURSE_SERVICE).to(No).inSingletonScope(),this._container.bind(Q.SUMMARIZER_SERVICE).to(Vi).inSingletonScope(),this._container.bind(Q.PLAYER_SERVICE).to(Bf).inSingletonScope(),this._container.bind(Q.CACHED_ITEM_STORE).to($u).inSingletonScope(),this._container.bind(Q.TELEMETRY_DECORATOR).to(fr).inSingletonScope(),this._container.bind(Q.STORAGE_SERVICE).to(Xh).inSingletonScope(),this._container.bind(Q.NOTIFICATION_SERVICE).to(ol).inSingletonScope(),this._container.bind(Q.NETWORKINFO_SERVICE).to(_l).inSingletonScope(),this._container.bind(Q.SEARCH_HISTORY_SERVICE).to(Pl).inSingletonScope(),this._container.bind(Q.CODEPUSH_EXPERIMENT_SERVICE).to(Gl).inSingletonScope(),this._container.bind(Q.DEVICE_REGISTER_SERVICE).to(Pt).inSingletonScope(),this._container.bind(Q.FAQ_SERVICE).to(Xl).inSingletonScope(),this._container.bind(Q.ARCHIVE_SERVICE).to(_d).inSingletonScope(),this._container.bind(Q.NETWORK_QUEUE).to(Id).inSingletonScope(),this._container.bind(Q.DISCUSSION_SERVICE).to(np).inSingletonScope(),this._container.bind(Q.SEGMENTATION_SERVICE).to(fp).inSingletonScope(),this._container.bind(Q.DEBUGGING_SERVICE).to(_p).inSingletonScope(),this._container.bind(Q.NOTIFICATION_SERVICE_V2).to(Sp).inSingletonScope(),this._container.bind(Q.CERTIFICATE_SERVICE).to(Bp).inSingletonScope(),e=this.sharedPreferences,[4,vt.CsModule.instance.init({core:{httpAdapter:"web"===t.platform?"HttpClientBrowserAdapter":"HttpClientCordovaAdapter",global:{channelId:t.apiConfig.api_authentication.channelId,producerId:t.apiConfig.api_authentication.producerId,deviceId:gu(window.device.uuid).toString()},api:{host:t.apiConfig.host,authentication:{}}},services:{contentServiceConfig:{hierarchyApiPath:"/api/questionset/v1",questionListApiPath:"/api/question/v1"},courseServiceConfig:{apiPath:"/api/course/v1",certRegistrationApiPath:"/api/certreg/v2/certs"},groupServiceConfig:{apiPath:"/api/group/v1",dataApiPath:"/api/data/v1/group",updateGroupGuidelinesApiPath:"/api/group/membership/v1"},userServiceConfig:{apiPath:"/api/user/v2"},formServiceConfig:{apiPath:"/api/data/v1/form"},discussionServiceConfig:{apiPath:"/discussion"},notificationServiceConfig:{apiPath:"/api/notification/v1/feed"},certificateServiceConfig:{apiPath:t.certificateServiceConfig.apiPath,apiPathLegacy:t.certificateServiceConfig.apiPathLegacy,rcApiPath:t.certificateServiceConfig.rcApiPath}}},function(){n._container.rebind(Z.HTTP_SERVICE).toConstantValue(vt.CsModule.instance.httpService),n._container.rebind(Z.GROUP_SERVICE).toConstantValue(vt.CsModule.instance.groupService),n._container.rebind(Z.COURSE_SERVICE).toConstantValue(vt.CsModule.instance.courseService),n._container.rebind(Z.USER_SERVICE).toConstantValue(vt.CsModule.instance.userService),n._container.rebind(Z.DISCUSSION_SERVICE).toConstantValue(vt.CsModule.instance.discussionService),n._container.rebind(Z.CONTENT_SERVICE).toConstantValue(vt.CsModule.instance.contentService),n._container.rebind(Z.NOTIFICATION_SERVICE_V2).toConstantValue(vt.CsModule.instance.notificationService),n._container.rebind(Z.CERTIFICATE_SERVICE).toConstantValue(vt.CsModule.instance.certificateService)}.bind(this),new(function(){function t(){}return t.prototype.setItem=function(t,n){return e.putString(t,n).toPromise()},t.prototype.getItem=function(t){return e.getString(t).toPromise()},t}()))];case 1:return r.sent(),this._container.bind(Z.HTTP_SERVICE).toConstantValue(vt.CsModule.instance.httpService),this._container.bind(Z.GROUP_SERVICE).toConstantValue(vt.CsModule.instance.groupService),this._container.bind(Z.COURSE_SERVICE).toConstantValue(vt.CsModule.instance.courseService),this._container.bind(Z.USER_SERVICE).toConstantValue(vt.CsModule.instance.userService),this._container.bind(Z.DISCUSSION_SERVICE).toConstantValue(vt.CsModule.instance.discussionService),this._container.bind(Z.CONTENT_SERVICE).toConstantValue(vt.CsModule.instance.contentService),this._container.bind(Z.NOTIFICATION_SERVICE_V2).toConstantValue(vt.CsModule.instance.notificationService),this._container.bind(Z.CERTIFICATE_SERVICE).toConstantValue(vt.CsModule.instance.certificateService),[4,this.dbService.init()];case 2:return r.sent(),[4,this.appInfo.init()];case 3:return r.sent(),[4,this.preInit().toPromise()];case 4:return r.sent(),this._isInitialised=!0,this.postInit().subscribe(),[2]}}))}))},t.prototype.updateTelemetryConfig=function(t){for(var e in t)t.hasOwnProperty(e)&&(this.sdkConfig.telemetryConfig[e]=t[e])},t.prototype.updateDeviceRegisterConfig=function(t){for(var e in t)t.hasOwnProperty(e)&&(this.sdkConfig.deviceRegisterConfig[e]=t[e],"fcmToken"===e&&this.telemetryService.resetDeviceRegisterTTL())},t.prototype.updateContentServiceConfig=function(t){for(var e in t)t.hasOwnProperty(e)&&(this.sdkConfig.contentServiceConfig[e]=t[e])},t.prototype.updatePageServiceConfig=function(t){for(var e in t)t.hasOwnProperty(e)&&(this.sdkConfig.pageServiceConfig[e]=t[e])},t.prototype.preInit=function(){var t=this;return this.telemetryService.preInit().pipe(Object(dt.concatMap)((function(){return t.frameworkService.preInit().pipe(Object(dt.concatMap)((function(){return t.profileService.preInit()})))})))},t.prototype.postInit=function(){return Object(J.combineLatest)([this.apiService.onInit(),this.authService.onInit(),this.summarizerService.onInit(),this.errorLoggerService.onInit(),this.eventsBusService.onInit(),this.downloadService.onInit(),this.contentService.onInit(),this.storageService.onInit(),this.telemetryService.onInit(),this.notificationService.onInit()])},t}(),Yp=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Gp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Hp=function(){function t(t,e,n){this.apiConfig=t,this.apiService=e,this.eventsBusService=n}return t.parseAccessToken=function(t){var e=X.getJWTPayload(t);return{userToken:3===e.sub.split(":").length?e.sub.split(":").pop():e.sub,accessTokenExpiresOn:1e3*e.exp}},t.prototype.buildGoogleTargetUrl=function(t,e){var n=new URL(t.googleRedirectUrl);return delete e.redirect_uri,n.searchParams.set("redirect_uri",this.apiConfig.user_authentication.redirectUrl),delete e.error_callback,n.searchParams.set("error_callback",this.apiConfig.user_authentication.redirectUrl),Object.keys(e).forEach((function(t){return n.searchParams.set(t,e[t])})),n},t.prototype.buildPasswordSessionProvider=function(t,e){var n=this;return t.capture({host:e.when.host,path:e.when.path,params:e.when.params}).then((function(){return t.closeWebview()})).then((function(){return t.success()})).then((function(t){return n.resolvePasswordSession(t)}))},t.prototype.buildStateSessionProvider=function(t,e){var n=this;return t.capture({host:e.when.host,path:e.when.path,params:e.when.params}).then((function(){return t.closeWebview()})).then((function(){return t.success()})).then((function(t){return n.resolveStateSession(t)}))},t.prototype.buildGoogleSessionProvider=function(t,e,n){var r=this;return t.capture({host:e.when.host,path:e.when.path,params:e.when.params}).then((function(){return t.closeWebview()})).then((function(){return t.success()})).then((function(e){return t.getCaptureExtras().then((function(i){var o=r.buildGoogleTargetUrl(e,i);return t.launchCustomTab({host:o.origin,path:o.pathname,params:yn.parse(o.searchParams.toString(),{ignoreQueryPrefix:!0}),extraParams:n.get("extraParam")}).then((function(){return t.success()})).then((function(t){return r.resolveGoogleSession(t)}))}))}))},t.prototype.resolvePasswordSession=function(e){var n=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(this.apiConfig.user_authentication.authUrl+"/token").withBody({redirect_uri:this.apiConfig.host+"/oauth2callback",code:e.code,grant_type:"authorization_code",client_id:"android"}).withHeaders({"Content-Type":"application/x-www-form-urlencoded"}).withSerializer(P.CsHttpSerializer.URLENCODED).withBearerToken(!1).withUserToken(!1).build();return this.apiService.fetch(n).toPromise().then((function(e){if(e.body.access_token&&e.body.refresh_token){var n=t.parseAccessToken(e.body.access_token),r=n.userToken,i=n.accessTokenExpiresOn;return{access_token:e.body.access_token,refresh_token:e.body.refresh_token,accessTokenExpiresOn:i,userToken:r}}throw new ge("Server Error")})).catch((function(){throw new ge("Server Error")}))},t.prototype.resolveStateSession=function(e){var n="/v1/sso/create/session?id="+("ios"===window.device.platform.toLowerCase()?encodeURIComponent(e.id):e.id),r=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(n).withUserToken(!1).withBearerToken(!1).build();return this.apiService.fetch(r).toPromise().then((function(e){if(e.body.access_token&&e.body.refresh_token){var n=t.parseAccessToken(e.body.access_token),r=n.userToken,i=n.accessTokenExpiresOn;return{access_token:e.body.access_token,refresh_token:e.body.refresh_token,accessTokenExpiresOn:i,userToken:r}}throw new ge("Server Error")})).catch((function(){throw new ge("Server Error")}))},t.prototype.resolveGoogleSession=function(e){return Yp(this,void 0,void 0,(function(){var n,r,i;return Gp(this,(function(o){if(e.access_token&&e.refresh_token)return n=t.parseAccessToken(e.access_token),r=n.userToken,i=n.accessTokenExpiresOn,[2,{access_token:e.access_token,refresh_token:e.refresh_token,accessTokenExpiresOn:i,userToken:r}];if(e.error_message)throw new ge(e.error_message);throw new ge("Server Error")}))}))},t}(),zp=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Kp=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},Wp=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Xp=function(t){function e(e,n,r){var i=t.call(this,qp.instance.sdkConfig.apiConfig,qp.instance.apiService,qp.instance.eventsBusService)||this;return i.autoMergeConfig=e,i.webviewRunner=n,i.captured=r,i.telemetryService=qp.instance.telemetryService,i}return zp(e,t),e.prototype.provide=function(){return Kp(this,void 0,void 0,(function(){var t,e,n=this;return Wp(this,(function(r){switch(r.label){case 0:return t=this.webviewRunner,[4,this.telemetryService.buildContext().toPromise()];case 1:return e=r.sent(),this.autoMergeConfig.target.params.push({key:"pdata",value:JSON.stringify(e.pdata)}),Object.keys(this.captured).forEach((function(t){n.autoMergeConfig.target.params.push({key:t,value:n.captured[t]})})),[2,t.redirectTo({host:this.autoMergeConfig.target.host,path:this.autoMergeConfig.target.path,params:this.autoMergeConfig.target.params.reduce((function(t,e){return t[e.key]=e.value,t}),{})}).then((function(){return t.any.apply(t,n.autoMergeConfig.return.reduce((function(e,r){switch(r.type){case"password":e.push(n.buildPasswordSessionProvider(t,r).then((function(t){return n.performAutoMerge({payload:n.captured.payload,session:t})})));break;case"state":e.push(n.buildStateSessionProvider(t,r));break;case"google":e.push(n.buildGoogleSessionProvider(t,r).then((function(t){return n.performAutoMerge({payload:n.captured.payload,session:t})})))}return e}),[]))}))]}}))}))},e.prototype.performAutoMerge=function(t){var e=this,n=t.payload,r=t.session,i=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.GET).withPath(this.apiConfig.user_authentication.autoMergeApiPath).withParameters({client_id:"android"}).withHeaders({"x-authenticated-user-token":r.access_token,"x-authenticated-user-data":n}).build();return this.apiService.fetch(i).pipe(Object(dt.mapTo)(void 0)).toPromise().then((function(){return e.eventsBusService.emit({namespace:$.AUTH,event:{type:me.AUTO_MIGRATE_SUCCESS,payload:void 0}}),r})).catch((function(t){return console.error(t),e.eventsBusService.emit({namespace:$.AUTH,event:{type:me.AUTO_MIGRATE_FAIL,payload:void 0}}),r}))},e}(Hp),Jp=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zp=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Qp=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},$p=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},tm=function(t){function e(e,n,r,i){var o=t.call(this,qp.instance.sdkConfig.apiConfig,qp.instance.apiService,qp.instance.eventsBusService)||this;return o.loginConfig=e,o.autoMergeConfig=n,o.customWebViewConfig=r,o.telemetryService=qp.instance.telemetryService,o.webviewRunner=i||new Tn,o}return Jp(e,t),e.prototype.provide=function(){return Qp(this,void 0,void 0,(function(){var t,e,n=this;return $p(this,(function(r){switch(r.label){case 0:return t=this.webviewRunner,[4,this.telemetryService.buildContext().toPromise()];case 1:return e=r.sent(),"password"==this.loginConfig.context&&(this.loginConfig.target.path="/recover/identify/account"),this.loginConfig.target.params.push({key:"pdata",value:JSON.stringify(e.pdata)}),"ios"!==window.device.platform.toLowerCase()||"login"!==this.loginConfig.context?[3,3]:[4,t.launchWebview({host:this.loginConfig.target.host,path:"logoff",params:this.loginConfig.target.params.reduce((function(t,e){return t[e.key]=e.value,t}),Zp({},this.resetParams))})];case 2:r.sent(),r.label=3;case 3:return[2,t.launchWebview({host:this.loginConfig.target.host,path:this.loginConfig.target.path,params:this.loginConfig.target.params.reduce((function(t,e){return t[e.key]=e.value,t}),Zp({},this.resetParams))}).then((function(){return t.any.apply(t,n.loginConfig.return.reduce((function(e,r){switch(r.type){case"password":e.push(n.buildPasswordSessionProvider(t,r)),n.resetParams&&"password"==n.loginConfig.context&&t.closeWebview();break;case"state":e.push(n.buildStateSessionProvider(t,r));break;case"google":e.push(n.buildGoogleSessionProvider(t,r,n.customWebViewConfig));break;case"state-error":e.push(t.capture({host:r.when.host,path:r.when.path,params:r.when.params}).then((function(){return t.closeWebview().then((function(){return t.resolveCaptured("error_message").catch((function(){throw new ge("Server Error")})).then((function(t){throw new ge(t)}))}))})));break;case"migrate":e.push(t.capture({host:r.when.host,path:r.when.path,params:r.when.params}).then((function(){return t.success()})).then((function(e){return t.resetInAppBrowserEventListeners(),t.clearCapture().then((function(){return new Xp(n.autoMergeConfig,n.webviewRunner,e).provide()}))})));break;case"reset":e.push(t.capture({host:r.when.host,path:r.when.path,params:r.when.params.concat([{key:"client_id",resolveTo:"client_id",match:"portal"},{key:"automerge",resolveTo:"automerge",exists:"false"}])}).then((function(){return t.getCaptureExtras().then((function(e){return n.resetParams=e,t.closeWebview().then((function(){return new Promise((function(t){return setTimeout(t,500)})).then((function(){return n.provide()}))}))}))})))}return e}),[]))}))]}}))}))},e}(Hp),em=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),nm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},rm=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},im=function(t){function e(e,n){var r=t.call(this,qp.instance.sdkConfig.apiConfig,qp.instance.apiService,qp.instance.eventsBusService)||this;return r.manualMergeConfig=e,r.telemetryService=qp.instance.telemetryService,r.webviewRunner=n||new Tn,r}return em(e,t),e.prototype.provide=function(){return nm(this,void 0,void 0,(function(){var t,e,n=this;return rm(this,(function(r){switch(r.label){case 0:return t=this.webviewRunner,[4,this.telemetryService.buildContext().toPromise()];case 1:return e=r.sent(),this.manualMergeConfig.target.params.push({key:"pdata",value:JSON.stringify(e.pdata)}),[2,t.launchWebview({host:this.manualMergeConfig.target.host,path:this.manualMergeConfig.target.path,params:this.manualMergeConfig.target.params.reduce((function(t,e){return t[e.key]=e.value,t}),{})}).then((function(){return t.any.apply(t,n.manualMergeConfig.return.reduce((function(e,r){switch(r.type){case"password":e.push(n.buildPasswordSessionProvider(t,r));break;case"google":e.push(n.buildGoogleSessionProvider(t,r));break;case"exit":e.push(t.capture({host:r.when.host,path:r.when.path,params:r.when.params}).then((function(){return t.closeWebview().then((function(){return t.clearCapture().then((function(){return nm(n,void 0,void 0,(function(){return rm(this,(function(t){throw new am("EXIT param found")}))}))}))}))})))}return e}),[]))}))]}}))}))},e}(Hp),om=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),am=function(t){function e(e){var n=t.call(this,e,"INTERRUPT_ERROR")||this;return Object.setPrototypeOf(n,gn.prototype),n}return om(e,t),e}(gn),sm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},um=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},cm=function(){function t(t){this.nativeGoogleTokenProvider=t,this.apiService=qp.instance.apiService}return t.parseAccessToken=function(t){var e=X.getJWTPayload(t);return{userToken:3===e.sub.split(":").length?e.sub.split(":").pop():e.sub,accessTokenExpiresOn:1e3*e.exp}},t.prototype.provide=function(){return sm(this,void 0,void 0,(function(){var t;return um(this,(function(e){switch(e.label){case 0:return[4,this.nativeGoogleTokenProvider()];case 1:return t=e.sent(),[2,this.callGoogleNativeLogin(t.idToken,t.email).toPromise()]}}))}))},t.prototype.callGoogleNativeLogin=function(e,n){var r="ios"===window.device.platform.toLowerCase()?"ios":null,i=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(t.LOGIN_API_ENDPOINT).withBearerToken(!1).withUserToken(!1).withBody({emailId:n,platform:r}).withHeaders({"X-GOOGLE-ID-TOKEN":e}).build();return this.apiService.fetch(i).pipe(Object(dt.map)((function(e){return e.body&&vt.CsModule.instance.updateAuthTokenConfig(e.body.access_token),{access_token:e.body.access_token,refresh_token:e.body.refresh_token,userToken:t.parseAccessToken(e.body.access_token).userToken}})))},t.LOGIN_API_ENDPOINT="/google/auth/android",t}(),fm=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},hm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},lm=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},dm=function(){function t(t){this.nativeAppleTokenProvider=t,this.apiService=qp.instance.apiService,console.log(this.apiService)}return t.parseAccessToken=function(t){var e=X.getJWTPayload(t);return{userToken:3===e.sub.split(":").length?e.sub.split(":").pop():e.sub,accessTokenExpiresOn:1e3*e.exp}},t.prototype.provide=function(){return hm(this,void 0,void 0,(function(){var t;return lm(this,(function(e){switch(e.label){case 0:return[4,this.nativeAppleTokenProvider()];case 1:return t=e.sent(),[2,this.callAppleNativeLogin(t).toPromise()]}}))}))},t.prototype.callAppleNativeLogin=function(e){var n="ios"===window.device.platform.toLowerCase()?"ios":null,r=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(t.LOGIN_API_ENDPOINT).withBearerToken(!1).withUserToken(!1).withBody(fm({emailId:e.email,platform:n},e)).build();return this.apiService.fetch(r).pipe(Object(dt.map)((function(e){return e.body&&vt.CsModule.instance.updateAuthTokenConfig(e.body.sessionId.access_token),{access_token:e.body.sessionId.access_token,refresh_token:e.body.sessionId.refresh_token,userToken:t.parseAccessToken(e.body.sessionId.access_token).userToken}})))},t.LOGIN_API_ENDPOINT="/apple/auth/ios",t}(),pm=function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),mm=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},bm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ym=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},vm=function(t){function e(e,n,r){var i=t.call(this,qp.instance.sdkConfig.apiConfig,qp.instance.apiService,qp.instance.eventsBusService)||this;return i.stateSessionConfig=e,i.autoMergeConfig=n,i.telemetryService=qp.instance.telemetryService,i.webViewRunner=r||new Tn,i}return pm(e,t),e.prototype.provide=function(){return bm(this,void 0,void 0,(function(){var t,e,n=this;return ym(this,(function(r){switch(r.label){case 0:return t=this.webViewRunner,[4,this.telemetryService.buildContext().toPromise()];case 1:return e=r.sent(),this.stateSessionConfig.target.params.push({key:"pdata",value:JSON.stringify(e.pdata)}),[2,t.launchWebview({host:this.stateSessionConfig.target.host,path:this.stateSessionConfig.target.path,params:this.stateSessionConfig.target.params.reduce((function(t,e){return t[e.key]=e.value,t}),mm({},this.resetParams))}).then((function(){return t.any.apply(t,n.stateSessionConfig.return.reduce((function(e,r){switch(r.type){case"state":e.push(n.buildStateSessionProvider(t,r));break;case"state-error":e.push(t.capture({host:r.when.host,path:r.when.path,params:r.when.params}).then((function(){return t.closeWebview().then((function(){return t.resolveCaptured("error_message").catch((function(){throw new ge("Server Error")})).then((function(t){throw new ge(t)}))}))})));break;case"migrate":e.push(t.capture({host:r.when.host,path:r.when.path,params:r.when.params}).then((function(){return t.success()})).then((function(e){return t.resetInAppBrowserEventListeners(),t.clearCapture().then((function(){return new Xp(n.autoMergeConfig,n.webViewRunner,e).provide()}))})))}return e}),[]))}))]}}))}))},e}(Hp),gm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},_m=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Em=function(){function t(t,e){this.loginConfig=t,this.nativeKeycloakTokenProvider=e,this.apiService=qp.instance.apiService}return t.parseAccessToken=function(t){var e=X.getJWTPayload(t);return{userToken:3===e.sub.split(":").length?e.sub.split(":").pop():e.sub,accessTokenExpiresOn:1e3*e.exp}},t.prototype.provide=function(){return gm(this,void 0,void 0,(function(){return _m(this,(function(t){return[2,this.callKeycloakNativeLogin(this.nativeKeycloakTokenProvider.username,this.nativeKeycloakTokenProvider.password).toPromise()]}))}))},t.prototype.callKeycloakNativeLogin=function(e,n){var r="ios"===window.device.platform.toLowerCase()?"ios":window.device.platform.toLowerCase(),i=(new P.CsRequest.Builder).withType(P.CsHttpRequestType.POST).withPath(t.LOGIN_API_ENDPOINT).withBearerToken(!1).withUserToken(!1).withBody({client_id:r,emailId:e,password:n,loginConfig:this.loginConfig.target}).build();return this.apiService.fetch(i).pipe(Object(dt.map)((function(e){return e.body&&e.body.access_token?(vt.CsModule.instance.updateAuthTokenConfig(e.body.access_token),{access_token:e.body.access_token,refresh_token:e.body.refresh_token,userToken:t.parseAccessToken(e.body.access_token).userToken}):e.body})))},t.LOGIN_API_ENDPOINT="/keycloak/login",t}(),Mm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))},wm=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=r[2&o[0]?"return":o[0]?"throw":"next"])&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[0,i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},Sm=function(){function t(t,e,n){this.loginConfig=t,this.customWebViewConfig=e,this.apiConfig=qp.instance.sdkConfig.apiConfig,this.telemetryService=qp.instance.telemetryService,this.webviewRunner=n||new Tn}return t.parseAccessToken=function(t){var e=X.getJWTPayload(t);return{userToken:3===e.sub.split(":").length?e.sub.split(":").pop():e.sub,accessTokenExpiresOn:1e3*e.exp}},t.prototype.buildGoogleTargetUrl=function(t,e){var n=new URL(t.googleRedirectUrl);return delete e.redirect_uri,n.searchParams.set("redirect_uri",this.apiConfig.user_authentication.redirectUrl),delete e.error_callback,n.searchParams.set("error_callback",this.apiConfig.user_authentication.redirectUrl),Object.keys(e).forEach((function(t){return n.searchParams.set(t,e[t])})),n},t.prototype.provide=function(){return Mm(this,void 0,void 0,(function(){var e,n,r,i,o;return wm(this,(function(a){switch(a.label){case 0:return e=this.webviewRunner,[4,this.telemetryService.buildContext().toPromise()];case 1:return n=a.sent(),this.loginConfig.target.params.push({key:"pdata",value:JSON.stringify(n.pdata)}),r="",i={},this.loginConfig.target.params.forEach((function(t){"redirect_uri"==t.key&&(r=t.value),i[t.key]=t.value})),o=this.buildGoogleTargetUrl({googleRedirectUrl:this.loginConfig.target.host+"/"+t.LOGIN_API_ENDPOINT+"?redirect_uri="+r},i),[2,e.launchCustomTab({host:o.origin,path:o.pathname,params:yn.parse(o.searchParams.toString(),{ignoreQueryPrefix:!0}),extraParams:this.customWebViewConfig.get("extraParam")}).then((function(){return e.success()})).then((function(e){return{access_token:e.access_token,refresh_token:e.refresh_token,userToken:t.parseAccessToken(e.access_token).userToken}}))]}}))}))},t.LOGIN_API_ENDPOINT="/google/auth",t}(),Om=n(60)}])}));
|